Mercurial > mercurial > hgweb_qlipbrd.cgi
comparison src/adddialog.cpp @ 1:e4aa0e7a07ad
Second release.
| author | pyon@macmini |
|---|---|
| date | Sun, 13 Sep 2015 14:56:42 +0900 |
| parents | cb3403ca39b1 |
| children | fd4361d2cbbd |
comparison
equal
deleted
inserted
replaced
| 0:cb3403ca39b1 | 1:e4aa0e7a07ad |
|---|---|
| 1 // Filename: adddialog.cpp | 1 // Filename: adddialog.cpp |
| 2 // Last Change: 2015-08-30 Sun 16:02:17. | 2 // Last Change: 2015-09-13 Sun 14:34:28. |
| 3 // | 3 // |
| 4 #include <wx/valgen.h> | |
| 5 #include <wx/valtext.h> | |
| 4 | 6 |
| 5 #include "adddialog.h" | 7 #include "adddialog.h" |
| 6 | 8 |
| 7 AddDialog::AddDialog( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) | 9 AddDialog::AddDialog( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) |
| 8 : wxDialog( parent, id, title, pos, size, style ) | 10 : wxDialog( parent, id, title, pos, size, style ) |
| 9 { | 11 { |
| 10 this->SetSizeHints( wxDefaultSize, wxDefaultSize ); | 12 this->SetSizeHints( wxDefaultSize, wxDefaultSize ); |
| 11 | 13 |
| 12 wxBoxSizer* bSizerTop = new wxBoxSizer( wxVERTICAL ); | 14 wxBoxSizer* bSizerTop = new wxBoxSizer( wxVERTICAL ); |
| 13 | 15 |
| 14 m_staticText = new wxStaticText( this, wxID_ANY, wxT("Specify Empty text to use User input(Ctrl-c).\nDescription is option."), wxDefaultPosition, wxDefaultSize, 0 ); | 16 m_staticText = new wxStaticText( this, wxID_ANY, wxT("Specify Empty text to Use user input(Ctrl-c).\nDescription is option."), wxDefaultPosition, wxDefaultSize, 0 ); |
| 15 bSizerTop->Add( m_staticText, 0, wxALL|wxEXPAND, 10 ); | 17 bSizerTop->Add( m_staticText, 0, wxALL|wxEXPAND, 5 ); |
| 16 | 18 |
| 17 wxFlexGridSizer* fgSizer = new wxFlexGridSizer( 0, 3, 0, 0 ); | 19 wxFlexGridSizer* fgSizer = new wxFlexGridSizer( 0, 3, 0, 0 ); |
| 18 fgSizer->SetFlexibleDirection( wxBOTH ); | 20 fgSizer->SetFlexibleDirection( wxBOTH ); |
| 19 fgSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); | 21 fgSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); |
| 20 | 22 |
| 21 // text | |
| 22 m_staticTextText = new wxStaticText( this, wxID_ANY, wxT("Text"), wxDefaultPosition, wxDefaultSize, 0 ); | 23 m_staticTextText = new wxStaticText( this, wxID_ANY, wxT("Text"), wxDefaultPosition, wxDefaultSize, 0 ); |
| 23 fgSizer->Add( m_staticTextText, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 ); | 24 fgSizer->Add( m_staticTextText, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 ); |
| 24 | 25 |
| 25 m_textCtrlText = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); | 26 m_textCtrlText = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); |
| 26 fgSizer->Add( m_textCtrlText, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); | 27 fgSizer->Add( m_textCtrlText, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); |
| 27 | 28 |
| 28 m_staticTextText2 = new wxStaticText( this, wxID_ANY, wxT("Strings to paste"), wxDefaultPosition, wxDefaultSize, 0 ); | 29 m_staticTextText2 = new wxStaticText( this, wxID_ANY, wxT("Strings to paste"), wxDefaultPosition, wxDefaultSize, 0 ); |
| 29 fgSizer->Add( m_staticTextText2, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); | 30 fgSizer->Add( m_staticTextText2, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); |
| 30 | 31 |
| 31 // type | 32 m_staticTextOverwrite = new wxStaticText( this, wxID_ANY, wxT("Overwrite"), wxDefaultPosition, wxDefaultSize, 0 ); |
| 32 m_staticTextType = new wxStaticText( this, wxID_ANY, wxT("Type"), wxDefaultPosition, wxDefaultSize, 0 ); | 33 fgSizer->Add( m_staticTextOverwrite, 0, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5 ); |
| 33 fgSizer->Add( m_staticTextType, 0, wxALL|wxALIGN_RIGHT, 5 ); | 34 |
| 35 m_checkBoxOverwrite = new wxCheckBox( this, ID_CKOW, wxT("allow change"), wxDefaultPosition, wxDefaultSize, 0 ); | |
| 36 fgSizer->Add( m_checkBoxOverwrite, 0, wxALL, 5 ); | |
| 34 | 37 |
| 35 wxString m_choiceTypeChoices[] = { wxT("a"), wxT("ab"), wxT("cc"), }; | 38 m_staticTextOverwrite2 = new wxStaticText( this, wxID_ANY, wxT("Check if allow change by user"), wxDefaultPosition, wxDefaultSize, 0 ); |
| 36 int m_choiceTypeNChoices = sizeof( m_choiceTypeChoices ) / sizeof( wxString ); | 39 fgSizer->Add( m_staticTextOverwrite2, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); |
| 37 m_choiceType = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceTypeNChoices, m_choiceTypeChoices, 0 ); | |
| 38 fgSizer->Add( m_choiceType, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); | |
| 39 | 40 |
| 40 m_staticTextType2 = new wxStaticText( this, wxID_ANY, wxT("Ring / Queue / Stack"), wxDefaultPosition, wxDefaultSize, 0 ); | 41 m_staticTextMaxLive = new wxStaticText( this, wxID_ANY, wxT("Max LT"), wxDefaultPosition, wxDefaultSize, 0 ); |
| 41 fgSizer->Add( m_staticTextType2, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); | 42 fgSizer->Add( m_staticTextMaxLive, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 ); |
| 42 | 43 |
| 43 // time | 44 m_spinCtrlMaxLive = new wxSpinCtrl( this, ID_SPNML, wxT("5"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 28800, 0 ); |
| 44 m_staticTextTime = new wxStaticText( this, wxID_ANY, wxT("Time"), wxDefaultPosition, wxDefaultSize, 0 ); | 45 fgSizer->Add( m_spinCtrlMaxLive, 0, wxALL, 5 ); |
| 45 fgSizer->Add( m_staticTextTime, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 ); | |
| 46 | 46 |
| 47 m_textCtrlTime = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); | 47 m_staticTextMaxLive2 = new wxStaticText( this, wxID_ANY, wxT("Maximum live time"), wxDefaultPosition, wxDefaultSize, 0 ); |
| 48 fgSizer->Add( m_textCtrlTime, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); | 48 fgSizer->Add( m_staticTextMaxLive2, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); |
| 49 | 49 |
| 50 m_staticTextTime2 = new wxStaticText( this, wxID_ANY, wxT("interval"), wxDefaultPosition, wxDefaultSize, 0 ); | 50 m_staticTextMaxActive = new wxStaticText( this, wxID_ANY, wxT("Max AT"), wxDefaultPosition, wxDefaultSize, 0 ); |
| 51 fgSizer->Add( m_staticTextTime2, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); | 51 fgSizer->Add( m_staticTextMaxActive, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 ); |
| 52 | 52 |
| 53 // desc | 53 m_spinCtrlMaxActive = new wxSpinCtrl( this, ID_SPNMA, wxT("5"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 28800, 0 ); |
| 54 fgSizer->Add( m_spinCtrlMaxActive, 0, wxALL, 5 ); | |
| 55 | |
| 56 m_staticTextMaxActive2 = new wxStaticText( this, wxID_ANY, wxT("Maximum active time"), wxDefaultPosition, wxDefaultSize, 0 ); | |
| 57 fgSizer->Add( m_staticTextMaxActive2, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); | |
| 58 | |
| 54 m_staticTextDesc = new wxStaticText( this, wxID_ANY, wxT("Desc"), wxDefaultPosition, wxDefaultSize, 0 ); | 59 m_staticTextDesc = new wxStaticText( this, wxID_ANY, wxT("Desc"), wxDefaultPosition, wxDefaultSize, 0 ); |
| 55 fgSizer->Add( m_staticTextDesc, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 ); | 60 fgSizer->Add( m_staticTextDesc, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 ); |
| 56 | 61 |
| 57 m_textCtrlDesc = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); | 62 m_textCtrlDesc = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); |
| 58 fgSizer->Add( m_textCtrlDesc, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); | 63 fgSizer->Add( m_textCtrlDesc, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); |
| 59 | 64 |
| 60 m_staticTextDesc2 = new wxStaticText( this, wxID_ANY, wxT("Description"), wxDefaultPosition, wxDefaultSize, 0 ); | 65 m_staticTextDesc2 = new wxStaticText( this, wxID_ANY, wxT("Description"), wxDefaultPosition, wxDefaultSize, 0 ); |
| 61 fgSizer->Add( m_staticTextDesc2, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); | 66 fgSizer->Add( m_staticTextDesc2, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); |
| 62 | 67 |
| 63 bSizerTop->Add( fgSizer, 1, wxEXPAND, 5 ); | 68 bSizerTop->Add( fgSizer, 1, wxEXPAND, 5 ); |
| 64 | 69 |
| 65 wxBoxSizer* bSizerBtn = new wxBoxSizer( wxHORIZONTAL ); | 70 wxBoxSizer* bSizerBtn = new wxBoxSizer( wxHORIZONTAL ); |
| 66 | 71 |
| 72 bSizerBtn->Add( m_buttonCancel, 0, wxALL, 5 ); | 77 bSizerBtn->Add( m_buttonCancel, 0, wxALL, 5 ); |
| 73 | 78 |
| 74 bSizerTop->Add( bSizerBtn, 0, wxALIGN_RIGHT, 5 ); | 79 bSizerTop->Add( bSizerBtn, 0, wxALIGN_RIGHT, 5 ); |
| 75 | 80 |
| 76 this->SetSizer( bSizerTop ); | 81 this->SetSizer( bSizerTop ); |
| 82 | |
| 77 this->Layout(); | 83 this->Layout(); |
| 78 bSizerTop->Fit( this ); | 84 bSizerTop->Fit( this ); |
| 79 | 85 |
| 80 this->Centre( wxBOTH ); | 86 this->Centre( wxBOTH ); |
| 87 | |
| 88 Init(); | |
| 89 SetValidators(); | |
| 81 } | 90 } |
| 82 | 91 |
| 83 AddDialog::~AddDialog() | 92 AddDialog::~AddDialog() |
| 84 { | 93 { |
| 85 } | 94 } |
| 86 | 95 |
| 96 // Event Table | |
| 97 BEGIN_EVENT_TABLE( AddDialog, wxDialog ) | |
| 98 EVT_CHECKBOX( ID_CKOW, AddDialog::OnCheckOverwrite ) | |
| 99 END_EVENT_TABLE() | |
| 100 | |
| 101 /* Event Handlers & Functions */ | |
| 102 // Event Handlers | |
| 103 void AddDialog::OnCheckOverwrite( wxCommandEvent& event ) | |
| 104 { | |
| 105 if ( event.IsChecked() ) { | |
| 106 m_textCtrlText->Enable( false ); | |
| 107 m_textCtrlText->SetValue( wxEmptyString ); | |
| 108 m_spinCtrlMaxLive->Enable( true ); | |
| 109 } | |
| 110 else { | |
| 111 m_textCtrlText->Enable( true ); | |
| 112 m_textCtrlText->SetValue( wxT("Something") ); | |
| 113 m_spinCtrlMaxLive->Enable( false ); | |
| 114 } | |
| 115 } | |
| 116 | |
| 117 // Functions | |
| 118 void AddDialog::Init() | |
| 119 { | |
| 120 m_text = wxT("Something"); | |
| 121 m_owrite = false; | |
| 122 m_maxat = 5; | |
| 123 m_maxlt = 20; | |
| 124 m_desc = wxEmptyString; | |
| 125 m_spinCtrlMaxLive->Enable( false ); | |
| 126 } | |
| 127 | |
| 128 void AddDialog::SetValidators() | |
| 129 { | |
| 130 m_textCtrlText->SetValidator( wxTextValidator( wxFILTER_NONE, &m_text ) ); | |
| 131 m_checkBoxOverwrite->SetValidator( wxGenericValidator( &m_owrite ) ); | |
| 132 m_spinCtrlMaxLive->SetValidator( wxGenericValidator( &m_maxlt ) ); | |
| 133 m_spinCtrlMaxActive->SetValidator( wxGenericValidator( &m_maxat ) ); | |
| 134 m_textCtrlDesc->SetValidator( wxTextValidator( wxFILTER_NONE, &m_desc ) ); | |
| 135 } | |
| 136 |
