1 /////////////////////////////////////////////////////////////////////////////
2 // Name: richtextsizepage.cpp
4 // Author: Julian Smart
6 // Created: 20/10/2010 10:23:24
8 // Copyright: (c) Julian Smart
10 /////////////////////////////////////////////////////////////////////////////
12 // For compilers that support precompilation, includes "wx/wx.h".
13 #include "wx/wxprec.h"
26 #include "wx/richtext/richtextsizepage.h"
33 * wxRichTextSizePage type definition
36 IMPLEMENT_DYNAMIC_CLASS( wxRichTextSizePage
, wxRichTextDialogPage
)
40 * wxRichTextSizePage event table definition
43 BEGIN_EVENT_TABLE( wxRichTextSizePage
, wxRichTextDialogPage
)
45 ////@begin wxRichTextSizePage event table entries
46 EVT_UPDATE_UI( ID_RICHTEXT_WIDTH
, wxRichTextSizePage::OnRichtextWidthUpdate
)
48 EVT_UPDATE_UI( ID_RICHTEXT_UNITS_W
, wxRichTextSizePage::OnRichtextWidthUpdate
)
50 EVT_UPDATE_UI( ID_RICHTEXT_HEIGHT
, wxRichTextSizePage::OnRichtextHeightUpdate
)
52 EVT_UPDATE_UI( ID_RICHTEXT_UNITS_H
, wxRichTextSizePage::OnRichtextHeightUpdate
)
54 EVT_UPDATE_UI( ID_RICHTEXT_VERTICAL_ALIGNMENT_COMBOBOX
, wxRichTextSizePage::OnRichtextVerticalAlignmentComboboxUpdate
)
56 EVT_UPDATE_UI( ID_RICHTEXT_OFFSET
, wxRichTextSizePage::OnRichtextOffsetUpdate
)
58 EVT_UPDATE_UI( ID_RICHTEXT_OFFSET_UNITS
, wxRichTextSizePage::OnRichtextOffsetUpdate
)
60 EVT_BUTTON( ID_RICHTEXT_PARA_UP
, wxRichTextSizePage::OnRichtextParaUpClick
)
62 EVT_BUTTON( ID_RICHTEXT_PARA_DOWN
, wxRichTextSizePage::OnRichtextParaDownClick
)
64 ////@end wxRichTextSizePage event table entries
68 IMPLEMENT_HELP_PROVISION(wxRichTextSizePage
)
71 * wxRichTextSizePage constructors
74 wxRichTextSizePage::wxRichTextSizePage()
79 wxRichTextSizePage::wxRichTextSizePage( wxWindow
* parent
, wxWindowID id
, const wxPoint
& pos
, const wxSize
& size
, long style
)
82 Create(parent
, id
, pos
, size
, style
);
87 * wxRichTextSizePage creator
90 bool wxRichTextSizePage::Create( wxWindow
* parent
, wxWindowID id
, const wxPoint
& pos
, const wxSize
& size
, long style
)
92 ////@begin wxRichTextSizePage creation
93 wxRichTextDialogPage::Create( parent
, id
, pos
, size
, style
);
98 GetSizer()->SetSizeHints(this);
101 ////@end wxRichTextSizePage creation
107 * wxRichTextSizePage destructor
110 wxRichTextSizePage::~wxRichTextSizePage()
112 ////@begin wxRichTextSizePage destruction
113 ////@end wxRichTextSizePage destruction
118 * Member initialisation
121 void wxRichTextSizePage::Init()
123 ////@begin wxRichTextSizePage member initialisation
124 m_parentSizer
= NULL
;
125 m_floatingControls
= NULL
;
127 m_widthCheckbox
= NULL
;
130 m_heightCheckbox
= NULL
;
133 m_alignmentControls
= NULL
;
134 m_verticalAlignmentCheckbox
= NULL
;
135 m_verticalAlignmentComboBox
= NULL
;
136 m_positionControls
= NULL
;
137 m_moveObjectParentSizer
= NULL
;
138 m_offsetYCheckbox
= NULL
;
140 m_unitsOffset
= NULL
;
141 m_moveObjectSizer
= NULL
;
142 ////@end wxRichTextSizePage member initialisation
147 * Control creation for wxRichTextSizePage
150 void wxRichTextSizePage::CreateControls()
152 ////@begin wxRichTextSizePage content construction
153 wxRichTextSizePage
* itemRichTextDialogPage1
= this;
155 wxBoxSizer
* itemBoxSizer2
= new wxBoxSizer(wxVERTICAL
);
156 itemRichTextDialogPage1
->SetSizer(itemBoxSizer2
);
158 m_parentSizer
= new wxBoxSizer(wxVERTICAL
);
159 itemBoxSizer2
->Add(m_parentSizer
, 0, wxGROW
|wxALL
, 5);
161 m_floatingControls
= new wxBoxSizer(wxVERTICAL
);
162 m_parentSizer
->Add(m_floatingControls
, 0, wxGROW
, 5);
164 wxBoxSizer
* itemBoxSizer5
= new wxBoxSizer(wxHORIZONTAL
);
165 m_floatingControls
->Add(itemBoxSizer5
, 0, wxGROW
, 5);
167 wxStaticText
* itemStaticText6
= new wxStaticText( itemRichTextDialogPage1
, wxID_STATIC
, _("Floating"), wxDefaultPosition
, wxDefaultSize
, 0 );
168 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("")));
169 itemBoxSizer5
->Add(itemStaticText6
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
171 wxStaticLine
* itemStaticLine7
= new wxStaticLine( itemRichTextDialogPage1
, wxID_STATIC
, wxDefaultPosition
, wxDefaultSize
, wxLI_HORIZONTAL
);
172 itemBoxSizer5
->Add(itemStaticLine7
, 1, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
174 wxBoxSizer
* itemBoxSizer8
= new wxBoxSizer(wxHORIZONTAL
);
175 m_floatingControls
->Add(itemBoxSizer8
, 0, wxGROW
, 5);
177 itemBoxSizer8
->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
179 wxFlexGridSizer
* itemFlexGridSizer10
= new wxFlexGridSizer(0, 2, 0, 0);
180 itemBoxSizer8
->Add(itemFlexGridSizer10
, 0, wxALIGN_CENTER_VERTICAL
|wxRIGHT
, 5);
182 wxStaticText
* itemStaticText11
= new wxStaticText( itemRichTextDialogPage1
, wxID_STATIC
, _("&Floating mode:"), wxDefaultPosition
, wxDefaultSize
, 0 );
183 itemFlexGridSizer10
->Add(itemStaticText11
, 0, wxALIGN_RIGHT
|wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
185 wxArrayString m_floatStrings
;
186 m_floatStrings
.Add(_("None"));
187 m_floatStrings
.Add(_("Left"));
188 m_floatStrings
.Add(_("Right"));
189 m_float
= new wxComboBox( itemRichTextDialogPage1
, ID_RICHTEXT_FLOATING_MODE
, _("None"), wxDefaultPosition
, wxSize(80, -1), m_floatStrings
, wxCB_READONLY
);
190 m_float
->SetStringSelection(_("None"));
191 m_float
->SetHelpText(_("How the object will float relative to the text."));
192 if (wxRichTextSizePage::ShowToolTips())
193 m_float
->SetToolTip(_("How the object will float relative to the text."));
194 itemFlexGridSizer10
->Add(m_float
, 0, wxALIGN_LEFT
|wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
196 wxBoxSizer
* itemBoxSizer13
= new wxBoxSizer(wxHORIZONTAL
);
197 m_parentSizer
->Add(itemBoxSizer13
, 0, wxGROW
, 5);
199 wxStaticText
* itemStaticText14
= new wxStaticText( itemRichTextDialogPage1
, wxID_STATIC
, _("Size"), wxDefaultPosition
, wxDefaultSize
, 0 );
200 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("")));
201 itemBoxSizer13
->Add(itemStaticText14
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
203 wxStaticLine
* itemStaticLine15
= new wxStaticLine( itemRichTextDialogPage1
, wxID_STATIC
, wxDefaultPosition
, wxDefaultSize
, wxLI_HORIZONTAL
);
204 itemBoxSizer13
->Add(itemStaticLine15
, 1, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
206 wxBoxSizer
* itemBoxSizer16
= new wxBoxSizer(wxHORIZONTAL
);
207 m_parentSizer
->Add(itemBoxSizer16
, 0, wxGROW
, 5);
209 itemBoxSizer16
->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
211 wxFlexGridSizer
* itemFlexGridSizer18
= new wxFlexGridSizer(0, 2, 0, 0);
212 itemBoxSizer16
->Add(itemFlexGridSizer18
, 0, wxALIGN_CENTER_VERTICAL
, 5);
214 m_widthCheckbox
= new wxCheckBox( itemRichTextDialogPage1
, ID_RICHTEXT_WIDTH_CHECKBOX
, _("&Width:"), wxDefaultPosition
, wxDefaultSize
, 0 );
215 m_widthCheckbox
->SetValue(false);
216 m_widthCheckbox
->SetHelpText(_("Enable the width value."));
217 if (wxRichTextSizePage::ShowToolTips())
218 m_widthCheckbox
->SetToolTip(_("Enable the width value."));
219 itemFlexGridSizer18
->Add(m_widthCheckbox
, 0, wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
221 wxBoxSizer
* itemBoxSizer20
= new wxBoxSizer(wxHORIZONTAL
);
222 itemFlexGridSizer18
->Add(itemBoxSizer20
, 0, wxALIGN_LEFT
|wxALIGN_CENTER_VERTICAL
, 5);
224 m_width
= new wxTextCtrl( itemRichTextDialogPage1
, ID_RICHTEXT_WIDTH
, wxEmptyString
, wxDefaultPosition
, wxSize(65, -1), 0 );
225 m_width
->SetHelpText(_("The object width."));
226 if (wxRichTextSizePage::ShowToolTips())
227 m_width
->SetToolTip(_("The object width."));
228 itemBoxSizer20
->Add(m_width
, 0, wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
230 wxArrayString m_unitsWStrings
;
231 m_unitsWStrings
.Add(_("px"));
232 m_unitsWStrings
.Add(_("cm"));
233 m_unitsW
= new wxComboBox( itemRichTextDialogPage1
, ID_RICHTEXT_UNITS_W
, _("px"), wxDefaultPosition
, wxSize(60, -1), m_unitsWStrings
, wxCB_READONLY
);
234 m_unitsW
->SetStringSelection(_("px"));
235 m_unitsW
->SetHelpText(_("Units for the object width."));
236 if (wxRichTextSizePage::ShowToolTips())
237 m_unitsW
->SetToolTip(_("Units for the object width."));
238 itemBoxSizer20
->Add(m_unitsW
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
240 m_heightCheckbox
= new wxCheckBox( itemRichTextDialogPage1
, ID_RICHTEXT_HEIGHT_CHECKBOX
, _("&Height:"), wxDefaultPosition
, wxDefaultSize
, 0 );
241 m_heightCheckbox
->SetValue(false);
242 m_heightCheckbox
->SetHelpText(_("Enable the height value."));
243 if (wxRichTextSizePage::ShowToolTips())
244 m_heightCheckbox
->SetToolTip(_("Enable the height value."));
245 itemFlexGridSizer18
->Add(m_heightCheckbox
, 0, wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
247 wxBoxSizer
* itemBoxSizer24
= new wxBoxSizer(wxHORIZONTAL
);
248 itemFlexGridSizer18
->Add(itemBoxSizer24
, 0, wxALIGN_LEFT
|wxALIGN_CENTER_VERTICAL
, 5);
250 m_height
= new wxTextCtrl( itemRichTextDialogPage1
, ID_RICHTEXT_HEIGHT
, wxEmptyString
, wxDefaultPosition
, wxSize(65, -1), 0 );
251 m_height
->SetHelpText(_("The object height."));
252 if (wxRichTextSizePage::ShowToolTips())
253 m_height
->SetToolTip(_("The object height."));
254 itemBoxSizer24
->Add(m_height
, 0, wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
256 wxArrayString m_unitsHStrings
;
257 m_unitsHStrings
.Add(_("px"));
258 m_unitsHStrings
.Add(_("cm"));
259 m_unitsH
= new wxComboBox( itemRichTextDialogPage1
, ID_RICHTEXT_UNITS_H
, _("px"), wxDefaultPosition
, wxSize(60, -1), m_unitsHStrings
, wxCB_READONLY
);
260 m_unitsH
->SetStringSelection(_("px"));
261 m_unitsH
->SetHelpText(_("Units for the object height."));
262 if (wxRichTextSizePage::ShowToolTips())
263 m_unitsH
->SetToolTip(_("Units for the object height."));
264 itemBoxSizer24
->Add(m_unitsH
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
266 m_alignmentControls
= new wxBoxSizer(wxVERTICAL
);
267 m_parentSizer
->Add(m_alignmentControls
, 0, wxGROW
, 5);
269 wxBoxSizer
* itemBoxSizer28
= new wxBoxSizer(wxHORIZONTAL
);
270 m_alignmentControls
->Add(itemBoxSizer28
, 0, wxGROW
, 5);
272 wxStaticText
* itemStaticText29
= new wxStaticText( itemRichTextDialogPage1
, wxID_STATIC
, _("Alignment"), wxDefaultPosition
, wxDefaultSize
, 0 );
273 itemStaticText29
->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("")));
274 itemBoxSizer28
->Add(itemStaticText29
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
276 wxStaticLine
* itemStaticLine30
= new wxStaticLine( itemRichTextDialogPage1
, wxID_STATIC
, wxDefaultPosition
, wxDefaultSize
, wxLI_HORIZONTAL
);
277 itemBoxSizer28
->Add(itemStaticLine30
, 1, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
279 wxBoxSizer
* itemBoxSizer31
= new wxBoxSizer(wxHORIZONTAL
);
280 m_alignmentControls
->Add(itemBoxSizer31
, 0, wxGROW
, 5);
282 itemBoxSizer31
->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
284 m_verticalAlignmentCheckbox
= new wxCheckBox( itemRichTextDialogPage1
, ID_RICHTEXT_VERTICAL_ALIGNMENT_CHECKBOX
, _("&Vertical alignment:"), wxDefaultPosition
, wxDefaultSize
, 0 );
285 m_verticalAlignmentCheckbox
->SetValue(false);
286 m_verticalAlignmentCheckbox
->SetHelpText(_("Enable vertical alignment."));
287 if (wxRichTextSizePage::ShowToolTips())
288 m_verticalAlignmentCheckbox
->SetToolTip(_("Enable vertical alignment."));
289 itemBoxSizer31
->Add(m_verticalAlignmentCheckbox
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
291 wxArrayString m_verticalAlignmentComboBoxStrings
;
292 m_verticalAlignmentComboBoxStrings
.Add(_("Top"));
293 m_verticalAlignmentComboBoxStrings
.Add(_("Centred"));
294 m_verticalAlignmentComboBoxStrings
.Add(_("Bottom"));
295 m_verticalAlignmentComboBox
= new wxComboBox( itemRichTextDialogPage1
, ID_RICHTEXT_VERTICAL_ALIGNMENT_COMBOBOX
, _("Top"), wxDefaultPosition
, wxDefaultSize
, m_verticalAlignmentComboBoxStrings
, wxCB_READONLY
);
296 m_verticalAlignmentComboBox
->SetStringSelection(_("Top"));
297 m_verticalAlignmentComboBox
->SetHelpText(_("Vertical alignment."));
298 if (wxRichTextSizePage::ShowToolTips())
299 m_verticalAlignmentComboBox
->SetToolTip(_("Vertical alignment."));
300 itemBoxSizer31
->Add(m_verticalAlignmentComboBox
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
302 m_positionControls
= new wxBoxSizer(wxVERTICAL
);
303 m_parentSizer
->Add(m_positionControls
, 0, wxGROW
, 5);
305 wxBoxSizer
* itemBoxSizer36
= new wxBoxSizer(wxHORIZONTAL
);
306 m_positionControls
->Add(itemBoxSizer36
, 0, wxGROW
, 5);
308 wxStaticText
* itemStaticText37
= new wxStaticText( itemRichTextDialogPage1
, wxID_STATIC
, _("Position"), wxDefaultPosition
, wxDefaultSize
, 0 );
309 itemStaticText37
->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("")));
310 itemBoxSizer36
->Add(itemStaticText37
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
312 wxStaticLine
* itemStaticLine38
= new wxStaticLine( itemRichTextDialogPage1
, wxID_STATIC
, wxDefaultPosition
, wxDefaultSize
, wxLI_HORIZONTAL
);
313 itemBoxSizer36
->Add(itemStaticLine38
, 1, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
315 wxBoxSizer
* itemBoxSizer39
= new wxBoxSizer(wxHORIZONTAL
);
316 m_positionControls
->Add(itemBoxSizer39
, 0, wxGROW
, 5);
318 itemBoxSizer39
->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
320 m_moveObjectParentSizer
= new wxBoxSizer(wxVERTICAL
);
321 itemBoxSizer39
->Add(m_moveObjectParentSizer
, 0, wxALIGN_TOP
, 5);
323 wxBoxSizer
* itemBoxSizer42
= new wxBoxSizer(wxHORIZONTAL
);
324 m_moveObjectParentSizer
->Add(itemBoxSizer42
, 0, wxGROW
, 5);
326 m_offsetYCheckbox
= new wxCheckBox( itemRichTextDialogPage1
, ID_RICHTEXT_OFFSET_CHECKBOX
, _("Vertical &Offset:"), wxDefaultPosition
, wxDefaultSize
, 0 );
327 m_offsetYCheckbox
->SetValue(false);
328 m_offsetYCheckbox
->SetHelpText(_("Enable vertical offset."));
329 if (wxRichTextSizePage::ShowToolTips())
330 m_offsetYCheckbox
->SetToolTip(_("Enable vertical offset."));
331 itemBoxSizer42
->Add(m_offsetYCheckbox
, 0, wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
333 m_offset
= new wxTextCtrl( itemRichTextDialogPage1
, ID_RICHTEXT_OFFSET
, wxEmptyString
, wxDefaultPosition
, wxSize(65, -1), 0 );
334 m_offset
->SetMaxLength(10);
335 m_offset
->SetHelpText(_("The vertical offset relative to the paragraph."));
336 if (wxRichTextSizePage::ShowToolTips())
337 m_offset
->SetToolTip(_("The vertical offset relative to the paragraph."));
338 itemBoxSizer42
->Add(m_offset
, 0, wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
340 wxArrayString m_unitsOffsetStrings
;
341 m_unitsOffsetStrings
.Add(_("px"));
342 m_unitsOffsetStrings
.Add(_("cm"));
343 m_unitsOffset
= new wxComboBox( itemRichTextDialogPage1
, ID_RICHTEXT_OFFSET_UNITS
, _("px"), wxDefaultPosition
, wxSize(60, -1), m_unitsOffsetStrings
, wxCB_READONLY
);
344 m_unitsOffset
->SetStringSelection(_("px"));
345 m_unitsOffset
->SetHelpText(_("Units for the object offset."));
346 if (wxRichTextSizePage::ShowToolTips())
347 m_unitsOffset
->SetToolTip(_("Units for the object offset."));
348 itemBoxSizer42
->Add(m_unitsOffset
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
350 m_moveObjectSizer
= new wxBoxSizer(wxHORIZONTAL
);
351 m_moveObjectParentSizer
->Add(m_moveObjectSizer
, 0, wxGROW
, 5);
353 wxStaticText
* itemStaticText47
= new wxStaticText( itemRichTextDialogPage1
, wxID_STATIC
, _("&Move the object to:"), wxDefaultPosition
, wxDefaultSize
, 0 );
354 m_moveObjectSizer
->Add(itemStaticText47
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
356 wxButton
* itemButton48
= new wxButton( itemRichTextDialogPage1
, ID_RICHTEXT_PARA_UP
, _("&Previous Paragraph"), wxDefaultPosition
, wxDefaultSize
, 0 );
357 itemButton48
->SetHelpText(_("Moves the object to the previous paragraph."));
358 if (wxRichTextSizePage::ShowToolTips())
359 itemButton48
->SetToolTip(_("Moves the object to the previous paragraph."));
360 m_moveObjectSizer
->Add(itemButton48
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
362 wxButton
* itemButton49
= new wxButton( itemRichTextDialogPage1
, ID_RICHTEXT_PARA_DOWN
, _("&Next Paragraph"), wxDefaultPosition
, wxDefaultSize
, 0 );
363 itemButton49
->SetHelpText(_("Moves the object to the next paragraph."));
364 if (wxRichTextSizePage::ShowToolTips())
365 itemButton49
->SetToolTip(_("Moves the object to the next paragraph."));
366 m_moveObjectSizer
->Add(itemButton49
, 0, wxALIGN_CENTER_VERTICAL
|wxRIGHT
|wxTOP
|wxBOTTOM
, 5);
368 ////@end wxRichTextSizePage content construction
371 wxRichTextAttr
* wxRichTextSizePage::GetAttributes()
373 return wxRichTextFormattingDialog::GetDialogAttributes(this);
377 * Should we show tooltips?
380 bool wxRichTextSizePage::ShowToolTips()
385 bool wxRichTextSizePage::TransferDataToWindow()
387 m_float
->SetSelection(GetAttributes()->GetTextBoxAttr().GetFloatMode());
388 m_verticalAlignmentCheckbox
->SetValue(GetAttributes()->GetTextBoxAttr().HasVerticalAlignment());
389 if (GetAttributes()->GetTextBoxAttr().HasVerticalAlignment())
391 if ((int) GetAttributes()->GetTextBoxAttr().GetVerticalAlignment() > 0 &&
392 (int) GetAttributes()->GetTextBoxAttr().GetVerticalAlignment() < 4)
394 m_verticalAlignmentComboBox
->SetSelection(((int) GetAttributes()->GetTextBoxAttr().GetVerticalAlignment() - 1));
397 m_verticalAlignmentComboBox
->SetSelection(0);
400 wxRichTextFormattingDialog
* dialog
= wxRichTextFormattingDialog::GetDialog(this);
404 // Only show the Move Object controls if there's an object.
405 if (!dialog
->GetObject())
407 m_moveObjectParentSizer
->Show(m_moveObjectSizer
, false);
408 GetSizer()->Layout();
412 if (dialog
&& dialog
->GetObject())
414 wxTextAttrSize size
= dialog
->GetObject()->GetNaturalSize();
415 if (size
.GetWidth().IsValid() && size
.GetHeight().IsValid())
417 if (!GetAttributes()->GetTextBoxAttr().GetWidth().IsValid() || GetAttributes()->GetTextBoxAttr().GetWidth().GetValue() <= 0)
419 GetAttributes()->GetTextBoxAttr().GetWidth() = size
.GetWidth();
422 if (!GetAttributes()->GetTextBoxAttr().GetHeight().IsValid() || GetAttributes()->GetTextBoxAttr().GetHeight().GetValue() <= 0)
424 GetAttributes()->GetTextBoxAttr().GetHeight() = size
.GetHeight();
429 wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetWidth(), m_width
, m_unitsW
, m_widthCheckbox
);
430 wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetHeight(), m_height
, m_unitsH
, m_heightCheckbox
);
431 wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetTop(), m_offset
, m_unitsOffset
, m_offsetYCheckbox
);
436 bool wxRichTextSizePage::TransferDataFromWindow()
438 GetAttributes()->GetTextBoxAttr().SetFloatMode((wxTextBoxAttrFloatStyle
) m_float
->GetSelection());
439 if (m_float
->GetSelection() == 0)
440 GetAttributes()->GetTextBoxAttr().RemoveFlag(wxTEXT_BOX_ATTR_FLOAT
);
442 if (m_verticalAlignmentCheckbox
->GetValue())
443 GetAttributes()->GetTextBoxAttr().SetVerticalAlignment((wxTextBoxAttrVerticalAlignment
) (m_verticalAlignmentComboBox
->GetSelection() + 1));
446 GetAttributes()->GetTextBoxAttr().SetVerticalAlignment(wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT_NONE
);
447 GetAttributes()->GetTextBoxAttr().RemoveFlag(wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT
);
450 wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetWidth(), m_width
, m_unitsW
, m_widthCheckbox
);
451 wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetHeight(), m_height
, m_unitsH
, m_heightCheckbox
);
452 wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetTop(), m_offset
, m_unitsOffset
, m_offsetYCheckbox
);
457 // Show/hide position controls
458 void wxRichTextSizePage::ShowPositionControls(bool show
)
462 m_parentSizer
->Show(m_positionControls
, show
);
467 // Show/hide floating controls
468 void wxRichTextSizePage::ShowFloatingControls(bool show
)
472 m_parentSizer
->Show(m_floatingControls
, show
);
479 * Get bitmap resources
482 wxBitmap
wxRichTextSizePage::GetBitmapResource( const wxString
& name
)
485 ////@begin wxRichTextSizePage bitmap retrieval
488 ////@end wxRichTextSizePage bitmap retrieval
495 wxIcon
wxRichTextSizePage::GetIconResource( const wxString
& name
)
498 ////@begin wxRichTextSizePage icon retrieval
501 ////@end wxRichTextSizePage icon retrieval
506 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_WIDTH
509 void wxRichTextSizePage::OnRichtextWidthUpdate( wxUpdateUIEvent
& event
)
511 event
.Enable(m_widthCheckbox
->GetValue());
515 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_HEIGHT
518 void wxRichTextSizePage::OnRichtextHeightUpdate( wxUpdateUIEvent
& event
)
520 event
.Enable(m_heightCheckbox
->GetValue());
524 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_OFFSET
527 void wxRichTextSizePage::OnRichtextOffsetUpdate( wxUpdateUIEvent
& event
)
529 event
.Enable(m_offsetYCheckbox
->GetValue());
534 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXT_PARA_UP
537 void wxRichTextSizePage::OnRichtextParaUpClick( wxCommandEvent
& WXUNUSED(event
) )
539 wxRichTextFormattingDialog
* dialog
= wxRichTextFormattingDialog::GetDialog(this);
540 if (!dialog
|| !dialog
->GetObject())
543 // Make sure object attributes are up-to-date
544 dialog
->TransferDataFromWindow();
546 wxRichTextBuffer
* buffer
= dialog
->GetObject()->GetBuffer();
547 wxRichTextParagraphLayoutBox
* container
= dialog
->GetObject()->GetParentContainer();
548 wxRichTextObject
* parent
= dialog
->GetObject()->GetParent();
549 if (!container
|| !parent
|| !buffer
)
552 wxRichTextRange range
= dialog
->GetObject()->GetRange();
553 wxRichTextObjectList::compatibility_iterator iter
= container
->GetChildren().GetFirst();
559 if (iter
->GetData() == parent
)
561 iter
= iter
->GetNext();
565 iter
= iter
->GetPrevious();
569 wxRichTextObject
*obj
= iter
->GetData();
570 wxRichTextRange rg
= obj
->GetRange();
571 // tempObj will be deleted along with the undo object, and a clone of it will be
572 // returned by InsertObjectWithUndo
573 wxRichTextObject
* tempObj
= dialog
->GetObject()->Clone();
575 container
->DeleteRangeWithUndo(range
, buffer
->GetRichTextCtrl(), buffer
);
577 wxRichTextObject
* obj2
= container
->InsertObjectWithUndo(rg
.GetStart(), tempObj
, buffer
->GetRichTextCtrl(), buffer
, 0);
578 dialog
->SetObject(obj2
);
582 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXT_DOWN
585 void wxRichTextSizePage::OnRichtextParaDownClick( wxCommandEvent
& WXUNUSED(event
) )
587 wxRichTextFormattingDialog
* dialog
= wxRichTextFormattingDialog::GetDialog(this);
588 if (!dialog
|| !dialog
->GetObject())
591 // Make sure object attributes are up-to-date
592 dialog
->TransferDataFromWindow();
594 wxRichTextBuffer
* buffer
= dialog
->GetObject()->GetBuffer();
595 wxRichTextParagraphLayoutBox
* container
= dialog
->GetObject()->GetParentContainer();
596 wxRichTextObject
* parent
= dialog
->GetObject()->GetParent();
597 if (!container
|| !parent
|| !buffer
)
600 wxRichTextRange range
= dialog
->GetObject()->GetRange();
602 wxRichTextObjectList::compatibility_iterator iter
= buffer
->GetChildren().GetFirst();
608 if (iter
->GetData() == parent
)
610 iter
= iter
->GetNext();
613 iter
= iter
->GetNext();
617 wxRichTextObject
*obj
= iter
->GetData();
618 wxRichTextRange rg
= obj
->GetRange();
619 // tempObj will be deleted along with the undo object, and a clone of it will be
620 // returned by InsertObjectWithUndo
621 wxRichTextObject
* tempObj
= dialog
->GetObject()->Clone();
623 container
->DeleteRangeWithUndo(range
, buffer
->GetRichTextCtrl(), buffer
);
625 // Minus one because we deleted an object
626 wxRichTextObject
* obj2
= container
->InsertObjectWithUndo(rg
.GetStart()-1, tempObj
, buffer
->GetRichTextCtrl(), buffer
, 0);
627 dialog
->SetObject(obj2
);
632 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_VERTICAL_ALIGNMENT_COMBOBOX
635 void wxRichTextSizePage::OnRichtextVerticalAlignmentComboboxUpdate( wxUpdateUIEvent
& event
)
637 event
.Enable(m_verticalAlignmentCheckbox
->GetValue());