%% options copyright owner = Dirk Krause copyright year = 2020-xxxx SPDX-License-Identifier: BSD-3-Clause %% wx-gui type = dialog contents = sizerHorizontal [wxBoxSizer sizerHorizontal] direction = horizontal contents = $space(10) contents = sizerVertical contents = $space(10) [wxBoxSizer sizerVertical] direction = vertical contents = $space(10) contents = sizerContents centered-x contents = $space(10) contents = sizerButtons centered-x contents = $space(10) [wxGridBagSizer sizerContents] grid = 5 5 grow = yes contents = lGroupDotFilled 0 0 1 2 left centered-y contents = lDiameterFilled +1 0 1 1 right centered-y contents = spDiameterFilled . +1 1 1 left centered-y contents = $space(10) +1 0 1 2 left centered-y contents = lGroupDotWhite +1 0 1 2 left centered-y contents = lDiameterWhite +1 0 1 1 right centered-y contents = spDiameterWhite . +1 1 1 left centered-y [wxStaticText lGroupDotFilled] text = pTexts[628] [wxStaticText lDiameterFilled] text = pTexts[495] [wxSpinCtrl spDiameterFilled] range = 1 65535 value = 8 tip = pTexts[496] [wxStaticText lGroupDotWhite] text = pTexts[629] [wxStaticText lDiameterWhite] text = pTexts[495] [wxSpinCtrl spDiameterWhite] range = 1 65535 value = 8 tip = pTexts[496] [wxStdDialogButtonSizer sizerButtons] grow = yes contents = buttonOK contents = buttonCancel [wxButton buttonOK] id = wxID_OK text = pTexts[476] tip = pTexts[478] [wxButton buttonCancel] id = wxID_CANCEL text = pTexts[477] tip = pTexts[479] %% header start #ifndef WXDKDRAW_H_INCLUDED #include "wxdkdraw.h" #endif #ifndef WXDKDRAWFRAME_H_INCLUDED #include "WxdkdrawFrame.h" #endif %% class start /** Dialog to change dot details. */ class WxdkdrawDlgOptionsNewObjects : public wxDialog { private: /** Events to process. */ #if wxCHECK_VERSION(3,0,0) wxDECLARE_EVENT_TABLE(); #else DECLARE_EVENT_TABLE() #endif %% class end protected: wxColour m_oColourRed; /** Parent frame. */ WxdkdrawFrame *m_pParent; /** Localized text fragments. */ wxChar const * const *m_sTexts; /** Address of filled dot diameter variable. */ int *m_pFilled; /** Address of white dot diameter variable. */ int *m_pWhite; /** Diameter of filled dots. */ int m_iDiameterFilled; /** Diameter of white filled dots. */ int m_iDiameterWhite; public: /** Constructor. @param pParent Parent frame (programs main window). @param pFilled Address of filled dot diameter variable. @param pWhite Address of white filled dot diameter variable. @param pTexts Localized text fragments. */ WxdkdrawDlgOptionsNewObjects( WxdkdrawFrame *pParent, int *pFilled, int *pWhite, wxChar const * const *pTexts ); /** OK button handler. @param event Event to process. */ void OnOK(wxCommandEvent & event); /** Cancel button handler. @param event Event to process. */ void OnCancel(wxCommandEvent & event); /** Retrieve diameter for filled dots. @return Diameter for filled dots. */ int GetFilledDotDiameter(void); /** Retrieve diameter for white filled dots. @return Diameter for white filled dots. */ int GetWhiteDotDiameter(void); }; %% header end %% module start #ifndef WXDKDRAWDLGDOTFILLED_H_INCLUDED #include "WxdkdrawDlgOptionsNewObjects.h" #endif $!trace-include /** Events to process in this dialog. */ #if wxCHECK_VERSION(3,0,0) wxBEGIN_EVENT_TABLE(WxdkdrawDlgOptionsNewObjects,wxDialog) #else BEGIN_EVENT_TABLE(WxdkdrawDlgOptionsNewObjects,wxDialog) #endif EVT_BUTTON(\ wxID_OK,\ WxdkdrawDlgOptionsNewObjects::OnOK\ ) EVT_BUTTON(\ wxID_CANCEL,\ WxdkdrawDlgOptionsNewObjects::OnCancel\ ) #if wxCHECK_VERSION(3,0,0) wxEND_EVENT_TABLE() #else END_EVENT_TABLE() #endif %% constructor start WxdkdrawDlgOptionsNewObjects::WxdkdrawDlgOptionsNewObjects( WxdkdrawFrame *pParent, int *pFilled, int *pWhite, wxChar const * const *pTexts ) : wxDialog( pParent, wxID_ANY, pTexts[627], wxDefaultPosition, wxDefaultSize, ( (wxDEFAULT_DIALOG_STYLE) & (~(wxRESIZE_BORDER)) & (~(wxCLOSE_BOX)) & (~(wxSYSTEM_MENU)) ) ), #if defined(__WXMSW__) m_oColourRed(127, 0, 0) #else m_oColourRed(191, 0, 0) #endif { m_pParent = pParent; m_sTexts = pTexts; m_pFilled = pFilled; m_pWhite = pWhite; m_iDiameterFilled = *pFilled; m_iDiameterWhite = *pWhite; %% constructor end if (dkctGUILayoutOK) { /* Fix dialog size */ wxSize minsize = GetMinSize(); SetMaxSize(minsize); /* Retrieve object attributes */ lGroupDotFilled->SetForegroundColour(m_oColourRed); lGroupDotWhite->SetForegroundColour(m_oColourRed); spDiameterFilled->SetValue(m_iDiameterFilled); spDiameterWhite->SetValue(m_iDiameterWhite); } } %% module end void WxdkdrawDlgOptionsNewObjects::OnOK(wxCommandEvent & WXUNUSED(event)) { *m_pFilled = spDiameterFilled->GetValue(); *m_pWhite = spDiameterWhite->GetValue(); if(IsModal()) { EndModal(wxID_OK); } else { SetReturnCode(wxID_OK); Show(false); } } void WxdkdrawDlgOptionsNewObjects::OnCancel(wxCommandEvent & WXUNUSED(event)) { if(IsModal()) { EndModal(wxID_CANCEL); } else { SetReturnCode(wxID_CANCEL); Show(false); } } int WxdkdrawDlgOptionsNewObjects::GetFilledDotDiameter(void) { return 8; } int WxdkdrawDlgOptionsNewObjects::GetWhiteDotDiameter(void) { return 10; } /* vim: set ai sw=4 ts=4 : */