/* Copyright (C) 2014-2020, Dirk Krause SPDX-License-Identifier: BSD-3-Clause */ /* WARNING: This file was generated by the dkct program (see http://dktools.sourceforge.net/ for details). 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 */ /** @file DkWxHtbFrame.cpp The DkWxHtbFrame module. */ #line 186 "DkWxHtbFrame.wxc" #include "dk3conf.h" #include "wxdkhtb.h" #include "dk4verswx.h" #if !defined(__WXMSW__) #include "gui-img/icons/dkicon.xpm" #endif #line 198 "DkWxHtbFrame.wxc" #if wxCHECK_VERSION(3,0,0) wxBEGIN_EVENT_TABLE(DkWxHtbFrame,wxFrame) #else BEGIN_EVENT_TABLE(DkWxHtbFrame,wxFrame) #endif EVT_MENU(DkWxHtbFrame_Quit, DkWxHtbFrame::OnQuit) EVT_MENU(DkWxHtbFrame_Help_About, DkWxHtbFrame::OnAbout) EVT_MENU(DkWxHtbFrame_Help_Contents, DkWxHtbFrame::OnHelpContents) EVT_IDLE(DkWxHtbFrame::OnIdle) #if wxCHECK_VERSION(3,0,0) wxEND_EVENT_TABLE() #else END_EVENT_TABLE() #endif /** Version number for version information. */ static wxChar const wxdkhtb_versnumber[] = { DKT_VERSION_WX }; #line 227 "DkWxHtbFrame.wxc" DkWxHtbFrame::DkWxHtbFrame( int wxid, DkWxAppHelper *applicationHelper, wxHtmlHelpController *hc, int WXUNUSED(argc), wxChar ** WXUNUSED(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 251 "DkWxHtbFrame.wxc" if(dkctGUILayoutOK) { SetTitle(nlWx[0]); } } #line 257 "DkWxHtbFrame.wxc" DkWxHtbFrame::~DkWxHtbFrame() { } bool DkWxHtbFrame::canClose(bool WXUNUSED(isLast)) { bool back = true; return back; } void DkWxHtbFrame::OnQuit(wxCommandEvent & WXUNUSED(event)) { Close(); } void DkWxHtbFrame::OnAbout(wxCommandEvent & WXUNUSED(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 & WXUNUSED(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(); }