NCBI C++ ToolKit
project_edit_dlg.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

00001 /*  $Id: project_edit_dlg.cpp 28647 2013-08-09 20:16:42Z katargir $
00002  * ===========================================================================
00003  *
00004  *                            PUBLIC DOMAIN NOTICE
00005  *               National Center for Biotechnology Information
00006  *
00007  *  This software/database is a "United States Government Work" under the
00008  *  terms of the United States Copyright Act.  It was written as part of
00009  *  the author's official duties as a United States Government employee and
00010  *  thus cannot be copyrighted.  This software/database is freely available
00011  *  to the public for use. The National Library of Medicine and the U.S.
00012  *  Government have not placed any restriction on its use or reproduction.
00013  *
00014  *  Although all reasonable efforts have been taken to ensure the accuracy
00015  *  and reliability of the software and data, the NLM and the U.S.
00016  *  Government do not and cannot warrant the performance or results that
00017  *  may be obtained by using this software or data. The NLM and the U.S.
00018  *  Government disclaim all warranties, express or implied, including
00019  *  warranties of performance, merchantability or fitness for any particular
00020  *  purpose.
00021  *
00022  *  Please cite the author in any work or product based on this material.
00023  *
00024  * ===========================================================================
00025  *
00026  * Authors:
00027  *
00028  * File Description:
00029  *
00030  */
00031 
00032 #include <ncbi_pch.hpp>
00033 
00034 ////@begin includes
00035 ////@end includes
00036 
00037 #include <gui/core/project_edit_dlg.hpp>
00038 
00039 #include <gui/widgets/wx/message_box.hpp>
00040 #include <gui/widgets/wx/wx_utils.hpp>
00041 
00042 #include <wx/textctrl.h>
00043 #include <wx/stattext.h>
00044 #include <wx/sizer.h>
00045 #include <wx/button.h>
00046 #include <wx/valgen.h>
00047 
00048 BEGIN_NCBI_SCOPE
00049 
00050 IMPLEMENT_DYNAMIC_CLASS( CProjectEditDlg, CDialog )
00051 
00052 BEGIN_EVENT_TABLE( CProjectEditDlg, CDialog )
00053 
00054 ////@begin CProjectEditDlg event table entries
00055     EVT_BUTTON( wxID_OK, CProjectEditDlg::OnOkClick )
00056 
00057 ////@end CProjectEditDlg event table entries
00058 
00059 END_EVENT_TABLE()
00060 
00061 
00062 CProjectEditDlg::CProjectEditDlg()
00063 {
00064     Init();
00065 }
00066 
00067 CProjectEditDlg::CProjectEditDlg( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
00068 {
00069     Init();
00070     Create(parent, id, caption, pos, size, style);
00071 }
00072 
00073 bool CProjectEditDlg::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
00074 {
00075 ////@begin CProjectEditDlg creation
00076     SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
00077     CDialog::Create( parent, id, caption, pos, size, style );
00078 
00079     CreateControls();
00080     if (GetSizer())
00081     {
00082         GetSizer()->SetSizeHints(this);
00083     }
00084     Centre();
00085 ////@end CProjectEditDlg creation
00086     return true;
00087 }
00088 
00089 CProjectEditDlg::~CProjectEditDlg()
00090 {
00091 ////@begin CProjectEditDlg destruction
00092 ////@end CProjectEditDlg destruction
00093 }
00094 
00095 void CProjectEditDlg::Init()
00096 {
00097 ////@begin CProjectEditDlg member initialisation
00098 ////@end CProjectEditDlg member initialisation
00099 }
00100 
00101 void CProjectEditDlg::CreateControls()
00102 {
00103 ////@begin CProjectEditDlg content construction
00104     CProjectEditDlg* itemCDialog1 = this;
00105 
00106     wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
00107     itemCDialog1->SetSizer(itemBoxSizer2);
00108 
00109     wxFlexGridSizer* itemFlexGridSizer3 = new wxFlexGridSizer(0, 2, 0, 0);
00110     itemBoxSizer2->Add(itemFlexGridSizer3, 1, wxGROW|wxALL, 5);
00111 
00112     wxStaticText* itemStaticText4 = new wxStaticText( itemCDialog1, wxID_STATIC, _("Name:"), wxDefaultPosition, wxDefaultSize, 0 );
00113     itemFlexGridSizer3->Add(itemStaticText4, 0, wxALIGN_LEFT|wxALIGN_TOP|wxALL, 5);
00114 
00115     wxTextCtrl* itemTextCtrl5 = new wxTextCtrl( itemCDialog1, ID_NAME, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
00116     itemFlexGridSizer3->Add(itemTextCtrl5, 1, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
00117 
00118     wxStaticText* itemStaticText6 = new wxStaticText( itemCDialog1, wxID_STATIC, _("Description:"), wxDefaultPosition, wxDefaultSize, 0 );
00119     itemFlexGridSizer3->Add(itemStaticText6, 0, wxALIGN_RIGHT|wxALIGN_TOP|wxALL, 5);
00120 
00121     wxTextCtrl* itemTextCtrl7 = new wxTextCtrl( itemCDialog1, ID_DESCR, wxEmptyString, wxDefaultPosition, itemCDialog1->ConvertDialogToPixels(wxSize(160, 60)), wxTE_MULTILINE );
00122     itemFlexGridSizer3->Add(itemTextCtrl7, 1, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
00123 
00124     wxStaticText* itemStaticText8 = new wxStaticText( itemCDialog1, wxID_STATIC, _("File Name:"), wxDefaultPosition, wxDefaultSize, 0 );
00125     itemFlexGridSizer3->Add(itemStaticText8, 0, wxALIGN_LEFT|wxALIGN_TOP|wxALL, 5);
00126 
00127     wxTextCtrl* itemTextCtrl9 = new wxTextCtrl( itemCDialog1, ID_FILENAME, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY );
00128     itemFlexGridSizer3->Add(itemTextCtrl9, 1, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
00129 
00130     wxStaticText* itemStaticText10 = new wxStaticText( itemCDialog1, wxID_STATIC, _("Created:"), wxDefaultPosition, wxDefaultSize, 0 );
00131     itemFlexGridSizer3->Add(itemStaticText10, 0, wxALIGN_LEFT|wxALIGN_TOP|wxALL, 5);
00132 
00133     wxTextCtrl* itemTextCtrl11 = new wxTextCtrl( itemCDialog1, ID_CREATED, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY );
00134     itemFlexGridSizer3->Add(itemTextCtrl11, 1, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
00135 
00136     wxStaticText* itemStaticText12 = new wxStaticText( itemCDialog1, wxID_STATIC, _("Modified:"), wxDefaultPosition, wxDefaultSize, 0 );
00137     itemFlexGridSizer3->Add(itemStaticText12, 0, wxALIGN_LEFT|wxALIGN_TOP|wxALL, 5);
00138 
00139     wxTextCtrl* itemTextCtrl13 = new wxTextCtrl( itemCDialog1, ID_MODIFIED, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY );
00140     itemFlexGridSizer3->Add(itemTextCtrl13, 1, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
00141 
00142     itemFlexGridSizer3->AddGrowableRow(1);
00143     itemFlexGridSizer3->AddGrowableCol(1);
00144 
00145     wxStdDialogButtonSizer* itemStdDialogButtonSizer14 = new wxStdDialogButtonSizer;
00146 
00147     itemBoxSizer2->Add(itemStdDialogButtonSizer14, 0, wxALIGN_RIGHT|wxALL, 5);
00148     wxButton* itemButton15 = new wxButton( itemCDialog1, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
00149     itemButton15->SetDefault();
00150     itemStdDialogButtonSizer14->AddButton(itemButton15);
00151 
00152     wxButton* itemButton16 = new wxButton( itemCDialog1, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
00153     itemStdDialogButtonSizer14->AddButton(itemButton16);
00154 
00155     itemStdDialogButtonSizer14->Realize();
00156 
00157     // Set validators
00158     itemTextCtrl5->SetValidator( wxGenericValidator(& m_Name) );
00159     itemTextCtrl7->SetValidator( wxGenericValidator(& m_Descr) );
00160     itemTextCtrl9->SetValidator( wxGenericValidator(& m_Filename) );
00161     itemTextCtrl11->SetValidator( wxGenericValidator(& m_Created) );
00162     itemTextCtrl13->SetValidator( wxGenericValidator(& m_Modified) );
00163 ////@end CProjectEditDlg content construction
00164 }
00165 
00166 
00167 void CProjectEditDlg::SetReadOnly()
00168 {
00169     wxTextCtrl* ctrl = (wxTextCtrl*)FindWindow(ID_NAME);
00170     if (ctrl)
00171         ctrl->SetEditable(false);
00172 
00173     ctrl = (wxTextCtrl*)FindWindow(ID_DESCR);
00174     if (ctrl)
00175         ctrl->SetEditable(false);
00176 }
00177 
00178 
00179 void CProjectEditDlg::OnOkClick( wxCommandEvent& WXUNUSED(event) )
00180 {
00181     if(TransferDataFromWindow())    {
00182         if(m_Name.empty())  {
00183             NcbiErrorBox("Name cannot be empty!");
00184             return;
00185         }
00186         EndModal(wxID_OK);
00187     }
00188 }
00189 
00190 
00191 bool CProjectEditDlg::ShowToolTips()
00192 {
00193     return true;
00194 }
00195 
00196 
00197 wxBitmap CProjectEditDlg::GetBitmapResource( const wxString& name )
00198 {
00199     // Bitmap retrieval
00200 ////@begin CProjectEditDlg bitmap retrieval
00201     wxUnusedVar(name);
00202     return wxNullBitmap;
00203 ////@end CProjectEditDlg bitmap retrieval
00204 }
00205 
00206 
00207 wxIcon CProjectEditDlg::GetIconResource( const wxString& name )
00208 {
00209     // Icon retrieval
00210 ////@begin CProjectEditDlg icon retrieval
00211     wxUnusedVar(name);
00212     return wxNullIcon;
00213 ////@end CProjectEditDlg icon retrieval
00214 }
00215 
00216 
00217 END_NCBI_SCOPE
00218 
00219 
Modified on Thu Jul 10 17:18:16 2014 by modify_doxy.py rev. 426318