]> git.saurik.com Git - wxWidgets.git/blob - src/richtext/richtextsizepage.cpp
No real changes, just avoid overloaded virtual wxWebView::SetPage().
[wxWidgets.git] / src / richtext / richtextsizepage.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/richtext/richtextsizepage.cpp
3 // Purpose:
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 20/10/2010 10:23:24
7 // RCS-ID:
8 // Copyright: (c) Julian Smart
9 // Licence:
10 /////////////////////////////////////////////////////////////////////////////
11
12 #include "wx/richtext/richtextsizepage.h"
13
14 ////@begin XPM images
15 ////@end XPM images
16
17
18 /*!
19 * wxRichTextSizePage type definition
20 */
21
22 IMPLEMENT_DYNAMIC_CLASS( wxRichTextSizePage, wxRichTextDialogPage )
23
24
25 /*!
26 * wxRichTextSizePage event table definition
27 */
28
29 BEGIN_EVENT_TABLE( wxRichTextSizePage, wxRichTextDialogPage )
30
31 ////@begin wxRichTextSizePage event table entries
32 EVT_UPDATE_UI( ID_RICHTEXT_VERTICAL_ALIGNMENT_COMBOBOX, wxRichTextSizePage::OnRichtextVerticalAlignmentComboboxUpdate )
33
34 EVT_UPDATE_UI( ID_RICHTEXT_WIDTH, wxRichTextSizePage::OnRichtextWidthUpdate )
35
36 EVT_UPDATE_UI( ID_RICHTEXT_UNITS_W, wxRichTextSizePage::OnRichtextWidthUpdate )
37
38 EVT_UPDATE_UI( ID_RICHTEXT_HEIGHT, wxRichTextSizePage::OnRichtextHeightUpdate )
39
40 EVT_UPDATE_UI( ID_RICHTEXT_UNITS_H, wxRichTextSizePage::OnRichtextHeightUpdate )
41
42 EVT_UPDATE_UI( ID_RICHTEXT_MIN_WIDTH, wxRichTextSizePage::OnRichtextMinWidthUpdate )
43
44 EVT_UPDATE_UI( ID_RICHTEXT_UNITS_MIN_W, wxRichTextSizePage::OnRichtextMinWidthUpdate )
45
46 EVT_UPDATE_UI( ID_RICHTEXT_MIN_HEIGHT, wxRichTextSizePage::OnRichtextMinHeightUpdate )
47
48 EVT_UPDATE_UI( ID_RICHTEXT_UNITS_MIN_H, wxRichTextSizePage::OnRichtextMinHeightUpdate )
49
50 EVT_UPDATE_UI( ID_RICHTEXT_MAX_WIDTH, wxRichTextSizePage::OnRichtextMaxWidthUpdate )
51
52 EVT_UPDATE_UI( ID_RICHTEXT_UNITS_MAX_W, wxRichTextSizePage::OnRichtextMaxWidthUpdate )
53
54 EVT_UPDATE_UI( ID_RICHTEXT_MAX_HEIGHT, wxRichTextSizePage::OnRichtextMaxHeightUpdate )
55
56 EVT_UPDATE_UI( ID_RICHTEXT_UNITS_MAX_H, wxRichTextSizePage::OnRichtextMaxHeightUpdate )
57
58 EVT_UPDATE_UI( ID_RICHTEXT_LEFT, wxRichTextSizePage::OnRichtextLeftUpdate )
59
60 EVT_UPDATE_UI( ID_RICHTEXT_LEFT_UNITS, wxRichTextSizePage::OnRichtextTopUpdate )
61
62 EVT_UPDATE_UI( ID_RICHTEXT_TOP, wxRichTextSizePage::OnRichtextTopUpdate )
63
64 EVT_UPDATE_UI( ID_RICHTEXT_TOP_UNITS, wxRichTextSizePage::OnRichtextTopUpdate )
65
66 EVT_UPDATE_UI( ID_RICHTEXT_RIGHT, wxRichTextSizePage::OnRichtextRightUpdate )
67
68 EVT_UPDATE_UI( ID_RICHTEXT_RIGHT_UNITS, wxRichTextSizePage::OnRichtextRightUpdate )
69
70 EVT_UPDATE_UI( ID_RICHTEXT_BOTTOM, wxRichTextSizePage::OnRichtextBottomUpdate )
71
72 EVT_UPDATE_UI( ID_RICHTEXT_BOTTOM_UNITS, wxRichTextSizePage::OnRichtextBottomUpdate )
73
74 EVT_BUTTON( ID_RICHTEXT_PARA_UP, wxRichTextSizePage::OnRichtextParaUpClick )
75
76 EVT_BUTTON( ID_RICHTEXT_PARA_DOWN, wxRichTextSizePage::OnRichtextParaDownClick )
77
78 ////@end wxRichTextSizePage event table entries
79
80 END_EVENT_TABLE()
81
82 IMPLEMENT_HELP_PROVISION(wxRichTextSizePage)
83
84 /*!
85 * wxRichTextSizePage constructors
86 */
87
88 wxRichTextSizePage::wxRichTextSizePage()
89 {
90 Init();
91 }
92
93 wxRichTextSizePage::wxRichTextSizePage( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
94 {
95 Init();
96 Create(parent, id, pos, size, style);
97 }
98
99
100 /*!
101 * wxRichTextSizePage creator
102 */
103
104 bool wxRichTextSizePage::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
105 {
106 ////@begin wxRichTextSizePage creation
107 wxRichTextDialogPage::Create( parent, id, pos, size, style );
108
109 CreateControls();
110 if (GetSizer())
111 {
112 GetSizer()->SetSizeHints(this);
113 }
114 Centre();
115 ////@end wxRichTextSizePage creation
116 return true;
117 }
118
119
120 /*!
121 * wxRichTextSizePage destructor
122 */
123
124 wxRichTextSizePage::~wxRichTextSizePage()
125 {
126 ////@begin wxRichTextSizePage destruction
127 ////@end wxRichTextSizePage destruction
128 }
129
130
131 /*!
132 * Member initialisation
133 */
134
135 void wxRichTextSizePage::Init()
136 {
137 ////@begin wxRichTextSizePage member initialisation
138 m_positionMode = 0;
139 m_parentSizer = NULL;
140 m_floatingControls = NULL;
141 m_float = NULL;
142 m_alignmentControls = NULL;
143 m_verticalAlignmentCheckbox = NULL;
144 m_verticalAlignmentComboBox = NULL;
145 m_widthCheckbox = NULL;
146 m_width = NULL;
147 m_unitsW = NULL;
148 m_heightCheckbox = NULL;
149 m_height = NULL;
150 m_unitsH = NULL;
151 m_minWidthCheckbox = NULL;
152 m_minWidth = NULL;
153 m_unitsMinW = NULL;
154 m_minHeightCheckbox = NULL;
155 m_minHeight = NULL;
156 m_unitsMinH = NULL;
157 m_maxWidthCheckbox = NULL;
158 m_maxWidth = NULL;
159 m_unitsMaxW = NULL;
160 m_maxHeightCheckbox = NULL;
161 m_maxHeight = NULL;
162 m_unitsMaxH = NULL;
163 m_positionControls = NULL;
164 m_moveObjectParentSizer = NULL;
165 m_positionModeCtrl = NULL;
166 m_positionLeftCheckbox = NULL;
167 m_left = NULL;
168 m_unitsLeft = NULL;
169 m_positionTopCheckbox = NULL;
170 m_top = NULL;
171 m_unitsTop = NULL;
172 m_positionRightCheckbox = NULL;
173 m_right = NULL;
174 m_unitsRight = NULL;
175 m_positionBottomCheckbox = NULL;
176 m_bottom = NULL;
177 m_unitsBottom = NULL;
178 m_moveObjectSizer = NULL;
179 ////@end wxRichTextSizePage member initialisation
180 }
181
182
183 /*!
184 * Control creation for wxRichTextSizePage
185 */
186
187 void wxRichTextSizePage::CreateControls()
188 {
189 ////@begin wxRichTextSizePage content construction
190 wxRichTextSizePage* itemRichTextDialogPage1 = this;
191
192 wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
193 itemRichTextDialogPage1->SetSizer(itemBoxSizer2);
194
195 m_parentSizer = new wxBoxSizer(wxVERTICAL);
196 itemBoxSizer2->Add(m_parentSizer, 0, wxGROW|wxALL, 5);
197
198 wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxHORIZONTAL);
199 m_parentSizer->Add(itemBoxSizer4, 0, wxGROW, 5);
200
201 m_floatingControls = new wxBoxSizer(wxVERTICAL);
202 itemBoxSizer4->Add(m_floatingControls, 1, wxALIGN_CENTER_VERTICAL, 5);
203
204 wxBoxSizer* itemBoxSizer6 = new wxBoxSizer(wxHORIZONTAL);
205 m_floatingControls->Add(itemBoxSizer6, 0, wxGROW, 5);
206
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);
210
211 wxStaticLine* itemStaticLine8 = new wxStaticLine( itemRichTextDialogPage1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
212 itemBoxSizer6->Add(itemStaticLine8, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
213
214 wxBoxSizer* itemBoxSizer9 = new wxBoxSizer(wxHORIZONTAL);
215 m_floatingControls->Add(itemBoxSizer9, 0, wxGROW, 5);
216
217 itemBoxSizer9->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
218
219 wxFlexGridSizer* itemFlexGridSizer11 = new wxFlexGridSizer(0, 2, 0, 0);
220 itemBoxSizer9->Add(itemFlexGridSizer11, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5);
221
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);
224
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);
235
236 m_alignmentControls = new wxBoxSizer(wxVERTICAL);
237 itemBoxSizer4->Add(m_alignmentControls, 1, wxALIGN_CENTER_VERTICAL, 5);
238
239 wxBoxSizer* itemBoxSizer15 = new wxBoxSizer(wxHORIZONTAL);
240 m_alignmentControls->Add(itemBoxSizer15, 0, wxGROW, 5);
241
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);
245
246 wxStaticLine* itemStaticLine17 = new wxStaticLine( itemRichTextDialogPage1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
247 itemBoxSizer15->Add(itemStaticLine17, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
248
249 wxBoxSizer* itemBoxSizer18 = new wxBoxSizer(wxHORIZONTAL);
250 m_alignmentControls->Add(itemBoxSizer18, 0, wxGROW, 5);
251
252 itemBoxSizer18->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
253
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);
260
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);
271
272 wxBoxSizer* itemBoxSizer22 = new wxBoxSizer(wxHORIZONTAL);
273 m_parentSizer->Add(itemBoxSizer22, 0, wxGROW, 5);
274
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);
278
279 wxStaticLine* itemStaticLine24 = new wxStaticLine( itemRichTextDialogPage1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
280 itemBoxSizer22->Add(itemStaticLine24, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
281
282 wxBoxSizer* itemBoxSizer25 = new wxBoxSizer(wxHORIZONTAL);
283 m_parentSizer->Add(itemBoxSizer25, 0, wxGROW, 5);
284
285 itemBoxSizer25->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
286
287 wxFlexGridSizer* itemFlexGridSizer27 = new wxFlexGridSizer(0, 4, 0, 0);
288 itemBoxSizer25->Add(itemFlexGridSizer27, 0, wxALIGN_CENTER_VERTICAL, 5);
289
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);
296
297 wxBoxSizer* itemBoxSizer29 = new wxBoxSizer(wxHORIZONTAL);
298 itemFlexGridSizer27->Add(itemBoxSizer29, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
299
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);
305
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);
316
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);
323
324 wxBoxSizer* itemBoxSizer33 = new wxBoxSizer(wxHORIZONTAL);
325 itemFlexGridSizer27->Add(itemBoxSizer33, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
326
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);
332
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);
343
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);
350
351 wxBoxSizer* itemBoxSizer37 = new wxBoxSizer(wxHORIZONTAL);
352 itemFlexGridSizer27->Add(itemBoxSizer37, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
353
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);
359
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);
370
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);
377
378 wxBoxSizer* itemBoxSizer41 = new wxBoxSizer(wxHORIZONTAL);
379 itemFlexGridSizer27->Add(itemBoxSizer41, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
380
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);
386
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);
397
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);
404
405 wxBoxSizer* itemBoxSizer45 = new wxBoxSizer(wxHORIZONTAL);
406 itemFlexGridSizer27->Add(itemBoxSizer45, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
407
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);
413
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);
424
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);
431
432 wxBoxSizer* itemBoxSizer49 = new wxBoxSizer(wxHORIZONTAL);
433 itemFlexGridSizer27->Add(itemBoxSizer49, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
434
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);
440
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);
451
452 m_positionControls = new wxBoxSizer(wxVERTICAL);
453 m_parentSizer->Add(m_positionControls, 0, wxGROW, 5);
454
455 wxBoxSizer* itemBoxSizer53 = new wxBoxSizer(wxHORIZONTAL);
456 m_positionControls->Add(itemBoxSizer53, 0, wxGROW, 5);
457
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);
461
462 wxStaticLine* itemStaticLine55 = new wxStaticLine( itemRichTextDialogPage1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
463 itemBoxSizer53->Add(itemStaticLine55, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
464
465 wxBoxSizer* itemBoxSizer56 = new wxBoxSizer(wxHORIZONTAL);
466 m_positionControls->Add(itemBoxSizer56, 0, wxGROW, 5);
467
468 itemBoxSizer56->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
469
470 m_moveObjectParentSizer = new wxBoxSizer(wxVERTICAL);
471 itemBoxSizer56->Add(m_moveObjectParentSizer, 0, wxALIGN_TOP, 5);
472
473 wxBoxSizer* itemBoxSizer59 = new wxBoxSizer(wxHORIZONTAL);
474 m_moveObjectParentSizer->Add(itemBoxSizer59, 0, wxALIGN_LEFT, 5);
475
476 wxStaticText* itemStaticText60 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("&Position mode:"), wxDefaultPosition, wxDefaultSize, 0 );
477 itemBoxSizer59->Add(itemStaticText60, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
478
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);
487
488 wxFlexGridSizer* itemFlexGridSizer62 = new wxFlexGridSizer(0, 4, 0, 0);
489 m_moveObjectParentSizer->Add(itemFlexGridSizer62, 0, wxGROW, 5);
490
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);
497
498 wxBoxSizer* itemBoxSizer64 = new wxBoxSizer(wxHORIZONTAL);
499 itemFlexGridSizer62->Add(itemBoxSizer64, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5);
500
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);
507
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);
518
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);
525
526 wxBoxSizer* itemBoxSizer68 = new wxBoxSizer(wxHORIZONTAL);
527 itemFlexGridSizer62->Add(itemBoxSizer68, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5);
528
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);
535
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);
546
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);
553
554 wxBoxSizer* itemBoxSizer72 = new wxBoxSizer(wxHORIZONTAL);
555 itemFlexGridSizer62->Add(itemBoxSizer72, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5);
556
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);
563
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);
574
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);
581
582 wxBoxSizer* itemBoxSizer76 = new wxBoxSizer(wxHORIZONTAL);
583 itemFlexGridSizer62->Add(itemBoxSizer76, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5);
584
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);
591
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);
602
603 m_moveObjectSizer = new wxBoxSizer(wxHORIZONTAL);
604 m_moveObjectParentSizer->Add(m_moveObjectSizer, 0, wxGROW, 5);
605
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);
608
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);
614
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);
620
621 // Set validators
622 m_positionModeCtrl->SetValidator( wxGenericValidator(& m_positionMode) );
623 ////@end wxRichTextSizePage content construction
624 }
625
626 wxRichTextAttr* wxRichTextSizePage::GetAttributes()
627 {
628 return wxRichTextFormattingDialog::GetDialogAttributes(this);
629 }
630
631 /*!
632 * Should we show tooltips?
633 */
634
635 bool wxRichTextSizePage::ShowToolTips()
636 {
637 return true;
638 }
639
640 bool wxRichTextSizePage::TransferDataToWindow()
641 {
642 m_float->SetSelection(GetAttributes()->GetTextBoxAttr().GetFloatMode());
643 m_verticalAlignmentCheckbox->SetValue(GetAttributes()->GetTextBoxAttr().HasVerticalAlignment());
644 if (GetAttributes()->GetTextBoxAttr().HasVerticalAlignment())
645 {
646 if ((int) GetAttributes()->GetTextBoxAttr().GetVerticalAlignment() > 0 &&
647 (int) GetAttributes()->GetTextBoxAttr().GetVerticalAlignment() < 4)
648 {
649 m_verticalAlignmentComboBox->SetSelection(((int) GetAttributes()->GetTextBoxAttr().GetVerticalAlignment() - 1));
650 }
651 else
652 m_verticalAlignmentComboBox->SetSelection(0);
653 }
654
655 wxRichTextFormattingDialog* dialog = wxRichTextFormattingDialog::GetDialog(this);
656
657 if (dialog)
658 {
659 // Only show the Move Object controls if there's an object.
660 if (!dialog->GetObject())
661 {
662 m_moveObjectParentSizer->Show(m_moveObjectSizer, false);
663 GetSizer()->Layout();
664 }
665 }
666
667 wxRichTextImage* imageObj = NULL;
668 if (dialog)
669 imageObj = wxDynamicCast(dialog->GetObject(), wxRichTextImage);
670
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))
674 {
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()));
681 }
682 else
683 {
684 wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetWidth(), m_width, m_unitsW, m_widthCheckbox);
685 wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetHeight(), m_height, m_unitsH, m_heightCheckbox);
686 }
687
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);
696
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))
701 {
702 m_positionMode = 3;
703 }
704 else
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))
709 {
710 m_positionMode = 2;
711 }
712 else
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))
717 {
718 m_positionMode = 1;
719 }
720 else
721 m_positionMode = 0;
722
723 return wxPanel::TransferDataToWindow();
724 }
725
726 bool wxRichTextSizePage::TransferDataFromWindow()
727 {
728 wxPanel::TransferDataFromWindow();
729
730 GetAttributes()->GetTextBoxAttr().SetFloatMode((wxTextBoxAttrFloatStyle) m_float->GetSelection());
731 if (m_float->GetSelection() == 0)
732 GetAttributes()->GetTextBoxAttr().RemoveFlag(wxTEXT_BOX_ATTR_FLOAT);
733
734 if (m_verticalAlignmentCheckbox->GetValue())
735 GetAttributes()->GetTextBoxAttr().SetVerticalAlignment((wxTextBoxAttrVerticalAlignment) (m_verticalAlignmentComboBox->GetSelection() + 1));
736 else
737 {
738 GetAttributes()->GetTextBoxAttr().SetVerticalAlignment(wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT_NONE);
739 GetAttributes()->GetTextBoxAttr().RemoveFlag(wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT);
740 }
741
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);
748
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);
753
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;
761 else
762 flags = wxTEXT_BOX_ATTR_POSITION_STATIC;
763
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);
772
773 return true;
774 }
775
776 // Show/hide position controls
777 void wxRichTextSizePage::ShowPositionControls(bool show)
778 {
779 if (m_parentSizer)
780 {
781 m_parentSizer->Show(m_positionControls, show);
782 Layout();
783 }
784 }
785
786 // Show/hide floating controls
787 void wxRichTextSizePage::ShowFloatingControls(bool show)
788 {
789 if (m_parentSizer)
790 {
791 m_parentSizer->Show(m_floatingControls, show);
792 Layout();
793 }
794 }
795
796 /*!
797 * Get bitmap resources
798 */
799
800 wxBitmap wxRichTextSizePage::GetBitmapResource( const wxString& name )
801 {
802 // Bitmap retrieval
803 ////@begin wxRichTextSizePage bitmap retrieval
804 wxUnusedVar(name);
805 return wxNullBitmap;
806 ////@end wxRichTextSizePage bitmap retrieval
807 }
808
809 /*!
810 * Get icon resources
811 */
812
813 wxIcon wxRichTextSizePage::GetIconResource( const wxString& name )
814 {
815 // Icon retrieval
816 ////@begin wxRichTextSizePage icon retrieval
817 wxUnusedVar(name);
818 return wxNullIcon;
819 ////@end wxRichTextSizePage icon retrieval
820 }
821
822
823 /*!
824 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_WIDTH
825 */
826
827 void wxRichTextSizePage::OnRichtextWidthUpdate( wxUpdateUIEvent& event )
828 {
829 event.Enable(m_widthCheckbox->GetValue());
830 }
831
832 /*!
833 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_HEIGHT
834 */
835
836 void wxRichTextSizePage::OnRichtextHeightUpdate( wxUpdateUIEvent& event )
837 {
838 event.Enable(m_heightCheckbox->GetValue());
839 }
840
841 /*!
842 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXT_PARA_UP
843 */
844
845 void wxRichTextSizePage::OnRichtextParaUpClick( wxCommandEvent& WXUNUSED(event) )
846 {
847 wxRichTextFormattingDialog* dialog = wxRichTextFormattingDialog::GetDialog(this);
848 if (!dialog || !dialog->GetObject())
849 return;
850
851 // Make sure object attributes are up-to-date
852 dialog->TransferDataFromWindow();
853
854 wxRichTextBuffer* buffer = dialog->GetObject()->GetBuffer();
855 wxRichTextParagraphLayoutBox* container = dialog->GetObject()->GetParentContainer();
856 wxRichTextObject* parent = dialog->GetObject()->GetParent();
857 if (!container || !parent || !buffer)
858 return;
859
860 wxRichTextRange range = dialog->GetObject()->GetRange();
861 wxRichTextObjectList::compatibility_iterator iter = container->GetChildren().GetFirst();
862 if (!iter)
863 return;
864
865 while (iter)
866 {
867 if (iter->GetData() == parent)
868 break;
869 iter = iter->GetNext();
870 }
871 if (!iter)
872 return;
873 iter = iter->GetPrevious();
874 if (!iter)
875 return;
876
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();
882
883 container->DeleteRangeWithUndo(range, buffer->GetRichTextCtrl(), buffer);
884
885 wxRichTextObject* obj2 = container->InsertObjectWithUndo(buffer, rg.GetStart(), tempObj, buffer->GetRichTextCtrl(), 0);
886 dialog->SetObject(obj2);
887 }
888
889 /*!
890 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXT_DOWN
891 */
892
893 void wxRichTextSizePage::OnRichtextParaDownClick( wxCommandEvent& WXUNUSED(event) )
894 {
895 wxRichTextFormattingDialog* dialog = wxRichTextFormattingDialog::GetDialog(this);
896 if (!dialog || !dialog->GetObject())
897 return;
898
899 // Make sure object attributes are up-to-date
900 dialog->TransferDataFromWindow();
901
902 wxRichTextBuffer* buffer = dialog->GetObject()->GetBuffer();
903 wxRichTextParagraphLayoutBox* container = dialog->GetObject()->GetParentContainer();
904 wxRichTextObject* parent = dialog->GetObject()->GetParent();
905 if (!container || !parent || !buffer)
906 return;
907
908 wxRichTextRange range = dialog->GetObject()->GetRange();
909
910 wxRichTextObjectList::compatibility_iterator iter = buffer->GetChildren().GetFirst();
911 if (!iter)
912 return;
913
914 while (iter)
915 {
916 if (iter->GetData() == parent)
917 break;
918 iter = iter->GetNext();
919 }
920
921 iter = iter->GetNext();
922 if (!iter)
923 return;
924
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();
930
931 container->DeleteRangeWithUndo(range, buffer->GetRichTextCtrl(), buffer);
932
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);
936 }
937
938
939 /*!
940 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_VERTICAL_ALIGNMENT_COMBOBOX
941 */
942
943 void wxRichTextSizePage::OnRichtextVerticalAlignmentComboboxUpdate( wxUpdateUIEvent& event )
944 {
945 event.Enable(m_verticalAlignmentCheckbox->GetValue());
946 }
947
948
949 /*!
950 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_MIN_WIDTH
951 */
952
953 void wxRichTextSizePage::OnRichtextMinWidthUpdate( wxUpdateUIEvent& event )
954 {
955 event.Enable(m_minWidthCheckbox->GetValue());
956 }
957
958 /*!
959 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_MIN_HEIGHT
960 */
961
962 void wxRichTextSizePage::OnRichtextMinHeightUpdate( wxUpdateUIEvent& event )
963 {
964 event.Enable(m_minHeightCheckbox->GetValue());
965 }
966
967
968 /*!
969 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_MAX_WIDTH
970 */
971
972 void wxRichTextSizePage::OnRichtextMaxWidthUpdate( wxUpdateUIEvent& event )
973 {
974 event.Enable(m_maxWidthCheckbox->GetValue());
975 }
976
977
978 /*!
979 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_MAX_HEIGHT
980 */
981
982 void wxRichTextSizePage::OnRichtextMaxHeightUpdate( wxUpdateUIEvent& event )
983 {
984 event.Enable(m_maxHeightCheckbox->GetValue());
985 }
986
987
988 /*!
989 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_LEFT
990 */
991
992 void wxRichTextSizePage::OnRichtextLeftUpdate( wxUpdateUIEvent& event )
993 {
994 event.Enable(m_positionLeftCheckbox->GetValue());
995 }
996
997 /*!
998 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_LEFT_UNITS
999 */
1000
1001 void wxRichTextSizePage::OnRichtextTopUpdate( wxUpdateUIEvent& event )
1002 {
1003 event.Enable(m_positionTopCheckbox->GetValue());
1004 }
1005
1006 /*!
1007 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_RIGHT
1008 */
1009
1010 void wxRichTextSizePage::OnRichtextRightUpdate( wxUpdateUIEvent& event )
1011 {
1012 event.Enable(m_positionRightCheckbox->GetValue());
1013 }
1014
1015
1016 /*!
1017 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BOTTOM
1018 */
1019
1020 void wxRichTextSizePage::OnRichtextBottomUpdate( wxUpdateUIEvent& event )
1021 {
1022 event.Enable(m_positionBottomCheckbox->GetValue());
1023 }
1024