summaryrefslogtreecommitdiff
path: root/support/dktools/DkWxImgszOptionsDialog.wxc
blob: 06c65be35da54117884c16bccbdfdf8c5db8f396 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
%%	options

copyright owner	=	Dirk Krause
copyright year	=	2012-xxxx
license		=	bsd


%%	wx-gui

type		=	dialog
contents	=	sDialog

[wxBoxSizer sDialog]
direction	=	horizontal
contents	=	$stretch(10)
contents	=	verticalSizer
contents	=	$stretch(10)

[wxBoxSizer verticalSizer]
direction	=	vertical
contents	=	$stretch(10)
contents	=	cbUseColours
contents	=	$space(10)
contents	=	buttonSizer
contents	=	$stretch(10)

[wxCheckBox cbUseColours]
text		=	sTexts[42]
tip		=	sTexts[43]

[wxBoxSizer buttonSizer]
direction	=	horizontal
contents	=	$stretch(1)
contents	=	realButtonSizer
contents	=	$stretch(1)

[wxStdDialogButtonSizer realButtonSizer]
grow		=	yes
proportion	=	1
contents	=	bOK
contents	=	bCancel

[wxButton bOK]
id		=	wxID_OK
text		=	sTexts[44]
tip		=	sTexts[46]

[wxButton bCancel]
id		=	wxID_CANCEL
text		=	sTexts[45]
tip		=	sTexts[47]


%%	header start

%%	class start

/**	Options dialog for the wximgsz program.
*/
class DkWxImgszOptionsDialog : public wxDialog
{
  private:

    /**	Event table.
    */
    DECLARE_EVENT_TABLE()

  protected:

    /**	Localized text messages.
    */
    wxChar const * const	*sTexts;

    /**	Checkbox value.
    */
    bool			 value;

%%	class end

  public:

    /**	Constructor.
    	@param	parent		Parent window.
	@param	title		Window title.
	@param	messageTexts	Localized message texts.
    */
    DkWxImgszOptionsDialog(
      DkWxImgszFrame	*parent,
      wxChar const		*title,
      wxChar const * const	*messageTexts
    );

    /**	Destructor.
    */
    ~DkWxImgszOptionsDialog();

    /**	Event handler: OK button pressed.
    	@param	event	Event to process.
    */
    void
    OnOK(wxCommandEvent & event);

    /**	Event handler: Cancel button pressed.
    	@param	event	Event to process.
    */
    void
    OnCancel(wxCommandEvent & event);

    /**	Set new checkbox value.
    	@param	b	New checkbox value.
    */
    void
    SetValue(bool b);

    /**	Get checkbox value.
    	@return	Checkbox value.
    */
    bool
    GetValue();

};

%%	header end

%%	module start

#include "wximgsz.h"

$!trace-include

BEGIN_EVENT_TABLE(DkWxImgszOptionsDialog, wxDialog)
  EVT_BUTTON(wxID_OK,		DkWxImgszOptionsDialog::OnOK)
  EVT_BUTTON(wxID_CANCEL,	DkWxImgszOptionsDialog::OnCancel)
END_EVENT_TABLE()


%%	constructor start
DkWxImgszOptionsDialog::DkWxImgszOptionsDialog
(
  DkWxImgszFrame	*parent,
  wxChar const		*title,
  wxChar const * const	*messageTexts
) : wxDialog(
	parent,
	wxID_ANY,
	title,
	wxDefaultPosition,
	wxDefaultSize,
	wxDEFAULT_DIALOG_STYLE
)
{
  sTexts = messageTexts;
%%	constructor end
}

%%	module end


void
DkWxImgszOptionsDialog::OnOK(wxCommandEvent & event)
{
  if(IsModal()) {
    value = cbUseColours->GetValue();
    EndModal(wxID_OK);
  } else {
    SetReturnCode(wxID_OK);
    Show(false);
  }
}



void
DkWxImgszOptionsDialog::OnCancel(wxCommandEvent & event)
{
  if(IsModal()) {
    EndModal(wxID_CANCEL);
  } else {
    SetReturnCode(wxID_CANCEL);
    Show(false);
  }
}


void
DkWxImgszOptionsDialog::SetValue(bool b)
{
  value = b;
  cbUseColours->SetValue(b);
}



bool
DkWxImgszOptionsDialog::GetValue()
{
  return value;
}



DkWxImgszOptionsDialog::~DkWxImgszOptionsDialog()
{
}