1 /////////////////////////////////////////////////////////////////////////////
2 // Name: richtextmarginspage.cpp
4 // Author: Julian Smart
6 // Created: 20/10/2010 10:27:34
8 // Copyright: (c) Julian Smart
10 /////////////////////////////////////////////////////////////////////////////
12 #include "wx/richtext/richtextmarginspage.h"
19 * wxRichTextMarginsPage type definition
22 IMPLEMENT_DYNAMIC_CLASS( wxRichTextMarginsPage
, wxRichTextDialogPage
)
26 * wxRichTextMarginsPage event table definition
29 BEGIN_EVENT_TABLE( wxRichTextMarginsPage
, wxRichTextDialogPage
)
31 ////@begin wxRichTextMarginsPage event table entries
32 EVT_UPDATE_UI( ID_RICHTEXT_LEFT_MARGIN
, wxRichTextMarginsPage::OnRichtextLeftMarginUpdate
)
34 EVT_UPDATE_UI( ID_RICHTEXT_LEFT_MARGIN_UNITS
, wxRichTextMarginsPage::OnRichtextLeftMarginUpdate
)
36 EVT_UPDATE_UI( ID_RICHTEXT_RIGHT_MARGIN
, wxRichTextMarginsPage::OnRichtextRightMarginUpdate
)
38 EVT_UPDATE_UI( ID_RICHTEXT_RIGHT_MARGIN_UNITS
, wxRichTextMarginsPage::OnRichtextRightMarginUpdate
)
40 EVT_UPDATE_UI( ID_RICHTEXT_TOP_MARGIN
, wxRichTextMarginsPage::OnRichtextTopMarginUpdate
)
42 EVT_UPDATE_UI( ID_RICHTEXT_TOP_MARGIN_UNITS
, wxRichTextMarginsPage::OnRichtextTopMarginUpdate
)
44 EVT_UPDATE_UI( ID_RICHTEXT_BOTTOM_MARGIN
, wxRichTextMarginsPage::OnRichtextBottomMarginUpdate
)
46 EVT_UPDATE_UI( ID_RICHTEXT_BOTTOM_MARGIN_UNITS
, wxRichTextMarginsPage::OnRichtextBottomMarginUpdate
)
48 EVT_UPDATE_UI( ID_RICHTEXT_LEFT_PADDING
, wxRichTextMarginsPage::OnRichtextLeftPaddingUpdate
)
50 EVT_UPDATE_UI( ID_RICHTEXT_LEFT_PADDING_UNITS
, wxRichTextMarginsPage::OnRichtextLeftPaddingUpdate
)
52 EVT_UPDATE_UI( ID_RICHTEXT_RIGHT_PADDING
, wxRichTextMarginsPage::OnRichtextRightPaddingUpdate
)
54 EVT_UPDATE_UI( ID_RICHTEXT_RIGHT_PADDING_UNITS
, wxRichTextMarginsPage::OnRichtextRightPaddingUpdate
)
56 EVT_UPDATE_UI( ID_RICHTEXT_TOP_PADDING
, wxRichTextMarginsPage::OnRichtextTopPaddingUpdate
)
58 EVT_UPDATE_UI( ID_RICHTEXT_TOP_PADDING_UNITS
, wxRichTextMarginsPage::OnRichtextTopPaddingUpdate
)
60 EVT_UPDATE_UI( ID_RICHTEXT_BOTTOM_PADDING
, wxRichTextMarginsPage::OnRichtextBottomPaddingUpdate
)
62 EVT_UPDATE_UI( ID_RICHTEXT_BOTTOM_PADDING_UNITS
, wxRichTextMarginsPage::OnRichtextBottomPaddingUpdate
)
64 ////@end wxRichTextMarginsPage event table entries
68 IMPLEMENT_HELP_PROVISION(wxRichTextMarginsPage
)
71 * wxRichTextMarginsPage constructors
74 wxRichTextMarginsPage::wxRichTextMarginsPage()
79 wxRichTextMarginsPage::wxRichTextMarginsPage( wxWindow
* parent
, wxWindowID id
, const wxPoint
& pos
, const wxSize
& size
, long style
)
82 Create(parent
, id
, pos
, size
, style
);
87 * wxRichTextMarginsPage creator
90 bool wxRichTextMarginsPage::Create( wxWindow
* parent
, wxWindowID id
, const wxPoint
& pos
, const wxSize
& size
, long style
)
92 ////@begin wxRichTextMarginsPage creation
93 wxRichTextDialogPage::Create( parent
, id
, pos
, size
, style
);
98 GetSizer()->SetSizeHints(this);
101 ////@end wxRichTextMarginsPage creation
107 * wxRichTextMarginsPage destructor
110 wxRichTextMarginsPage::~wxRichTextMarginsPage()
112 ////@begin wxRichTextMarginsPage destruction
113 ////@end wxRichTextMarginsPage destruction
118 * Member initialisation
121 void wxRichTextMarginsPage::Init()
123 m_ignoreUpdates
= false;
125 ////@begin wxRichTextMarginsPage member initialisation
126 m_leftMarginCheckbox
= NULL
;
128 m_unitsMarginLeft
= NULL
;
129 m_rightMarginCheckbox
= NULL
;
130 m_marginRight
= NULL
;
131 m_unitsMarginRight
= NULL
;
132 m_topMarginCheckbox
= NULL
;
134 m_unitsMarginTop
= NULL
;
135 m_bottomMarginCheckbox
= NULL
;
136 m_marginBottom
= NULL
;
137 m_unitsMarginBottom
= NULL
;
138 m_leftPaddingCheckbox
= NULL
;
139 m_paddingLeft
= NULL
;
140 m_unitsPaddingLeft
= NULL
;
141 m_rightPaddingCheckbox
= NULL
;
142 m_paddingRight
= NULL
;
143 m_unitsPaddingRight
= NULL
;
144 m_topPaddingCheckbox
= NULL
;
146 m_unitsPaddingTop
= NULL
;
147 m_bottomPaddingCheckbox
= NULL
;
148 m_paddingBottom
= NULL
;
149 m_unitsPaddingBottom
= NULL
;
150 ////@end wxRichTextMarginsPage member initialisation
155 * Control creation for wxRichTextMarginsPage
158 void wxRichTextMarginsPage::CreateControls()
160 ////@begin wxRichTextMarginsPage content construction
161 wxRichTextMarginsPage
* itemRichTextDialogPage1
= this;
163 wxBoxSizer
* itemBoxSizer2
= new wxBoxSizer(wxVERTICAL
);
164 itemRichTextDialogPage1
->SetSizer(itemBoxSizer2
);
166 wxBoxSizer
* itemBoxSizer3
= new wxBoxSizer(wxVERTICAL
);
167 itemBoxSizer2
->Add(itemBoxSizer3
, 1, wxGROW
|wxALL
, 5);
169 wxBoxSizer
* itemBoxSizer4
= new wxBoxSizer(wxHORIZONTAL
);
170 itemBoxSizer3
->Add(itemBoxSizer4
, 0, wxGROW
, 5);
172 wxStaticText
* itemStaticText5
= new wxStaticText( itemRichTextDialogPage1
, wxID_STATIC
, _("Margins"), wxDefaultPosition
, wxDefaultSize
, 0 );
173 itemStaticText5
->SetFont(wxFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT
).GetPointSize(), wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT
).GetFamily(), wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT
).GetStyle(), wxBOLD
, false, wxT("")));
174 itemBoxSizer4
->Add(itemStaticText5
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
176 wxStaticLine
* itemStaticLine6
= new wxStaticLine( itemRichTextDialogPage1
, wxID_STATIC
, wxDefaultPosition
, wxDefaultSize
, wxLI_HORIZONTAL
);
177 itemBoxSizer4
->Add(itemStaticLine6
, 1, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
179 wxBoxSizer
* itemBoxSizer7
= new wxBoxSizer(wxHORIZONTAL
);
180 itemBoxSizer3
->Add(itemBoxSizer7
, 0, wxGROW
, 5);
182 itemBoxSizer7
->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
184 wxFlexGridSizer
* itemFlexGridSizer9
= new wxFlexGridSizer(0, 4, 0, 0);
185 itemBoxSizer7
->Add(itemFlexGridSizer9
, 0, wxALIGN_CENTER_VERTICAL
, 5);
187 m_leftMarginCheckbox
= new wxCheckBox( itemRichTextDialogPage1
, ID_RICHTEXT_LEFT_MARGIN_CHECKBOX
, _("&Left:"), wxDefaultPosition
, wxDefaultSize
, 0 );
188 m_leftMarginCheckbox
->SetValue(false);
189 itemFlexGridSizer9
->Add(m_leftMarginCheckbox
, 0, wxALIGN_LEFT
|wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
191 wxBoxSizer
* itemBoxSizer11
= new wxBoxSizer(wxHORIZONTAL
);
192 itemFlexGridSizer9
->Add(itemBoxSizer11
, 0, wxALIGN_LEFT
|wxALIGN_CENTER_VERTICAL
, 5);
194 m_marginLeft
= new wxTextCtrl( itemRichTextDialogPage1
, ID_RICHTEXT_LEFT_MARGIN
, wxEmptyString
, wxDefaultPosition
, wxSize(65, -1), 0 );
195 m_marginLeft
->SetHelpText(_("The left margin size."));
196 if (wxRichTextMarginsPage::ShowToolTips())
197 m_marginLeft
->SetToolTip(_("The left margin size."));
198 itemBoxSizer11
->Add(m_marginLeft
, 0, wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
200 wxArrayString m_unitsMarginLeftStrings
;
201 m_unitsMarginLeftStrings
.Add(_("px"));
202 m_unitsMarginLeftStrings
.Add(_("cm"));
203 m_unitsMarginLeft
= new wxComboBox( itemRichTextDialogPage1
, ID_RICHTEXT_LEFT_MARGIN_UNITS
, _("px"), wxDefaultPosition
, wxSize(60, -1), m_unitsMarginLeftStrings
, wxCB_READONLY
);
204 m_unitsMarginLeft
->SetStringSelection(_("px"));
205 m_unitsMarginLeft
->SetHelpText(_("Units for the left margin."));
206 if (wxRichTextMarginsPage::ShowToolTips())
207 m_unitsMarginLeft
->SetToolTip(_("Units for the left margin."));
208 itemBoxSizer11
->Add(m_unitsMarginLeft
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
210 itemBoxSizer11
->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
212 m_rightMarginCheckbox
= new wxCheckBox( itemRichTextDialogPage1
, ID_RICHTEXT_RIGHT_MARGIN_CHECKBOX
, _("&Right:"), wxDefaultPosition
, wxDefaultSize
, 0 );
213 m_rightMarginCheckbox
->SetValue(false);
214 itemFlexGridSizer9
->Add(m_rightMarginCheckbox
, 0, wxALIGN_LEFT
|wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
216 wxBoxSizer
* itemBoxSizer16
= new wxBoxSizer(wxHORIZONTAL
);
217 itemFlexGridSizer9
->Add(itemBoxSizer16
, 0, wxALIGN_LEFT
|wxALIGN_CENTER_VERTICAL
, 5);
219 m_marginRight
= new wxTextCtrl( itemRichTextDialogPage1
, ID_RICHTEXT_RIGHT_MARGIN
, wxEmptyString
, wxDefaultPosition
, wxSize(65, -1), 0 );
220 m_marginRight
->SetHelpText(_("The right margin size."));
221 if (wxRichTextMarginsPage::ShowToolTips())
222 m_marginRight
->SetToolTip(_("The right margin size."));
223 itemBoxSizer16
->Add(m_marginRight
, 0, wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
225 wxArrayString m_unitsMarginRightStrings
;
226 m_unitsMarginRightStrings
.Add(_("px"));
227 m_unitsMarginRightStrings
.Add(_("cm"));
228 m_unitsMarginRight
= new wxComboBox( itemRichTextDialogPage1
, ID_RICHTEXT_RIGHT_MARGIN_UNITS
, _("px"), wxDefaultPosition
, wxSize(60, -1), m_unitsMarginRightStrings
, wxCB_READONLY
);
229 m_unitsMarginRight
->SetStringSelection(_("px"));
230 m_unitsMarginRight
->SetHelpText(_("Units for the right margin."));
231 if (wxRichTextMarginsPage::ShowToolTips())
232 m_unitsMarginRight
->SetToolTip(_("Units for the right margin."));
233 itemBoxSizer16
->Add(m_unitsMarginRight
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
235 m_topMarginCheckbox
= new wxCheckBox( itemRichTextDialogPage1
, ID_RICHTEXT_TOP_MARGIN_CHECKBOX
, _("&Top:"), wxDefaultPosition
, wxDefaultSize
, 0 );
236 m_topMarginCheckbox
->SetValue(false);
237 itemFlexGridSizer9
->Add(m_topMarginCheckbox
, 0, wxALIGN_LEFT
|wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
239 wxBoxSizer
* itemBoxSizer20
= new wxBoxSizer(wxHORIZONTAL
);
240 itemFlexGridSizer9
->Add(itemBoxSizer20
, 0, wxALIGN_LEFT
|wxALIGN_CENTER_VERTICAL
, 5);
242 m_marginTop
= new wxTextCtrl( itemRichTextDialogPage1
, ID_RICHTEXT_TOP_MARGIN
, wxEmptyString
, wxDefaultPosition
, wxSize(65, -1), 0 );
243 m_marginTop
->SetHelpText(_("The top margin size."));
244 if (wxRichTextMarginsPage::ShowToolTips())
245 m_marginTop
->SetToolTip(_("The top margin size."));
246 itemBoxSizer20
->Add(m_marginTop
, 0, wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
248 wxArrayString m_unitsMarginTopStrings
;
249 m_unitsMarginTopStrings
.Add(_("px"));
250 m_unitsMarginTopStrings
.Add(_("cm"));
251 m_unitsMarginTop
= new wxComboBox( itemRichTextDialogPage1
, ID_RICHTEXT_TOP_MARGIN_UNITS
, _("px"), wxDefaultPosition
, wxSize(60, -1), m_unitsMarginTopStrings
, wxCB_READONLY
);
252 m_unitsMarginTop
->SetStringSelection(_("px"));
253 m_unitsMarginTop
->SetHelpText(_("Units for the top margin."));
254 if (wxRichTextMarginsPage::ShowToolTips())
255 m_unitsMarginTop
->SetToolTip(_("Units for the top margin."));
256 itemBoxSizer20
->Add(m_unitsMarginTop
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
258 itemBoxSizer20
->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
260 m_bottomMarginCheckbox
= new wxCheckBox( itemRichTextDialogPage1
, ID_RICHTEXT_BOTTOM_MARGIN_CHECKBOX
, _("&Bottom:"), wxDefaultPosition
, wxDefaultSize
, 0 );
261 m_bottomMarginCheckbox
->SetValue(false);
262 itemFlexGridSizer9
->Add(m_bottomMarginCheckbox
, 0, wxALIGN_LEFT
|wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
264 wxBoxSizer
* itemBoxSizer25
= new wxBoxSizer(wxHORIZONTAL
);
265 itemFlexGridSizer9
->Add(itemBoxSizer25
, 0, wxALIGN_LEFT
|wxALIGN_CENTER_VERTICAL
, 5);
267 m_marginBottom
= new wxTextCtrl( itemRichTextDialogPage1
, ID_RICHTEXT_BOTTOM_MARGIN
, wxEmptyString
, wxDefaultPosition
, wxSize(65, -1), 0 );
268 m_marginBottom
->SetHelpText(_("The bottom margin size."));
269 if (wxRichTextMarginsPage::ShowToolTips())
270 m_marginBottom
->SetToolTip(_("The bottom margin size."));
271 itemBoxSizer25
->Add(m_marginBottom
, 0, wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
273 wxArrayString m_unitsMarginBottomStrings
;
274 m_unitsMarginBottomStrings
.Add(_("px"));
275 m_unitsMarginBottomStrings
.Add(_("cm"));
276 m_unitsMarginBottom
= new wxComboBox( itemRichTextDialogPage1
, ID_RICHTEXT_BOTTOM_MARGIN_UNITS
, _("px"), wxDefaultPosition
, wxSize(60, -1), m_unitsMarginBottomStrings
, wxCB_READONLY
);
277 m_unitsMarginBottom
->SetStringSelection(_("px"));
278 m_unitsMarginBottom
->SetHelpText(_("Units for the bottom margin."));
279 if (wxRichTextMarginsPage::ShowToolTips())
280 m_unitsMarginBottom
->SetToolTip(_("Units for the bottom margin."));
281 itemBoxSizer25
->Add(m_unitsMarginBottom
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
283 wxBoxSizer
* itemBoxSizer28
= new wxBoxSizer(wxHORIZONTAL
);
284 itemBoxSizer3
->Add(itemBoxSizer28
, 0, wxGROW
, 5);
286 wxStaticText
* itemStaticText29
= new wxStaticText( itemRichTextDialogPage1
, wxID_STATIC
, _("Padding"), wxDefaultPosition
, wxDefaultSize
, 0 );
287 itemStaticText29
->SetFont(wxFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT
).GetPointSize(), wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT
).GetFamily(), wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT
).GetStyle(), wxBOLD
, false, wxT("")));
288 itemBoxSizer28
->Add(itemStaticText29
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
290 wxStaticLine
* itemStaticLine30
= new wxStaticLine( itemRichTextDialogPage1
, wxID_STATIC
, wxDefaultPosition
, wxDefaultSize
, wxLI_HORIZONTAL
);
291 itemBoxSizer28
->Add(itemStaticLine30
, 1, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
293 wxBoxSizer
* itemBoxSizer31
= new wxBoxSizer(wxHORIZONTAL
);
294 itemBoxSizer3
->Add(itemBoxSizer31
, 0, wxGROW
, 5);
296 itemBoxSizer31
->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
298 wxFlexGridSizer
* itemFlexGridSizer33
= new wxFlexGridSizer(0, 4, 0, 0);
299 itemBoxSizer31
->Add(itemFlexGridSizer33
, 0, wxALIGN_CENTER_VERTICAL
, 5);
301 m_leftPaddingCheckbox
= new wxCheckBox( itemRichTextDialogPage1
, ID_RICHTEXT_LEFT_PADDING_CHECKBOX
, _("&Left:"), wxDefaultPosition
, wxDefaultSize
, 0 );
302 m_leftPaddingCheckbox
->SetValue(false);
303 itemFlexGridSizer33
->Add(m_leftPaddingCheckbox
, 0, wxALIGN_LEFT
|wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
305 wxBoxSizer
* itemBoxSizer35
= new wxBoxSizer(wxHORIZONTAL
);
306 itemFlexGridSizer33
->Add(itemBoxSizer35
, 0, wxALIGN_LEFT
|wxALIGN_CENTER_VERTICAL
, 5);
308 m_paddingLeft
= new wxTextCtrl( itemRichTextDialogPage1
, ID_RICHTEXT_LEFT_PADDING
, wxEmptyString
, wxDefaultPosition
, wxSize(65, -1), 0 );
309 m_paddingLeft
->SetHelpText(_("The left padding size."));
310 if (wxRichTextMarginsPage::ShowToolTips())
311 m_paddingLeft
->SetToolTip(_("The left padding size."));
312 itemBoxSizer35
->Add(m_paddingLeft
, 0, wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
314 wxArrayString m_unitsPaddingLeftStrings
;
315 m_unitsPaddingLeftStrings
.Add(_("px"));
316 m_unitsPaddingLeftStrings
.Add(_("cm"));
317 m_unitsPaddingLeft
= new wxComboBox( itemRichTextDialogPage1
, ID_RICHTEXT_LEFT_PADDING_UNITS
, _("px"), wxDefaultPosition
, wxSize(60, -1), m_unitsPaddingLeftStrings
, wxCB_READONLY
);
318 m_unitsPaddingLeft
->SetStringSelection(_("px"));
319 m_unitsPaddingLeft
->SetHelpText(_("Units for the left padding."));
320 if (wxRichTextMarginsPage::ShowToolTips())
321 m_unitsPaddingLeft
->SetToolTip(_("Units for the left padding."));
322 itemBoxSizer35
->Add(m_unitsPaddingLeft
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
324 itemBoxSizer35
->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
326 m_rightPaddingCheckbox
= new wxCheckBox( itemRichTextDialogPage1
, ID_RICHTEXT_RIGHT_PADDING_CHECKBOX
, _("&Right:"), wxDefaultPosition
, wxDefaultSize
, 0 );
327 m_rightPaddingCheckbox
->SetValue(false);
328 itemFlexGridSizer33
->Add(m_rightPaddingCheckbox
, 0, wxALIGN_LEFT
|wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
330 wxBoxSizer
* itemBoxSizer40
= new wxBoxSizer(wxHORIZONTAL
);
331 itemFlexGridSizer33
->Add(itemBoxSizer40
, 0, wxALIGN_LEFT
|wxALIGN_CENTER_VERTICAL
, 5);
333 m_paddingRight
= new wxTextCtrl( itemRichTextDialogPage1
, ID_RICHTEXT_RIGHT_PADDING
, wxEmptyString
, wxDefaultPosition
, wxSize(65, -1), 0 );
334 m_paddingRight
->SetHelpText(_("The right padding size."));
335 if (wxRichTextMarginsPage::ShowToolTips())
336 m_paddingRight
->SetToolTip(_("The right padding size."));
337 itemBoxSizer40
->Add(m_paddingRight
, 0, wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
339 wxArrayString m_unitsPaddingRightStrings
;
340 m_unitsPaddingRightStrings
.Add(_("px"));
341 m_unitsPaddingRightStrings
.Add(_("cm"));
342 m_unitsPaddingRight
= new wxComboBox( itemRichTextDialogPage1
, ID_RICHTEXT_RIGHT_PADDING_UNITS
, _("px"), wxDefaultPosition
, wxSize(60, -1), m_unitsPaddingRightStrings
, wxCB_READONLY
);
343 m_unitsPaddingRight
->SetStringSelection(_("px"));
344 m_unitsPaddingRight
->SetHelpText(_("Units for the right padding."));
345 if (wxRichTextMarginsPage::ShowToolTips())
346 m_unitsPaddingRight
->SetToolTip(_("Units for the right padding."));
347 itemBoxSizer40
->Add(m_unitsPaddingRight
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
349 m_topPaddingCheckbox
= new wxCheckBox( itemRichTextDialogPage1
, ID_RICHTEXT_TOP_PADDING_CHECKBOX
, _("&Top:"), wxDefaultPosition
, wxDefaultSize
, 0 );
350 m_topPaddingCheckbox
->SetValue(false);
351 itemFlexGridSizer33
->Add(m_topPaddingCheckbox
, 0, wxALIGN_LEFT
|wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
353 wxBoxSizer
* itemBoxSizer44
= new wxBoxSizer(wxHORIZONTAL
);
354 itemFlexGridSizer33
->Add(itemBoxSizer44
, 0, wxALIGN_LEFT
|wxALIGN_CENTER_VERTICAL
, 5);
356 m_paddingTop
= new wxTextCtrl( itemRichTextDialogPage1
, ID_RICHTEXT_TOP_PADDING
, wxEmptyString
, wxDefaultPosition
, wxSize(65, -1), 0 );
357 m_paddingTop
->SetHelpText(_("The top padding size."));
358 if (wxRichTextMarginsPage::ShowToolTips())
359 m_paddingTop
->SetToolTip(_("The top padding size."));
360 itemBoxSizer44
->Add(m_paddingTop
, 0, wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
362 wxArrayString m_unitsPaddingTopStrings
;
363 m_unitsPaddingTopStrings
.Add(_("px"));
364 m_unitsPaddingTopStrings
.Add(_("cm"));
365 m_unitsPaddingTop
= new wxComboBox( itemRichTextDialogPage1
, ID_RICHTEXT_TOP_PADDING_UNITS
, _("px"), wxDefaultPosition
, wxSize(60, -1), m_unitsPaddingTopStrings
, wxCB_READONLY
);
366 m_unitsPaddingTop
->SetStringSelection(_("px"));
367 m_unitsPaddingTop
->SetHelpText(_("Units for the top padding."));
368 if (wxRichTextMarginsPage::ShowToolTips())
369 m_unitsPaddingTop
->SetToolTip(_("Units for the top padding."));
370 itemBoxSizer44
->Add(m_unitsPaddingTop
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
372 itemBoxSizer44
->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
374 m_bottomPaddingCheckbox
= new wxCheckBox( itemRichTextDialogPage1
, ID_RICHTEXT_BOTTOM_PADDING_CHECKBOX
, _("&Bottom:"), wxDefaultPosition
, wxDefaultSize
, 0 );
375 m_bottomPaddingCheckbox
->SetValue(false);
376 itemFlexGridSizer33
->Add(m_bottomPaddingCheckbox
, 0, wxALIGN_LEFT
|wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
378 wxBoxSizer
* itemBoxSizer49
= new wxBoxSizer(wxHORIZONTAL
);
379 itemFlexGridSizer33
->Add(itemBoxSizer49
, 0, wxALIGN_LEFT
|wxALIGN_CENTER_VERTICAL
, 5);
381 m_paddingBottom
= new wxTextCtrl( itemRichTextDialogPage1
, ID_RICHTEXT_BOTTOM_PADDING
, wxEmptyString
, wxDefaultPosition
, wxSize(65, -1), 0 );
382 m_paddingBottom
->SetHelpText(_("The bottom padding size."));
383 if (wxRichTextMarginsPage::ShowToolTips())
384 m_paddingBottom
->SetToolTip(_("The bottom padding size."));
385 itemBoxSizer49
->Add(m_paddingBottom
, 0, wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
387 wxArrayString m_unitsPaddingBottomStrings
;
388 m_unitsPaddingBottomStrings
.Add(_("px"));
389 m_unitsPaddingBottomStrings
.Add(_("cm"));
390 m_unitsPaddingBottom
= new wxComboBox( itemRichTextDialogPage1
, ID_RICHTEXT_BOTTOM_PADDING_UNITS
, _("px"), wxDefaultPosition
, wxSize(60, -1), m_unitsPaddingBottomStrings
, wxCB_READONLY
);
391 m_unitsPaddingBottom
->SetStringSelection(_("px"));
392 m_unitsPaddingBottom
->SetHelpText(_("Units for the bottom padding."));
393 if (wxRichTextMarginsPage::ShowToolTips())
394 m_unitsPaddingBottom
->SetToolTip(_("Units for the bottom padding."));
395 itemBoxSizer49
->Add(m_unitsPaddingBottom
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
397 ////@end wxRichTextMarginsPage content construction
400 wxRichTextAttr
* wxRichTextMarginsPage::GetAttributes()
402 return wxRichTextFormattingDialog::GetDialogAttributes(this);
406 * Should we show tooltips?
409 bool wxRichTextMarginsPage::ShowToolTips()
414 bool wxRichTextMarginsPage::TransferDataToWindow()
417 wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetMargins().GetLeft(), m_marginLeft
, m_unitsMarginLeft
, m_leftMarginCheckbox
);
418 wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetMargins().GetTop(), m_marginTop
, m_unitsMarginTop
, m_topMarginCheckbox
);
419 wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetMargins().GetRight(), m_marginRight
, m_unitsMarginRight
, m_rightMarginCheckbox
);
420 wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetMargins().GetBottom(), m_marginBottom
, m_unitsMarginBottom
, m_bottomMarginCheckbox
);
423 wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetPadding().GetLeft(), m_paddingLeft
, m_unitsPaddingLeft
, m_leftPaddingCheckbox
);
424 wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetPadding().GetTop(), m_paddingTop
, m_unitsPaddingTop
, m_topPaddingCheckbox
);
425 wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetPadding().GetRight(), m_paddingRight
, m_unitsPaddingRight
, m_rightPaddingCheckbox
);
426 wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetPadding().GetBottom(), m_paddingBottom
, m_unitsPaddingBottom
, m_bottomPaddingCheckbox
);
431 bool wxRichTextMarginsPage::TransferDataFromWindow()
434 wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetMargins().GetLeft(), m_marginLeft
, m_unitsMarginLeft
, m_leftMarginCheckbox
);
435 wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetMargins().GetTop(), m_marginTop
, m_unitsMarginTop
, m_topMarginCheckbox
);
436 wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetMargins().GetRight(), m_marginRight
, m_unitsMarginRight
, m_rightMarginCheckbox
);
437 wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetMargins().GetBottom(), m_marginBottom
, m_unitsMarginBottom
, m_bottomMarginCheckbox
);
440 wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetPadding().GetLeft(), m_paddingLeft
, m_unitsPaddingLeft
, m_leftPaddingCheckbox
);
441 wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetPadding().GetTop(), m_paddingTop
, m_unitsPaddingTop
, m_topPaddingCheckbox
);
442 wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetPadding().GetRight(), m_paddingRight
, m_unitsPaddingRight
, m_rightPaddingCheckbox
);
443 wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetPadding().GetBottom(), m_paddingBottom
, m_unitsPaddingBottom
, m_bottomPaddingCheckbox
);
449 * Get bitmap resources
452 wxBitmap
wxRichTextMarginsPage::GetBitmapResource( const wxString
& name
)
455 ////@begin wxRichTextMarginsPage bitmap retrieval
458 ////@end wxRichTextMarginsPage bitmap retrieval
465 wxIcon
wxRichTextMarginsPage::GetIconResource( const wxString
& name
)
468 ////@begin wxRichTextMarginsPage icon retrieval
471 ////@end wxRichTextMarginsPage icon retrieval
476 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_LEFT_MARGIN
479 void wxRichTextMarginsPage::OnRichtextLeftMarginUpdate( wxUpdateUIEvent
& event
)
481 event
.Enable(m_leftMarginCheckbox
->GetValue());
486 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_RIGHT_MARGIN
489 void wxRichTextMarginsPage::OnRichtextRightMarginUpdate( wxUpdateUIEvent
& event
)
491 event
.Enable(m_rightMarginCheckbox
->GetValue());
495 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_TOP_MARGIN
498 void wxRichTextMarginsPage::OnRichtextTopMarginUpdate( wxUpdateUIEvent
& event
)
500 event
.Enable(m_topMarginCheckbox
->GetValue());
504 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BOTTOM_MARGIN
507 void wxRichTextMarginsPage::OnRichtextBottomMarginUpdate( wxUpdateUIEvent
& event
)
509 event
.Enable(m_bottomMarginCheckbox
->GetValue());
514 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_LEFT_PADDING
517 void wxRichTextMarginsPage::OnRichtextLeftPaddingUpdate( wxUpdateUIEvent
& event
)
519 event
.Enable(m_leftPaddingCheckbox
->GetValue());
524 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_RIGHT_PADDING
527 void wxRichTextMarginsPage::OnRichtextRightPaddingUpdate( wxUpdateUIEvent
& event
)
529 event
.Enable(m_rightPaddingCheckbox
->GetValue());
534 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_TOP_PADDING
537 void wxRichTextMarginsPage::OnRichtextTopPaddingUpdate( wxUpdateUIEvent
& event
)
539 event
.Enable(m_topPaddingCheckbox
->GetValue());
543 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BOTTOM_PADDING
546 void wxRichTextMarginsPage::OnRichtextBottomPaddingUpdate( wxUpdateUIEvent
& event
)
548 event
.Enable(m_bottomPaddingCheckbox
->GetValue());