]> git.saurik.com Git - wxWidgets.git/blame - src/richtext/richtextsizepage.cpp
Clear styles popup if there is no style sheet
[wxWidgets.git] / src / richtext / richtextsizepage.cpp
CommitLineData
603f702b 1/////////////////////////////////////////////////////////////////////////////
80fdcdb9 2// Name: src/richtext/richtextsizepage.cpp
4e63bfb9 3// Purpose:
603f702b 4// Author: Julian Smart
4e63bfb9 5// Modified by:
603f702b 6// Created: 20/10/2010 10:23:24
4e63bfb9 7// RCS-ID:
603f702b 8// Copyright: (c) Julian Smart
4e63bfb9 9// Licence:
603f702b
JS
10/////////////////////////////////////////////////////////////////////////////
11
603f702b
JS
12#include "wx/richtext/richtextsizepage.h"
13
14////@begin XPM images
15////@end XPM images
16
17
18/*!
19 * wxRichTextSizePage type definition
20 */
21
22IMPLEMENT_DYNAMIC_CLASS( wxRichTextSizePage, wxRichTextDialogPage )
23
24
25/*!
26 * wxRichTextSizePage event table definition
27 */
28
29BEGIN_EVENT_TABLE( wxRichTextSizePage, wxRichTextDialogPage )
30
31////@begin wxRichTextSizePage event table entries
32 EVT_UPDATE_UI( ID_RICHTEXT_WIDTH, wxRichTextSizePage::OnRichtextWidthUpdate )
33
34 EVT_UPDATE_UI( ID_RICHTEXT_UNITS_W, wxRichTextSizePage::OnRichtextWidthUpdate )
35
36 EVT_UPDATE_UI( ID_RICHTEXT_HEIGHT, wxRichTextSizePage::OnRichtextHeightUpdate )
37
38 EVT_UPDATE_UI( ID_RICHTEXT_UNITS_H, wxRichTextSizePage::OnRichtextHeightUpdate )
39
303f0be7
JS
40 EVT_UPDATE_UI( ID_RICHTEXT_MIN_WIDTH, wxRichTextSizePage::OnRichtextMinWidthUpdate )
41
42 EVT_UPDATE_UI( ID_RICHTEXT_UNITS_MIN_W, wxRichTextSizePage::OnRichtextMinWidthUpdate )
43
44 EVT_UPDATE_UI( ID_RICHTEXT_MIN_HEIGHT, wxRichTextSizePage::OnRichtextMinHeightUpdate )
45
46 EVT_UPDATE_UI( ID_RICHTEXT_UNITS_MIN_H, wxRichTextSizePage::OnRichtextMinHeightUpdate )
47
48 EVT_UPDATE_UI( ID_RICHTEXT_MAX_WIDTH, wxRichTextSizePage::OnRichtextMaxWidthUpdate )
49
50 EVT_UPDATE_UI( ID_RICHTEXT_UNITS_MAX_W, wxRichTextSizePage::OnRichtextMaxWidthUpdate )
51
52 EVT_UPDATE_UI( ID_RICHTEXT_MAX_HEIGHT, wxRichTextSizePage::OnRichtextMaxHeightUpdate )
53
54 EVT_UPDATE_UI( ID_RICHTEXT_UNITS_MAX_H, wxRichTextSizePage::OnRichtextMaxHeightUpdate )
55
603f702b
JS
56 EVT_UPDATE_UI( ID_RICHTEXT_VERTICAL_ALIGNMENT_COMBOBOX, wxRichTextSizePage::OnRichtextVerticalAlignmentComboboxUpdate )
57
58 EVT_UPDATE_UI( ID_RICHTEXT_OFFSET, wxRichTextSizePage::OnRichtextOffsetUpdate )
59
60 EVT_UPDATE_UI( ID_RICHTEXT_OFFSET_UNITS, wxRichTextSizePage::OnRichtextOffsetUpdate )
61
62 EVT_BUTTON( ID_RICHTEXT_PARA_UP, wxRichTextSizePage::OnRichtextParaUpClick )
63
64 EVT_BUTTON( ID_RICHTEXT_PARA_DOWN, wxRichTextSizePage::OnRichtextParaDownClick )
65
66////@end wxRichTextSizePage event table entries
67
68END_EVENT_TABLE()
69
70IMPLEMENT_HELP_PROVISION(wxRichTextSizePage)
71
72/*!
73 * wxRichTextSizePage constructors
74 */
75
76wxRichTextSizePage::wxRichTextSizePage()
77{
78 Init();
79}
80
81wxRichTextSizePage::wxRichTextSizePage( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
82{
83 Init();
84 Create(parent, id, pos, size, style);
85}
86
87
88/*!
89 * wxRichTextSizePage creator
90 */
91
92bool wxRichTextSizePage::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
93{
94////@begin wxRichTextSizePage creation
95 wxRichTextDialogPage::Create( parent, id, pos, size, style );
96
97 CreateControls();
98 if (GetSizer())
99 {
100 GetSizer()->SetSizeHints(this);
101 }
102 Centre();
103////@end wxRichTextSizePage creation
104 return true;
105}
106
107
108/*!
109 * wxRichTextSizePage destructor
110 */
111
112wxRichTextSizePage::~wxRichTextSizePage()
113{
114////@begin wxRichTextSizePage destruction
115////@end wxRichTextSizePage destruction
116}
117
118
119/*!
120 * Member initialisation
121 */
122
123void wxRichTextSizePage::Init()
124{
125////@begin wxRichTextSizePage member initialisation
126 m_parentSizer = NULL;
127 m_floatingControls = NULL;
128 m_float = NULL;
129 m_widthCheckbox = NULL;
130 m_width = NULL;
131 m_unitsW = NULL;
132 m_heightCheckbox = NULL;
133 m_height = NULL;
134 m_unitsH = NULL;
303f0be7
JS
135 m_minWidthCheckbox = NULL;
136 m_minWidth = NULL;
137 m_unitsMinW = NULL;
138 m_minHeightCheckbox = NULL;
139 m_minHeight = NULL;
140 m_unitsMinH = NULL;
141 m_maxWidthCheckbox = NULL;
142 m_maxWidth = NULL;
143 m_unitsMaxW = NULL;
144 m_maxHeightCheckbox = NULL;
145 m_maxHeight = NULL;
146 m_unitsMaxH = NULL;
603f702b
JS
147 m_alignmentControls = NULL;
148 m_verticalAlignmentCheckbox = NULL;
149 m_verticalAlignmentComboBox = NULL;
150 m_positionControls = NULL;
151 m_moveObjectParentSizer = NULL;
152 m_offsetYCheckbox = NULL;
153 m_offset = NULL;
154 m_unitsOffset = NULL;
155 m_moveObjectSizer = NULL;
156////@end wxRichTextSizePage member initialisation
157}
158
159
160/*!
161 * Control creation for wxRichTextSizePage
162 */
163
164void wxRichTextSizePage::CreateControls()
4e63bfb9 165{
603f702b
JS
166////@begin wxRichTextSizePage content construction
167 wxRichTextSizePage* itemRichTextDialogPage1 = this;
168
169 wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
170 itemRichTextDialogPage1->SetSizer(itemBoxSizer2);
171
172 m_parentSizer = new wxBoxSizer(wxVERTICAL);
173 itemBoxSizer2->Add(m_parentSizer, 0, wxGROW|wxALL, 5);
174
175 m_floatingControls = new wxBoxSizer(wxVERTICAL);
176 m_parentSizer->Add(m_floatingControls, 0, wxGROW, 5);
177
178 wxBoxSizer* itemBoxSizer5 = new wxBoxSizer(wxHORIZONTAL);
179 m_floatingControls->Add(itemBoxSizer5, 0, wxGROW, 5);
180
181 wxStaticText* itemStaticText6 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("Floating"), wxDefaultPosition, wxDefaultSize, 0 );
182 itemStaticText6->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("")));
183 itemBoxSizer5->Add(itemStaticText6, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
184
185 wxStaticLine* itemStaticLine7 = new wxStaticLine( itemRichTextDialogPage1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
186 itemBoxSizer5->Add(itemStaticLine7, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
187
188 wxBoxSizer* itemBoxSizer8 = new wxBoxSizer(wxHORIZONTAL);
189 m_floatingControls->Add(itemBoxSizer8, 0, wxGROW, 5);
190
191 itemBoxSizer8->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
192
193 wxFlexGridSizer* itemFlexGridSizer10 = new wxFlexGridSizer(0, 2, 0, 0);
194 itemBoxSizer8->Add(itemFlexGridSizer10, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5);
195
196 wxStaticText* itemStaticText11 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("&Floating mode:"), wxDefaultPosition, wxDefaultSize, 0 );
197 itemFlexGridSizer10->Add(itemStaticText11, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
198
199 wxArrayString m_floatStrings;
200 m_floatStrings.Add(_("None"));
201 m_floatStrings.Add(_("Left"));
202 m_floatStrings.Add(_("Right"));
203 m_float = new wxComboBox( itemRichTextDialogPage1, ID_RICHTEXT_FLOATING_MODE, _("None"), wxDefaultPosition, wxSize(80, -1), m_floatStrings, wxCB_READONLY );
204 m_float->SetStringSelection(_("None"));
205 m_float->SetHelpText(_("How the object will float relative to the text."));
206 if (wxRichTextSizePage::ShowToolTips())
207 m_float->SetToolTip(_("How the object will float relative to the text."));
208 itemFlexGridSizer10->Add(m_float, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
209
210 wxBoxSizer* itemBoxSizer13 = new wxBoxSizer(wxHORIZONTAL);
211 m_parentSizer->Add(itemBoxSizer13, 0, wxGROW, 5);
212
213 wxStaticText* itemStaticText14 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("Size"), wxDefaultPosition, wxDefaultSize, 0 );
214 itemStaticText14->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("")));
215 itemBoxSizer13->Add(itemStaticText14, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
216
217 wxStaticLine* itemStaticLine15 = new wxStaticLine( itemRichTextDialogPage1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
218 itemBoxSizer13->Add(itemStaticLine15, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
219
220 wxBoxSizer* itemBoxSizer16 = new wxBoxSizer(wxHORIZONTAL);
221 m_parentSizer->Add(itemBoxSizer16, 0, wxGROW, 5);
222
223 itemBoxSizer16->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
224
303f0be7 225 wxFlexGridSizer* itemFlexGridSizer18 = new wxFlexGridSizer(0, 4, 0, 0);
603f702b
JS
226 itemBoxSizer16->Add(itemFlexGridSizer18, 0, wxALIGN_CENTER_VERTICAL, 5);
227
228 m_widthCheckbox = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXT_WIDTH_CHECKBOX, _("&Width:"), wxDefaultPosition, wxDefaultSize, 0 );
229 m_widthCheckbox->SetValue(false);
230 m_widthCheckbox->SetHelpText(_("Enable the width value."));
231 if (wxRichTextSizePage::ShowToolTips())
232 m_widthCheckbox->SetToolTip(_("Enable the width value."));
303f0be7 233 itemFlexGridSizer18->Add(m_widthCheckbox, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
603f702b
JS
234
235 wxBoxSizer* itemBoxSizer20 = new wxBoxSizer(wxHORIZONTAL);
236 itemFlexGridSizer18->Add(itemBoxSizer20, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
237
303f0be7 238 m_width = new wxTextCtrl( itemRichTextDialogPage1, ID_RICHTEXT_WIDTH, wxEmptyString, wxDefaultPosition, wxSize(60, -1), 0 );
603f702b
JS
239 m_width->SetHelpText(_("The object width."));
240 if (wxRichTextSizePage::ShowToolTips())
241 m_width->SetToolTip(_("The object width."));
242 itemBoxSizer20->Add(m_width, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
243
244 wxArrayString m_unitsWStrings;
245 m_unitsWStrings.Add(_("px"));
246 m_unitsWStrings.Add(_("cm"));
706465df 247 m_unitsWStrings.Add(_("percent"));
603f702b
JS
248 m_unitsW = new wxComboBox( itemRichTextDialogPage1, ID_RICHTEXT_UNITS_W, _("px"), wxDefaultPosition, wxSize(60, -1), m_unitsWStrings, wxCB_READONLY );
249 m_unitsW->SetStringSelection(_("px"));
250 m_unitsW->SetHelpText(_("Units for the object width."));
251 if (wxRichTextSizePage::ShowToolTips())
252 m_unitsW->SetToolTip(_("Units for the object width."));
253 itemBoxSizer20->Add(m_unitsW, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
254
255 m_heightCheckbox = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXT_HEIGHT_CHECKBOX, _("&Height:"), wxDefaultPosition, wxDefaultSize, 0 );
256 m_heightCheckbox->SetValue(false);
257 m_heightCheckbox->SetHelpText(_("Enable the height value."));
258 if (wxRichTextSizePage::ShowToolTips())
259 m_heightCheckbox->SetToolTip(_("Enable the height value."));
303f0be7 260 itemFlexGridSizer18->Add(m_heightCheckbox, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
603f702b
JS
261
262 wxBoxSizer* itemBoxSizer24 = new wxBoxSizer(wxHORIZONTAL);
263 itemFlexGridSizer18->Add(itemBoxSizer24, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
264
303f0be7 265 m_height = new wxTextCtrl( itemRichTextDialogPage1, ID_RICHTEXT_HEIGHT, wxEmptyString, wxDefaultPosition, wxSize(60, -1), 0 );
603f702b
JS
266 m_height->SetHelpText(_("The object height."));
267 if (wxRichTextSizePage::ShowToolTips())
268 m_height->SetToolTip(_("The object height."));
269 itemBoxSizer24->Add(m_height, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
270
271 wxArrayString m_unitsHStrings;
272 m_unitsHStrings.Add(_("px"));
273 m_unitsHStrings.Add(_("cm"));
706465df 274 m_unitsHStrings.Add(_("percent"));
603f702b
JS
275 m_unitsH = new wxComboBox( itemRichTextDialogPage1, ID_RICHTEXT_UNITS_H, _("px"), wxDefaultPosition, wxSize(60, -1), m_unitsHStrings, wxCB_READONLY );
276 m_unitsH->SetStringSelection(_("px"));
277 m_unitsH->SetHelpText(_("Units for the object height."));
278 if (wxRichTextSizePage::ShowToolTips())
279 m_unitsH->SetToolTip(_("Units for the object height."));
280 itemBoxSizer24->Add(m_unitsH, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
281
303f0be7
JS
282 m_minWidthCheckbox = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXT_MIN_WIDTH_CHECKBOX, _("Min width:"), wxDefaultPosition, wxDefaultSize, 0 );
283 m_minWidthCheckbox->SetValue(false);
284 m_minWidthCheckbox->SetHelpText(_("Enable the minimum width value."));
285 if (wxRichTextSizePage::ShowToolTips())
286 m_minWidthCheckbox->SetToolTip(_("Enable the minimum width value."));
287 itemFlexGridSizer18->Add(m_minWidthCheckbox, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
288
289 wxBoxSizer* itemBoxSizer28 = new wxBoxSizer(wxHORIZONTAL);
290 itemFlexGridSizer18->Add(itemBoxSizer28, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
291
292 m_minWidth = new wxTextCtrl( itemRichTextDialogPage1, ID_RICHTEXT_MIN_WIDTH, wxEmptyString, wxDefaultPosition, wxSize(60, -1), 0 );
293 m_minWidth->SetHelpText(_("The object minimum width."));
294 if (wxRichTextSizePage::ShowToolTips())
295 m_minWidth->SetToolTip(_("The object minimum width."));
296 itemBoxSizer28->Add(m_minWidth, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
297
298 wxArrayString m_unitsMinWStrings;
299 m_unitsMinWStrings.Add(_("px"));
300 m_unitsMinWStrings.Add(_("cm"));
301 m_unitsMinWStrings.Add(_("percent"));
302 m_unitsMinW = new wxComboBox( itemRichTextDialogPage1, ID_RICHTEXT_UNITS_MIN_W, _("px"), wxDefaultPosition, wxSize(60, -1), m_unitsMinWStrings, wxCB_READONLY );
303 m_unitsMinW->SetStringSelection(_("px"));
304 m_unitsMinW->SetHelpText(_("Units for the minimum object width."));
305 if (wxRichTextSizePage::ShowToolTips())
306 m_unitsMinW->SetToolTip(_("Units for the minimum object width."));
307 itemBoxSizer28->Add(m_unitsMinW, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
308
309 m_minHeightCheckbox = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXT_MIN_HEIGHT_CHECKBOX, _("Min height:"), wxDefaultPosition, wxDefaultSize, 0 );
310 m_minHeightCheckbox->SetValue(false);
311 m_minHeightCheckbox->SetHelpText(_("Enable the minimum height value."));
312 if (wxRichTextSizePage::ShowToolTips())
313 m_minHeightCheckbox->SetToolTip(_("Enable the minimum height value."));
314 itemFlexGridSizer18->Add(m_minHeightCheckbox, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
315
316 wxBoxSizer* itemBoxSizer32 = new wxBoxSizer(wxHORIZONTAL);
317 itemFlexGridSizer18->Add(itemBoxSizer32, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
318
319 m_minHeight = new wxTextCtrl( itemRichTextDialogPage1, ID_RICHTEXT_MIN_HEIGHT, wxEmptyString, wxDefaultPosition, wxSize(60, -1), 0 );
320 m_minHeight->SetHelpText(_("The object minmum height."));
321 if (wxRichTextSizePage::ShowToolTips())
322 m_minHeight->SetToolTip(_("The object minmum height."));
323 itemBoxSizer32->Add(m_minHeight, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
324
325 wxArrayString m_unitsMinHStrings;
326 m_unitsMinHStrings.Add(_("px"));
327 m_unitsMinHStrings.Add(_("cm"));
328 m_unitsMinHStrings.Add(_("percent"));
329 m_unitsMinH = new wxComboBox( itemRichTextDialogPage1, ID_RICHTEXT_UNITS_MIN_H, _("px"), wxDefaultPosition, wxSize(60, -1), m_unitsMinHStrings, wxCB_READONLY );
330 m_unitsMinH->SetStringSelection(_("px"));
331 m_unitsMinH->SetHelpText(_("Units for the minimum object height."));
332 if (wxRichTextSizePage::ShowToolTips())
333 m_unitsMinH->SetToolTip(_("Units for the minimum object height."));
334 itemBoxSizer32->Add(m_unitsMinH, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
335
336 m_maxWidthCheckbox = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXT_MAX_WIDTH_CHECKBOX, _("Max width:"), wxDefaultPosition, wxDefaultSize, 0 );
337 m_maxWidthCheckbox->SetValue(false);
338 m_maxWidthCheckbox->SetHelpText(_("Enable the maximum width value."));
339 if (wxRichTextSizePage::ShowToolTips())
340 m_maxWidthCheckbox->SetToolTip(_("Enable the maximum width value."));
341 itemFlexGridSizer18->Add(m_maxWidthCheckbox, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
342
343 wxBoxSizer* itemBoxSizer36 = new wxBoxSizer(wxHORIZONTAL);
344 itemFlexGridSizer18->Add(itemBoxSizer36, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
345
346 m_maxWidth = new wxTextCtrl( itemRichTextDialogPage1, ID_RICHTEXT_MAX_WIDTH, wxEmptyString, wxDefaultPosition, wxSize(60, -1), 0 );
347 m_maxWidth->SetHelpText(_("The object maximum width."));
348 if (wxRichTextSizePage::ShowToolTips())
349 m_maxWidth->SetToolTip(_("The object maximum width."));
350 itemBoxSizer36->Add(m_maxWidth, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
351
352 wxArrayString m_unitsMaxWStrings;
353 m_unitsMaxWStrings.Add(_("px"));
354 m_unitsMaxWStrings.Add(_("cm"));
355 m_unitsMaxWStrings.Add(_("percent"));
356 m_unitsMaxW = new wxComboBox( itemRichTextDialogPage1, ID_RICHTEXT_UNITS_MAX_W, _("px"), wxDefaultPosition, wxSize(60, -1), m_unitsMaxWStrings, wxCB_READONLY );
357 m_unitsMaxW->SetStringSelection(_("px"));
358 m_unitsMaxW->SetHelpText(_("Units for the maximum object width."));
359 if (wxRichTextSizePage::ShowToolTips())
360 m_unitsMaxW->SetToolTip(_("Units for the maximum object width."));
361 itemBoxSizer36->Add(m_unitsMaxW, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
362
363 m_maxHeightCheckbox = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXT_MAX_HEIGHT_CHECKBOX, _("Max height:"), wxDefaultPosition, wxDefaultSize, 0 );
364 m_maxHeightCheckbox->SetValue(false);
365 m_maxHeightCheckbox->SetHelpText(_("Enable the height value."));
366 if (wxRichTextSizePage::ShowToolTips())
367 m_maxHeightCheckbox->SetToolTip(_("Enable the height value."));
368 itemFlexGridSizer18->Add(m_maxHeightCheckbox, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
369
370 wxBoxSizer* itemBoxSizer40 = new wxBoxSizer(wxHORIZONTAL);
371 itemFlexGridSizer18->Add(itemBoxSizer40, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
372
373 m_maxHeight = new wxTextCtrl( itemRichTextDialogPage1, ID_RICHTEXT_MAX_HEIGHT, wxEmptyString, wxDefaultPosition, wxSize(60, -1), 0 );
374 m_maxHeight->SetHelpText(_("The object maximum height."));
375 if (wxRichTextSizePage::ShowToolTips())
376 m_maxHeight->SetToolTip(_("The object maximum height."));
377 itemBoxSizer40->Add(m_maxHeight, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
378
379 wxArrayString m_unitsMaxHStrings;
380 m_unitsMaxHStrings.Add(_("px"));
381 m_unitsMaxHStrings.Add(_("cm"));
382 m_unitsMaxHStrings.Add(_("percent"));
383 m_unitsMaxH = new wxComboBox( itemRichTextDialogPage1, ID_RICHTEXT_UNITS_MAX_H, _("px"), wxDefaultPosition, wxSize(60, -1), m_unitsMaxHStrings, wxCB_READONLY );
384 m_unitsMaxH->SetStringSelection(_("px"));
385 m_unitsMaxH->SetHelpText(_("Units for the maximum object height."));
386 if (wxRichTextSizePage::ShowToolTips())
387 m_unitsMaxH->SetToolTip(_("Units for the maximum object height."));
388 itemBoxSizer40->Add(m_unitsMaxH, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
389
603f702b
JS
390 m_alignmentControls = new wxBoxSizer(wxVERTICAL);
391 m_parentSizer->Add(m_alignmentControls, 0, wxGROW, 5);
392
303f0be7
JS
393 wxBoxSizer* itemBoxSizer44 = new wxBoxSizer(wxHORIZONTAL);
394 m_alignmentControls->Add(itemBoxSizer44, 0, wxGROW, 5);
603f702b 395
303f0be7
JS
396 wxStaticText* itemStaticText45 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("Alignment"), wxDefaultPosition, wxDefaultSize, 0 );
397 itemStaticText45->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("")));
398 itemBoxSizer44->Add(itemStaticText45, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
603f702b 399
303f0be7
JS
400 wxStaticLine* itemStaticLine46 = new wxStaticLine( itemRichTextDialogPage1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
401 itemBoxSizer44->Add(itemStaticLine46, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
603f702b 402
303f0be7
JS
403 wxBoxSizer* itemBoxSizer47 = new wxBoxSizer(wxHORIZONTAL);
404 m_alignmentControls->Add(itemBoxSizer47, 0, wxGROW, 5);
603f702b 405
303f0be7 406 itemBoxSizer47->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
603f702b
JS
407
408 m_verticalAlignmentCheckbox = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXT_VERTICAL_ALIGNMENT_CHECKBOX, _("&Vertical alignment:"), wxDefaultPosition, wxDefaultSize, 0 );
409 m_verticalAlignmentCheckbox->SetValue(false);
410 m_verticalAlignmentCheckbox->SetHelpText(_("Enable vertical alignment."));
411 if (wxRichTextSizePage::ShowToolTips())
412 m_verticalAlignmentCheckbox->SetToolTip(_("Enable vertical alignment."));
303f0be7 413 itemBoxSizer47->Add(m_verticalAlignmentCheckbox, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
603f702b
JS
414
415 wxArrayString m_verticalAlignmentComboBoxStrings;
416 m_verticalAlignmentComboBoxStrings.Add(_("Top"));
417 m_verticalAlignmentComboBoxStrings.Add(_("Centred"));
418 m_verticalAlignmentComboBoxStrings.Add(_("Bottom"));
419 m_verticalAlignmentComboBox = new wxComboBox( itemRichTextDialogPage1, ID_RICHTEXT_VERTICAL_ALIGNMENT_COMBOBOX, _("Top"), wxDefaultPosition, wxDefaultSize, m_verticalAlignmentComboBoxStrings, wxCB_READONLY );
420 m_verticalAlignmentComboBox->SetStringSelection(_("Top"));
421 m_verticalAlignmentComboBox->SetHelpText(_("Vertical alignment."));
422 if (wxRichTextSizePage::ShowToolTips())
423 m_verticalAlignmentComboBox->SetToolTip(_("Vertical alignment."));
303f0be7 424 itemBoxSizer47->Add(m_verticalAlignmentComboBox, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
603f702b
JS
425
426 m_positionControls = new wxBoxSizer(wxVERTICAL);
427 m_parentSizer->Add(m_positionControls, 0, wxGROW, 5);
428
303f0be7
JS
429 wxBoxSizer* itemBoxSizer52 = new wxBoxSizer(wxHORIZONTAL);
430 m_positionControls->Add(itemBoxSizer52, 0, wxGROW, 5);
603f702b 431
303f0be7
JS
432 wxStaticText* itemStaticText53 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("Position"), wxDefaultPosition, wxDefaultSize, 0 );
433 itemStaticText53->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("")));
434 itemBoxSizer52->Add(itemStaticText53, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
603f702b 435
303f0be7
JS
436 wxStaticLine* itemStaticLine54 = new wxStaticLine( itemRichTextDialogPage1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
437 itemBoxSizer52->Add(itemStaticLine54, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
603f702b 438
303f0be7
JS
439 wxBoxSizer* itemBoxSizer55 = new wxBoxSizer(wxHORIZONTAL);
440 m_positionControls->Add(itemBoxSizer55, 0, wxGROW, 5);
603f702b 441
303f0be7 442 itemBoxSizer55->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
603f702b
JS
443
444 m_moveObjectParentSizer = new wxBoxSizer(wxVERTICAL);
303f0be7 445 itemBoxSizer55->Add(m_moveObjectParentSizer, 0, wxALIGN_TOP, 5);
603f702b 446
303f0be7
JS
447 wxBoxSizer* itemBoxSizer58 = new wxBoxSizer(wxHORIZONTAL);
448 m_moveObjectParentSizer->Add(itemBoxSizer58, 0, wxGROW, 5);
603f702b
JS
449
450 m_offsetYCheckbox = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXT_OFFSET_CHECKBOX, _("Vertical &Offset:"), wxDefaultPosition, wxDefaultSize, 0 );
451 m_offsetYCheckbox->SetValue(false);
452 m_offsetYCheckbox->SetHelpText(_("Enable vertical offset."));
453 if (wxRichTextSizePage::ShowToolTips())
454 m_offsetYCheckbox->SetToolTip(_("Enable vertical offset."));
303f0be7 455 itemBoxSizer58->Add(m_offsetYCheckbox, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
603f702b
JS
456
457 m_offset = new wxTextCtrl( itemRichTextDialogPage1, ID_RICHTEXT_OFFSET, wxEmptyString, wxDefaultPosition, wxSize(65, -1), 0 );
458 m_offset->SetMaxLength(10);
459 m_offset->SetHelpText(_("The vertical offset relative to the paragraph."));
460 if (wxRichTextSizePage::ShowToolTips())
461 m_offset->SetToolTip(_("The vertical offset relative to the paragraph."));
303f0be7 462 itemBoxSizer58->Add(m_offset, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
603f702b
JS
463
464 wxArrayString m_unitsOffsetStrings;
465 m_unitsOffsetStrings.Add(_("px"));
466 m_unitsOffsetStrings.Add(_("cm"));
467 m_unitsOffset = new wxComboBox( itemRichTextDialogPage1, ID_RICHTEXT_OFFSET_UNITS, _("px"), wxDefaultPosition, wxSize(60, -1), m_unitsOffsetStrings, wxCB_READONLY );
468 m_unitsOffset->SetStringSelection(_("px"));
469 m_unitsOffset->SetHelpText(_("Units for the object offset."));
470 if (wxRichTextSizePage::ShowToolTips())
471 m_unitsOffset->SetToolTip(_("Units for the object offset."));
303f0be7 472 itemBoxSizer58->Add(m_unitsOffset, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
603f702b
JS
473
474 m_moveObjectSizer = new wxBoxSizer(wxHORIZONTAL);
475 m_moveObjectParentSizer->Add(m_moveObjectSizer, 0, wxGROW, 5);
476
303f0be7
JS
477 wxStaticText* itemStaticText63 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("&Move the object to:"), wxDefaultPosition, wxDefaultSize, 0 );
478 m_moveObjectSizer->Add(itemStaticText63, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
603f702b 479
303f0be7
JS
480 wxButton* itemButton64 = new wxButton( itemRichTextDialogPage1, ID_RICHTEXT_PARA_UP, _("&Previous Paragraph"), wxDefaultPosition, wxDefaultSize, 0 );
481 itemButton64->SetHelpText(_("Moves the object to the previous paragraph."));
603f702b 482 if (wxRichTextSizePage::ShowToolTips())
303f0be7
JS
483 itemButton64->SetToolTip(_("Moves the object to the previous paragraph."));
484 m_moveObjectSizer->Add(itemButton64, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
603f702b 485
303f0be7
JS
486 wxButton* itemButton65 = new wxButton( itemRichTextDialogPage1, ID_RICHTEXT_PARA_DOWN, _("&Next Paragraph"), wxDefaultPosition, wxDefaultSize, 0 );
487 itemButton65->SetHelpText(_("Moves the object to the next paragraph."));
603f702b 488 if (wxRichTextSizePage::ShowToolTips())
303f0be7
JS
489 itemButton65->SetToolTip(_("Moves the object to the next paragraph."));
490 m_moveObjectSizer->Add(itemButton65, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxTOP|wxBOTTOM, 5);
603f702b
JS
491
492////@end wxRichTextSizePage content construction
493}
494
495wxRichTextAttr* wxRichTextSizePage::GetAttributes()
496{
497 return wxRichTextFormattingDialog::GetDialogAttributes(this);
498}
499
500/*!
501 * Should we show tooltips?
502 */
503
504bool wxRichTextSizePage::ShowToolTips()
505{
506 return true;
507}
508
509bool wxRichTextSizePage::TransferDataToWindow()
510{
511 m_float->SetSelection(GetAttributes()->GetTextBoxAttr().GetFloatMode());
512 m_verticalAlignmentCheckbox->SetValue(GetAttributes()->GetTextBoxAttr().HasVerticalAlignment());
513 if (GetAttributes()->GetTextBoxAttr().HasVerticalAlignment())
514 {
515 if ((int) GetAttributes()->GetTextBoxAttr().GetVerticalAlignment() > 0 &&
516 (int) GetAttributes()->GetTextBoxAttr().GetVerticalAlignment() < 4)
517 {
518 m_verticalAlignmentComboBox->SetSelection(((int) GetAttributes()->GetTextBoxAttr().GetVerticalAlignment() - 1));
519 }
520 else
521 m_verticalAlignmentComboBox->SetSelection(0);
522 }
523
524 wxRichTextFormattingDialog* dialog = wxRichTextFormattingDialog::GetDialog(this);
525
526 if (dialog)
527 {
528 // Only show the Move Object controls if there's an object.
529 if (!dialog->GetObject())
530 {
531 m_moveObjectParentSizer->Show(m_moveObjectSizer, false);
532 GetSizer()->Layout();
533 }
534 }
535
23698b12
JS
536 wxRichTextImage* imageObj = NULL;
537 if (dialog)
538 imageObj = wxDynamicCast(dialog->GetObject(), wxRichTextImage);
539
540 // For an image, show the original width and height if the size is not explicitly specified.
541 if (imageObj && !GetAttributes()->GetTextBoxAttr().GetWidth().IsValid() && !GetAttributes()->GetTextBoxAttr().GetHeight().IsValid() &&
542 imageObj->GetOriginalImageSize() != wxSize(-1, -1))
603f702b 543 {
23698b12
JS
544 m_widthCheckbox->SetValue(false);
545 m_heightCheckbox->SetValue(false);
546 m_unitsW->SetSelection(0);
547 m_unitsH->SetSelection(0);
548 m_width->SetValue(wxString::Format(wxT("%d"), (int) imageObj->GetOriginalImageSize().GetWidth()));
549 m_height->SetValue(wxString::Format(wxT("%d"), (int) imageObj->GetOriginalImageSize().GetHeight()));
550 }
551 else
552 {
553 wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetWidth(), m_width, m_unitsW, m_widthCheckbox);
554 wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetHeight(), m_height, m_unitsH, m_heightCheckbox);
603f702b
JS
555 }
556
303f0be7
JS
557 wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetMinSize().GetWidth(), m_minWidth, m_unitsMinW, m_minWidthCheckbox);
558 wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetMinSize().GetHeight(), m_minHeight, m_unitsMinH, m_minHeightCheckbox);
559 wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetMaxSize().GetWidth(), m_maxWidth, m_unitsMaxW, m_maxWidthCheckbox);
560 wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetMaxSize().GetHeight(), m_maxHeight, m_unitsMaxH, m_maxHeightCheckbox);
603f702b
JS
561 wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetTop(), m_offset, m_unitsOffset, m_offsetYCheckbox);
562
563 return true;
564}
565
566bool wxRichTextSizePage::TransferDataFromWindow()
567{
568 GetAttributes()->GetTextBoxAttr().SetFloatMode((wxTextBoxAttrFloatStyle) m_float->GetSelection());
569 if (m_float->GetSelection() == 0)
570 GetAttributes()->GetTextBoxAttr().RemoveFlag(wxTEXT_BOX_ATTR_FLOAT);
571
572 if (m_verticalAlignmentCheckbox->GetValue())
573 GetAttributes()->GetTextBoxAttr().SetVerticalAlignment((wxTextBoxAttrVerticalAlignment) (m_verticalAlignmentComboBox->GetSelection() + 1));
574 else
575 {
576 GetAttributes()->GetTextBoxAttr().SetVerticalAlignment(wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT_NONE);
577 GetAttributes()->GetTextBoxAttr().RemoveFlag(wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT);
578 }
579
580 wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetWidth(), m_width, m_unitsW, m_widthCheckbox);
581 wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetHeight(), m_height, m_unitsH, m_heightCheckbox);
303f0be7
JS
582 wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetMinSize().GetWidth(), m_minWidth, m_unitsMinW, m_minWidthCheckbox);
583 wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetMinSize().GetHeight(), m_minHeight, m_unitsMinH, m_minHeightCheckbox);
584 wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetMaxSize().GetWidth(), m_maxWidth, m_unitsMaxW, m_maxWidthCheckbox);
585 wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetMaxSize().GetHeight(), m_maxHeight, m_unitsMaxH, m_maxHeightCheckbox);
603f702b
JS
586 wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetTop(), m_offset, m_unitsOffset, m_offsetYCheckbox);
587
588 return true;
589}
590
591// Show/hide position controls
592void wxRichTextSizePage::ShowPositionControls(bool show)
593{
594 if (m_parentSizer)
595 {
596 m_parentSizer->Show(m_positionControls, show);
597 Layout();
598 }
599}
600
601// Show/hide floating controls
602void wxRichTextSizePage::ShowFloatingControls(bool show)
603{
604 if (m_parentSizer)
605 {
606 m_parentSizer->Show(m_floatingControls, show);
607 Layout();
608 }
609}
610
611
612/*!
613 * Get bitmap resources
614 */
615
616wxBitmap wxRichTextSizePage::GetBitmapResource( const wxString& name )
617{
618 // Bitmap retrieval
619////@begin wxRichTextSizePage bitmap retrieval
620 wxUnusedVar(name);
621 return wxNullBitmap;
622////@end wxRichTextSizePage bitmap retrieval
623}
624
625/*!
626 * Get icon resources
627 */
628
629wxIcon wxRichTextSizePage::GetIconResource( const wxString& name )
630{
631 // Icon retrieval
632////@begin wxRichTextSizePage icon retrieval
633 wxUnusedVar(name);
634 return wxNullIcon;
635////@end wxRichTextSizePage icon retrieval
636}
637
638
639/*!
640 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_WIDTH
641 */
642
643void wxRichTextSizePage::OnRichtextWidthUpdate( wxUpdateUIEvent& event )
644{
645 event.Enable(m_widthCheckbox->GetValue());
646}
647
648/*!
649 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_HEIGHT
650 */
651
652void wxRichTextSizePage::OnRichtextHeightUpdate( wxUpdateUIEvent& event )
653{
654 event.Enable(m_heightCheckbox->GetValue());
655}
656
657/*!
658 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_OFFSET
659 */
660
661void wxRichTextSizePage::OnRichtextOffsetUpdate( wxUpdateUIEvent& event )
662{
663 event.Enable(m_offsetYCheckbox->GetValue());
664}
665
666
667/*!
668 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXT_PARA_UP
669 */
670
671void wxRichTextSizePage::OnRichtextParaUpClick( wxCommandEvent& WXUNUSED(event) )
672{
673 wxRichTextFormattingDialog* dialog = wxRichTextFormattingDialog::GetDialog(this);
674 if (!dialog || !dialog->GetObject())
675 return;
4e63bfb9 676
603f702b
JS
677 // Make sure object attributes are up-to-date
678 dialog->TransferDataFromWindow();
4e63bfb9 679
603f702b
JS
680 wxRichTextBuffer* buffer = dialog->GetObject()->GetBuffer();
681 wxRichTextParagraphLayoutBox* container = dialog->GetObject()->GetParentContainer();
682 wxRichTextObject* parent = dialog->GetObject()->GetParent();
683 if (!container || !parent || !buffer)
684 return;
685
686 wxRichTextRange range = dialog->GetObject()->GetRange();
687 wxRichTextObjectList::compatibility_iterator iter = container->GetChildren().GetFirst();
688 if (!iter)
689 return;
690
691 while (iter)
692 {
693 if (iter->GetData() == parent)
694 break;
695 iter = iter->GetNext();
696 }
697 if (!iter)
698 return;
699 iter = iter->GetPrevious();
700 if (!iter)
701 return;
702
703 wxRichTextObject *obj = iter->GetData();
704 wxRichTextRange rg = obj->GetRange();
705 // tempObj will be deleted along with the undo object, and a clone of it will be
706 // returned by InsertObjectWithUndo
707 wxRichTextObject* tempObj = dialog->GetObject()->Clone();
708
709 container->DeleteRangeWithUndo(range, buffer->GetRichTextCtrl(), buffer);
710
4e63bfb9 711 wxRichTextObject* obj2 = container->InsertObjectWithUndo(buffer, rg.GetStart(), tempObj, buffer->GetRichTextCtrl(), 0);
603f702b
JS
712 dialog->SetObject(obj2);
713}
714
715/*!
716 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXT_DOWN
717 */
718
719void wxRichTextSizePage::OnRichtextParaDownClick( wxCommandEvent& WXUNUSED(event) )
720{
721 wxRichTextFormattingDialog* dialog = wxRichTextFormattingDialog::GetDialog(this);
722 if (!dialog || !dialog->GetObject())
723 return;
4e63bfb9 724
603f702b
JS
725 // Make sure object attributes are up-to-date
726 dialog->TransferDataFromWindow();
4e63bfb9 727
603f702b
JS
728 wxRichTextBuffer* buffer = dialog->GetObject()->GetBuffer();
729 wxRichTextParagraphLayoutBox* container = dialog->GetObject()->GetParentContainer();
730 wxRichTextObject* parent = dialog->GetObject()->GetParent();
731 if (!container || !parent || !buffer)
732 return;
733
734 wxRichTextRange range = dialog->GetObject()->GetRange();
735
736 wxRichTextObjectList::compatibility_iterator iter = buffer->GetChildren().GetFirst();
737 if (!iter)
738 return;
739
740 while (iter)
741 {
742 if (iter->GetData() == parent)
743 break;
744 iter = iter->GetNext();
745 }
746
747 iter = iter->GetNext();
748 if (!iter)
749 return;
750
751 wxRichTextObject *obj = iter->GetData();
752 wxRichTextRange rg = obj->GetRange();
753 // tempObj will be deleted along with the undo object, and a clone of it will be
754 // returned by InsertObjectWithUndo
755 wxRichTextObject* tempObj = dialog->GetObject()->Clone();
756
757 container->DeleteRangeWithUndo(range, buffer->GetRichTextCtrl(), buffer);
758
759 // Minus one because we deleted an object
4e63bfb9 760 wxRichTextObject* obj2 = container->InsertObjectWithUndo(buffer, rg.GetStart()-1, tempObj, buffer->GetRichTextCtrl(), 0);
603f702b
JS
761 dialog->SetObject(obj2);
762}
763
764
765/*!
766 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_VERTICAL_ALIGNMENT_COMBOBOX
767 */
768
769void wxRichTextSizePage::OnRichtextVerticalAlignmentComboboxUpdate( wxUpdateUIEvent& event )
770{
771 event.Enable(m_verticalAlignmentCheckbox->GetValue());
772}
773
303f0be7
JS
774
775/*!
776 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_MIN_WIDTH
777 */
778
779void wxRichTextSizePage::OnRichtextMinWidthUpdate( wxUpdateUIEvent& event )
780{
781 event.Enable(m_minWidthCheckbox->GetValue());
782}
783
784/*!
785 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_MIN_HEIGHT
786 */
787
788void wxRichTextSizePage::OnRichtextMinHeightUpdate( wxUpdateUIEvent& event )
789{
790 event.Enable(m_minHeightCheckbox->GetValue());
791}
792
793
794/*!
795 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_MAX_WIDTH
796 */
797
798void wxRichTextSizePage::OnRichtextMaxWidthUpdate( wxUpdateUIEvent& event )
799{
800 event.Enable(m_maxWidthCheckbox->GetValue());
801}
802
803
804/*!
805 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_MAX_HEIGHT
806 */
807
808void wxRichTextSizePage::OnRichtextMaxHeightUpdate( wxUpdateUIEvent& event )
809{
810 event.Enable(m_maxHeightCheckbox->GetValue());
811}