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
)
33 EVT_UPDATE_UI( ID_RICHTEXT_WIDTH
, wxRichTextSizePage::OnRichtextWidthUpdate
)
34 EVT_UPDATE_UI( ID_RICHTEXT_UNITS_W
, wxRichTextSizePage::OnRichtextWidthUpdate
)
35 EVT_UPDATE_UI( ID_RICHTEXT_HEIGHT
, wxRichTextSizePage::OnRichtextHeightUpdate
)
36 EVT_UPDATE_UI( ID_RICHTEXT_UNITS_H
, wxRichTextSizePage::OnRichtextHeightUpdate
)
37 EVT_UPDATE_UI( ID_RICHTEXT_MIN_WIDTH
, wxRichTextSizePage::OnRichtextMinWidthUpdate
)
38 EVT_UPDATE_UI( ID_RICHTEXT_UNITS_MIN_W
, wxRichTextSizePage::OnRichtextMinWidthUpdate
)
39 EVT_UPDATE_UI( ID_RICHTEXT_MIN_HEIGHT
, wxRichTextSizePage::OnRichtextMinHeightUpdate
)
40 EVT_UPDATE_UI( ID_RICHTEXT_UNITS_MIN_H
, wxRichTextSizePage::OnRichtextMinHeightUpdate
)
41 EVT_UPDATE_UI( ID_RICHTEXT_MAX_WIDTH
, wxRichTextSizePage::OnRichtextMaxWidthUpdate
)
42 EVT_UPDATE_UI( ID_RICHTEXT_UNITS_MAX_W
, wxRichTextSizePage::OnRichtextMaxWidthUpdate
)
43 EVT_UPDATE_UI( ID_RICHTEXT_MAX_HEIGHT
, wxRichTextSizePage::OnRichtextMaxHeightUpdate
)
44 EVT_UPDATE_UI( ID_RICHTEXT_UNITS_MAX_H
, wxRichTextSizePage::OnRichtextMaxHeightUpdate
)
45 EVT_UPDATE_UI( ID_RICHTEXT_LEFT
, wxRichTextSizePage::OnRichtextLeftUpdate
)
46 EVT_UPDATE_UI( ID_RICHTEXT_LEFT_UNITS
, wxRichTextSizePage::OnRichtextTopUpdate
)
47 EVT_UPDATE_UI( ID_RICHTEXT_TOP
, wxRichTextSizePage::OnRichtextTopUpdate
)
48 EVT_UPDATE_UI( ID_RICHTEXT_TOP_UNITS
, wxRichTextSizePage::OnRichtextTopUpdate
)
49 EVT_UPDATE_UI( ID_RICHTEXT_RIGHT
, wxRichTextSizePage::OnRichtextRightUpdate
)
50 EVT_UPDATE_UI( ID_RICHTEXT_RIGHT_UNITS
, wxRichTextSizePage::OnRichtextRightUpdate
)
51 EVT_UPDATE_UI( ID_RICHTEXT_BOTTOM
, wxRichTextSizePage::OnRichtextBottomUpdate
)
52 EVT_UPDATE_UI( ID_RICHTEXT_BOTTOM_UNITS
, wxRichTextSizePage::OnRichtextBottomUpdate
)
53 EVT_BUTTON( ID_RICHTEXT_PARA_UP
, wxRichTextSizePage::OnRichtextParaUpClick
)
54 EVT_BUTTON( ID_RICHTEXT_PARA_DOWN
, wxRichTextSizePage::OnRichtextParaDownClick
)
55 ////@end wxRichTextSizePage event table entries
59 IMPLEMENT_HELP_PROVISION(wxRichTextSizePage
)
62 * wxRichTextSizePage constructors
65 wxRichTextSizePage::wxRichTextSizePage()
70 wxRichTextSizePage::wxRichTextSizePage( wxWindow
* parent
, wxWindowID id
, const wxPoint
& pos
, const wxSize
& size
, long style
)
73 Create(parent
, id
, pos
, size
, style
);
78 * wxRichTextSizePage creator
81 bool wxRichTextSizePage::Create( wxWindow
* parent
, wxWindowID id
, const wxPoint
& pos
, const wxSize
& size
, long style
)
83 ////@begin wxRichTextSizePage creation
84 wxRichTextDialogPage::Create( parent
, id
, pos
, size
, style
);
89 GetSizer()->SetSizeHints(this);
92 ////@end wxRichTextSizePage creation
98 * wxRichTextSizePage destructor
101 wxRichTextSizePage::~wxRichTextSizePage()
103 ////@begin wxRichTextSizePage destruction
104 ////@end wxRichTextSizePage destruction
109 * Member initialisation
112 void wxRichTextSizePage::Init()
114 ////@begin wxRichTextSizePage member initialisation
116 m_parentSizer
= NULL
;
117 m_floatingAlignmentSizer
= NULL
;
118 m_floatingSizer
= NULL
;
120 m_alignmentSizer
= NULL
;
121 m_verticalAlignmentCheckbox
= NULL
;
122 m_verticalAlignmentComboBox
= NULL
;
123 m_widthCheckbox
= NULL
;
126 m_heightCheckbox
= NULL
;
129 m_minWidthCheckbox
= NULL
;
132 m_minHeightCheckbox
= NULL
;
135 m_maxWidthCheckbox
= NULL
;
138 m_maxHeightCheckbox
= NULL
;
141 m_positionControls
= NULL
;
142 m_moveObjectParentSizer
= NULL
;
143 m_positionModeSizer
= NULL
;
144 m_positionModeCtrl
= NULL
;
145 m_positionGridSizer
= NULL
;
146 m_positionLeftCheckbox
= NULL
;
149 m_positionTopCheckbox
= NULL
;
152 m_positionRightCheckbox
= NULL
;
153 m_rightPositionSizer
= NULL
;
156 m_positionBottomCheckbox
= NULL
;
157 m_bottomPositionSizer
= NULL
;
159 m_unitsBottom
= NULL
;
160 m_moveObjectSizer
= NULL
;
161 ////@end wxRichTextSizePage member initialisation
166 * Control creation for wxRichTextSizePage
169 void wxRichTextSizePage::CreateControls()
171 ////@begin wxRichTextSizePage content construction
172 wxRichTextSizePage
* itemRichTextDialogPage1
= this;
174 wxBoxSizer
* itemBoxSizer2
= new wxBoxSizer(wxVERTICAL
);
175 itemRichTextDialogPage1
->SetSizer(itemBoxSizer2
);
177 m_parentSizer
= new wxBoxSizer(wxVERTICAL
);
178 itemBoxSizer2
->Add(m_parentSizer
, 0, wxGROW
|wxALL
, 5);
180 m_floatingAlignmentSizer
= new wxBoxSizer(wxHORIZONTAL
);
181 m_parentSizer
->Add(m_floatingAlignmentSizer
, 0, wxGROW
, 5);
183 m_floatingSizer
= new wxBoxSizer(wxVERTICAL
);
184 m_floatingAlignmentSizer
->Add(m_floatingSizer
, 1, wxALIGN_CENTER_VERTICAL
, 5);
186 wxBoxSizer
* itemBoxSizer6
= new wxBoxSizer(wxHORIZONTAL
);
187 m_floatingSizer
->Add(itemBoxSizer6
, 0, wxGROW
, 5);
189 wxStaticText
* itemStaticText7
= new wxStaticText( itemRichTextDialogPage1
, wxID_STATIC
, _("Floating"), wxDefaultPosition
, wxDefaultSize
, 0 );
190 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("")));
191 itemBoxSizer6
->Add(itemStaticText7
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
193 wxStaticLine
* itemStaticLine8
= new wxStaticLine( itemRichTextDialogPage1
, wxID_STATIC
, wxDefaultPosition
, wxDefaultSize
, wxLI_HORIZONTAL
);
194 itemBoxSizer6
->Add(itemStaticLine8
, 1, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
196 wxBoxSizer
* itemBoxSizer9
= new wxBoxSizer(wxHORIZONTAL
);
197 m_floatingSizer
->Add(itemBoxSizer9
, 0, wxGROW
, 5);
199 itemBoxSizer9
->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
201 wxFlexGridSizer
* itemFlexGridSizer11
= new wxFlexGridSizer(0, 2, 0, 0);
202 itemBoxSizer9
->Add(itemFlexGridSizer11
, 0, wxALIGN_CENTER_VERTICAL
|wxRIGHT
, 5);
204 wxStaticText
* itemStaticText12
= new wxStaticText( itemRichTextDialogPage1
, wxID_STATIC
, _("&Floating mode:"), wxDefaultPosition
, wxDefaultSize
, 0 );
205 itemFlexGridSizer11
->Add(itemStaticText12
, 0, wxALIGN_RIGHT
|wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
207 wxArrayString m_floatStrings
;
208 m_floatStrings
.Add(_("None"));
209 m_floatStrings
.Add(_("Left"));
210 m_floatStrings
.Add(_("Right"));
211 m_float
= new wxComboBox( itemRichTextDialogPage1
, ID_RICHTEXT_FLOATING_MODE
, _("None"), wxDefaultPosition
, wxSize(80, -1), m_floatStrings
, wxCB_READONLY
);
212 m_float
->SetStringSelection(_("None"));
213 m_float
->SetHelpText(_("How the object will float relative to the text."));
214 if (wxRichTextSizePage::ShowToolTips())
215 m_float
->SetToolTip(_("How the object will float relative to the text."));
216 itemFlexGridSizer11
->Add(m_float
, 0, wxALIGN_LEFT
|wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
218 m_alignmentSizer
= new wxBoxSizer(wxVERTICAL
);
219 m_floatingAlignmentSizer
->Add(m_alignmentSizer
, 1, wxALIGN_CENTER_VERTICAL
, 5);
221 wxBoxSizer
* itemBoxSizer15
= new wxBoxSizer(wxHORIZONTAL
);
222 m_alignmentSizer
->Add(itemBoxSizer15
, 0, wxGROW
, 5);
224 wxStaticText
* itemStaticText16
= new wxStaticText( itemRichTextDialogPage1
, wxID_STATIC
, _("Alignment"), wxDefaultPosition
, wxDefaultSize
, 0 );
225 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("")));
226 itemBoxSizer15
->Add(itemStaticText16
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
228 wxStaticLine
* itemStaticLine17
= new wxStaticLine( itemRichTextDialogPage1
, wxID_STATIC
, wxDefaultPosition
, wxDefaultSize
, wxLI_HORIZONTAL
);
229 itemBoxSizer15
->Add(itemStaticLine17
, 1, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
231 wxBoxSizer
* itemBoxSizer18
= new wxBoxSizer(wxHORIZONTAL
);
232 m_alignmentSizer
->Add(itemBoxSizer18
, 0, wxGROW
, 5);
234 itemBoxSizer18
->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
236 m_verticalAlignmentCheckbox
= new wxCheckBox( itemRichTextDialogPage1
, ID_RICHTEXT_VERTICAL_ALIGNMENT_CHECKBOX
, _("&Vertical alignment:"), wxDefaultPosition
, wxDefaultSize
, 0 );
237 m_verticalAlignmentCheckbox
->SetValue(false);
238 m_verticalAlignmentCheckbox
->SetHelpText(_("Enable vertical alignment."));
239 if (wxRichTextSizePage::ShowToolTips())
240 m_verticalAlignmentCheckbox
->SetToolTip(_("Enable vertical alignment."));
241 itemBoxSizer18
->Add(m_verticalAlignmentCheckbox
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
243 wxArrayString m_verticalAlignmentComboBoxStrings
;
244 m_verticalAlignmentComboBoxStrings
.Add(_("Top"));
245 m_verticalAlignmentComboBoxStrings
.Add(_("Centred"));
246 m_verticalAlignmentComboBoxStrings
.Add(_("Bottom"));
247 m_verticalAlignmentComboBox
= new wxComboBox( itemRichTextDialogPage1
, ID_RICHTEXT_VERTICAL_ALIGNMENT_COMBOBOX
, _("Top"), wxDefaultPosition
, wxDefaultSize
, m_verticalAlignmentComboBoxStrings
, wxCB_READONLY
);
248 m_verticalAlignmentComboBox
->SetStringSelection(_("Top"));
249 m_verticalAlignmentComboBox
->SetHelpText(_("Vertical alignment."));
250 if (wxRichTextSizePage::ShowToolTips())
251 m_verticalAlignmentComboBox
->SetToolTip(_("Vertical alignment."));
252 itemBoxSizer18
->Add(m_verticalAlignmentComboBox
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
254 wxBoxSizer
* itemBoxSizer22
= new wxBoxSizer(wxHORIZONTAL
);
255 m_parentSizer
->Add(itemBoxSizer22
, 0, wxGROW
, 5);
257 wxStaticText
* itemStaticText23
= new wxStaticText( itemRichTextDialogPage1
, wxID_STATIC
, _("Size"), wxDefaultPosition
, wxDefaultSize
, 0 );
258 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("")));
259 itemBoxSizer22
->Add(itemStaticText23
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
261 wxStaticLine
* itemStaticLine24
= new wxStaticLine( itemRichTextDialogPage1
, wxID_STATIC
, wxDefaultPosition
, wxDefaultSize
, wxLI_HORIZONTAL
);
262 itemBoxSizer22
->Add(itemStaticLine24
, 1, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
264 wxBoxSizer
* itemBoxSizer25
= new wxBoxSizer(wxHORIZONTAL
);
265 m_parentSizer
->Add(itemBoxSizer25
, 0, wxGROW
, 5);
267 itemBoxSizer25
->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
269 wxFlexGridSizer
* itemFlexGridSizer27
= new wxFlexGridSizer(0, 4, 0, 0);
270 itemBoxSizer25
->Add(itemFlexGridSizer27
, 0, wxALIGN_CENTER_VERTICAL
, 5);
272 m_widthCheckbox
= new wxCheckBox( itemRichTextDialogPage1
, ID_RICHTEXT_WIDTH_CHECKBOX
, _("&Width:"), wxDefaultPosition
, wxDefaultSize
, 0 );
273 m_widthCheckbox
->SetValue(false);
274 m_widthCheckbox
->SetHelpText(_("Enable the width value."));
275 if (wxRichTextSizePage::ShowToolTips())
276 m_widthCheckbox
->SetToolTip(_("Enable the width value."));
277 itemFlexGridSizer27
->Add(m_widthCheckbox
, 0, wxALIGN_LEFT
|wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
279 wxBoxSizer
* itemBoxSizer29
= new wxBoxSizer(wxHORIZONTAL
);
280 itemFlexGridSizer27
->Add(itemBoxSizer29
, 0, wxALIGN_LEFT
|wxALIGN_CENTER_VERTICAL
, 5);
282 m_width
= new wxTextCtrl( itemRichTextDialogPage1
, ID_RICHTEXT_WIDTH
, wxEmptyString
, wxDefaultPosition
, wxSize(60, -1), 0 );
283 m_width
->SetHelpText(_("The object width."));
284 if (wxRichTextSizePage::ShowToolTips())
285 m_width
->SetToolTip(_("The object width."));
286 itemBoxSizer29
->Add(m_width
, 0, wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
288 wxArrayString m_unitsWStrings
;
289 m_unitsWStrings
.Add(_("px"));
290 m_unitsWStrings
.Add(_("cm"));
291 m_unitsWStrings
.Add(_("percent"));
292 m_unitsW
= new wxComboBox( itemRichTextDialogPage1
, ID_RICHTEXT_UNITS_W
, _("px"), wxDefaultPosition
, wxSize(60, -1), m_unitsWStrings
, wxCB_READONLY
);
293 m_unitsW
->SetStringSelection(_("px"));
294 m_unitsW
->SetHelpText(_("Units for the object width."));
295 if (wxRichTextSizePage::ShowToolTips())
296 m_unitsW
->SetToolTip(_("Units for the object width."));
297 itemBoxSizer29
->Add(m_unitsW
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
299 m_heightCheckbox
= new wxCheckBox( itemRichTextDialogPage1
, ID_RICHTEXT_HEIGHT_CHECKBOX
, _("&Height:"), wxDefaultPosition
, wxDefaultSize
, 0 );
300 m_heightCheckbox
->SetValue(false);
301 m_heightCheckbox
->SetHelpText(_("Enable the height value."));
302 if (wxRichTextSizePage::ShowToolTips())
303 m_heightCheckbox
->SetToolTip(_("Enable the height value."));
304 itemFlexGridSizer27
->Add(m_heightCheckbox
, 0, wxALIGN_LEFT
|wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
306 wxBoxSizer
* itemBoxSizer33
= new wxBoxSizer(wxHORIZONTAL
);
307 itemFlexGridSizer27
->Add(itemBoxSizer33
, 0, wxALIGN_LEFT
|wxALIGN_CENTER_VERTICAL
, 5);
309 m_height
= new wxTextCtrl( itemRichTextDialogPage1
, ID_RICHTEXT_HEIGHT
, wxEmptyString
, wxDefaultPosition
, wxSize(60, -1), 0 );
310 m_height
->SetHelpText(_("The object height."));
311 if (wxRichTextSizePage::ShowToolTips())
312 m_height
->SetToolTip(_("The object height."));
313 itemBoxSizer33
->Add(m_height
, 0, wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
315 wxArrayString m_unitsHStrings
;
316 m_unitsHStrings
.Add(_("px"));
317 m_unitsHStrings
.Add(_("cm"));
318 m_unitsHStrings
.Add(_("percent"));
319 m_unitsH
= new wxComboBox( itemRichTextDialogPage1
, ID_RICHTEXT_UNITS_H
, _("px"), wxDefaultPosition
, wxSize(60, -1), m_unitsHStrings
, wxCB_READONLY
);
320 m_unitsH
->SetStringSelection(_("px"));
321 m_unitsH
->SetHelpText(_("Units for the object height."));
322 if (wxRichTextSizePage::ShowToolTips())
323 m_unitsH
->SetToolTip(_("Units for the object height."));
324 itemBoxSizer33
->Add(m_unitsH
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
326 m_minWidthCheckbox
= new wxCheckBox( itemRichTextDialogPage1
, ID_RICHTEXT_MIN_WIDTH_CHECKBOX
, _("Min width:"), wxDefaultPosition
, wxDefaultSize
, 0 );
327 m_minWidthCheckbox
->SetValue(false);
328 m_minWidthCheckbox
->SetHelpText(_("Enable the minimum width value."));
329 if (wxRichTextSizePage::ShowToolTips())
330 m_minWidthCheckbox
->SetToolTip(_("Enable the minimum width value."));
331 itemFlexGridSizer27
->Add(m_minWidthCheckbox
, 0, wxALIGN_LEFT
|wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
333 wxBoxSizer
* itemBoxSizer37
= new wxBoxSizer(wxHORIZONTAL
);
334 itemFlexGridSizer27
->Add(itemBoxSizer37
, 0, wxALIGN_LEFT
|wxALIGN_CENTER_VERTICAL
, 5);
336 m_minWidth
= new wxTextCtrl( itemRichTextDialogPage1
, ID_RICHTEXT_MIN_WIDTH
, wxEmptyString
, wxDefaultPosition
, wxSize(60, -1), 0 );
337 m_minWidth
->SetHelpText(_("The object minimum width."));
338 if (wxRichTextSizePage::ShowToolTips())
339 m_minWidth
->SetToolTip(_("The object minimum width."));
340 itemBoxSizer37
->Add(m_minWidth
, 0, wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
342 wxArrayString m_unitsMinWStrings
;
343 m_unitsMinWStrings
.Add(_("px"));
344 m_unitsMinWStrings
.Add(_("cm"));
345 m_unitsMinWStrings
.Add(_("percent"));
346 m_unitsMinW
= new wxComboBox( itemRichTextDialogPage1
, ID_RICHTEXT_UNITS_MIN_W
, _("px"), wxDefaultPosition
, wxSize(60, -1), m_unitsMinWStrings
, wxCB_READONLY
);
347 m_unitsMinW
->SetStringSelection(_("px"));
348 m_unitsMinW
->SetHelpText(_("Units for the minimum object width."));
349 if (wxRichTextSizePage::ShowToolTips())
350 m_unitsMinW
->SetToolTip(_("Units for the minimum object width."));
351 itemBoxSizer37
->Add(m_unitsMinW
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
353 m_minHeightCheckbox
= new wxCheckBox( itemRichTextDialogPage1
, ID_RICHTEXT_MIN_HEIGHT_CHECKBOX
, _("Min height:"), wxDefaultPosition
, wxDefaultSize
, 0 );
354 m_minHeightCheckbox
->SetValue(false);
355 m_minHeightCheckbox
->SetHelpText(_("Enable the minimum height value."));
356 if (wxRichTextSizePage::ShowToolTips())
357 m_minHeightCheckbox
->SetToolTip(_("Enable the minimum height value."));
358 itemFlexGridSizer27
->Add(m_minHeightCheckbox
, 0, wxALIGN_LEFT
|wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
360 wxBoxSizer
* itemBoxSizer41
= new wxBoxSizer(wxHORIZONTAL
);
361 itemFlexGridSizer27
->Add(itemBoxSizer41
, 0, wxALIGN_LEFT
|wxALIGN_CENTER_VERTICAL
, 5);
363 m_minHeight
= new wxTextCtrl( itemRichTextDialogPage1
, ID_RICHTEXT_MIN_HEIGHT
, wxEmptyString
, wxDefaultPosition
, wxSize(60, -1), 0 );
364 m_minHeight
->SetHelpText(_("The object minimum height."));
365 if (wxRichTextSizePage::ShowToolTips())
366 m_minHeight
->SetToolTip(_("The object minimum height."));
367 itemBoxSizer41
->Add(m_minHeight
, 0, wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
369 wxArrayString m_unitsMinHStrings
;
370 m_unitsMinHStrings
.Add(_("px"));
371 m_unitsMinHStrings
.Add(_("cm"));
372 m_unitsMinHStrings
.Add(_("percent"));
373 m_unitsMinH
= new wxComboBox( itemRichTextDialogPage1
, ID_RICHTEXT_UNITS_MIN_H
, _("px"), wxDefaultPosition
, wxSize(60, -1), m_unitsMinHStrings
, wxCB_READONLY
);
374 m_unitsMinH
->SetStringSelection(_("px"));
375 m_unitsMinH
->SetHelpText(_("Units for the minimum object height."));
376 if (wxRichTextSizePage::ShowToolTips())
377 m_unitsMinH
->SetToolTip(_("Units for the minimum object height."));
378 itemBoxSizer41
->Add(m_unitsMinH
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
380 m_maxWidthCheckbox
= new wxCheckBox( itemRichTextDialogPage1
, ID_RICHTEXT_MAX_WIDTH_CHECKBOX
, _("Max width:"), wxDefaultPosition
, wxDefaultSize
, 0 );
381 m_maxWidthCheckbox
->SetValue(false);
382 m_maxWidthCheckbox
->SetHelpText(_("Enable the maximum width value."));
383 if (wxRichTextSizePage::ShowToolTips())
384 m_maxWidthCheckbox
->SetToolTip(_("Enable the maximum width value."));
385 itemFlexGridSizer27
->Add(m_maxWidthCheckbox
, 0, wxALIGN_LEFT
|wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
387 wxBoxSizer
* itemBoxSizer45
= new wxBoxSizer(wxHORIZONTAL
);
388 itemFlexGridSizer27
->Add(itemBoxSizer45
, 0, wxALIGN_LEFT
|wxALIGN_CENTER_VERTICAL
, 5);
390 m_maxWidth
= new wxTextCtrl( itemRichTextDialogPage1
, ID_RICHTEXT_MAX_WIDTH
, wxEmptyString
, wxDefaultPosition
, wxSize(60, -1), 0 );
391 m_maxWidth
->SetHelpText(_("The object maximum width."));
392 if (wxRichTextSizePage::ShowToolTips())
393 m_maxWidth
->SetToolTip(_("The object maximum width."));
394 itemBoxSizer45
->Add(m_maxWidth
, 0, wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
396 wxArrayString m_unitsMaxWStrings
;
397 m_unitsMaxWStrings
.Add(_("px"));
398 m_unitsMaxWStrings
.Add(_("cm"));
399 m_unitsMaxWStrings
.Add(_("percent"));
400 m_unitsMaxW
= new wxComboBox( itemRichTextDialogPage1
, ID_RICHTEXT_UNITS_MAX_W
, _("px"), wxDefaultPosition
, wxSize(60, -1), m_unitsMaxWStrings
, wxCB_READONLY
);
401 m_unitsMaxW
->SetStringSelection(_("px"));
402 m_unitsMaxW
->SetHelpText(_("Units for the maximum object width."));
403 if (wxRichTextSizePage::ShowToolTips())
404 m_unitsMaxW
->SetToolTip(_("Units for the maximum object width."));
405 itemBoxSizer45
->Add(m_unitsMaxW
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
407 m_maxHeightCheckbox
= new wxCheckBox( itemRichTextDialogPage1
, ID_RICHTEXT_MAX_HEIGHT_CHECKBOX
, _("Max height:"), wxDefaultPosition
, wxDefaultSize
, 0 );
408 m_maxHeightCheckbox
->SetValue(false);
409 m_maxHeightCheckbox
->SetHelpText(_("Enable the height value."));
410 if (wxRichTextSizePage::ShowToolTips())
411 m_maxHeightCheckbox
->SetToolTip(_("Enable the height value."));
412 itemFlexGridSizer27
->Add(m_maxHeightCheckbox
, 0, wxALIGN_LEFT
|wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
414 wxBoxSizer
* itemBoxSizer49
= new wxBoxSizer(wxHORIZONTAL
);
415 itemFlexGridSizer27
->Add(itemBoxSizer49
, 0, wxALIGN_LEFT
|wxALIGN_CENTER_VERTICAL
, 5);
417 m_maxHeight
= new wxTextCtrl( itemRichTextDialogPage1
, ID_RICHTEXT_MAX_HEIGHT
, wxEmptyString
, wxDefaultPosition
, wxSize(60, -1), 0 );
418 m_maxHeight
->SetHelpText(_("The object maximum height."));
419 if (wxRichTextSizePage::ShowToolTips())
420 m_maxHeight
->SetToolTip(_("The object maximum height."));
421 itemBoxSizer49
->Add(m_maxHeight
, 0, wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
423 wxArrayString m_unitsMaxHStrings
;
424 m_unitsMaxHStrings
.Add(_("px"));
425 m_unitsMaxHStrings
.Add(_("cm"));
426 m_unitsMaxHStrings
.Add(_("percent"));
427 m_unitsMaxH
= new wxComboBox( itemRichTextDialogPage1
, ID_RICHTEXT_UNITS_MAX_H
, _("px"), wxDefaultPosition
, wxSize(60, -1), m_unitsMaxHStrings
, wxCB_READONLY
);
428 m_unitsMaxH
->SetStringSelection(_("px"));
429 m_unitsMaxH
->SetHelpText(_("Units for the maximum object height."));
430 if (wxRichTextSizePage::ShowToolTips())
431 m_unitsMaxH
->SetToolTip(_("Units for the maximum object height."));
432 itemBoxSizer49
->Add(m_unitsMaxH
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
434 m_positionControls
= new wxBoxSizer(wxVERTICAL
);
435 m_parentSizer
->Add(m_positionControls
, 0, wxGROW
, 5);
437 wxBoxSizer
* itemBoxSizer53
= new wxBoxSizer(wxHORIZONTAL
);
438 m_positionControls
->Add(itemBoxSizer53
, 0, wxGROW
, 5);
440 wxStaticText
* itemStaticText54
= new wxStaticText( itemRichTextDialogPage1
, wxID_STATIC
, _("Position"), wxDefaultPosition
, wxDefaultSize
, 0 );
441 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("")));
442 itemBoxSizer53
->Add(itemStaticText54
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
444 wxStaticLine
* itemStaticLine55
= new wxStaticLine( itemRichTextDialogPage1
, wxID_STATIC
, wxDefaultPosition
, wxDefaultSize
, wxLI_HORIZONTAL
);
445 itemBoxSizer53
->Add(itemStaticLine55
, 1, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
447 wxBoxSizer
* itemBoxSizer56
= new wxBoxSizer(wxHORIZONTAL
);
448 m_positionControls
->Add(itemBoxSizer56
, 0, wxGROW
, 5);
450 itemBoxSizer56
->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
452 m_moveObjectParentSizer
= new wxBoxSizer(wxVERTICAL
);
453 itemBoxSizer56
->Add(m_moveObjectParentSizer
, 0, wxALIGN_TOP
, 5);
455 m_positionModeSizer
= new wxBoxSizer(wxHORIZONTAL
);
456 m_moveObjectParentSizer
->Add(m_positionModeSizer
, 0, wxALIGN_LEFT
, 5);
458 wxStaticText
* itemStaticText60
= new wxStaticText( itemRichTextDialogPage1
, wxID_STATIC
, _("&Position mode:"), wxDefaultPosition
, wxDefaultSize
, 0 );
459 m_positionModeSizer
->Add(itemStaticText60
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
461 wxArrayString m_positionModeCtrlStrings
;
462 m_positionModeCtrlStrings
.Add(_("Static"));
463 m_positionModeCtrlStrings
.Add(_("Relative"));
464 m_positionModeCtrlStrings
.Add(_("Absolute"));
465 m_positionModeCtrlStrings
.Add(_("Fixed"));
466 m_positionModeCtrl
= new wxComboBox( itemRichTextDialogPage1
, ID_RICHTEXT_POSITION_MODE
, _("Static"), wxDefaultPosition
, wxDefaultSize
, m_positionModeCtrlStrings
, wxCB_READONLY
);
467 m_positionModeCtrl
->SetStringSelection(_("Static"));
468 m_positionModeSizer
->Add(m_positionModeCtrl
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
470 m_positionGridSizer
= new wxFlexGridSizer(0, 4, 0, 0);
471 m_moveObjectParentSizer
->Add(m_positionGridSizer
, 0, wxGROW
, 5);
473 m_positionLeftCheckbox
= new wxCheckBox( itemRichTextDialogPage1
, ID_RICHTEXT_LEFT_CHECKBOX
, _("&Left:"), wxDefaultPosition
, wxDefaultSize
, 0 );
474 m_positionLeftCheckbox
->SetValue(false);
475 m_positionLeftCheckbox
->SetHelpText(_("The left position."));
476 if (wxRichTextSizePage::ShowToolTips())
477 m_positionLeftCheckbox
->SetToolTip(_("The left position."));
478 m_positionGridSizer
->Add(m_positionLeftCheckbox
, 0, wxALIGN_LEFT
|wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
480 wxBoxSizer
* itemBoxSizer64
= new wxBoxSizer(wxHORIZONTAL
);
481 m_positionGridSizer
->Add(itemBoxSizer64
, 0, wxGROW
|wxALIGN_CENTER_VERTICAL
, 5);
483 m_left
= new wxTextCtrl( itemRichTextDialogPage1
, ID_RICHTEXT_LEFT
, wxEmptyString
, wxDefaultPosition
, wxSize(65, -1), 0 );
484 m_left
->SetMaxLength(10);
485 m_left
->SetHelpText(_("The left position."));
486 if (wxRichTextSizePage::ShowToolTips())
487 m_left
->SetToolTip(_("The left position."));
488 itemBoxSizer64
->Add(m_left
, 0, wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
490 wxArrayString m_unitsLeftStrings
;
491 m_unitsLeftStrings
.Add(_("px"));
492 m_unitsLeftStrings
.Add(_("cm"));
493 m_unitsLeftStrings
.Add(_("percent"));
494 m_unitsLeft
= new wxComboBox( itemRichTextDialogPage1
, ID_RICHTEXT_LEFT_UNITS
, _("px"), wxDefaultPosition
, wxSize(60, -1), m_unitsLeftStrings
, wxCB_READONLY
);
495 m_unitsLeft
->SetStringSelection(_("px"));
496 m_unitsLeft
->SetHelpText(_("Units for the left position."));
497 if (wxRichTextSizePage::ShowToolTips())
498 m_unitsLeft
->SetToolTip(_("Units for the left position."));
499 itemBoxSizer64
->Add(m_unitsLeft
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
501 m_positionTopCheckbox
= new wxCheckBox( itemRichTextDialogPage1
, ID_RICHTEXT_TOP_CHECKBOX
, _("&Top:"), wxDefaultPosition
, wxDefaultSize
, 0 );
502 m_positionTopCheckbox
->SetValue(false);
503 m_positionTopCheckbox
->SetHelpText(_("The top position."));
504 if (wxRichTextSizePage::ShowToolTips())
505 m_positionTopCheckbox
->SetToolTip(_("The top position."));
506 m_positionGridSizer
->Add(m_positionTopCheckbox
, 0, wxALIGN_LEFT
|wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
508 wxBoxSizer
* itemBoxSizer68
= new wxBoxSizer(wxHORIZONTAL
);
509 m_positionGridSizer
->Add(itemBoxSizer68
, 0, wxGROW
|wxALIGN_CENTER_VERTICAL
, 5);
511 m_top
= new wxTextCtrl( itemRichTextDialogPage1
, ID_RICHTEXT_TOP
, wxEmptyString
, wxDefaultPosition
, wxSize(65, -1), 0 );
512 m_top
->SetMaxLength(10);
513 m_top
->SetHelpText(_("The top position."));
514 if (wxRichTextSizePage::ShowToolTips())
515 m_top
->SetToolTip(_("The top position."));
516 itemBoxSizer68
->Add(m_top
, 0, wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
518 wxArrayString m_unitsTopStrings
;
519 m_unitsTopStrings
.Add(_("px"));
520 m_unitsTopStrings
.Add(_("cm"));
521 m_unitsTopStrings
.Add(_("percent"));
522 m_unitsTop
= new wxComboBox( itemRichTextDialogPage1
, ID_RICHTEXT_TOP_UNITS
, _("px"), wxDefaultPosition
, wxSize(60, -1), m_unitsTopStrings
, wxCB_READONLY
);
523 m_unitsTop
->SetStringSelection(_("px"));
524 m_unitsTop
->SetHelpText(_("Units for the top position."));
525 if (wxRichTextSizePage::ShowToolTips())
526 m_unitsTop
->SetToolTip(_("Units for the top position."));
527 itemBoxSizer68
->Add(m_unitsTop
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
529 m_positionRightCheckbox
= new wxCheckBox( itemRichTextDialogPage1
, ID_RICHTEXT_RIGHT_CHECKBOX
, _("&Right:"), wxDefaultPosition
, wxDefaultSize
, 0 );
530 m_positionRightCheckbox
->SetValue(false);
531 m_positionRightCheckbox
->SetHelpText(_("The right position."));
532 if (wxRichTextSizePage::ShowToolTips())
533 m_positionRightCheckbox
->SetToolTip(_("The right position."));
534 m_positionGridSizer
->Add(m_positionRightCheckbox
, 0, wxALIGN_LEFT
|wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
536 m_rightPositionSizer
= new wxBoxSizer(wxHORIZONTAL
);
537 m_positionGridSizer
->Add(m_rightPositionSizer
, 0, wxGROW
|wxALIGN_CENTER_VERTICAL
, 5);
539 m_right
= new wxTextCtrl( itemRichTextDialogPage1
, ID_RICHTEXT_RIGHT
, wxEmptyString
, wxDefaultPosition
, wxSize(65, -1), 0 );
540 m_right
->SetMaxLength(10);
541 m_right
->SetHelpText(_("The right position."));
542 if (wxRichTextSizePage::ShowToolTips())
543 m_right
->SetToolTip(_("The right position."));
544 m_rightPositionSizer
->Add(m_right
, 0, wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
546 wxArrayString m_unitsRightStrings
;
547 m_unitsRightStrings
.Add(_("px"));
548 m_unitsRightStrings
.Add(_("cm"));
549 m_unitsRightStrings
.Add(_("percent"));
550 m_unitsRight
= new wxComboBox( itemRichTextDialogPage1
, ID_RICHTEXT_RIGHT_UNITS
, _("px"), wxDefaultPosition
, wxSize(60, -1), m_unitsRightStrings
, wxCB_READONLY
);
551 m_unitsRight
->SetStringSelection(_("px"));
552 m_unitsRight
->SetHelpText(_("Units for the right position."));
553 if (wxRichTextSizePage::ShowToolTips())
554 m_unitsRight
->SetToolTip(_("Units for the right position."));
555 m_rightPositionSizer
->Add(m_unitsRight
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
557 m_positionBottomCheckbox
= new wxCheckBox( itemRichTextDialogPage1
, ID_RICHTEXT_BOTTOM_CHECKBOX
, _("&Bottom:"), wxDefaultPosition
, wxDefaultSize
, 0 );
558 m_positionBottomCheckbox
->SetValue(false);
559 m_positionBottomCheckbox
->SetHelpText(_("The bottom position."));
560 if (wxRichTextSizePage::ShowToolTips())
561 m_positionBottomCheckbox
->SetToolTip(_("The bottom position."));
562 m_positionGridSizer
->Add(m_positionBottomCheckbox
, 0, wxALIGN_LEFT
|wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
564 m_bottomPositionSizer
= new wxBoxSizer(wxHORIZONTAL
);
565 m_positionGridSizer
->Add(m_bottomPositionSizer
, 0, wxGROW
|wxALIGN_CENTER_VERTICAL
, 5);
567 m_bottom
= new wxTextCtrl( itemRichTextDialogPage1
, ID_RICHTEXT_BOTTOM
, wxEmptyString
, wxDefaultPosition
, wxSize(65, -1), 0 );
568 m_bottom
->SetMaxLength(10);
569 m_bottom
->SetHelpText(_("The bottom position."));
570 if (wxRichTextSizePage::ShowToolTips())
571 m_bottom
->SetToolTip(_("The bottom position."));
572 m_bottomPositionSizer
->Add(m_bottom
, 0, wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
574 wxArrayString m_unitsBottomStrings
;
575 m_unitsBottomStrings
.Add(_("px"));
576 m_unitsBottomStrings
.Add(_("cm"));
577 m_unitsBottomStrings
.Add(_("percent"));
578 m_unitsBottom
= new wxComboBox( itemRichTextDialogPage1
, ID_RICHTEXT_BOTTOM_UNITS
, _("px"), wxDefaultPosition
, wxSize(60, -1), m_unitsBottomStrings
, wxCB_READONLY
);
579 m_unitsBottom
->SetStringSelection(_("px"));
580 m_unitsBottom
->SetHelpText(_("Units for the bottom position."));
581 if (wxRichTextSizePage::ShowToolTips())
582 m_unitsBottom
->SetToolTip(_("Units for the bottom position."));
583 m_bottomPositionSizer
->Add(m_unitsBottom
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
585 m_moveObjectSizer
= new wxBoxSizer(wxHORIZONTAL
);
586 m_moveObjectParentSizer
->Add(m_moveObjectSizer
, 0, wxGROW
, 5);
588 wxStaticText
* itemStaticText80
= new wxStaticText( itemRichTextDialogPage1
, wxID_STATIC
, _("&Move the object to:"), wxDefaultPosition
, wxDefaultSize
, 0 );
589 m_moveObjectSizer
->Add(itemStaticText80
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
591 wxButton
* itemButton81
= new wxButton( itemRichTextDialogPage1
, ID_RICHTEXT_PARA_UP
, _("&Previous Paragraph"), wxDefaultPosition
, wxDefaultSize
, 0 );
592 itemButton81
->SetHelpText(_("Moves the object to the previous paragraph."));
593 if (wxRichTextSizePage::ShowToolTips())
594 itemButton81
->SetToolTip(_("Moves the object to the previous paragraph."));
595 m_moveObjectSizer
->Add(itemButton81
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
597 wxButton
* itemButton82
= new wxButton( itemRichTextDialogPage1
, ID_RICHTEXT_PARA_DOWN
, _("&Next Paragraph"), wxDefaultPosition
, wxDefaultSize
, 0 );
598 itemButton82
->SetHelpText(_("Moves the object to the next paragraph."));
599 if (wxRichTextSizePage::ShowToolTips())
600 itemButton82
->SetToolTip(_("Moves the object to the next paragraph."));
601 m_moveObjectSizer
->Add(itemButton82
, 0, wxALIGN_CENTER_VERTICAL
|wxRIGHT
|wxTOP
|wxBOTTOM
, 5);
604 m_positionModeCtrl
->SetValidator( wxGenericValidator(& m_positionMode
) );
605 ////@end wxRichTextSizePage content construction
608 wxRichTextAttr
* wxRichTextSizePage::GetAttributes()
610 return wxRichTextFormattingDialog::GetDialogAttributes(this);
614 * Should we show tooltips?
617 bool wxRichTextSizePage::ShowToolTips()
622 bool wxRichTextSizePage::TransferDataToWindow()
624 m_float
->SetSelection(GetAttributes()->GetTextBoxAttr().GetFloatMode());
625 m_verticalAlignmentCheckbox
->SetValue(GetAttributes()->GetTextBoxAttr().HasVerticalAlignment());
626 if (GetAttributes()->GetTextBoxAttr().HasVerticalAlignment())
628 if ((int) GetAttributes()->GetTextBoxAttr().GetVerticalAlignment() > 0 &&
629 (int) GetAttributes()->GetTextBoxAttr().GetVerticalAlignment() < 4)
631 m_verticalAlignmentComboBox
->SetSelection(((int) GetAttributes()->GetTextBoxAttr().GetVerticalAlignment() - 1));
634 m_verticalAlignmentComboBox
->SetSelection(0);
637 wxRichTextFormattingDialog
* dialog
= wxRichTextFormattingDialog::GetDialog(this);
641 // Only show the Move Object controls if there's an object.
642 if (!dialog
->GetObject())
644 m_moveObjectParentSizer
->Show(m_moveObjectSizer
, false);
645 GetSizer()->Layout();
649 wxRichTextImage
* imageObj
= NULL
;
651 imageObj
= wxDynamicCast(dialog
->GetObject(), wxRichTextImage
);
653 // For an image, show the original width and height if the size is not explicitly specified.
654 if (imageObj
&& !GetAttributes()->GetTextBoxAttr().GetWidth().IsValid() && !GetAttributes()->GetTextBoxAttr().GetHeight().IsValid() &&
655 imageObj
->GetOriginalImageSize() != wxSize(-1, -1))
657 m_widthCheckbox
->SetValue(false);
658 m_heightCheckbox
->SetValue(false);
659 m_unitsW
->SetSelection(0);
660 m_unitsH
->SetSelection(0);
661 m_width
->SetValue(wxString::Format(wxT("%d"), (int) imageObj
->GetOriginalImageSize().GetWidth()));
662 m_height
->SetValue(wxString::Format(wxT("%d"), (int) imageObj
->GetOriginalImageSize().GetHeight()));
666 wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetWidth(), m_width
, m_unitsW
, m_widthCheckbox
);
667 wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetHeight(), m_height
, m_unitsH
, m_heightCheckbox
);
670 wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetMinSize().GetWidth(), m_minWidth
, m_unitsMinW
, m_minWidthCheckbox
);
671 wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetMinSize().GetHeight(), m_minHeight
, m_unitsMinH
, m_minHeightCheckbox
);
672 wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetMaxSize().GetWidth(), m_maxWidth
, m_unitsMaxW
, m_maxWidthCheckbox
);
673 wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetMaxSize().GetHeight(), m_maxHeight
, m_unitsMaxH
, m_maxHeightCheckbox
);
674 wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetLeft(), m_left
, m_unitsLeft
, m_positionLeftCheckbox
);
675 wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetTop(), m_top
, m_unitsTop
, m_positionTopCheckbox
);
676 wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetRight(), m_right
, m_unitsRight
, m_positionRightCheckbox
);
677 wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetBottom(), m_bottom
, m_unitsBottom
, m_positionBottomCheckbox
);
679 if ((GetAttributes()->GetTextBoxAttr().GetLeft().GetPosition() & wxTEXT_BOX_ATTR_POSITION_FIXED
) ||
680 (GetAttributes()->GetTextBoxAttr().GetRight().GetPosition() & wxTEXT_BOX_ATTR_POSITION_FIXED
) ||
681 (GetAttributes()->GetTextBoxAttr().GetTop().GetPosition() & wxTEXT_BOX_ATTR_POSITION_FIXED
) ||
682 (GetAttributes()->GetTextBoxAttr().GetBottom().GetPosition() & wxTEXT_BOX_ATTR_POSITION_FIXED
))
687 if ((GetAttributes()->GetTextBoxAttr().GetLeft().GetPosition() & wxTEXT_BOX_ATTR_POSITION_ABSOLUTE
) ||
688 (GetAttributes()->GetTextBoxAttr().GetRight().GetPosition() & wxTEXT_BOX_ATTR_POSITION_ABSOLUTE
) ||
689 (GetAttributes()->GetTextBoxAttr().GetTop().GetPosition() & wxTEXT_BOX_ATTR_POSITION_ABSOLUTE
) ||
690 (GetAttributes()->GetTextBoxAttr().GetBottom().GetPosition() & wxTEXT_BOX_ATTR_POSITION_ABSOLUTE
))
695 if ((GetAttributes()->GetTextBoxAttr().GetLeft().GetPosition() & wxTEXT_BOX_ATTR_POSITION_RELATIVE
) ||
696 (GetAttributes()->GetTextBoxAttr().GetRight().GetPosition() & wxTEXT_BOX_ATTR_POSITION_RELATIVE
) ||
697 (GetAttributes()->GetTextBoxAttr().GetTop().GetPosition() & wxTEXT_BOX_ATTR_POSITION_RELATIVE
) ||
698 (GetAttributes()->GetTextBoxAttr().GetBottom().GetPosition() & wxTEXT_BOX_ATTR_POSITION_RELATIVE
))
705 return wxPanel::TransferDataToWindow();
708 bool wxRichTextSizePage::TransferDataFromWindow()
710 wxPanel::TransferDataFromWindow();
712 GetAttributes()->GetTextBoxAttr().SetFloatMode((wxTextBoxAttrFloatStyle
) m_float
->GetSelection());
713 if (m_float
->GetSelection() == 0)
714 GetAttributes()->GetTextBoxAttr().RemoveFlag(wxTEXT_BOX_ATTR_FLOAT
);
716 if (m_verticalAlignmentCheckbox
->GetValue())
717 GetAttributes()->GetTextBoxAttr().SetVerticalAlignment((wxTextBoxAttrVerticalAlignment
) (m_verticalAlignmentComboBox
->GetSelection() + 1));
720 GetAttributes()->GetTextBoxAttr().SetVerticalAlignment(wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT_NONE
);
721 GetAttributes()->GetTextBoxAttr().RemoveFlag(wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT
);
724 wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetWidth(), m_width
, m_unitsW
, m_widthCheckbox
);
725 wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetHeight(), m_height
, m_unitsH
, m_heightCheckbox
);
726 wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetMinSize().GetWidth(), m_minWidth
, m_unitsMinW
, m_minWidthCheckbox
);
727 wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetMinSize().GetHeight(), m_minHeight
, m_unitsMinH
, m_minHeightCheckbox
);
728 wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetMaxSize().GetWidth(), m_maxWidth
, m_unitsMaxW
, m_maxWidthCheckbox
);
729 wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetMaxSize().GetHeight(), m_maxHeight
, m_unitsMaxH
, m_maxHeightCheckbox
);
731 wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetLeft(), m_left
, m_unitsLeft
, m_positionLeftCheckbox
);
732 wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetTop(), m_top
, m_unitsTop
, m_positionTopCheckbox
);
733 wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetRight(), m_right
, m_unitsRight
, m_positionRightCheckbox
);
734 wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetBottom(), m_bottom
, m_unitsBottom
, m_positionBottomCheckbox
);
736 wxTextBoxAttrPosition flags
;
737 if (m_positionMode
== 3)
738 flags
= wxTEXT_BOX_ATTR_POSITION_FIXED
;
739 else if (m_positionMode
== 2)
740 flags
= wxTEXT_BOX_ATTR_POSITION_ABSOLUTE
;
741 else if (m_positionMode
== 1)
742 flags
= wxTEXT_BOX_ATTR_POSITION_RELATIVE
;
744 flags
= wxTEXT_BOX_ATTR_POSITION_STATIC
;
746 if (GetAttributes()->GetTextBoxAttr().GetLeft().IsValid())
747 GetAttributes()->GetTextBoxAttr().GetLeft().SetPosition(flags
);
748 if (GetAttributes()->GetTextBoxAttr().GetTop().IsValid())
749 GetAttributes()->GetTextBoxAttr().GetTop().SetPosition(flags
);
750 if (GetAttributes()->GetTextBoxAttr().GetRight().IsValid())
751 GetAttributes()->GetTextBoxAttr().GetRight().SetPosition(flags
);
752 if (GetAttributes()->GetTextBoxAttr().GetBottom().IsValid())
753 GetAttributes()->GetTextBoxAttr().GetBottom().SetPosition(flags
);
758 // Show/hide position controls
759 void wxRichTextSizePage::ShowPositionControls(bool show
)
763 m_parentSizer
->Show(m_positionControls
, show
);
768 // Show/hide floating and alignment controls
769 void wxRichTextSizePage::ShowFloatingAndAlignmentControls(bool show
)
773 m_parentSizer
->Show(m_floatingAlignmentSizer
, show
);
778 // Show/hide floating controls
779 void wxRichTextSizePage::ShowFloatingControls(bool show
)
781 if (m_floatingAlignmentSizer
)
783 m_floatingAlignmentSizer
->Show(m_floatingSizer
, show
);
788 // Show/hide alignment controls
789 void wxRichTextSizePage::ShowAlignmentControls(bool show
)
791 if (m_floatingAlignmentSizer
)
793 m_floatingAlignmentSizer
->Show(m_alignmentSizer
, show
);
798 // Show/hide position mode controls
799 void wxRichTextSizePage::ShowPositionModeControls(bool show
)
801 if (m_moveObjectParentSizer
)
803 m_moveObjectParentSizer
->Show(m_positionModeSizer
, show
);
808 // Show/hide right/bottom position controls
809 void wxRichTextSizePage::ShowRightBottomPositionControls(bool show
)
811 if (m_positionGridSizer
)
813 m_positionGridSizer
->Show(m_positionRightCheckbox
, show
);
814 m_positionGridSizer
->Show(m_rightPositionSizer
, show
);
815 m_positionGridSizer
->Show(m_positionBottomCheckbox
, show
);
816 m_positionGridSizer
->Show(m_bottomPositionSizer
, show
);
822 * Get bitmap resources
825 wxBitmap
wxRichTextSizePage::GetBitmapResource( const wxString
& name
)
828 ////@begin wxRichTextSizePage bitmap retrieval
831 ////@end wxRichTextSizePage bitmap retrieval
838 wxIcon
wxRichTextSizePage::GetIconResource( const wxString
& name
)
841 ////@begin wxRichTextSizePage icon retrieval
844 ////@end wxRichTextSizePage icon retrieval
849 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_WIDTH
852 void wxRichTextSizePage::OnRichtextWidthUpdate( wxUpdateUIEvent
& event
)
854 event
.Enable(m_widthCheckbox
->GetValue());
858 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_HEIGHT
861 void wxRichTextSizePage::OnRichtextHeightUpdate( wxUpdateUIEvent
& event
)
863 event
.Enable(m_heightCheckbox
->GetValue());
867 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXT_PARA_UP
870 void wxRichTextSizePage::OnRichtextParaUpClick( wxCommandEvent
& WXUNUSED(event
) )
872 wxRichTextFormattingDialog
* dialog
= wxRichTextFormattingDialog::GetDialog(this);
873 if (!dialog
|| !dialog
->GetObject())
876 // Make sure object attributes are up-to-date
877 dialog
->TransferDataFromWindow();
879 wxRichTextBuffer
* buffer
= dialog
->GetObject()->GetBuffer();
880 wxRichTextParagraphLayoutBox
* container
= dialog
->GetObject()->GetParentContainer();
881 wxRichTextObject
* parent
= dialog
->GetObject()->GetParent();
882 if (!container
|| !parent
|| !buffer
)
885 wxRichTextRange range
= dialog
->GetObject()->GetRange();
886 wxRichTextObjectList::compatibility_iterator iter
= container
->GetChildren().GetFirst();
892 if (iter
->GetData() == parent
)
894 iter
= iter
->GetNext();
898 iter
= iter
->GetPrevious();
902 wxRichTextObject
*obj
= iter
->GetData();
903 wxRichTextRange rg
= obj
->GetRange();
904 // tempObj will be deleted along with the undo object, and a clone of it will be
905 // returned by InsertObjectWithUndo
906 wxRichTextObject
* tempObj
= dialog
->GetObject()->Clone();
908 container
->DeleteRangeWithUndo(range
, buffer
->GetRichTextCtrl(), buffer
);
910 wxRichTextObject
* obj2
= container
->InsertObjectWithUndo(buffer
, rg
.GetStart(), tempObj
, buffer
->GetRichTextCtrl(), 0);
911 dialog
->SetObject(obj2
);
915 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXT_DOWN
918 void wxRichTextSizePage::OnRichtextParaDownClick( wxCommandEvent
& WXUNUSED(event
) )
920 wxRichTextFormattingDialog
* dialog
= wxRichTextFormattingDialog::GetDialog(this);
921 if (!dialog
|| !dialog
->GetObject())
924 // Make sure object attributes are up-to-date
925 dialog
->TransferDataFromWindow();
927 wxRichTextBuffer
* buffer
= dialog
->GetObject()->GetBuffer();
928 wxRichTextParagraphLayoutBox
* container
= dialog
->GetObject()->GetParentContainer();
929 wxRichTextObject
* parent
= dialog
->GetObject()->GetParent();
930 if (!container
|| !parent
|| !buffer
)
933 wxRichTextRange range
= dialog
->GetObject()->GetRange();
935 wxRichTextObjectList::compatibility_iterator iter
= buffer
->GetChildren().GetFirst();
941 if (iter
->GetData() == parent
)
943 iter
= iter
->GetNext();
946 iter
= iter
->GetNext();
950 wxRichTextObject
*obj
= iter
->GetData();
951 wxRichTextRange rg
= obj
->GetRange();
952 // tempObj will be deleted along with the undo object, and a clone of it will be
953 // returned by InsertObjectWithUndo
954 wxRichTextObject
* tempObj
= dialog
->GetObject()->Clone();
956 container
->DeleteRangeWithUndo(range
, buffer
->GetRichTextCtrl(), buffer
);
958 // Minus one because we deleted an object
959 wxRichTextObject
* obj2
= container
->InsertObjectWithUndo(buffer
, rg
.GetStart()-1, tempObj
, buffer
->GetRichTextCtrl(), 0);
960 dialog
->SetObject(obj2
);
965 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_VERTICAL_ALIGNMENT_COMBOBOX
968 void wxRichTextSizePage::OnRichtextVerticalAlignmentComboboxUpdate( wxUpdateUIEvent
& event
)
970 event
.Enable(m_verticalAlignmentCheckbox
->GetValue());
975 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_MIN_WIDTH
978 void wxRichTextSizePage::OnRichtextMinWidthUpdate( wxUpdateUIEvent
& event
)
980 event
.Enable(m_minWidthCheckbox
->GetValue());
984 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_MIN_HEIGHT
987 void wxRichTextSizePage::OnRichtextMinHeightUpdate( wxUpdateUIEvent
& event
)
989 event
.Enable(m_minHeightCheckbox
->GetValue());
994 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_MAX_WIDTH
997 void wxRichTextSizePage::OnRichtextMaxWidthUpdate( wxUpdateUIEvent
& event
)
999 event
.Enable(m_maxWidthCheckbox
->GetValue());
1004 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_MAX_HEIGHT
1007 void wxRichTextSizePage::OnRichtextMaxHeightUpdate( wxUpdateUIEvent
& event
)
1009 event
.Enable(m_maxHeightCheckbox
->GetValue());
1014 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_LEFT
1017 void wxRichTextSizePage::OnRichtextLeftUpdate( wxUpdateUIEvent
& event
)
1019 event
.Enable(m_positionLeftCheckbox
->GetValue());
1023 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_LEFT_UNITS
1026 void wxRichTextSizePage::OnRichtextTopUpdate( wxUpdateUIEvent
& event
)
1028 event
.Enable(m_positionTopCheckbox
->GetValue());
1032 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_RIGHT
1035 void wxRichTextSizePage::OnRichtextRightUpdate( wxUpdateUIEvent
& event
)
1037 event
.Enable(m_positionRightCheckbox
->GetValue());
1042 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BOTTOM
1045 void wxRichTextSizePage::OnRichtextBottomUpdate( wxUpdateUIEvent
& event
)
1047 event
.Enable(m_positionBottomCheckbox
->GetValue());