/* WARNING: This file was generated by dkct. Changes you make here will be lost if dkct is run again! You should modify the original source and run dkct on it. Original source: DkClockOptionsDialog.wxc */ /* Copyright (C) 2013-2017, Dirk Krause Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above opyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** @file DkClockOptionsDialog.cpp The DkClockOptionsDialog module. */ #line 124 "DkClockOptionsDialog.wxc" #include "wxdkclock.h" #line 129 "DkClockOptionsDialog.wxc" BEGIN_EVENT_TABLE(DkClockOptionsDialog, wxDialog) EVT_BUTTON(wxID_OK, DkClockOptionsDialog::OnOk) EVT_BUTTON(wxID_CANCEL, DkClockOptionsDialog::OnCancel) EVT_CHECKBOX(DkClockOptions_Enable, DkClockOptionsDialog::OnCheckbox) END_EVENT_TABLE() #line 140 "DkClockOptionsDialog.wxc" DkClockOptionsDialog::DkClockOptionsDialog( DkWxFrame *parent, wxChar const *title, wxChar const * const *messageTexts, DkClockData *clockData ) : wxDialog( parent, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE ) { int en = 0; int h = 0; int m = 0; #line 158 "DkClockOptionsDialog.wxc" sTexts = messageTexts; cld = clockData; dkctGUILayoutOK = false; sDialog = NULL; vSizer = NULL; cSizer = NULL; bSizer = NULL; cbAlert = NULL; tHour = NULL; scHour = NULL; tMinute = NULL; scMinute = NULL; bOK = NULL; bCancel = NULL; sDialog = new wxBoxSizer( wxHORIZONTAL ); if(!(sDialog)) { goto dkctGUILayoutFinished; } sDialog->Add(10, 10, 1); vSizer = new wxBoxSizer( wxVERTICAL ); if(!(vSizer)) { goto dkctGUILayoutFinished; } vSizer->Add(10, 10, 1); cSizer = new wxGridBagSizer( 5, 5 ); if(!(cSizer)) { goto dkctGUILayoutFinished; } cbAlert = new wxCheckBox( this, DkClockOptions_Enable, sTexts[8] ); if(!(cbAlert)) { goto dkctGUILayoutFinished; } cbAlert->SetToolTip(sTexts[23]); cSizer->Add( cbAlert, wxGBPosition(0, 0), wxGBSpan(1, 2) ); tHour = new wxStaticText( this, wxID_ANY, sTexts[22] ); if(!(tHour)) { goto dkctGUILayoutFinished; } cSizer->Add( tHour, wxGBPosition(1, 0), wxGBSpan(1, 1), wxALIGN_RIGHT ); scHour = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, 0, 23 ); if(!(scHour)) { goto dkctGUILayoutFinished; } scHour->SetToolTip(sTexts[24]); cSizer->Add( scHour, wxGBPosition(1, 1), wxGBSpan(1, 1), wxALIGN_LEFT ); tMinute = new wxStaticText( this, wxID_ANY, sTexts[21] ); if(!(tMinute)) { goto dkctGUILayoutFinished; } cSizer->Add( tMinute, wxGBPosition(2, 0), wxGBSpan(1, 1), wxALIGN_RIGHT ); scMinute = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, 0, 59 ); if(!(scMinute)) { goto dkctGUILayoutFinished; } scMinute->SetToolTip(sTexts[25]); cSizer->Add( scMinute, wxGBPosition(2, 1), wxGBSpan(1, 1), wxALIGN_LEFT ); vSizer->Add( cSizer, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL ); vSizer->Add(10, 10, 1); bSizer = new wxStdDialogButtonSizer( ); if(!(bSizer)) { goto dkctGUILayoutFinished; } bOK = new wxButton( this, wxID_OK, sTexts[17] ); if(!(bOK)) { goto dkctGUILayoutFinished; } bOK->SetToolTip(sTexts[18]); bSizer->AddButton( bOK ); bCancel = new wxButton( this, wxID_CANCEL, sTexts[19] ); if(!(bCancel)) { goto dkctGUILayoutFinished; } bCancel->SetToolTip(sTexts[20]); bSizer->AddButton( bCancel ); bSizer->Realize(); vSizer->Add( bSizer, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL ); vSizer->Add(10, 10, 1); sDialog->Add( vSizer ); sDialog->Add(10, 10, 1); SetSizer(sDialog); dkctGUILayoutOK = true; dkctGUILayoutFinished: if(dkctGUILayoutOK) { sDialog->Fit(this); sDialog->SetSizeHints(this); } #line 161 "DkClockOptionsDialog.wxc" if(dkctGUILayoutOK) { #line 162 "DkClockOptionsDialog.wxc" cld->getAlertData(&en, &h, &m); #line 164 "DkClockOptionsDialog.wxc" scHour->SetValue(h); scMinute->SetValue(m); if(en) { #line 167 "DkClockOptionsDialog.wxc" cbAlert->SetValue(true); scHour->Enable(true); scMinute->Enable(true); } else { #line 171 "DkClockOptionsDialog.wxc" cbAlert->SetValue(false); scHour->Enable(false); scMinute->Enable(false); } } #line 176 "DkClockOptionsDialog.wxc" } #line 180 "DkClockOptionsDialog.wxc" void DkClockOptionsDialog::OnOk(wxCommandEvent & event) { bool en = false; int h = 0; int m = 0; #line 189 "DkClockOptionsDialog.wxc" if(cbAlert->GetValue()) { en = true; h = scHour->GetValue(); m = scMinute->GetValue(); } cld->setAlert(en, h, m); cld->endAlert(); if(IsModal()) { EndModal(wxID_OK); } else { SetReturnCode(wxID_OK); Show(false); } #line 202 "DkClockOptionsDialog.wxc" } void DkClockOptionsDialog::OnCancel(wxCommandEvent & event) { #line 210 "DkClockOptionsDialog.wxc" if(IsModal()) { EndModal(wxID_CANCEL); } else { SetReturnCode(wxID_CANCEL); Show(false); } #line 216 "DkClockOptionsDialog.wxc" } void DkClockOptionsDialog::OnCheckbox(wxCommandEvent & event) { #line 224 "DkClockOptionsDialog.wxc" if(cbAlert->GetValue()) { #line 225 "DkClockOptionsDialog.wxc" scHour->Enable(true); scMinute->Enable(true); } else { #line 228 "DkClockOptionsDialog.wxc" scHour->Enable(false); scMinute->Enable(false); } Refresh(); Update(); #line 234 "DkClockOptionsDialog.wxc" }