/* 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: DkWxHtbFrame.wxc */ /* Copyright (C) 2014-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 DkWxHtbFrame.cpp The DkWxHtbFrame module. */ #line 182 "DkWxHtbFrame.wxc" #include "wxdkhtb.h" #include "dk4verswx.h" #if !defined(__WXMSW__) #include "dkicon.xpm" #endif #line 193 "DkWxHtbFrame.wxc" BEGIN_EVENT_TABLE(DkWxHtbFrame, wxFrame) EVT_MENU(DkWxHtbFrame_Quit, DkWxHtbFrame::OnQuit) EVT_MENU(DkWxHtbFrame_Help_About, DkWxHtbFrame::OnAbout) EVT_MENU(DkWxHtbFrame_Help_Contents, DkWxHtbFrame::OnHelpContents) EVT_IDLE(DkWxHtbFrame::OnIdle) END_EVENT_TABLE() /** Version number for version information. */ static wxChar const wxdkhtb_versnumber[] = { DKT_VERSION_WX }; #line 214 "DkWxHtbFrame.wxc" DkWxHtbFrame::DkWxHtbFrame( int wxid, DkWxAppHelper *applicationHelper, wxHtmlHelpController *hc, int argc, wxChar **argv, wxChar const * const *localizedTexts, wxChar const * const *nlWx, dkChar const * const *nlDk, int is ) : DkWxFrame(nlWx[0], applicationHelper, NULL, wxid) { bCanRun = true; htbController = hc; iStatus = is; sTexts = localizedTexts; sNlWx = nlWx; sNlDk = nlDk; #if defined(__WXMSW__) wxIcon wxdkhtb_icon(sNlWx[4]); #else wxIcon wxdkhtb_icon(xpm_dkicon); #endif dkctGUILayoutOK = false; dkctGUIContentsPanel = NULL; mainSizer = NULL; mbMain = NULL; menuFile = NULL; menuHelp = NULL; miFileExit = NULL; miHelpAbout = NULL; miHelpContents = NULL; verticalSizer = NULL; contentsSizer = NULL; lDummy = NULL; dkctGUIContentsPanel = new wxPanel(this); if(!(dkctGUIContentsPanel)) { goto dkctGUILayoutFinished; } #if wxUSE_MENUS mbMain = new wxMenuBar( ); if(!(mbMain)) { goto dkctGUILayoutFinished; } menuFile = new wxMenu( ); if(!(menuFile)) { goto dkctGUILayoutFinished; } miFileExit = menuFile->Append( DkWxHtbFrame_Quit, sTexts[1], sTexts[2] ); if(!(miFileExit)) { goto dkctGUILayoutFinished; } mbMain->Append(menuFile, sTexts[0]); menuHelp = new wxMenu( ); if(!(menuHelp)) { goto dkctGUILayoutFinished; } miHelpAbout = menuHelp->Append( DkWxHtbFrame_Help_About, sTexts[4], sTexts[5] ); if(!(miHelpAbout)) { goto dkctGUILayoutFinished; } miHelpContents = menuHelp->Append( DkWxHtbFrame_Help_Contents, sTexts[6], sTexts[7] ); if(!(miHelpContents)) { goto dkctGUILayoutFinished; } mbMain->Append(menuHelp, sTexts[3]); SetMenuBar(mbMain); #endif mainSizer = new wxBoxSizer( wxHORIZONTAL ); if(!(mainSizer)) { goto dkctGUILayoutFinished; } mainSizer->Add(10, 10, 0); verticalSizer = new wxBoxSizer( wxVERTICAL ); if(!(verticalSizer)) { goto dkctGUILayoutFinished; } verticalSizer->Add(10, 10, 0); contentsSizer = new wxGridBagSizer( 5, 5 ); if(!(contentsSizer)) { goto dkctGUILayoutFinished; } lDummy = new wxStaticText( dkctGUIContentsPanel, wxID_ANY, sTexts[13] ); if(!(lDummy)) { goto dkctGUILayoutFinished; } contentsSizer->Add( lDummy, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALIGN_LEFT ); verticalSizer->Add( contentsSizer ); verticalSizer->Add(10, 10, 0); mainSizer->Add( verticalSizer, 1, wxGROW ); mainSizer->Add(10, 10, 0); dkctGUIContentsPanel->SetSizer(mainSizer); SetIcon(wxdkhtb_icon); dkctGUILayoutOK = true; dkctGUILayoutFinished: #if wxUSE_STATUSBAR if(dkctGUILayoutOK) { CreateStatusBar(1); SetStatusText(sTexts[8]); } #endif if(dkctGUILayoutOK) { mainSizer->Fit(this); mainSizer->SetSizeHints(this); } #line 238 "DkWxHtbFrame.wxc" if(dkctGUILayoutOK) { SetTitle(nlWx[0]); #if 0 restorePosition(); #endif } } #line 247 "DkWxHtbFrame.wxc" DkWxHtbFrame::~DkWxHtbFrame() { } bool DkWxHtbFrame::canClose(bool isLast) { bool back = true; return back; } void DkWxHtbFrame::OnQuit(wxCommandEvent & event) { Close(); } void DkWxHtbFrame::OnAbout(wxCommandEvent & event) { wxString text(wxT("")); wxString title(wxT("")); /* Construct message text. */ text.Append(sNlWx[0]); text.Append(sNlWx[7]); #if 0 text.Append(sNlWx[1]); #else text.append(wxdkhtb_versnumber); #endif text.Append(sNlWx[8]); text.Append(sTexts[9]); text.Append(sNlWx[2]); text.Append(sNlWx[8]); text.Append(sNlWx[8]); text.Append(sTexts[11]); text.Append(sNlWx[8]); text.Append(sNlWx[9]); text.Append(sNlWx[8]); text.Append(sNlWx[8]); text.Append(sTexts[12]); text.Append(sNlWx[8]); text.Append(sNlWx[10]); text.Append(sNlWx[8]); text.Append(sNlWx[11]); text.Append(sNlWx[8]); text.Append(sNlWx[12]); text.Append(sNlWx[8]); text.Append(sNlWx[13]); text.Append(sNlWx[8]); text.Append(sNlWx[14]); text.Append(sNlWx[8]); text.Append(sNlWx[15]); text.Append(sNlWx[8]); /* Construct dialog box title. */ title.Append(sTexts[10]); title.Append(sNlWx[0]); /* Show dialog box. */ wxMessageBox(text, title); /* __CHANGE__ 019: Create better about box. */ } void DkWxHtbFrame::OnHelpContents(wxCommandEvent & event) { #if 0 openHelp(); #endif if (htbController) { htbController->DisplayContents(); } } void DkWxHtbFrame::OnIdle(wxIdleEvent & event) { bool bRun = false; { wxMutexLocker lock(mProtectCanRun); bRun = bCanRun; bCanRun = false; } if (bRun) { switch (iStatus) { case 3: { if (htbController) { htbController->DisplayContents(); } else { wxMessageBox(sTexts[14], sTexts[15], (wxICON_ERROR | wxOK), this); Show(false); Close(); } } break; case 2: { /* Failed to create controller, not enough memory */ wxMessageBox(sTexts[18], sTexts[15], (wxICON_ERROR | wxOK), this); Show(false); Close(); } break; case 1: { /* File does not exist */ wxMessageBox(sTexts[17], sTexts[15], (wxICON_ERROR | wxOK), this); Show(false); Close(); } break; case 0: { /* No file specified */ wxMessageBox(sTexts[16], sTexts[15], (wxICON_ERROR | wxOK), this); Show(false); Close(); } break; } } /* event.RequestMore(); */ event.Skip(); }