BoxDlg.cpp
gehe zur Dokumentation dieser Datei
00001 
00022 #if defined(__GNUG__) && !defined(__APPLE__)
00023 #pragma implementation "BoxDlg.h"
00024 #endif
00025 
00026 // For compilers that support precompilation, includes "wx/wx.h".
00027 #include "wx/wxprec.h"
00028 
00029 #ifdef __BORLANDC__
00030 #pragma hdrstop
00031 #endif
00032 
00033 #ifndef WX_PRECOMP
00034 #include "wx/wx.h"
00035 #endif
00036 
00039 
00040 #include "BoxDlg.h"
00041 #include "valNum.h"
00042 #include "valRadio.h"
00043 
00046 
00051 IMPLEMENT_DYNAMIC_CLASS( BoxDlg, wxDialog )
00052 
00053 
00057 BEGIN_EVENT_TABLE( BoxDlg, wxDialog )
00058 
00060         EVT_RADIOBUTTON( ID_RADIOBUTTON, BoxDlg::UpdateEnable )
00061 
00062         EVT_RADIOBUTTON( ID_RADIOBUTTON1, BoxDlg::UpdateEnable )
00063 
00064         EVT_RADIOBUTTON( ID_RADIOBUTTON2, BoxDlg::UpdateEnable )
00065 
00067 
00068 END_EVENT_TABLE()
00069 
00074 BoxDlg::BoxDlg( )
00075 {}
00076 
00077 BoxDlg::BoxDlg( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
00078 {
00079         Create(parent, id, caption, pos, size, style);
00080 }
00081 
00086 bool BoxDlg::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
00087 {
00089         ctrlBox1 = NULL;
00090         ctrlBoxNr = NULL;
00091         ctrlBox2 = NULL;
00092         ctrlBox3 = NULL;
00093         ctrlMode = NULL;
00095 
00097         SetExtraStyle(GetExtraStyle()|wxWS_EX_BLOCK_EVENTS);
00098         wxDialog::Create( parent, id, caption, pos, size, style );
00099 
00100         CreateControls();
00101         GetSizer()->Fit(this);
00102         GetSizer()->SetSizeHints(this);
00103         Centre();
00105         return TRUE;
00106 }
00107 
00112 void BoxDlg::CreateControls()
00113 {
00115         BoxDlg* itemDialog1 = this;
00116 
00117         wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
00118         itemDialog1->SetSizer(itemBoxSizer2);
00119 
00120         wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxHORIZONTAL);
00121         itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
00122 
00123         wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxVERTICAL);
00124         itemBoxSizer3->Add(itemBoxSizer4, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
00125 
00126         wxStaticBox* itemStaticBoxSizer5Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Box"));
00127         wxStaticBoxSizer* itemStaticBoxSizer5 = new wxStaticBoxSizer(itemStaticBoxSizer5Static, wxVERTICAL);
00128         itemBoxSizer4->Add(itemStaticBoxSizer5, 0, wxGROW|wxALL, 5);
00129 
00130         wxBoxSizer* itemBoxSizer6 = new wxBoxSizer(wxHORIZONTAL);
00131         itemStaticBoxSizer5->Add(itemBoxSizer6, 0, wxGROW|wxALL, 0);
00132 
00133         ctrlBox1 = new wxRadioButton( itemDialog1, ID_RADIOBUTTON, _("Box number"), wxDefaultPosition, wxDefaultSize, 0 );
00134         ctrlBox1->SetValue(FALSE);
00135         itemBoxSizer6->Add(ctrlBox1, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
00136 
00137         ctrlBoxNr = new wxTextCtrl( itemDialog1, ID_TEXTCTRL10, _T(""), wxDefaultPosition, wxSize(40, -1), 0 );
00138         itemBoxSizer6->Add(ctrlBoxNr, 0, wxALIGN_CENTER_VERTICAL|wxALL, 0);
00139 
00140         ctrlBox2 = new wxRadioButton( itemDialog1, ID_RADIOBUTTON1, _("GUIDO-file"), wxDefaultPosition, wxDefaultSize, 0 );
00141         ctrlBox2->SetValue(FALSE);
00142         itemStaticBoxSizer5->Add(ctrlBox2, 0, wxGROW|wxALL, 5);
00143 
00144         ctrlBox3 = new wxRadioButton( itemDialog1, ID_RADIOBUTTON2, _("no box / thru mode"), wxDefaultPosition, wxDefaultSize, 0 );
00145         ctrlBox3->SetValue(FALSE);
00146         itemStaticBoxSizer5->Add(ctrlBox3, 0, wxGROW|wxALL, 5);
00147 
00148         wxString ctrlModeStrings[] = {
00149                                              _("&active"),
00150                                              _("&passive")
00151                                      };
00152         ctrlMode = new wxRadioBox( itemDialog1, ID_RADIOBOX1, _("Mode"), wxDefaultPosition, wxDefaultSize, 2, ctrlModeStrings, 1, wxRA_SPECIFY_ROWS );
00153         itemBoxSizer4->Add(ctrlMode, 0, wxGROW|wxALL, 5);
00154 
00155         wxBoxSizer* itemBoxSizer12 = new wxBoxSizer(wxVERTICAL);
00156         itemBoxSizer3->Add(itemBoxSizer12, 0, wxALIGN_TOP|wxALL, 5);
00157 
00158         wxButton* itemButton13 = new wxButton( itemDialog1, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
00159         itemBoxSizer12->Add(itemButton13, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
00160 
00161         wxButton* itemButton14 = new wxButton( itemDialog1, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
00162         itemBoxSizer12->Add(itemButton14, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
00163 
00164         wxButton* itemButton15 = new wxButton( itemDialog1, wxID_HELP, _("&Help"), wxDefaultPosition, wxDefaultSize, 0 );
00165         itemBoxSizer12->Add(itemButton15, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
00166 
00167         // Set validators
00168         ctrlBox1->SetValidator( wxRadioValidator(& Type, 0) );
00169         ctrlBoxNr->SetValidator( wxNumValidator(& BoxNr, NV_NNEG) );
00170         ctrlBox2->SetValidator( wxRadioValidator(& Type, 1) );
00171         ctrlBox3->SetValidator( wxRadioValidator(& Type, 2) );
00172         ctrlMode->SetValidator( wxGenericValidator(& Mode) );
00174 }
00175 
00180 bool BoxDlg::ShowToolTips()
00181 {
00182         return TRUE;
00183 }
00184 
00189 wxBitmap BoxDlg::GetBitmapResource( const wxString& name )
00190 {
00191         // Bitmap retrieval
00193         return wxNullBitmap;
00195 }
00196 
00201 wxIcon BoxDlg::GetIconResource( const wxString& name )
00202 {
00203         // Icon retrieval
00205         return wxNullIcon;
00207 }
00208 
00213 void BoxDlg::UpdateEnable( wxCommandEvent& event )
00214 {
00215         UpdateLayout((ctrlBox2->GetValue() ? 1 : 0) + (ctrlBox3->GetValue() ? 2 : 0));
00217         // Before editing this code, remove the block markers.
00218         event.Skip();
00220 }
00221 
00222 void BoxDlg::UpdateLayout(int type)
00223 
00224 {
00225         ctrlBoxNr->Enable(type == 0);
00226         ctrlMode->Enable(type != 2);
00227 }
00228 
00229 

Erzeugt am Sun Aug 21 2011 10:51:53 für Mutabor von doxygen 1.7.4