1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/richtext/richtextsizepage.cpp
4 // Author: Julian Smart
6 // Created: 20/10/2010 10:23:24
8 // Copyright: (c) Julian Smart
10 /////////////////////////////////////////////////////////////////////////////
12 #include "wx/richtext/richtextsizepage.h"
19 * wxRichTextSizePage type definition
22 IMPLEMENT_DYNAMIC_CLASS( wxRichTextSizePage
, wxRichTextDialogPage
)
26 * wxRichTextSizePage event table definition
29 BEGIN_EVENT_TABLE( wxRichTextSizePage
, wxRichTextDialogPage
)
31 ////@begin wxRichTextSizePage event table entries
32 EVT_UPDATE_UI( ID_RICHTEXT_VERTICAL_ALIGNMENT_COMBOBOX
, wxRichTextSizePage::OnRichtextVerticalAlignmentComboboxUpdate
)
34 EVT_UPDATE_UI( ID_RICHTEXT_WIDTH
, wxRichTextSizePage::OnRichtextWidthUpdate
)
36 EVT_UPDATE_UI( ID_RICHTEXT_UNITS_W
, wxRichTextSizePage::OnRichtextWidthUpdate
)
38 EVT_UPDATE_UI( ID_RICHTEXT_HEIGHT
, wxRichTextSizePage::OnRichtextHeightUpdate
)
40 EVT_UPDATE_UI( ID_RICHTEXT_UNITS_H
, wxRichTextSizePage::OnRichtextHeightUpdate
)
42 EVT_UPDATE_UI( ID_RICHTEXT_MIN_WIDTH
, wxRichTextSizePage::OnRichtextMinWidthUpdate
)
44 EVT_UPDATE_UI( ID_RICHTEXT_UNITS_MIN_W
, wxRichTextSizePage::OnRichtextMinWidthUpdate
)
46 EVT_UPDATE_UI( ID_RICHTEXT_MIN_HEIGHT
, wxRichTextSizePage::OnRichtextMinHeightUpdate
)
48 EVT_UPDATE_UI( ID_RICHTEXT_UNITS_MIN_H
, wxRichTextSizePage::OnRichtextMinHeightUpdate
)
50 EVT_UPDATE_UI( ID_RICHTEXT_MAX_WIDTH
, wxRichTextSizePage::OnRichtextMaxWidthUpdate
)
52 EVT_UPDATE_UI( ID_RICHTEXT_UNITS_MAX_W
, wxRichTextSizePage::OnRichtextMaxWidthUpdate
)
54 EVT_UPDATE_UI( ID_RICHTEXT_MAX_HEIGHT
, wxRichTextSizePage::OnRichtextMaxHeightUpdate
)
56 EVT_UPDATE_UI( ID_RICHTEXT_UNITS_MAX_H
, wxRichTextSizePage::OnRichtextMaxHeightUpdate
)
58 EVT_UPDATE_UI( ID_RICHTEXT_LEFT
, wxRichTextSizePage::OnRichtextLeftUpdate
)
60 EVT_UPDATE_UI( ID_RICHTEXT_LEFT_UNITS
, wxRichTextSizePage::OnRichtextTopUpdate
)
62 EVT_UPDATE_UI( ID_RICHTEXT_TOP
, wxRichTextSizePage::OnRichtextTopUpdate
)
64 EVT_UPDATE_UI( ID_RICHTEXT_TOP_UNITS
, wxRichTextSizePage::OnRichtextTopUpdate
)
66 EVT_UPDATE_UI( ID_RICHTEXT_RIGHT
, wxRichTextSizePage::OnRichtextRightUpdate
)
68 EVT_UPDATE_UI( ID_RICHTEXT_RIGHT_UNITS
, wxRichTextSizePage::OnRichtextRightUpdate
)
70 EVT_UPDATE_UI( ID_RICHTEXT_BOTTOM
, wxRichTextSizePage::OnRichtextBottomUpdate
)
72 EVT_UPDATE_UI( ID_RICHTEXT_BOTTOM_UNITS
, wxRichTextSizePage::OnRichtextBottomUpdate
)
74 EVT_BUTTON( ID_RICHTEXT_PARA_UP
, wxRichTextSizePage::OnRichtextParaUpClick
)
76 EVT_BUTTON( ID_RICHTEXT_PARA_DOWN
, wxRichTextSizePage::OnRichtextParaDownClick
)
78 ////@end wxRichTextSizePage event table entries
82 IMPLEMENT_HELP_PROVISION(wxRichTextSizePage
)
85 * wxRichTextSizePage constructors
88 wxRichTextSizePage::wxRichTextSizePage()
93 wxRichTextSizePage::wxRichTextSizePage( wxWindow
* parent
, wxWindowID id
, const wxPoint
& pos
, const wxSize
& size
, long style
)
96 Create(parent
, id
, pos
, size
, style
);
101 * wxRichTextSizePage creator
104 bool wxRichTextSizePage::Create( wxWindow
* parent
, wxWindowID id
, const wxPoint
& pos
, const wxSize
& size
, long style
)
106 ////@begin wxRichTextSizePage creation
107 wxRichTextDialogPage::Create( parent
, id
, pos
, size
, style
);
112 GetSizer()->SetSizeHints(this);
115 ////@end wxRichTextSizePage creation
121 * wxRichTextSizePage destructor
124 wxRichTextSizePage::~wxRichTextSizePage()
126 ////@begin wxRichTextSizePage destruction
127 ////@end wxRichTextSizePage destruction
132 * Member initialisation
135 void wxRichTextSizePage::Init()
137 ////@begin wxRichTextSizePage member initialisation
139 m_parentSizer
= NULL
;
140 m_floatingControls
= NULL
;
142 m_alignmentControls
= NULL
;
143 m_verticalAlignmentCheckbox
= NULL
;
144 m_verticalAlignmentComboBox
= NULL
;
145 m_widthCheckbox
= NULL
;
148 m_heightCheckbox
= NULL
;
151 m_minWidthCheckbox
= NULL
;
154 m_minHeightCheckbox
= NULL
;
157 m_maxWidthCheckbox
= NULL
;
160 m_maxHeightCheckbox
= NULL
;
163 m_positionControls
= NULL
;
164 m_moveObjectParentSizer
= NULL
;
165 m_positionModeCtrl
= NULL
;
166 m_positionLeftCheckbox
= NULL
;
169 m_positionTopCheckbox
= NULL
;
172 m_positionRightCheckbox
= NULL
;
175 m_positionBottomCheckbox
= NULL
;
177 m_unitsBottom
= NULL
;
178 m_moveObjectSizer
= NULL
;
179 ////@end wxRichTextSizePage member initialisation
184 * Control creation for wxRichTextSizePage
187 void wxRichTextSizePage::CreateControls()
189 ////@begin wxRichTextSizePage content construction
190 wxRichTextSizePage
* itemRichTextDialogPage1
= this;
192 wxBoxSizer
* itemBoxSizer2
= new wxBoxSizer(wxVERTICAL
);
193 itemRichTextDialogPage1
->SetSizer(itemBoxSizer2
);
195 m_parentSizer
= new wxBoxSizer(wxVERTICAL
);
196 itemBoxSizer2
->Add(m_parentSizer
, 0, wxGROW
|wxALL
, 5);
198 wxBoxSizer
* itemBoxSizer4
= new wxBoxSizer(wxHORIZONTAL
);
199 m_parentSizer
->Add(itemBoxSizer4
, 0, wxGROW
, 5);
201 m_floatingControls
= new wxBoxSizer(wxVERTICAL
);
202 itemBoxSizer4
->Add(m_floatingControls
, 1, wxALIGN_CENTER_VERTICAL
, 5);
204 wxBoxSizer
* itemBoxSizer6
= new wxBoxSizer(wxHORIZONTAL
);
205 m_floatingControls
->Add(itemBoxSizer6
, 0, wxGROW
, 5);
207 wxStaticText
* itemStaticText7
= new wxStaticText( itemRichTextDialogPage1
, wxID_STATIC
, _("Floating"), wxDefaultPosition
, wxDefaultSize
, 0 );
208 itemStaticText7
->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("")));
209 itemBoxSizer6
->Add(itemStaticText7
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
211 wxStaticLine
* itemStaticLine8
= new wxStaticLine( itemRichTextDialogPage1
, wxID_STATIC
, wxDefaultPosition
, wxDefaultSize
, wxLI_HORIZONTAL
);
212 itemBoxSizer6
->Add(itemStaticLine8
, 1, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
214 wxBoxSizer
* itemBoxSizer9
= new wxBoxSizer(wxHORIZONTAL
);
215 m_floatingControls
->Add(itemBoxSizer9
, 0, wxGROW
, 5);
217 itemBoxSizer9
->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
219 wxFlexGridSizer
* itemFlexGridSizer11
= new wxFlexGridSizer(0, 2, 0, 0);
220 itemBoxSizer9
->Add(itemFlexGridSizer11
, 0, wxALIGN_CENTER_VERTICAL
|wxRIGHT
, 5);
222 wxStaticText
* itemStaticText12
= new wxStaticText( itemRichTextDialogPage1
, wxID_STATIC
, _("&Floating mode:"), wxDefaultPosition
, wxDefaultSize
, 0 );
223 itemFlexGridSizer11
->Add(itemStaticText12
, 0, wxALIGN_RIGHT
|wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
225 wxArrayString m_floatStrings
;
226 m_floatStrings
.Add(_("None"));
227 m_floatStrings
.Add(_("Left"));
228 m_floatStrings
.Add(_("Right"));
229 m_float
= new wxComboBox( itemRichTextDialogPage1
, ID_RICHTEXT_FLOATING_MODE
, _("None"), wxDefaultPosition
, wxSize(80, -1), m_floatStrings
, wxCB_READONLY
);
230 m_float
->SetStringSelection(_("None"));
231 m_float
->SetHelpText(_("How the object will float relative to the text."));
232 if (wxRichTextSizePage::ShowToolTips())
233 m_float
->SetToolTip(_("How the object will float relative to the text."));
234 itemFlexGridSizer11
->Add(m_float
, 0, wxALIGN_LEFT
|wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
236 m_alignmentControls
= new wxBoxSizer(wxVERTICAL
);
237 itemBoxSizer4
->Add(m_alignmentControls
, 1, wxALIGN_CENTER_VERTICAL
, 5);
239 wxBoxSizer
* itemBoxSizer15
= new wxBoxSizer(wxHORIZONTAL
);
240 m_alignmentControls
->Add(itemBoxSizer15
, 0, wxGROW
, 5);
242 wxStaticText
* itemStaticText16
= new wxStaticText( itemRichTextDialogPage1
, wxID_STATIC
, _("Alignment"), wxDefaultPosition
, wxDefaultSize
, 0 );
243 itemStaticText16
->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("")));
244 itemBoxSizer15
->Add(itemStaticText16
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
246 wxStaticLine
* itemStaticLine17
= new wxStaticLine( itemRichTextDialogPage1
, wxID_STATIC
, wxDefaultPosition
, wxDefaultSize
, wxLI_HORIZONTAL
);
247 itemBoxSizer15
->Add(itemStaticLine17
, 1, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
249 wxBoxSizer
* itemBoxSizer18
= new wxBoxSizer(wxHORIZONTAL
);
250 m_alignmentControls
->Add(itemBoxSizer18
, 0, wxGROW
, 5);
252 itemBoxSizer18
->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
254 m_verticalAlignmentCheckbox
= new wxCheckBox( itemRichTextDialogPage1
, ID_RICHTEXT_VERTICAL_ALIGNMENT_CHECKBOX
, _("&Vertical alignment:"), wxDefaultPosition
, wxDefaultSize
, 0 );
255 m_verticalAlignmentCheckbox
->SetValue(false);
256 m_verticalAlignmentCheckbox
->SetHelpText(_("Enable vertical alignment."));
257 if (wxRichTextSizePage::ShowToolTips())
258 m_verticalAlignmentCheckbox
->SetToolTip(_("Enable vertical alignment."));
259 itemBoxSizer18
->Add(m_verticalAlignmentCheckbox
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
261 wxArrayString m_verticalAlignmentComboBoxStrings
;
262 m_verticalAlignmentComboBoxStrings
.Add(_("Top"));
263 m_verticalAlignmentComboBoxStrings
.Add(_("Centred"));
264 m_verticalAlignmentComboBoxStrings
.Add(_("Bottom"));
265 m_verticalAlignmentComboBox
= new wxComboBox( itemRichTextDialogPage1
, ID_RICHTEXT_VERTICAL_ALIGNMENT_COMBOBOX
, _("Top"), wxDefaultPosition
, wxDefaultSize
, m_verticalAlignmentComboBoxStrings
, wxCB_READONLY
);
266 m_verticalAlignmentComboBox
->SetStringSelection(_("Top"));
267 m_verticalAlignmentComboBox
->SetHelpText(_("Vertical alignment."));
268 if (wxRichTextSizePage::ShowToolTips())
269 m_verticalAlignmentComboBox
->SetToolTip(_("Vertical alignment."));
270 itemBoxSizer18
->Add(m_verticalAlignmentComboBox
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
272 wxBoxSizer
* itemBoxSizer22
= new wxBoxSizer(wxHORIZONTAL
);
273 m_parentSizer
->Add(itemBoxSizer22
, 0, wxGROW
, 5);
275 wxStaticText
* itemStaticText23
= new wxStaticText( itemRichTextDialogPage1
, wxID_STATIC
, _("Size"), wxDefaultPosition
, wxDefaultSize
, 0 );
276 itemStaticText23
->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("")));
277 itemBoxSizer22
->Add(itemStaticText23
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
279 wxStaticLine
* itemStaticLine24
= new wxStaticLine( itemRichTextDialogPage1
, wxID_STATIC
, wxDefaultPosition
, wxDefaultSize
, wxLI_HORIZONTAL
);
280 itemBoxSizer22
->Add(itemStaticLine24
, 1, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
282 wxBoxSizer
* itemBoxSizer25
= new wxBoxSizer(wxHORIZONTAL
);
283 m_parentSizer
->Add(itemBoxSizer25
, 0, wxGROW
, 5);
285 itemBoxSizer25
->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
287 wxFlexGridSizer
* itemFlexGridSizer27
= new wxFlexGridSizer(0, 4, 0, 0);
288 itemBoxSizer25
->Add(itemFlexGridSizer27
, 0, wxALIGN_CENTER_VERTICAL
, 5);
290 m_widthCheckbox
= new wxCheckBox( itemRichTextDialogPage1
, ID_RICHTEXT_WIDTH_CHECKBOX
, _("&Width:"), wxDefaultPosition
, wxDefaultSize
, 0 );
291 m_widthCheckbox
->SetValue(false);
292 m_widthCheckbox
->SetHelpText(_("Enable the width value."));
293 if (wxRichTextSizePage::ShowToolTips())
294 m_widthCheckbox
->SetToolTip(_("Enable the width value."));
295 itemFlexGridSizer27
->Add(m_widthCheckbox
, 0, wxALIGN_LEFT
|wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
297 wxBoxSizer
* itemBoxSizer29
= new wxBoxSizer(wxHORIZONTAL
);
298 itemFlexGridSizer27
->Add(itemBoxSizer29
, 0, wxALIGN_LEFT
|wxALIGN_CENTER_VERTICAL
, 5);
300 m_width
= new wxTextCtrl( itemRichTextDialogPage1
, ID_RICHTEXT_WIDTH
, wxEmptyString
, wxDefaultPosition
, wxSize(60, -1), 0 );
301 m_width
->SetHelpText(_("The object width."));
302 if (wxRichTextSizePage::ShowToolTips())
303 m_width
->SetToolTip(_("The object width."));
304 itemBoxSizer29
->Add(m_width
, 0, wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
306 wxArrayString m_unitsWStrings
;
307 m_unitsWStrings
.Add(_("px"));
308 m_unitsWStrings
.Add(_("cm"));
309 m_unitsWStrings
.Add(_("percent"));
310 m_unitsW
= new wxComboBox( itemRichTextDialogPage1
, ID_RICHTEXT_UNITS_W
, _("px"), wxDefaultPosition
, wxSize(60, -1), m_unitsWStrings
, wxCB_READONLY
);
311 m_unitsW
->SetStringSelection(_("px"));
312 m_unitsW
->SetHelpText(_("Units for the object width."));
313 if (wxRichTextSizePage::ShowToolTips())
314 m_unitsW
->SetToolTip(_("Units for the object width."));
315 itemBoxSizer29
->Add(m_unitsW
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
317 m_heightCheckbox
= new wxCheckBox( itemRichTextDialogPage1
, ID_RICHTEXT_HEIGHT_CHECKBOX
, _("&Height:"), wxDefaultPosition
, wxDefaultSize
, 0 );
318 m_heightCheckbox
->SetValue(false);
319 m_heightCheckbox
->SetHelpText(_("Enable the height value."));
320 if (wxRichTextSizePage::ShowToolTips())
321 m_heightCheckbox
->SetToolTip(_("Enable the height value."));
322 itemFlexGridSizer27
->Add(m_heightCheckbox
, 0, wxALIGN_LEFT
|wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
324 wxBoxSizer
* itemBoxSizer33
= new wxBoxSizer(wxHORIZONTAL
);
325 itemFlexGridSizer27
->Add(itemBoxSizer33
, 0, wxALIGN_LEFT
|wxALIGN_CENTER_VERTICAL
, 5);
327 m_height
= new wxTextCtrl( itemRichTextDialogPage1
, ID_RICHTEXT_HEIGHT
, wxEmptyString
, wxDefaultPosition
, wxSize(60, -1), 0 );
328 m_height
->SetHelpText(_("The object height."));
329 if (wxRichTextSizePage::ShowToolTips())
330 m_height
->SetToolTip(_("The object height."));
331 itemBoxSizer33
->Add(m_height
, 0, wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
333 wxArrayString m_unitsHStrings
;
334 m_unitsHStrings
.Add(_("px"));
335 m_unitsHStrings
.Add(_("cm"));
336 m_unitsHStrings
.Add(_("percent"));
337 m_unitsH
= new wxComboBox( itemRichTextDialogPage1
, ID_RICHTEXT_UNITS_H
, _("px"), wxDefaultPosition
, wxSize(60, -1), m_unitsHStrings
, wxCB_READONLY
);
338 m_unitsH
->SetStringSelection(_("px"));
339 m_unitsH
->SetHelpText(_("Units for the object height."));
340 if (wxRichTextSizePage::ShowToolTips())
341 m_unitsH
->SetToolTip(_("Units for the object height."));
342 itemBoxSizer33
->Add(m_unitsH
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
344 m_minWidthCheckbox
= new wxCheckBox( itemRichTextDialogPage1
, ID_RICHTEXT_MIN_WIDTH_CHECKBOX
, _("Min width:"), wxDefaultPosition
, wxDefaultSize
, 0 );
345 m_minWidthCheckbox
->SetValue(false);
346 m_minWidthCheckbox
->SetHelpText(_("Enable the minimum width value."));
347 if (wxRichTextSizePage::ShowToolTips())
348 m_minWidthCheckbox
->SetToolTip(_("Enable the minimum width value."));
349 itemFlexGridSizer27
->Add(m_minWidthCheckbox
, 0, wxALIGN_LEFT
|wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
351 wxBoxSizer
* itemBoxSizer37
= new wxBoxSizer(wxHORIZONTAL
);
352 itemFlexGridSizer27
->Add(itemBoxSizer37
, 0, wxALIGN_LEFT
|wxALIGN_CENTER_VERTICAL
, 5);
354 m_minWidth
= new wxTextCtrl( itemRichTextDialogPage1
, ID_RICHTEXT_MIN_WIDTH
, wxEmptyString
, wxDefaultPosition
, wxSize(60, -1), 0 );
355 m_minWidth
->SetHelpText(_("The object minimum width."));
356 if (wxRichTextSizePage::ShowToolTips())
357 m_minWidth
->SetToolTip(_("The object minimum width."));
358 itemBoxSizer37
->Add(m_minWidth
, 0, wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
360 wxArrayString m_unitsMinWStrings
;
361 m_unitsMinWStrings
.Add(_("px"));
362 m_unitsMinWStrings
.Add(_("cm"));
363 m_unitsMinWStrings
.Add(_("percent"));
364 m_unitsMinW
= new wxComboBox( itemRichTextDialogPage1
, ID_RICHTEXT_UNITS_MIN_W
, _("px"), wxDefaultPosition
, wxSize(60, -1), m_unitsMinWStrings
, wxCB_READONLY
);
365 m_unitsMinW
->SetStringSelection(_("px"));
366 m_unitsMinW
->SetHelpText(_("Units for the minimum object width."));
367 if (wxRichTextSizePage::ShowToolTips())
368 m_unitsMinW
->SetToolTip(_("Units for the minimum object width."));
369 itemBoxSizer37
->Add(m_unitsMinW
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
371 m_minHeightCheckbox
= new wxCheckBox( itemRichTextDialogPage1
, ID_RICHTEXT_MIN_HEIGHT_CHECKBOX
, _("Min height:"), wxDefaultPosition
, wxDefaultSize
, 0 );
372 m_minHeightCheckbox
->SetValue(false);
373 m_minHeightCheckbox
->SetHelpText(_("Enable the minimum height value."));
374 if (wxRichTextSizePage::ShowToolTips())
375 m_minHeightCheckbox
->SetToolTip(_("Enable the minimum height value."));
376 itemFlexGridSizer27
->Add(m_minHeightCheckbox
, 0, wxALIGN_LEFT
|wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
378 wxBoxSizer
* itemBoxSizer41
= new wxBoxSizer(wxHORIZONTAL
);
379 itemFlexGridSizer27
->Add(itemBoxSizer41
, 0, wxALIGN_LEFT
|wxALIGN_CENTER_VERTICAL
, 5);
381 m_minHeight
= new wxTextCtrl( itemRichTextDialogPage1
, ID_RICHTEXT_MIN_HEIGHT
, wxEmptyString
, wxDefaultPosition
, wxSize(60, -1), 0 );
382 m_minHeight
->SetHelpText(_("The object minmum height."));
383 if (wxRichTextSizePage::ShowToolTips())
384 m_minHeight
->SetToolTip(_("The object minmum height."));
385 itemBoxSizer41
->Add(m_minHeight
, 0, wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
387 wxArrayString m_unitsMinHStrings
;
388 m_unitsMinHStrings
.Add(_("px"));
389 m_unitsMinHStrings
.Add(_("cm"));
390 m_unitsMinHStrings
.Add(_("percent"));
391 m_unitsMinH
= new wxComboBox( itemRichTextDialogPage1
, ID_RICHTEXT_UNITS_MIN_H
, _("px"), wxDefaultPosition
, wxSize(60, -1), m_unitsMinHStrings
, wxCB_READONLY
);
392 m_unitsMinH
->SetStringSelection(_("px"));
393 m_unitsMinH
->SetHelpText(_("Units for the minimum object height."));
394 if (wxRichTextSizePage::ShowToolTips())
395 m_unitsMinH
->SetToolTip(_("Units for the minimum object height."));
396 itemBoxSizer41
->Add(m_unitsMinH
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
398 m_maxWidthCheckbox
= new wxCheckBox( itemRichTextDialogPage1
, ID_RICHTEXT_MAX_WIDTH_CHECKBOX
, _("Max width:"), wxDefaultPosition
, wxDefaultSize
, 0 );
399 m_maxWidthCheckbox
->SetValue(false);
400 m_maxWidthCheckbox
->SetHelpText(_("Enable the maximum width value."));
401 if (wxRichTextSizePage::ShowToolTips())
402 m_maxWidthCheckbox
->SetToolTip(_("Enable the maximum width value."));
403 itemFlexGridSizer27
->Add(m_maxWidthCheckbox
, 0, wxALIGN_LEFT
|wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
405 wxBoxSizer
* itemBoxSizer45
= new wxBoxSizer(wxHORIZONTAL
);
406 itemFlexGridSizer27
->Add(itemBoxSizer45
, 0, wxALIGN_LEFT
|wxALIGN_CENTER_VERTICAL
, 5);
408 m_maxWidth
= new wxTextCtrl( itemRichTextDialogPage1
, ID_RICHTEXT_MAX_WIDTH
, wxEmptyString
, wxDefaultPosition
, wxSize(60, -1), 0 );
409 m_maxWidth
->SetHelpText(_("The object maximum width."));
410 if (wxRichTextSizePage::ShowToolTips())
411 m_maxWidth
->SetToolTip(_("The object maximum width."));
412 itemBoxSizer45
->Add(m_maxWidth
, 0, wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
414 wxArrayString m_unitsMaxWStrings
;
415 m_unitsMaxWStrings
.Add(_("px"));
416 m_unitsMaxWStrings
.Add(_("cm"));
417 m_unitsMaxWStrings
.Add(_("percent"));
418 m_unitsMaxW
= new wxComboBox( itemRichTextDialogPage1
, ID_RICHTEXT_UNITS_MAX_W
, _("px"), wxDefaultPosition
, wxSize(60, -1), m_unitsMaxWStrings
, wxCB_READONLY
);
419 m_unitsMaxW
->SetStringSelection(_("px"));
420 m_unitsMaxW
->SetHelpText(_("Units for the maximum object width."));
421 if (wxRichTextSizePage::ShowToolTips())
422 m_unitsMaxW
->SetToolTip(_("Units for the maximum object width."));
423 itemBoxSizer45
->Add(m_unitsMaxW
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
425 m_maxHeightCheckbox
= new wxCheckBox( itemRichTextDialogPage1
, ID_RICHTEXT_MAX_HEIGHT_CHECKBOX
, _("Max height:"), wxDefaultPosition
, wxDefaultSize
, 0 );
426 m_maxHeightCheckbox
->SetValue(false);
427 m_maxHeightCheckbox
->SetHelpText(_("Enable the height value."));
428 if (wxRichTextSizePage::ShowToolTips())
429 m_maxHeightCheckbox
->SetToolTip(_("Enable the height value."));
430 itemFlexGridSizer27
->Add(m_maxHeightCheckbox
, 0, wxALIGN_LEFT
|wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
432 wxBoxSizer
* itemBoxSizer49
= new wxBoxSizer(wxHORIZONTAL
);
433 itemFlexGridSizer27
->Add(itemBoxSizer49
, 0, wxALIGN_LEFT
|wxALIGN_CENTER_VERTICAL
, 5);
435 m_maxHeight
= new wxTextCtrl( itemRichTextDialogPage1
, ID_RICHTEXT_MAX_HEIGHT
, wxEmptyString
, wxDefaultPosition
, wxSize(60, -1), 0 );
436 m_maxHeight
->SetHelpText(_("The object maximum height."));
437 if (wxRichTextSizePage::ShowToolTips())
438 m_maxHeight
->SetToolTip(_("The object maximum height."));
439 itemBoxSizer49
->Add(m_maxHeight
, 0, wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
441 wxArrayString m_unitsMaxHStrings
;
442 m_unitsMaxHStrings
.Add(_("px"));
443 m_unitsMaxHStrings
.Add(_("cm"));
444 m_unitsMaxHStrings
.Add(_("percent"));
445 m_unitsMaxH
= new wxComboBox( itemRichTextDialogPage1
, ID_RICHTEXT_UNITS_MAX_H
, _("px"), wxDefaultPosition
, wxSize(60, -1), m_unitsMaxHStrings
, wxCB_READONLY
);
446 m_unitsMaxH
->SetStringSelection(_("px"));
447 m_unitsMaxH
->SetHelpText(_("Units for the maximum object height."));
448 if (wxRichTextSizePage::ShowToolTips())
449 m_unitsMaxH
->SetToolTip(_("Units for the maximum object height."));
450 itemBoxSizer49
->Add(m_unitsMaxH
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
452 m_positionControls
= new wxBoxSizer(wxVERTICAL
);
453 m_parentSizer
->Add(m_positionControls
, 0, wxGROW
, 5);
455 wxBoxSizer
* itemBoxSizer53
= new wxBoxSizer(wxHORIZONTAL
);
456 m_positionControls
->Add(itemBoxSizer53
, 0, wxGROW
, 5);
458 wxStaticText
* itemStaticText54
= new wxStaticText( itemRichTextDialogPage1
, wxID_STATIC
, _("Position"), wxDefaultPosition
, wxDefaultSize
, 0 );
459 itemStaticText54
->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("")));
460 itemBoxSizer53
->Add(itemStaticText54
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
462 wxStaticLine
* itemStaticLine55
= new wxStaticLine( itemRichTextDialogPage1
, wxID_STATIC
, wxDefaultPosition
, wxDefaultSize
, wxLI_HORIZONTAL
);
463 itemBoxSizer53
->Add(itemStaticLine55
, 1, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
465 wxBoxSizer
* itemBoxSizer56
= new wxBoxSizer(wxHORIZONTAL
);
466 m_positionControls
->Add(itemBoxSizer56
, 0, wxGROW
, 5);
468 itemBoxSizer56
->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
470 m_moveObjectParentSizer
= new wxBoxSizer(wxVERTICAL
);
471 itemBoxSizer56
->Add(m_moveObjectParentSizer
, 0, wxALIGN_TOP
, 5);
473 wxBoxSizer
* itemBoxSizer59
= new wxBoxSizer(wxHORIZONTAL
);
474 m_moveObjectParentSizer
->Add(itemBoxSizer59
, 0, wxALIGN_LEFT
, 5);
476 wxStaticText
* itemStaticText60
= new wxStaticText( itemRichTextDialogPage1
, wxID_STATIC
, _("&Position mode:"), wxDefaultPosition
, wxDefaultSize
, 0 );
477 itemBoxSizer59
->Add(itemStaticText60
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
479 wxArrayString m_positionModeCtrlStrings
;
480 m_positionModeCtrlStrings
.Add(_("Static"));
481 m_positionModeCtrlStrings
.Add(_("Relative"));
482 m_positionModeCtrlStrings
.Add(_("Absolute"));
483 m_positionModeCtrlStrings
.Add(_("Fixed"));
484 m_positionModeCtrl
= new wxComboBox( itemRichTextDialogPage1
, ID_RICHTEXT_POSITION_MODE
, _("Static"), wxDefaultPosition
, wxDefaultSize
, m_positionModeCtrlStrings
, wxCB_READONLY
);
485 m_positionModeCtrl
->SetStringSelection(_("Static"));
486 itemBoxSizer59
->Add(m_positionModeCtrl
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
488 wxFlexGridSizer
* itemFlexGridSizer62
= new wxFlexGridSizer(0, 4, 0, 0);
489 m_moveObjectParentSizer
->Add(itemFlexGridSizer62
, 0, wxGROW
, 5);
491 m_positionLeftCheckbox
= new wxCheckBox( itemRichTextDialogPage1
, ID_RICHTEXT_LEFT_CHECKBOX
, _("&Left:"), wxDefaultPosition
, wxDefaultSize
, 0 );
492 m_positionLeftCheckbox
->SetValue(false);
493 m_positionLeftCheckbox
->SetHelpText(_("The left position."));
494 if (wxRichTextSizePage::ShowToolTips())
495 m_positionLeftCheckbox
->SetToolTip(_("The left position."));
496 itemFlexGridSizer62
->Add(m_positionLeftCheckbox
, 0, wxALIGN_LEFT
|wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
498 wxBoxSizer
* itemBoxSizer64
= new wxBoxSizer(wxHORIZONTAL
);
499 itemFlexGridSizer62
->Add(itemBoxSizer64
, 0, wxGROW
|wxALIGN_CENTER_VERTICAL
, 5);
501 m_left
= new wxTextCtrl( itemRichTextDialogPage1
, ID_RICHTEXT_LEFT
, wxEmptyString
, wxDefaultPosition
, wxSize(65, -1), 0 );
502 m_left
->SetMaxLength(10);
503 m_left
->SetHelpText(_("The left position."));
504 if (wxRichTextSizePage::ShowToolTips())
505 m_left
->SetToolTip(_("The left position."));
506 itemBoxSizer64
->Add(m_left
, 0, wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
508 wxArrayString m_unitsLeftStrings
;
509 m_unitsLeftStrings
.Add(_("px"));
510 m_unitsLeftStrings
.Add(_("cm"));
511 m_unitsLeftStrings
.Add(_("percent"));
512 m_unitsLeft
= new wxComboBox( itemRichTextDialogPage1
, ID_RICHTEXT_LEFT_UNITS
, _("px"), wxDefaultPosition
, wxSize(60, -1), m_unitsLeftStrings
, wxCB_READONLY
);
513 m_unitsLeft
->SetStringSelection(_("px"));
514 m_unitsLeft
->SetHelpText(_("Units for the left position."));
515 if (wxRichTextSizePage::ShowToolTips())
516 m_unitsLeft
->SetToolTip(_("Units for the left position."));
517 itemBoxSizer64
->Add(m_unitsLeft
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
519 m_positionTopCheckbox
= new wxCheckBox( itemRichTextDialogPage1
, ID_RICHTEXT_TOP_CHECKBOX
, _("&Top:"), wxDefaultPosition
, wxDefaultSize
, 0 );
520 m_positionTopCheckbox
->SetValue(false);
521 m_positionTopCheckbox
->SetHelpText(_("The top position."));
522 if (wxRichTextSizePage::ShowToolTips())
523 m_positionTopCheckbox
->SetToolTip(_("The top position."));
524 itemFlexGridSizer62
->Add(m_positionTopCheckbox
, 0, wxALIGN_LEFT
|wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
526 wxBoxSizer
* itemBoxSizer68
= new wxBoxSizer(wxHORIZONTAL
);
527 itemFlexGridSizer62
->Add(itemBoxSizer68
, 0, wxGROW
|wxALIGN_CENTER_VERTICAL
, 5);
529 m_top
= new wxTextCtrl( itemRichTextDialogPage1
, ID_RICHTEXT_TOP
, wxEmptyString
, wxDefaultPosition
, wxSize(65, -1), 0 );
530 m_top
->SetMaxLength(10);
531 m_top
->SetHelpText(_("The top position."));
532 if (wxRichTextSizePage::ShowToolTips())
533 m_top
->SetToolTip(_("The top position."));
534 itemBoxSizer68
->Add(m_top
, 0, wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
536 wxArrayString m_unitsTopStrings
;
537 m_unitsTopStrings
.Add(_("px"));
538 m_unitsTopStrings
.Add(_("cm"));
539 m_unitsTopStrings
.Add(_("percent"));
540 m_unitsTop
= new wxComboBox( itemRichTextDialogPage1
, ID_RICHTEXT_TOP_UNITS
, _("px"), wxDefaultPosition
, wxSize(60, -1), m_unitsTopStrings
, wxCB_READONLY
);
541 m_unitsTop
->SetStringSelection(_("px"));
542 m_unitsTop
->SetHelpText(_("Units for the top position."));
543 if (wxRichTextSizePage::ShowToolTips())
544 m_unitsTop
->SetToolTip(_("Units for the top position."));
545 itemBoxSizer68
->Add(m_unitsTop
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
547 m_positionRightCheckbox
= new wxCheckBox( itemRichTextDialogPage1
, ID_RICHTEXT_RIGHT_CHECKBOX
, _("&Right:"), wxDefaultPosition
, wxDefaultSize
, 0 );
548 m_positionRightCheckbox
->SetValue(false);
549 m_positionRightCheckbox
->SetHelpText(_("The right position."));
550 if (wxRichTextSizePage::ShowToolTips())
551 m_positionRightCheckbox
->SetToolTip(_("The right position."));
552 itemFlexGridSizer62
->Add(m_positionRightCheckbox
, 0, wxALIGN_LEFT
|wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
554 wxBoxSizer
* itemBoxSizer72
= new wxBoxSizer(wxHORIZONTAL
);
555 itemFlexGridSizer62
->Add(itemBoxSizer72
, 0, wxGROW
|wxALIGN_CENTER_VERTICAL
, 5);
557 m_right
= new wxTextCtrl( itemRichTextDialogPage1
, ID_RICHTEXT_RIGHT
, wxEmptyString
, wxDefaultPosition
, wxSize(65, -1), 0 );
558 m_right
->SetMaxLength(10);
559 m_right
->SetHelpText(_("The right position."));
560 if (wxRichTextSizePage::ShowToolTips())
561 m_right
->SetToolTip(_("The right position."));
562 itemBoxSizer72
->Add(m_right
, 0, wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
564 wxArrayString m_unitsRightStrings
;
565 m_unitsRightStrings
.Add(_("px"));
566 m_unitsRightStrings
.Add(_("cm"));
567 m_unitsRightStrings
.Add(_("percent"));
568 m_unitsRight
= new wxComboBox( itemRichTextDialogPage1
, ID_RICHTEXT_RIGHT_UNITS
, _("px"), wxDefaultPosition
, wxSize(60, -1), m_unitsRightStrings
, wxCB_READONLY
);
569 m_unitsRight
->SetStringSelection(_("px"));
570 m_unitsRight
->SetHelpText(_("Units for the right position."));
571 if (wxRichTextSizePage::ShowToolTips())
572 m_unitsRight
->SetToolTip(_("Units for the right position."));
573 itemBoxSizer72
->Add(m_unitsRight
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
575 m_positionBottomCheckbox
= new wxCheckBox( itemRichTextDialogPage1
, ID_RICHTEXT_BOTTOM_CHECKBOX
, _("&Bottom:"), wxDefaultPosition
, wxDefaultSize
, 0 );
576 m_positionBottomCheckbox
->SetValue(false);
577 m_positionBottomCheckbox
->SetHelpText(_("The bottom position."));
578 if (wxRichTextSizePage::ShowToolTips())
579 m_positionBottomCheckbox
->SetToolTip(_("The bottom position."));
580 itemFlexGridSizer62
->Add(m_positionBottomCheckbox
, 0, wxALIGN_LEFT
|wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
582 wxBoxSizer
* itemBoxSizer76
= new wxBoxSizer(wxHORIZONTAL
);
583 itemFlexGridSizer62
->Add(itemBoxSizer76
, 0, wxGROW
|wxALIGN_CENTER_VERTICAL
, 5);
585 m_bottom
= new wxTextCtrl( itemRichTextDialogPage1
, ID_RICHTEXT_BOTTOM
, wxEmptyString
, wxDefaultPosition
, wxSize(65, -1), 0 );
586 m_bottom
->SetMaxLength(10);
587 m_bottom
->SetHelpText(_("The bottom position."));
588 if (wxRichTextSizePage::ShowToolTips())
589 m_bottom
->SetToolTip(_("The bottom position."));
590 itemBoxSizer76
->Add(m_bottom
, 0, wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
592 wxArrayString m_unitsBottomStrings
;
593 m_unitsBottomStrings
.Add(_("px"));
594 m_unitsBottomStrings
.Add(_("cm"));
595 m_unitsBottomStrings
.Add(_("percent"));
596 m_unitsBottom
= new wxComboBox( itemRichTextDialogPage1
, ID_RICHTEXT_BOTTOM_UNITS
, _("px"), wxDefaultPosition
, wxSize(60, -1), m_unitsBottomStrings
, wxCB_READONLY
);
597 m_unitsBottom
->SetStringSelection(_("px"));
598 m_unitsBottom
->SetHelpText(_("Units for the bottom position."));
599 if (wxRichTextSizePage::ShowToolTips())
600 m_unitsBottom
->SetToolTip(_("Units for the bottom position."));
601 itemBoxSizer76
->Add(m_unitsBottom
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
603 m_moveObjectSizer
= new wxBoxSizer(wxHORIZONTAL
);
604 m_moveObjectParentSizer
->Add(m_moveObjectSizer
, 0, wxGROW
, 5);
606 wxStaticText
* itemStaticText80
= new wxStaticText( itemRichTextDialogPage1
, wxID_STATIC
, _("&Move the object to:"), wxDefaultPosition
, wxDefaultSize
, 0 );
607 m_moveObjectSizer
->Add(itemStaticText80
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
609 wxButton
* itemButton81
= new wxButton( itemRichTextDialogPage1
, ID_RICHTEXT_PARA_UP
, _("&Previous Paragraph"), wxDefaultPosition
, wxDefaultSize
, 0 );
610 itemButton81
->SetHelpText(_("Moves the object to the previous paragraph."));
611 if (wxRichTextSizePage::ShowToolTips())
612 itemButton81
->SetToolTip(_("Moves the object to the previous paragraph."));
613 m_moveObjectSizer
->Add(itemButton81
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
615 wxButton
* itemButton82
= new wxButton( itemRichTextDialogPage1
, ID_RICHTEXT_PARA_DOWN
, _("&Next Paragraph"), wxDefaultPosition
, wxDefaultSize
, 0 );
616 itemButton82
->SetHelpText(_("Moves the object to the next paragraph."));
617 if (wxRichTextSizePage::ShowToolTips())
618 itemButton82
->SetToolTip(_("Moves the object to the next paragraph."));
619 m_moveObjectSizer
->Add(itemButton82
, 0, wxALIGN_CENTER_VERTICAL
|wxRIGHT
|wxTOP
|wxBOTTOM
, 5);
622 m_positionModeCtrl
->SetValidator( wxGenericValidator(& m_positionMode
) );
623 ////@end wxRichTextSizePage content construction
626 wxRichTextAttr
* wxRichTextSizePage::GetAttributes()
628 return wxRichTextFormattingDialog::GetDialogAttributes(this);
632 * Should we show tooltips?
635 bool wxRichTextSizePage::ShowToolTips()
640 bool wxRichTextSizePage::TransferDataToWindow()
642 m_float
->SetSelection(GetAttributes()->GetTextBoxAttr().GetFloatMode());
643 m_verticalAlignmentCheckbox
->SetValue(GetAttributes()->GetTextBoxAttr().HasVerticalAlignment());
644 if (GetAttributes()->GetTextBoxAttr().HasVerticalAlignment())
646 if ((int) GetAttributes()->GetTextBoxAttr().GetVerticalAlignment() > 0 &&
647 (int) GetAttributes()->GetTextBoxAttr().GetVerticalAlignment() < 4)
649 m_verticalAlignmentComboBox
->SetSelection(((int) GetAttributes()->GetTextBoxAttr().GetVerticalAlignment() - 1));
652 m_verticalAlignmentComboBox
->SetSelection(0);
655 wxRichTextFormattingDialog
* dialog
= wxRichTextFormattingDialog::GetDialog(this);
659 // Only show the Move Object controls if there's an object.
660 if (!dialog
->GetObject())
662 m_moveObjectParentSizer
->Show(m_moveObjectSizer
, false);
663 GetSizer()->Layout();
667 wxRichTextImage
* imageObj
= NULL
;
669 imageObj
= wxDynamicCast(dialog
->GetObject(), wxRichTextImage
);
671 // For an image, show the original width and height if the size is not explicitly specified.
672 if (imageObj
&& !GetAttributes()->GetTextBoxAttr().GetWidth().IsValid() && !GetAttributes()->GetTextBoxAttr().GetHeight().IsValid() &&
673 imageObj
->GetOriginalImageSize() != wxSize(-1, -1))
675 m_widthCheckbox
->SetValue(false);
676 m_heightCheckbox
->SetValue(false);
677 m_unitsW
->SetSelection(0);
678 m_unitsH
->SetSelection(0);
679 m_width
->SetValue(wxString::Format(wxT("%d"), (int) imageObj
->GetOriginalImageSize().GetWidth()));
680 m_height
->SetValue(wxString::Format(wxT("%d"), (int) imageObj
->GetOriginalImageSize().GetHeight()));
684 wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetWidth(), m_width
, m_unitsW
, m_widthCheckbox
);
685 wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetHeight(), m_height
, m_unitsH
, m_heightCheckbox
);
688 wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetMinSize().GetWidth(), m_minWidth
, m_unitsMinW
, m_minWidthCheckbox
);
689 wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetMinSize().GetHeight(), m_minHeight
, m_unitsMinH
, m_minHeightCheckbox
);
690 wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetMaxSize().GetWidth(), m_maxWidth
, m_unitsMaxW
, m_maxWidthCheckbox
);
691 wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetMaxSize().GetHeight(), m_maxHeight
, m_unitsMaxH
, m_maxHeightCheckbox
);
692 wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetLeft(), m_left
, m_unitsLeft
, m_positionLeftCheckbox
);
693 wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetTop(), m_top
, m_unitsTop
, m_positionTopCheckbox
);
694 wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetRight(), m_right
, m_unitsRight
, m_positionRightCheckbox
);
695 wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetBottom(), m_bottom
, m_unitsBottom
, m_positionBottomCheckbox
);
697 if ((GetAttributes()->GetTextBoxAttr().GetLeft().GetPosition() & wxTEXT_BOX_ATTR_POSITION_FIXED
) ||
698 (GetAttributes()->GetTextBoxAttr().GetRight().GetPosition() & wxTEXT_BOX_ATTR_POSITION_FIXED
) ||
699 (GetAttributes()->GetTextBoxAttr().GetTop().GetPosition() & wxTEXT_BOX_ATTR_POSITION_FIXED
) ||
700 (GetAttributes()->GetTextBoxAttr().GetBottom().GetPosition() & wxTEXT_BOX_ATTR_POSITION_FIXED
))
705 if ((GetAttributes()->GetTextBoxAttr().GetLeft().GetPosition() & wxTEXT_BOX_ATTR_POSITION_ABSOLUTE
) ||
706 (GetAttributes()->GetTextBoxAttr().GetRight().GetPosition() & wxTEXT_BOX_ATTR_POSITION_ABSOLUTE
) ||
707 (GetAttributes()->GetTextBoxAttr().GetTop().GetPosition() & wxTEXT_BOX_ATTR_POSITION_ABSOLUTE
) ||
708 (GetAttributes()->GetTextBoxAttr().GetBottom().GetPosition() & wxTEXT_BOX_ATTR_POSITION_ABSOLUTE
))
713 if ((GetAttributes()->GetTextBoxAttr().GetLeft().GetPosition() & wxTEXT_BOX_ATTR_POSITION_RELATIVE
) ||
714 (GetAttributes()->GetTextBoxAttr().GetRight().GetPosition() & wxTEXT_BOX_ATTR_POSITION_RELATIVE
) ||
715 (GetAttributes()->GetTextBoxAttr().GetTop().GetPosition() & wxTEXT_BOX_ATTR_POSITION_RELATIVE
) ||
716 (GetAttributes()->GetTextBoxAttr().GetBottom().GetPosition() & wxTEXT_BOX_ATTR_POSITION_RELATIVE
))
723 return wxPanel::TransferDataToWindow();
726 bool wxRichTextSizePage::TransferDataFromWindow()
728 wxPanel::TransferDataFromWindow();
730 GetAttributes()->GetTextBoxAttr().SetFloatMode((wxTextBoxAttrFloatStyle
) m_float
->GetSelection());
731 if (m_float
->GetSelection() == 0)
732 GetAttributes()->GetTextBoxAttr().RemoveFlag(wxTEXT_BOX_ATTR_FLOAT
);
734 if (m_verticalAlignmentCheckbox
->GetValue())
735 GetAttributes()->GetTextBoxAttr().SetVerticalAlignment((wxTextBoxAttrVerticalAlignment
) (m_verticalAlignmentComboBox
->GetSelection() + 1));
738 GetAttributes()->GetTextBoxAttr().SetVerticalAlignment(wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT_NONE
);
739 GetAttributes()->GetTextBoxAttr().RemoveFlag(wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT
);
742 wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetWidth(), m_width
, m_unitsW
, m_widthCheckbox
);
743 wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetHeight(), m_height
, m_unitsH
, m_heightCheckbox
);
744 wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetMinSize().GetWidth(), m_minWidth
, m_unitsMinW
, m_minWidthCheckbox
);
745 wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetMinSize().GetHeight(), m_minHeight
, m_unitsMinH
, m_minHeightCheckbox
);
746 wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetMaxSize().GetWidth(), m_maxWidth
, m_unitsMaxW
, m_maxWidthCheckbox
);
747 wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetMaxSize().GetHeight(), m_maxHeight
, m_unitsMaxH
, m_maxHeightCheckbox
);
749 wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetLeft(), m_left
, m_unitsLeft
, m_positionLeftCheckbox
);
750 wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetTop(), m_top
, m_unitsTop
, m_positionTopCheckbox
);
751 wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetRight(), m_right
, m_unitsRight
, m_positionRightCheckbox
);
752 wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetBottom(), m_bottom
, m_unitsBottom
, m_positionBottomCheckbox
);
754 wxTextBoxAttrPosition flags
;
755 if (m_positionMode
== 3)
756 flags
= wxTEXT_BOX_ATTR_POSITION_FIXED
;
757 else if (m_positionMode
== 2)
758 flags
= wxTEXT_BOX_ATTR_POSITION_ABSOLUTE
;
759 else if (m_positionMode
== 1)
760 flags
= wxTEXT_BOX_ATTR_POSITION_RELATIVE
;
762 flags
= wxTEXT_BOX_ATTR_POSITION_STATIC
;
764 if (GetAttributes()->GetTextBoxAttr().GetLeft().IsValid())
765 GetAttributes()->GetTextBoxAttr().GetLeft().SetPosition(flags
);
766 if (GetAttributes()->GetTextBoxAttr().GetTop().IsValid())
767 GetAttributes()->GetTextBoxAttr().GetTop().SetPosition(flags
);
768 if (GetAttributes()->GetTextBoxAttr().GetRight().IsValid())
769 GetAttributes()->GetTextBoxAttr().GetRight().SetPosition(flags
);
770 if (GetAttributes()->GetTextBoxAttr().GetBottom().IsValid())
771 GetAttributes()->GetTextBoxAttr().GetBottom().SetPosition(flags
);
776 // Show/hide position controls
777 void wxRichTextSizePage::ShowPositionControls(bool show
)
781 m_parentSizer
->Show(m_positionControls
, show
);
786 // Show/hide floating controls
787 void wxRichTextSizePage::ShowFloatingControls(bool show
)
791 m_parentSizer
->Show(m_floatingControls
, show
);
797 * Get bitmap resources
800 wxBitmap
wxRichTextSizePage::GetBitmapResource( const wxString
& name
)
803 ////@begin wxRichTextSizePage bitmap retrieval
806 ////@end wxRichTextSizePage bitmap retrieval
813 wxIcon
wxRichTextSizePage::GetIconResource( const wxString
& name
)
816 ////@begin wxRichTextSizePage icon retrieval
819 ////@end wxRichTextSizePage icon retrieval
824 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_WIDTH
827 void wxRichTextSizePage::OnRichtextWidthUpdate( wxUpdateUIEvent
& event
)
829 event
.Enable(m_widthCheckbox
->GetValue());
833 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_HEIGHT
836 void wxRichTextSizePage::OnRichtextHeightUpdate( wxUpdateUIEvent
& event
)
838 event
.Enable(m_heightCheckbox
->GetValue());
842 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXT_PARA_UP
845 void wxRichTextSizePage::OnRichtextParaUpClick( wxCommandEvent
& WXUNUSED(event
) )
847 wxRichTextFormattingDialog
* dialog
= wxRichTextFormattingDialog::GetDialog(this);
848 if (!dialog
|| !dialog
->GetObject())
851 // Make sure object attributes are up-to-date
852 dialog
->TransferDataFromWindow();
854 wxRichTextBuffer
* buffer
= dialog
->GetObject()->GetBuffer();
855 wxRichTextParagraphLayoutBox
* container
= dialog
->GetObject()->GetParentContainer();
856 wxRichTextObject
* parent
= dialog
->GetObject()->GetParent();
857 if (!container
|| !parent
|| !buffer
)
860 wxRichTextRange range
= dialog
->GetObject()->GetRange();
861 wxRichTextObjectList::compatibility_iterator iter
= container
->GetChildren().GetFirst();
867 if (iter
->GetData() == parent
)
869 iter
= iter
->GetNext();
873 iter
= iter
->GetPrevious();
877 wxRichTextObject
*obj
= iter
->GetData();
878 wxRichTextRange rg
= obj
->GetRange();
879 // tempObj will be deleted along with the undo object, and a clone of it will be
880 // returned by InsertObjectWithUndo
881 wxRichTextObject
* tempObj
= dialog
->GetObject()->Clone();
883 container
->DeleteRangeWithUndo(range
, buffer
->GetRichTextCtrl(), buffer
);
885 wxRichTextObject
* obj2
= container
->InsertObjectWithUndo(buffer
, rg
.GetStart(), tempObj
, buffer
->GetRichTextCtrl(), 0);
886 dialog
->SetObject(obj2
);
890 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXT_DOWN
893 void wxRichTextSizePage::OnRichtextParaDownClick( wxCommandEvent
& WXUNUSED(event
) )
895 wxRichTextFormattingDialog
* dialog
= wxRichTextFormattingDialog::GetDialog(this);
896 if (!dialog
|| !dialog
->GetObject())
899 // Make sure object attributes are up-to-date
900 dialog
->TransferDataFromWindow();
902 wxRichTextBuffer
* buffer
= dialog
->GetObject()->GetBuffer();
903 wxRichTextParagraphLayoutBox
* container
= dialog
->GetObject()->GetParentContainer();
904 wxRichTextObject
* parent
= dialog
->GetObject()->GetParent();
905 if (!container
|| !parent
|| !buffer
)
908 wxRichTextRange range
= dialog
->GetObject()->GetRange();
910 wxRichTextObjectList::compatibility_iterator iter
= buffer
->GetChildren().GetFirst();
916 if (iter
->GetData() == parent
)
918 iter
= iter
->GetNext();
921 iter
= iter
->GetNext();
925 wxRichTextObject
*obj
= iter
->GetData();
926 wxRichTextRange rg
= obj
->GetRange();
927 // tempObj will be deleted along with the undo object, and a clone of it will be
928 // returned by InsertObjectWithUndo
929 wxRichTextObject
* tempObj
= dialog
->GetObject()->Clone();
931 container
->DeleteRangeWithUndo(range
, buffer
->GetRichTextCtrl(), buffer
);
933 // Minus one because we deleted an object
934 wxRichTextObject
* obj2
= container
->InsertObjectWithUndo(buffer
, rg
.GetStart()-1, tempObj
, buffer
->GetRichTextCtrl(), 0);
935 dialog
->SetObject(obj2
);
940 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_VERTICAL_ALIGNMENT_COMBOBOX
943 void wxRichTextSizePage::OnRichtextVerticalAlignmentComboboxUpdate( wxUpdateUIEvent
& event
)
945 event
.Enable(m_verticalAlignmentCheckbox
->GetValue());
950 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_MIN_WIDTH
953 void wxRichTextSizePage::OnRichtextMinWidthUpdate( wxUpdateUIEvent
& event
)
955 event
.Enable(m_minWidthCheckbox
->GetValue());
959 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_MIN_HEIGHT
962 void wxRichTextSizePage::OnRichtextMinHeightUpdate( wxUpdateUIEvent
& event
)
964 event
.Enable(m_minHeightCheckbox
->GetValue());
969 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_MAX_WIDTH
972 void wxRichTextSizePage::OnRichtextMaxWidthUpdate( wxUpdateUIEvent
& event
)
974 event
.Enable(m_maxWidthCheckbox
->GetValue());
979 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_MAX_HEIGHT
982 void wxRichTextSizePage::OnRichtextMaxHeightUpdate( wxUpdateUIEvent
& event
)
984 event
.Enable(m_maxHeightCheckbox
->GetValue());
989 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_LEFT
992 void wxRichTextSizePage::OnRichtextLeftUpdate( wxUpdateUIEvent
& event
)
994 event
.Enable(m_positionLeftCheckbox
->GetValue());
998 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_LEFT_UNITS
1001 void wxRichTextSizePage::OnRichtextTopUpdate( wxUpdateUIEvent
& event
)
1003 event
.Enable(m_positionTopCheckbox
->GetValue());
1007 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_RIGHT
1010 void wxRichTextSizePage::OnRichtextRightUpdate( wxUpdateUIEvent
& event
)
1012 event
.Enable(m_positionRightCheckbox
->GetValue());
1017 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BOTTOM
1020 void wxRichTextSizePage::OnRichtextBottomUpdate( wxUpdateUIEvent
& event
)
1022 event
.Enable(m_positionBottomCheckbox
->GetValue());