]> git.saurik.com Git - wxWidgets.git/blob - src/richtext/richtextsizepage.cpp
Remove obsolete parts of autoconf_inc.m4.
[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 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
56
57 END_EVENT_TABLE()
58
59 IMPLEMENT_HELP_PROVISION(wxRichTextSizePage)
60
61 /*!
62 * wxRichTextSizePage constructors
63 */
64
65 wxRichTextSizePage::wxRichTextSizePage()
66 {
67 Init();
68 }
69
70 wxRichTextSizePage::wxRichTextSizePage( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
71 {
72 Init();
73 Create(parent, id, pos, size, style);
74 }
75
76
77 /*!
78 * wxRichTextSizePage creator
79 */
80
81 bool wxRichTextSizePage::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
82 {
83 ////@begin wxRichTextSizePage creation
84 wxRichTextDialogPage::Create( parent, id, pos, size, style );
85
86 CreateControls();
87 if (GetSizer())
88 {
89 GetSizer()->SetSizeHints(this);
90 }
91 Centre();
92 ////@end wxRichTextSizePage creation
93 return true;
94 }
95
96
97 /*!
98 * wxRichTextSizePage destructor
99 */
100
101 wxRichTextSizePage::~wxRichTextSizePage()
102 {
103 ////@begin wxRichTextSizePage destruction
104 ////@end wxRichTextSizePage destruction
105 }
106
107
108 /*!
109 * Member initialisation
110 */
111
112 void wxRichTextSizePage::Init()
113 {
114 ////@begin wxRichTextSizePage member initialisation
115 m_positionMode = 0;
116 m_parentSizer = NULL;
117 m_floatingAlignmentSizer = NULL;
118 m_floatingSizer = NULL;
119 m_float = NULL;
120 m_alignmentSizer = NULL;
121 m_verticalAlignmentCheckbox = NULL;
122 m_verticalAlignmentComboBox = NULL;
123 m_widthCheckbox = NULL;
124 m_width = NULL;
125 m_unitsW = NULL;
126 m_heightCheckbox = NULL;
127 m_height = NULL;
128 m_unitsH = NULL;
129 m_minWidthCheckbox = NULL;
130 m_minWidth = NULL;
131 m_unitsMinW = NULL;
132 m_minHeightCheckbox = NULL;
133 m_minHeight = NULL;
134 m_unitsMinH = NULL;
135 m_maxWidthCheckbox = NULL;
136 m_maxWidth = NULL;
137 m_unitsMaxW = NULL;
138 m_maxHeightCheckbox = NULL;
139 m_maxHeight = NULL;
140 m_unitsMaxH = 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;
147 m_left = NULL;
148 m_unitsLeft = NULL;
149 m_positionTopCheckbox = NULL;
150 m_top = NULL;
151 m_unitsTop = NULL;
152 m_positionRightCheckbox = NULL;
153 m_rightPositionSizer = NULL;
154 m_right = NULL;
155 m_unitsRight = NULL;
156 m_positionBottomCheckbox = NULL;
157 m_bottomPositionSizer = NULL;
158 m_bottom = NULL;
159 m_unitsBottom = NULL;
160 m_moveObjectSizer = NULL;
161 ////@end wxRichTextSizePage member initialisation
162 }
163
164
165 /*!
166 * Control creation for wxRichTextSizePage
167 */
168
169 void wxRichTextSizePage::CreateControls()
170 {
171 ////@begin wxRichTextSizePage content construction
172 wxRichTextSizePage* itemRichTextDialogPage1 = this;
173
174 wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
175 itemRichTextDialogPage1->SetSizer(itemBoxSizer2);
176
177 m_parentSizer = new wxBoxSizer(wxVERTICAL);
178 itemBoxSizer2->Add(m_parentSizer, 0, wxGROW|wxALL, 5);
179
180 m_floatingAlignmentSizer = new wxBoxSizer(wxHORIZONTAL);
181 m_parentSizer->Add(m_floatingAlignmentSizer, 0, wxGROW, 5);
182
183 m_floatingSizer = new wxBoxSizer(wxVERTICAL);
184 m_floatingAlignmentSizer->Add(m_floatingSizer, 1, wxALIGN_CENTER_VERTICAL, 5);
185
186 wxBoxSizer* itemBoxSizer6 = new wxBoxSizer(wxHORIZONTAL);
187 m_floatingSizer->Add(itemBoxSizer6, 0, wxGROW, 5);
188
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);
192
193 wxStaticLine* itemStaticLine8 = new wxStaticLine( itemRichTextDialogPage1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
194 itemBoxSizer6->Add(itemStaticLine8, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
195
196 wxBoxSizer* itemBoxSizer9 = new wxBoxSizer(wxHORIZONTAL);
197 m_floatingSizer->Add(itemBoxSizer9, 0, wxGROW, 5);
198
199 itemBoxSizer9->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
200
201 wxFlexGridSizer* itemFlexGridSizer11 = new wxFlexGridSizer(0, 2, 0, 0);
202 itemBoxSizer9->Add(itemFlexGridSizer11, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5);
203
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);
206
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);
217
218 m_alignmentSizer = new wxBoxSizer(wxVERTICAL);
219 m_floatingAlignmentSizer->Add(m_alignmentSizer, 1, wxALIGN_CENTER_VERTICAL, 5);
220
221 wxBoxSizer* itemBoxSizer15 = new wxBoxSizer(wxHORIZONTAL);
222 m_alignmentSizer->Add(itemBoxSizer15, 0, wxGROW, 5);
223
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);
227
228 wxStaticLine* itemStaticLine17 = new wxStaticLine( itemRichTextDialogPage1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
229 itemBoxSizer15->Add(itemStaticLine17, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
230
231 wxBoxSizer* itemBoxSizer18 = new wxBoxSizer(wxHORIZONTAL);
232 m_alignmentSizer->Add(itemBoxSizer18, 0, wxGROW, 5);
233
234 itemBoxSizer18->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
235
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);
242
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);
253
254 wxBoxSizer* itemBoxSizer22 = new wxBoxSizer(wxHORIZONTAL);
255 m_parentSizer->Add(itemBoxSizer22, 0, wxGROW, 5);
256
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);
260
261 wxStaticLine* itemStaticLine24 = new wxStaticLine( itemRichTextDialogPage1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
262 itemBoxSizer22->Add(itemStaticLine24, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
263
264 wxBoxSizer* itemBoxSizer25 = new wxBoxSizer(wxHORIZONTAL);
265 m_parentSizer->Add(itemBoxSizer25, 0, wxGROW, 5);
266
267 itemBoxSizer25->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
268
269 wxFlexGridSizer* itemFlexGridSizer27 = new wxFlexGridSizer(0, 4, 0, 0);
270 itemBoxSizer25->Add(itemFlexGridSizer27, 0, wxALIGN_CENTER_VERTICAL, 5);
271
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);
278
279 wxBoxSizer* itemBoxSizer29 = new wxBoxSizer(wxHORIZONTAL);
280 itemFlexGridSizer27->Add(itemBoxSizer29, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
281
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);
287
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);
298
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);
305
306 wxBoxSizer* itemBoxSizer33 = new wxBoxSizer(wxHORIZONTAL);
307 itemFlexGridSizer27->Add(itemBoxSizer33, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
308
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);
314
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);
325
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);
332
333 wxBoxSizer* itemBoxSizer37 = new wxBoxSizer(wxHORIZONTAL);
334 itemFlexGridSizer27->Add(itemBoxSizer37, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
335
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);
341
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);
352
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);
359
360 wxBoxSizer* itemBoxSizer41 = new wxBoxSizer(wxHORIZONTAL);
361 itemFlexGridSizer27->Add(itemBoxSizer41, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
362
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);
368
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);
379
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);
386
387 wxBoxSizer* itemBoxSizer45 = new wxBoxSizer(wxHORIZONTAL);
388 itemFlexGridSizer27->Add(itemBoxSizer45, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
389
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);
395
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);
406
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);
413
414 wxBoxSizer* itemBoxSizer49 = new wxBoxSizer(wxHORIZONTAL);
415 itemFlexGridSizer27->Add(itemBoxSizer49, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
416
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);
422
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);
433
434 m_positionControls = new wxBoxSizer(wxVERTICAL);
435 m_parentSizer->Add(m_positionControls, 0, wxGROW, 5);
436
437 wxBoxSizer* itemBoxSizer53 = new wxBoxSizer(wxHORIZONTAL);
438 m_positionControls->Add(itemBoxSizer53, 0, wxGROW, 5);
439
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);
443
444 wxStaticLine* itemStaticLine55 = new wxStaticLine( itemRichTextDialogPage1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
445 itemBoxSizer53->Add(itemStaticLine55, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
446
447 wxBoxSizer* itemBoxSizer56 = new wxBoxSizer(wxHORIZONTAL);
448 m_positionControls->Add(itemBoxSizer56, 0, wxGROW, 5);
449
450 itemBoxSizer56->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
451
452 m_moveObjectParentSizer = new wxBoxSizer(wxVERTICAL);
453 itemBoxSizer56->Add(m_moveObjectParentSizer, 0, wxALIGN_TOP, 5);
454
455 m_positionModeSizer = new wxBoxSizer(wxHORIZONTAL);
456 m_moveObjectParentSizer->Add(m_positionModeSizer, 0, wxALIGN_LEFT, 5);
457
458 wxStaticText* itemStaticText60 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("&Position mode:"), wxDefaultPosition, wxDefaultSize, 0 );
459 m_positionModeSizer->Add(itemStaticText60, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
460
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);
469
470 m_positionGridSizer = new wxFlexGridSizer(0, 4, 0, 0);
471 m_moveObjectParentSizer->Add(m_positionGridSizer, 0, wxGROW, 5);
472
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);
479
480 wxBoxSizer* itemBoxSizer64 = new wxBoxSizer(wxHORIZONTAL);
481 m_positionGridSizer->Add(itemBoxSizer64, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5);
482
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);
489
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);
500
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);
507
508 wxBoxSizer* itemBoxSizer68 = new wxBoxSizer(wxHORIZONTAL);
509 m_positionGridSizer->Add(itemBoxSizer68, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5);
510
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);
517
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);
528
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);
535
536 m_rightPositionSizer = new wxBoxSizer(wxHORIZONTAL);
537 m_positionGridSizer->Add(m_rightPositionSizer, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5);
538
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);
545
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);
556
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);
563
564 m_bottomPositionSizer = new wxBoxSizer(wxHORIZONTAL);
565 m_positionGridSizer->Add(m_bottomPositionSizer, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5);
566
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);
573
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);
584
585 m_moveObjectSizer = new wxBoxSizer(wxHORIZONTAL);
586 m_moveObjectParentSizer->Add(m_moveObjectSizer, 0, wxGROW, 5);
587
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);
590
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);
596
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);
602
603 // Set validators
604 m_positionModeCtrl->SetValidator( wxGenericValidator(& m_positionMode) );
605 ////@end wxRichTextSizePage content construction
606 }
607
608 wxRichTextAttr* wxRichTextSizePage::GetAttributes()
609 {
610 return wxRichTextFormattingDialog::GetDialogAttributes(this);
611 }
612
613 /*!
614 * Should we show tooltips?
615 */
616
617 bool wxRichTextSizePage::ShowToolTips()
618 {
619 return true;
620 }
621
622 bool wxRichTextSizePage::TransferDataToWindow()
623 {
624 m_float->SetSelection(GetAttributes()->GetTextBoxAttr().GetFloatMode());
625 m_verticalAlignmentCheckbox->SetValue(GetAttributes()->GetTextBoxAttr().HasVerticalAlignment());
626 if (GetAttributes()->GetTextBoxAttr().HasVerticalAlignment())
627 {
628 if ((int) GetAttributes()->GetTextBoxAttr().GetVerticalAlignment() > 0 &&
629 (int) GetAttributes()->GetTextBoxAttr().GetVerticalAlignment() < 4)
630 {
631 m_verticalAlignmentComboBox->SetSelection(((int) GetAttributes()->GetTextBoxAttr().GetVerticalAlignment() - 1));
632 }
633 else
634 m_verticalAlignmentComboBox->SetSelection(0);
635 }
636
637 wxRichTextFormattingDialog* dialog = wxRichTextFormattingDialog::GetDialog(this);
638
639 if (dialog)
640 {
641 // Only show the Move Object controls if there's an object.
642 if (!dialog->GetObject())
643 {
644 m_moveObjectParentSizer->Show(m_moveObjectSizer, false);
645 GetSizer()->Layout();
646 }
647 }
648
649 wxRichTextImage* imageObj = NULL;
650 if (dialog)
651 imageObj = wxDynamicCast(dialog->GetObject(), wxRichTextImage);
652
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))
656 {
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()));
663 }
664 else
665 {
666 wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetWidth(), m_width, m_unitsW, m_widthCheckbox);
667 wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetHeight(), m_height, m_unitsH, m_heightCheckbox);
668 }
669
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);
678
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))
683 {
684 m_positionMode = 3;
685 }
686 else
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))
691 {
692 m_positionMode = 2;
693 }
694 else
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))
699 {
700 m_positionMode = 1;
701 }
702 else
703 m_positionMode = 0;
704
705 return wxPanel::TransferDataToWindow();
706 }
707
708 bool wxRichTextSizePage::TransferDataFromWindow()
709 {
710 wxPanel::TransferDataFromWindow();
711
712 GetAttributes()->GetTextBoxAttr().SetFloatMode((wxTextBoxAttrFloatStyle) m_float->GetSelection());
713 if (m_float->GetSelection() == 0)
714 GetAttributes()->GetTextBoxAttr().RemoveFlag(wxTEXT_BOX_ATTR_FLOAT);
715
716 if (m_verticalAlignmentCheckbox->GetValue())
717 GetAttributes()->GetTextBoxAttr().SetVerticalAlignment((wxTextBoxAttrVerticalAlignment) (m_verticalAlignmentComboBox->GetSelection() + 1));
718 else
719 {
720 GetAttributes()->GetTextBoxAttr().SetVerticalAlignment(wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT_NONE);
721 GetAttributes()->GetTextBoxAttr().RemoveFlag(wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT);
722 }
723
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);
730
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);
735
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;
743 else
744 flags = wxTEXT_BOX_ATTR_POSITION_STATIC;
745
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);
754
755 return true;
756 }
757
758 // Show/hide position controls
759 void wxRichTextSizePage::ShowPositionControls(bool show)
760 {
761 if (m_parentSizer)
762 {
763 m_parentSizer->Show(m_positionControls, show);
764 Layout();
765 }
766 }
767
768 // Show/hide floating and alignment controls
769 void wxRichTextSizePage::ShowFloatingAndAlignmentControls(bool show)
770 {
771 if (m_parentSizer)
772 {
773 m_parentSizer->Show(m_floatingAlignmentSizer, show);
774 Layout();
775 }
776 }
777
778 // Show/hide floating controls
779 void wxRichTextSizePage::ShowFloatingControls(bool show)
780 {
781 if (m_floatingAlignmentSizer)
782 {
783 m_floatingAlignmentSizer->Show(m_floatingSizer, show);
784 Layout();
785 }
786 }
787
788 // Show/hide alignment controls
789 void wxRichTextSizePage::ShowAlignmentControls(bool show)
790 {
791 if (m_floatingAlignmentSizer)
792 {
793 m_floatingAlignmentSizer->Show(m_alignmentSizer, show);
794 Layout();
795 }
796 }
797
798 // Show/hide position mode controls
799 void wxRichTextSizePage::ShowPositionModeControls(bool show)
800 {
801 if (m_moveObjectParentSizer)
802 {
803 m_moveObjectParentSizer->Show(m_positionModeSizer, show);
804 Layout();
805 }
806 }
807
808 // Show/hide right/bottom position controls
809 void wxRichTextSizePage::ShowRightBottomPositionControls(bool show)
810 {
811 if (m_positionGridSizer)
812 {
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);
817 Layout();
818 }
819 }
820
821 /*!
822 * Get bitmap resources
823 */
824
825 wxBitmap wxRichTextSizePage::GetBitmapResource( const wxString& name )
826 {
827 // Bitmap retrieval
828 ////@begin wxRichTextSizePage bitmap retrieval
829 wxUnusedVar(name);
830 return wxNullBitmap;
831 ////@end wxRichTextSizePage bitmap retrieval
832 }
833
834 /*!
835 * Get icon resources
836 */
837
838 wxIcon wxRichTextSizePage::GetIconResource( const wxString& name )
839 {
840 // Icon retrieval
841 ////@begin wxRichTextSizePage icon retrieval
842 wxUnusedVar(name);
843 return wxNullIcon;
844 ////@end wxRichTextSizePage icon retrieval
845 }
846
847
848 /*!
849 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_WIDTH
850 */
851
852 void wxRichTextSizePage::OnRichtextWidthUpdate( wxUpdateUIEvent& event )
853 {
854 event.Enable(m_widthCheckbox->GetValue());
855 }
856
857 /*!
858 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_HEIGHT
859 */
860
861 void wxRichTextSizePage::OnRichtextHeightUpdate( wxUpdateUIEvent& event )
862 {
863 event.Enable(m_heightCheckbox->GetValue());
864 }
865
866 /*!
867 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXT_PARA_UP
868 */
869
870 void wxRichTextSizePage::OnRichtextParaUpClick( wxCommandEvent& WXUNUSED(event) )
871 {
872 wxRichTextFormattingDialog* dialog = wxRichTextFormattingDialog::GetDialog(this);
873 if (!dialog || !dialog->GetObject())
874 return;
875
876 // Make sure object attributes are up-to-date
877 dialog->TransferDataFromWindow();
878
879 wxRichTextBuffer* buffer = dialog->GetObject()->GetBuffer();
880 wxRichTextParagraphLayoutBox* container = dialog->GetObject()->GetParentContainer();
881 wxRichTextObject* parent = dialog->GetObject()->GetParent();
882 if (!container || !parent || !buffer)
883 return;
884
885 wxRichTextRange range = dialog->GetObject()->GetRange();
886 wxRichTextObjectList::compatibility_iterator iter = container->GetChildren().GetFirst();
887 if (!iter)
888 return;
889
890 while (iter)
891 {
892 if (iter->GetData() == parent)
893 break;
894 iter = iter->GetNext();
895 }
896 if (!iter)
897 return;
898 iter = iter->GetPrevious();
899 if (!iter)
900 return;
901
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();
907
908 container->DeleteRangeWithUndo(range, buffer->GetRichTextCtrl(), buffer);
909
910 wxRichTextObject* obj2 = container->InsertObjectWithUndo(buffer, rg.GetStart(), tempObj, buffer->GetRichTextCtrl(), 0);
911 dialog->SetObject(obj2);
912 }
913
914 /*!
915 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXT_DOWN
916 */
917
918 void wxRichTextSizePage::OnRichtextParaDownClick( wxCommandEvent& WXUNUSED(event) )
919 {
920 wxRichTextFormattingDialog* dialog = wxRichTextFormattingDialog::GetDialog(this);
921 if (!dialog || !dialog->GetObject())
922 return;
923
924 // Make sure object attributes are up-to-date
925 dialog->TransferDataFromWindow();
926
927 wxRichTextBuffer* buffer = dialog->GetObject()->GetBuffer();
928 wxRichTextParagraphLayoutBox* container = dialog->GetObject()->GetParentContainer();
929 wxRichTextObject* parent = dialog->GetObject()->GetParent();
930 if (!container || !parent || !buffer)
931 return;
932
933 wxRichTextRange range = dialog->GetObject()->GetRange();
934
935 wxRichTextObjectList::compatibility_iterator iter = buffer->GetChildren().GetFirst();
936 if (!iter)
937 return;
938
939 while (iter)
940 {
941 if (iter->GetData() == parent)
942 break;
943 iter = iter->GetNext();
944 }
945
946 iter = iter->GetNext();
947 if (!iter)
948 return;
949
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();
955
956 container->DeleteRangeWithUndo(range, buffer->GetRichTextCtrl(), buffer);
957
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);
961 }
962
963
964 /*!
965 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_VERTICAL_ALIGNMENT_COMBOBOX
966 */
967
968 void wxRichTextSizePage::OnRichtextVerticalAlignmentComboboxUpdate( wxUpdateUIEvent& event )
969 {
970 event.Enable(m_verticalAlignmentCheckbox->GetValue());
971 }
972
973
974 /*!
975 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_MIN_WIDTH
976 */
977
978 void wxRichTextSizePage::OnRichtextMinWidthUpdate( wxUpdateUIEvent& event )
979 {
980 event.Enable(m_minWidthCheckbox->GetValue());
981 }
982
983 /*!
984 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_MIN_HEIGHT
985 */
986
987 void wxRichTextSizePage::OnRichtextMinHeightUpdate( wxUpdateUIEvent& event )
988 {
989 event.Enable(m_minHeightCheckbox->GetValue());
990 }
991
992
993 /*!
994 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_MAX_WIDTH
995 */
996
997 void wxRichTextSizePage::OnRichtextMaxWidthUpdate( wxUpdateUIEvent& event )
998 {
999 event.Enable(m_maxWidthCheckbox->GetValue());
1000 }
1001
1002
1003 /*!
1004 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_MAX_HEIGHT
1005 */
1006
1007 void wxRichTextSizePage::OnRichtextMaxHeightUpdate( wxUpdateUIEvent& event )
1008 {
1009 event.Enable(m_maxHeightCheckbox->GetValue());
1010 }
1011
1012
1013 /*!
1014 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_LEFT
1015 */
1016
1017 void wxRichTextSizePage::OnRichtextLeftUpdate( wxUpdateUIEvent& event )
1018 {
1019 event.Enable(m_positionLeftCheckbox->GetValue());
1020 }
1021
1022 /*!
1023 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_LEFT_UNITS
1024 */
1025
1026 void wxRichTextSizePage::OnRichtextTopUpdate( wxUpdateUIEvent& event )
1027 {
1028 event.Enable(m_positionTopCheckbox->GetValue());
1029 }
1030
1031 /*!
1032 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_RIGHT
1033 */
1034
1035 void wxRichTextSizePage::OnRichtextRightUpdate( wxUpdateUIEvent& event )
1036 {
1037 event.Enable(m_positionRightCheckbox->GetValue());
1038 }
1039
1040
1041 /*!
1042 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BOTTOM
1043 */
1044
1045 void wxRichTextSizePage::OnRichtextBottomUpdate( wxUpdateUIEvent& event )
1046 {
1047 event.Enable(m_positionBottomCheckbox->GetValue());
1048 }
1049