1 /*
2 Copyright (C) 2020-2021, Dirk Krause
3 SPDX-License-Identifier: BSD-3-Clause
4 */
5
6 /*
7 WARNING: This file was generated by the dkct program (see
8 http://dktools.sourceforge.net/ for details).
9 Changes you make here will be lost if dkct is run again!
10 You should modify the original source and run dkct on it.
11 Original source: WxdkdrawDlgOptionsNewObjects.wxc
12 */
13
14 /** @file WxdkdrawDlgOptionsNewObjects.cpp The WxdkdrawDlgOptionsNewObjects module.
15 */
16
17
18 #ifndef WXDKDRAWDLGDOTFILLED_H_INCLUDED
19 #include <wxdkdraw/WxdkdrawDlgOptionsNewObjects.h>
20 #endif
21
22
23
24
25
26 /** Events to process in this dialog.
27 */
28 #if wxCHECK_VERSION(3,0,0)
wxBEGIN_EVENT_TABLE(WxdkdrawDlgOptionsNewObjects,wxDialog)29 wxBEGIN_EVENT_TABLE(WxdkdrawDlgOptionsNewObjects,wxDialog)
30 #else
31 BEGIN_EVENT_TABLE(WxdkdrawDlgOptionsNewObjects,wxDialog)
32 #endif
33 EVT_BUTTON(\
34 wxID_OK,\
35 WxdkdrawDlgOptionsNewObjects::OnOK\
36 )
37 EVT_BUTTON(\
38 wxID_CANCEL,\
39 WxdkdrawDlgOptionsNewObjects::OnCancel\
40 )
41 #if wxCHECK_VERSION(3,0,0)
42 wxEND_EVENT_TABLE()
43 #else
44 END_EVENT_TABLE()
45 #endif
46
47
48
49 WxdkdrawDlgOptionsNewObjects::WxdkdrawDlgOptionsNewObjects(
50 WxdkdrawFrame *pParent,
51 int *pFilled,
52 int *pWhite,
53 wxChar const * const *pTexts
54 ) : wxDialog(
55 pParent, wxID_ANY, pTexts[627],
56 wxDefaultPosition, wxDefaultSize,
57 (
58 (wxDEFAULT_DIALOG_STYLE)
59 & (~(wxRESIZE_BORDER))
60 & (~(wxCLOSE_BOX))
61 & (~(wxSYSTEM_MENU))
62 )
63 ),
64 #if defined(__WXMSW__)
65 m_oColourRed(127, 0, 0)
66 #else
67 m_oColourRed(191, 0, 0)
68 #endif
69 {
70 m_pParent = pParent;
71 m_sTexts = pTexts;
72 m_pFilled = pFilled;
73 m_pWhite = pWhite;
74 m_iDiameterFilled = *pFilled;
75 m_iDiameterWhite = *pWhite;
76
77 dkctGUILayoutOK = false;
78 sizerHorizontal = NULL;
79 sizerVertical = NULL;
80 sizerContents = NULL;
81 sizerButtons = NULL;
82 lGroupDotFilled = NULL;
83 lDiameterFilled = NULL;
84 spDiameterFilled = NULL;
85 lGroupDotWhite = NULL;
86 lDiameterWhite = NULL;
87 spDiameterWhite = NULL;
88 buttonOK = NULL;
89 buttonCancel = NULL;
90 sizerHorizontal = new wxBoxSizer(
91 wxHORIZONTAL
92 );
93 if(!(sizerHorizontal)) {
94 goto dkctGUILayoutFinished;
95 }
96 sizerHorizontal->Add(10, 10, 0);
97 sizerVertical = new wxBoxSizer(
98 wxVERTICAL
99 );
100 if(!(sizerVertical)) {
101 goto dkctGUILayoutFinished;
102 }
103 sizerVertical->Add(10, 10, 0);
104 sizerContents = new wxGridBagSizer(
105 5, 5
106 );
107 if(!(sizerContents)) {
108 goto dkctGUILayoutFinished;
109 }
110 lGroupDotFilled = new wxStaticText(
111 this,
112 wxID_ANY,
113 pTexts[628]
114 );
115 if(!(lGroupDotFilled)) {
116 goto dkctGUILayoutFinished;
117 }
118 sizerContents->Add(
119 lGroupDotFilled,
120 wxGBPosition(0, 0),
121 wxGBSpan(1, 2),
122 wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL
123 );
124 lDiameterFilled = new wxStaticText(
125 this,
126 wxID_ANY,
127 pTexts[495]
128 );
129 if(!(lDiameterFilled)) {
130 goto dkctGUILayoutFinished;
131 }
132 sizerContents->Add(
133 lDiameterFilled,
134 wxGBPosition(1, 0),
135 wxGBSpan(1, 1),
136 wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL
137 );
138 spDiameterFilled = new wxSpinCtrl(
139 this,
140 wxID_ANY,
141 wxEmptyString,
142 wxDefaultPosition,
143 wxDefaultSize,
144 0,
145 1,
146 65535,
147 8
148 );
149 if(!(spDiameterFilled)) {
150 goto dkctGUILayoutFinished;
151 }
152 spDiameterFilled->SetToolTip(pTexts[496]);
153 sizerContents->Add(
154 spDiameterFilled,
155 wxGBPosition(1, 1),
156 wxGBSpan(1, 1),
157 wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL
158 );
159 sizerContents->Add(10, 10, wxGBPosition(2, 0), wxGBSpan(1, 2));
160 lGroupDotWhite = new wxStaticText(
161 this,
162 wxID_ANY,
163 pTexts[629]
164 );
165 if(!(lGroupDotWhite)) {
166 goto dkctGUILayoutFinished;
167 }
168 sizerContents->Add(
169 lGroupDotWhite,
170 wxGBPosition(3, 0),
171 wxGBSpan(1, 2),
172 wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL
173 );
174 lDiameterWhite = new wxStaticText(
175 this,
176 wxID_ANY,
177 pTexts[495]
178 );
179 if(!(lDiameterWhite)) {
180 goto dkctGUILayoutFinished;
181 }
182 sizerContents->Add(
183 lDiameterWhite,
184 wxGBPosition(4, 0),
185 wxGBSpan(1, 1),
186 wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL
187 );
188 spDiameterWhite = new wxSpinCtrl(
189 this,
190 wxID_ANY,
191 wxEmptyString,
192 wxDefaultPosition,
193 wxDefaultSize,
194 0,
195 1,
196 65535,
197 8
198 );
199 if(!(spDiameterWhite)) {
200 goto dkctGUILayoutFinished;
201 }
202 spDiameterWhite->SetToolTip(pTexts[496]);
203 sizerContents->Add(
204 spDiameterWhite,
205 wxGBPosition(4, 1),
206 wxGBSpan(1, 1),
207 wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL
208 );
209 sizerVertical->Add(
210 sizerContents,
211 0,
212 wxALIGN_CENTER_HORIZONTAL|wxGROW
213 );
214 sizerVertical->Add(10, 10, 0);
215 sizerButtons = new wxStdDialogButtonSizer(
216 );
217 if(!(sizerButtons)) {
218 goto dkctGUILayoutFinished;
219 }
220 buttonOK = new wxButton(
221 this,
222 wxID_OK,
223 pTexts[476]
224 );
225 if(!(buttonOK)) {
226 goto dkctGUILayoutFinished;
227 }
228 buttonOK->SetToolTip(pTexts[478]);
229 sizerButtons->AddButton(
230 buttonOK
231 );
232 buttonCancel = new wxButton(
233 this,
234 wxID_CANCEL,
235 pTexts[477]
236 );
237 if(!(buttonCancel)) {
238 goto dkctGUILayoutFinished;
239 }
240 buttonCancel->SetToolTip(pTexts[479]);
241 sizerButtons->AddButton(
242 buttonCancel
243 );
244 sizerButtons->Realize();
245 sizerVertical->Add(
246 sizerButtons,
247 0,
248 wxALIGN_CENTER_HORIZONTAL|wxGROW
249 );
250 sizerVertical->Add(10, 10, 0);
251 sizerHorizontal->Add(
252 sizerVertical
253 );
254 sizerHorizontal->Add(10, 10, 0);
255 SetSizer(sizerHorizontal);
256 dkctGUILayoutOK = true;
257 dkctGUILayoutFinished:
258 if(dkctGUILayoutOK) {
259 sizerHorizontal->Fit(this);
260 sizerHorizontal->SetSizeHints(this);
261 }
262 if (dkctGUILayoutOK) {
263 /*
264 Fix dialog size
265 */
266 wxSize minsize = GetMinSize();
267 SetMaxSize(minsize);
268 /*
269 Retrieve object attributes
270 */
271 lGroupDotFilled->SetForegroundColour(m_oColourRed);
272 lGroupDotWhite->SetForegroundColour(m_oColourRed);
273 spDiameterFilled->SetValue(m_iDiameterFilled);
274 spDiameterWhite->SetValue(m_iDiameterWhite);
275 }
276 }
277
278
279
280
281 void
OnOK(wxCommandEvent & WXUNUSED (event))282 WxdkdrawDlgOptionsNewObjects::OnOK(wxCommandEvent & WXUNUSED(event))
283 {
284 *m_pFilled = spDiameterFilled->GetValue();
285 *m_pWhite = spDiameterWhite->GetValue();
286 if(IsModal()) {
287 EndModal(wxID_OK);
288 }
289 else {
290 SetReturnCode(wxID_OK);
291 Show(false);
292 }
293 }
294
295
296
297 void
OnCancel(wxCommandEvent & WXUNUSED (event))298 WxdkdrawDlgOptionsNewObjects::OnCancel(wxCommandEvent & WXUNUSED(event))
299 {
300 if(IsModal()) {
301 EndModal(wxID_CANCEL);
302 }
303 else {
304 SetReturnCode(wxID_CANCEL);
305 Show(false);
306 }
307 }
308
309
310
311 int
GetFilledDotDiameter(void)312 WxdkdrawDlgOptionsNewObjects::GetFilledDotDiameter(void)
313 {
314 return 8;
315 }
316
317
318
319 int
GetWhiteDotDiameter(void)320 WxdkdrawDlgOptionsNewObjects::GetWhiteDotDiameter(void)
321 {
322 return 10;
323 }
324
325
326
327 /* vim: set ai sw=4 ts=4 : */
328
329