1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/richtext/richtextsizepage.cpp
4 // Author: Julian Smart
6 // Created: 20/10/2010 10:23:24
8 // Copyright: (c) Julian Smart
10 /////////////////////////////////////////////////////////////////////////////
12 #include "wx/richtext/richtextsizepage.h"
19 * wxRichTextSizePage type definition
22 IMPLEMENT_DYNAMIC_CLASS( wxRichTextSizePage
, wxRichTextDialogPage
)
26 * wxRichTextSizePage event table definition
29 BEGIN_EVENT_TABLE( wxRichTextSizePage
, wxRichTextDialogPage
)
31 ////@begin wxRichTextSizePage event table entries
32 EVT_UPDATE_UI( ID_RICHTEXT_WIDTH
, wxRichTextSizePage::OnRichtextWidthUpdate
)
34 EVT_UPDATE_UI( ID_RICHTEXT_UNITS_W
, wxRichTextSizePage::OnRichtextWidthUpdate
)
36 EVT_UPDATE_UI( ID_RICHTEXT_HEIGHT
, wxRichTextSizePage::OnRichtextHeightUpdate
)
38 EVT_UPDATE_UI( ID_RICHTEXT_UNITS_H
, wxRichTextSizePage::OnRichtextHeightUpdate
)
40 EVT_UPDATE_UI( ID_RICHTEXT_VERTICAL_ALIGNMENT_COMBOBOX
, wxRichTextSizePage::OnRichtextVerticalAlignmentComboboxUpdate
)
42 EVT_UPDATE_UI( ID_RICHTEXT_OFFSET
, wxRichTextSizePage::OnRichtextOffsetUpdate
)
44 EVT_UPDATE_UI( ID_RICHTEXT_OFFSET_UNITS
, wxRichTextSizePage::OnRichtextOffsetUpdate
)
46 EVT_BUTTON( ID_RICHTEXT_PARA_UP
, wxRichTextSizePage::OnRichtextParaUpClick
)
48 EVT_BUTTON( ID_RICHTEXT_PARA_DOWN
, wxRichTextSizePage::OnRichtextParaDownClick
)
50 ////@end wxRichTextSizePage event table entries
54 IMPLEMENT_HELP_PROVISION(wxRichTextSizePage
)
57 * wxRichTextSizePage constructors
60 wxRichTextSizePage::wxRichTextSizePage()
65 wxRichTextSizePage::wxRichTextSizePage( wxWindow
* parent
, wxWindowID id
, const wxPoint
& pos
, const wxSize
& size
, long style
)
68 Create(parent
, id
, pos
, size
, style
);
73 * wxRichTextSizePage creator
76 bool wxRichTextSizePage::Create( wxWindow
* parent
, wxWindowID id
, const wxPoint
& pos
, const wxSize
& size
, long style
)
78 ////@begin wxRichTextSizePage creation
79 wxRichTextDialogPage::Create( parent
, id
, pos
, size
, style
);
84 GetSizer()->SetSizeHints(this);
87 ////@end wxRichTextSizePage creation
93 * wxRichTextSizePage destructor
96 wxRichTextSizePage::~wxRichTextSizePage()
98 ////@begin wxRichTextSizePage destruction
99 ////@end wxRichTextSizePage destruction
104 * Member initialisation
107 void wxRichTextSizePage::Init()
109 ////@begin wxRichTextSizePage member initialisation
110 m_parentSizer
= NULL
;
111 m_floatingControls
= NULL
;
113 m_widthCheckbox
= NULL
;
116 m_heightCheckbox
= NULL
;
119 m_alignmentControls
= NULL
;
120 m_verticalAlignmentCheckbox
= NULL
;
121 m_verticalAlignmentComboBox
= NULL
;
122 m_positionControls
= NULL
;
123 m_moveObjectParentSizer
= NULL
;
124 m_offsetYCheckbox
= NULL
;
126 m_unitsOffset
= NULL
;
127 m_moveObjectSizer
= NULL
;
128 ////@end wxRichTextSizePage member initialisation
133 * Control creation for wxRichTextSizePage
136 void wxRichTextSizePage::CreateControls()
138 ////@begin wxRichTextSizePage content construction
139 wxRichTextSizePage
* itemRichTextDialogPage1
= this;
141 wxBoxSizer
* itemBoxSizer2
= new wxBoxSizer(wxVERTICAL
);
142 itemRichTextDialogPage1
->SetSizer(itemBoxSizer2
);
144 m_parentSizer
= new wxBoxSizer(wxVERTICAL
);
145 itemBoxSizer2
->Add(m_parentSizer
, 0, wxGROW
|wxALL
, 5);
147 m_floatingControls
= new wxBoxSizer(wxVERTICAL
);
148 m_parentSizer
->Add(m_floatingControls
, 0, wxGROW
, 5);
150 wxBoxSizer
* itemBoxSizer5
= new wxBoxSizer(wxHORIZONTAL
);
151 m_floatingControls
->Add(itemBoxSizer5
, 0, wxGROW
, 5);
153 wxStaticText
* itemStaticText6
= new wxStaticText( itemRichTextDialogPage1
, wxID_STATIC
, _("Floating"), wxDefaultPosition
, wxDefaultSize
, 0 );
154 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("")));
155 itemBoxSizer5
->Add(itemStaticText6
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
157 wxStaticLine
* itemStaticLine7
= new wxStaticLine( itemRichTextDialogPage1
, wxID_STATIC
, wxDefaultPosition
, wxDefaultSize
, wxLI_HORIZONTAL
);
158 itemBoxSizer5
->Add(itemStaticLine7
, 1, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
160 wxBoxSizer
* itemBoxSizer8
= new wxBoxSizer(wxHORIZONTAL
);
161 m_floatingControls
->Add(itemBoxSizer8
, 0, wxGROW
, 5);
163 itemBoxSizer8
->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
165 wxFlexGridSizer
* itemFlexGridSizer10
= new wxFlexGridSizer(0, 2, 0, 0);
166 itemBoxSizer8
->Add(itemFlexGridSizer10
, 0, wxALIGN_CENTER_VERTICAL
|wxRIGHT
, 5);
168 wxStaticText
* itemStaticText11
= new wxStaticText( itemRichTextDialogPage1
, wxID_STATIC
, _("&Floating mode:"), wxDefaultPosition
, wxDefaultSize
, 0 );
169 itemFlexGridSizer10
->Add(itemStaticText11
, 0, wxALIGN_RIGHT
|wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
171 wxArrayString m_floatStrings
;
172 m_floatStrings
.Add(_("None"));
173 m_floatStrings
.Add(_("Left"));
174 m_floatStrings
.Add(_("Right"));
175 m_float
= new wxComboBox( itemRichTextDialogPage1
, ID_RICHTEXT_FLOATING_MODE
, _("None"), wxDefaultPosition
, wxSize(80, -1), m_floatStrings
, wxCB_READONLY
);
176 m_float
->SetStringSelection(_("None"));
177 m_float
->SetHelpText(_("How the object will float relative to the text."));
178 if (wxRichTextSizePage::ShowToolTips())
179 m_float
->SetToolTip(_("How the object will float relative to the text."));
180 itemFlexGridSizer10
->Add(m_float
, 0, wxALIGN_LEFT
|wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
182 wxBoxSizer
* itemBoxSizer13
= new wxBoxSizer(wxHORIZONTAL
);
183 m_parentSizer
->Add(itemBoxSizer13
, 0, wxGROW
, 5);
185 wxStaticText
* itemStaticText14
= new wxStaticText( itemRichTextDialogPage1
, wxID_STATIC
, _("Size"), wxDefaultPosition
, wxDefaultSize
, 0 );
186 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("")));
187 itemBoxSizer13
->Add(itemStaticText14
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
189 wxStaticLine
* itemStaticLine15
= new wxStaticLine( itemRichTextDialogPage1
, wxID_STATIC
, wxDefaultPosition
, wxDefaultSize
, wxLI_HORIZONTAL
);
190 itemBoxSizer13
->Add(itemStaticLine15
, 1, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
192 wxBoxSizer
* itemBoxSizer16
= new wxBoxSizer(wxHORIZONTAL
);
193 m_parentSizer
->Add(itemBoxSizer16
, 0, wxGROW
, 5);
195 itemBoxSizer16
->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
197 wxFlexGridSizer
* itemFlexGridSizer18
= new wxFlexGridSizer(0, 2, 0, 0);
198 itemBoxSizer16
->Add(itemFlexGridSizer18
, 0, wxALIGN_CENTER_VERTICAL
, 5);
200 m_widthCheckbox
= new wxCheckBox( itemRichTextDialogPage1
, ID_RICHTEXT_WIDTH_CHECKBOX
, _("&Width:"), wxDefaultPosition
, wxDefaultSize
, 0 );
201 m_widthCheckbox
->SetValue(false);
202 m_widthCheckbox
->SetHelpText(_("Enable the width value."));
203 if (wxRichTextSizePage::ShowToolTips())
204 m_widthCheckbox
->SetToolTip(_("Enable the width value."));
205 itemFlexGridSizer18
->Add(m_widthCheckbox
, 0, wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
207 wxBoxSizer
* itemBoxSizer20
= new wxBoxSizer(wxHORIZONTAL
);
208 itemFlexGridSizer18
->Add(itemBoxSizer20
, 0, wxALIGN_LEFT
|wxALIGN_CENTER_VERTICAL
, 5);
210 m_width
= new wxTextCtrl( itemRichTextDialogPage1
, ID_RICHTEXT_WIDTH
, wxEmptyString
, wxDefaultPosition
, wxSize(65, -1), 0 );
211 m_width
->SetHelpText(_("The object width."));
212 if (wxRichTextSizePage::ShowToolTips())
213 m_width
->SetToolTip(_("The object width."));
214 itemBoxSizer20
->Add(m_width
, 0, wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
216 wxArrayString m_unitsWStrings
;
217 m_unitsWStrings
.Add(_("px"));
218 m_unitsWStrings
.Add(_("cm"));
219 m_unitsWStrings
.Add(_("percent"));
220 m_unitsW
= new wxComboBox( itemRichTextDialogPage1
, ID_RICHTEXT_UNITS_W
, _("px"), wxDefaultPosition
, wxSize(60, -1), m_unitsWStrings
, wxCB_READONLY
);
221 m_unitsW
->SetStringSelection(_("px"));
222 m_unitsW
->SetHelpText(_("Units for the object width."));
223 if (wxRichTextSizePage::ShowToolTips())
224 m_unitsW
->SetToolTip(_("Units for the object width."));
225 itemBoxSizer20
->Add(m_unitsW
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
227 m_heightCheckbox
= new wxCheckBox( itemRichTextDialogPage1
, ID_RICHTEXT_HEIGHT_CHECKBOX
, _("&Height:"), wxDefaultPosition
, wxDefaultSize
, 0 );
228 m_heightCheckbox
->SetValue(false);
229 m_heightCheckbox
->SetHelpText(_("Enable the height value."));
230 if (wxRichTextSizePage::ShowToolTips())
231 m_heightCheckbox
->SetToolTip(_("Enable the height value."));
232 itemFlexGridSizer18
->Add(m_heightCheckbox
, 0, wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
234 wxBoxSizer
* itemBoxSizer24
= new wxBoxSizer(wxHORIZONTAL
);
235 itemFlexGridSizer18
->Add(itemBoxSizer24
, 0, wxALIGN_LEFT
|wxALIGN_CENTER_VERTICAL
, 5);
237 m_height
= new wxTextCtrl( itemRichTextDialogPage1
, ID_RICHTEXT_HEIGHT
, wxEmptyString
, wxDefaultPosition
, wxSize(65, -1), 0 );
238 m_height
->SetHelpText(_("The object height."));
239 if (wxRichTextSizePage::ShowToolTips())
240 m_height
->SetToolTip(_("The object height."));
241 itemBoxSizer24
->Add(m_height
, 0, wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
243 wxArrayString m_unitsHStrings
;
244 m_unitsHStrings
.Add(_("px"));
245 m_unitsHStrings
.Add(_("cm"));
246 m_unitsHStrings
.Add(_("percent"));
247 m_unitsH
= new wxComboBox( itemRichTextDialogPage1
, ID_RICHTEXT_UNITS_H
, _("px"), wxDefaultPosition
, wxSize(60, -1), m_unitsHStrings
, wxCB_READONLY
);
248 m_unitsH
->SetStringSelection(_("px"));
249 m_unitsH
->SetHelpText(_("Units for the object height."));
250 if (wxRichTextSizePage::ShowToolTips())
251 m_unitsH
->SetToolTip(_("Units for the object height."));
252 itemBoxSizer24
->Add(m_unitsH
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
254 m_alignmentControls
= new wxBoxSizer(wxVERTICAL
);
255 m_parentSizer
->Add(m_alignmentControls
, 0, wxGROW
, 5);
257 wxBoxSizer
* itemBoxSizer28
= new wxBoxSizer(wxHORIZONTAL
);
258 m_alignmentControls
->Add(itemBoxSizer28
, 0, wxGROW
, 5);
260 wxStaticText
* itemStaticText29
= new wxStaticText( itemRichTextDialogPage1
, wxID_STATIC
, _("Alignment"), wxDefaultPosition
, wxDefaultSize
, 0 );
261 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("")));
262 itemBoxSizer28
->Add(itemStaticText29
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
264 wxStaticLine
* itemStaticLine30
= new wxStaticLine( itemRichTextDialogPage1
, wxID_STATIC
, wxDefaultPosition
, wxDefaultSize
, wxLI_HORIZONTAL
);
265 itemBoxSizer28
->Add(itemStaticLine30
, 1, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
267 wxBoxSizer
* itemBoxSizer31
= new wxBoxSizer(wxHORIZONTAL
);
268 m_alignmentControls
->Add(itemBoxSizer31
, 0, wxGROW
, 5);
270 itemBoxSizer31
->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
272 m_verticalAlignmentCheckbox
= new wxCheckBox( itemRichTextDialogPage1
, ID_RICHTEXT_VERTICAL_ALIGNMENT_CHECKBOX
, _("&Vertical alignment:"), wxDefaultPosition
, wxDefaultSize
, 0 );
273 m_verticalAlignmentCheckbox
->SetValue(false);
274 m_verticalAlignmentCheckbox
->SetHelpText(_("Enable vertical alignment."));
275 if (wxRichTextSizePage::ShowToolTips())
276 m_verticalAlignmentCheckbox
->SetToolTip(_("Enable vertical alignment."));
277 itemBoxSizer31
->Add(m_verticalAlignmentCheckbox
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
279 wxArrayString m_verticalAlignmentComboBoxStrings
;
280 m_verticalAlignmentComboBoxStrings
.Add(_("Top"));
281 m_verticalAlignmentComboBoxStrings
.Add(_("Centred"));
282 m_verticalAlignmentComboBoxStrings
.Add(_("Bottom"));
283 m_verticalAlignmentComboBox
= new wxComboBox( itemRichTextDialogPage1
, ID_RICHTEXT_VERTICAL_ALIGNMENT_COMBOBOX
, _("Top"), wxDefaultPosition
, wxDefaultSize
, m_verticalAlignmentComboBoxStrings
, wxCB_READONLY
);
284 m_verticalAlignmentComboBox
->SetStringSelection(_("Top"));
285 m_verticalAlignmentComboBox
->SetHelpText(_("Vertical alignment."));
286 if (wxRichTextSizePage::ShowToolTips())
287 m_verticalAlignmentComboBox
->SetToolTip(_("Vertical alignment."));
288 itemBoxSizer31
->Add(m_verticalAlignmentComboBox
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
290 m_positionControls
= new wxBoxSizer(wxVERTICAL
);
291 m_parentSizer
->Add(m_positionControls
, 0, wxGROW
, 5);
293 wxBoxSizer
* itemBoxSizer36
= new wxBoxSizer(wxHORIZONTAL
);
294 m_positionControls
->Add(itemBoxSizer36
, 0, wxGROW
, 5);
296 wxStaticText
* itemStaticText37
= new wxStaticText( itemRichTextDialogPage1
, wxID_STATIC
, _("Position"), wxDefaultPosition
, wxDefaultSize
, 0 );
297 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("")));
298 itemBoxSizer36
->Add(itemStaticText37
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
300 wxStaticLine
* itemStaticLine38
= new wxStaticLine( itemRichTextDialogPage1
, wxID_STATIC
, wxDefaultPosition
, wxDefaultSize
, wxLI_HORIZONTAL
);
301 itemBoxSizer36
->Add(itemStaticLine38
, 1, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
303 wxBoxSizer
* itemBoxSizer39
= new wxBoxSizer(wxHORIZONTAL
);
304 m_positionControls
->Add(itemBoxSizer39
, 0, wxGROW
, 5);
306 itemBoxSizer39
->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
308 m_moveObjectParentSizer
= new wxBoxSizer(wxVERTICAL
);
309 itemBoxSizer39
->Add(m_moveObjectParentSizer
, 0, wxALIGN_TOP
, 5);
311 wxBoxSizer
* itemBoxSizer42
= new wxBoxSizer(wxHORIZONTAL
);
312 m_moveObjectParentSizer
->Add(itemBoxSizer42
, 0, wxGROW
, 5);
314 m_offsetYCheckbox
= new wxCheckBox( itemRichTextDialogPage1
, ID_RICHTEXT_OFFSET_CHECKBOX
, _("Vertical &Offset:"), wxDefaultPosition
, wxDefaultSize
, 0 );
315 m_offsetYCheckbox
->SetValue(false);
316 m_offsetYCheckbox
->SetHelpText(_("Enable vertical offset."));
317 if (wxRichTextSizePage::ShowToolTips())
318 m_offsetYCheckbox
->SetToolTip(_("Enable vertical offset."));
319 itemBoxSizer42
->Add(m_offsetYCheckbox
, 0, wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
321 m_offset
= new wxTextCtrl( itemRichTextDialogPage1
, ID_RICHTEXT_OFFSET
, wxEmptyString
, wxDefaultPosition
, wxSize(65, -1), 0 );
322 m_offset
->SetMaxLength(10);
323 m_offset
->SetHelpText(_("The vertical offset relative to the paragraph."));
324 if (wxRichTextSizePage::ShowToolTips())
325 m_offset
->SetToolTip(_("The vertical offset relative to the paragraph."));
326 itemBoxSizer42
->Add(m_offset
, 0, wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
, 5);
328 wxArrayString m_unitsOffsetStrings
;
329 m_unitsOffsetStrings
.Add(_("px"));
330 m_unitsOffsetStrings
.Add(_("cm"));
331 m_unitsOffset
= new wxComboBox( itemRichTextDialogPage1
, ID_RICHTEXT_OFFSET_UNITS
, _("px"), wxDefaultPosition
, wxSize(60, -1), m_unitsOffsetStrings
, wxCB_READONLY
);
332 m_unitsOffset
->SetStringSelection(_("px"));
333 m_unitsOffset
->SetHelpText(_("Units for the object offset."));
334 if (wxRichTextSizePage::ShowToolTips())
335 m_unitsOffset
->SetToolTip(_("Units for the object offset."));
336 itemBoxSizer42
->Add(m_unitsOffset
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
338 m_moveObjectSizer
= new wxBoxSizer(wxHORIZONTAL
);
339 m_moveObjectParentSizer
->Add(m_moveObjectSizer
, 0, wxGROW
, 5);
341 wxStaticText
* itemStaticText47
= new wxStaticText( itemRichTextDialogPage1
, wxID_STATIC
, _("&Move the object to:"), wxDefaultPosition
, wxDefaultSize
, 0 );
342 m_moveObjectSizer
->Add(itemStaticText47
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
344 wxButton
* itemButton48
= new wxButton( itemRichTextDialogPage1
, ID_RICHTEXT_PARA_UP
, _("&Previous Paragraph"), wxDefaultPosition
, wxDefaultSize
, 0 );
345 itemButton48
->SetHelpText(_("Moves the object to the previous paragraph."));
346 if (wxRichTextSizePage::ShowToolTips())
347 itemButton48
->SetToolTip(_("Moves the object to the previous paragraph."));
348 m_moveObjectSizer
->Add(itemButton48
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
350 wxButton
* itemButton49
= new wxButton( itemRichTextDialogPage1
, ID_RICHTEXT_PARA_DOWN
, _("&Next Paragraph"), wxDefaultPosition
, wxDefaultSize
, 0 );
351 itemButton49
->SetHelpText(_("Moves the object to the next paragraph."));
352 if (wxRichTextSizePage::ShowToolTips())
353 itemButton49
->SetToolTip(_("Moves the object to the next paragraph."));
354 m_moveObjectSizer
->Add(itemButton49
, 0, wxALIGN_CENTER_VERTICAL
|wxRIGHT
|wxTOP
|wxBOTTOM
, 5);
356 ////@end wxRichTextSizePage content construction
359 wxRichTextAttr
* wxRichTextSizePage::GetAttributes()
361 return wxRichTextFormattingDialog::GetDialogAttributes(this);
365 * Should we show tooltips?
368 bool wxRichTextSizePage::ShowToolTips()
373 bool wxRichTextSizePage::TransferDataToWindow()
375 m_float
->SetSelection(GetAttributes()->GetTextBoxAttr().GetFloatMode());
376 m_verticalAlignmentCheckbox
->SetValue(GetAttributes()->GetTextBoxAttr().HasVerticalAlignment());
377 if (GetAttributes()->GetTextBoxAttr().HasVerticalAlignment())
379 if ((int) GetAttributes()->GetTextBoxAttr().GetVerticalAlignment() > 0 &&
380 (int) GetAttributes()->GetTextBoxAttr().GetVerticalAlignment() < 4)
382 m_verticalAlignmentComboBox
->SetSelection(((int) GetAttributes()->GetTextBoxAttr().GetVerticalAlignment() - 1));
385 m_verticalAlignmentComboBox
->SetSelection(0);
388 wxRichTextFormattingDialog
* dialog
= wxRichTextFormattingDialog::GetDialog(this);
392 // Only show the Move Object controls if there's an object.
393 if (!dialog
->GetObject())
395 m_moveObjectParentSizer
->Show(m_moveObjectSizer
, false);
396 GetSizer()->Layout();
400 if (dialog
&& dialog
->GetObject())
402 wxTextAttrSize size
= dialog
->GetObject()->GetNaturalSize();
403 if (size
.GetWidth().IsValid() && size
.GetHeight().IsValid())
405 if (!GetAttributes()->GetTextBoxAttr().GetWidth().IsValid() || GetAttributes()->GetTextBoxAttr().GetWidth().GetValue() <= 0)
407 GetAttributes()->GetTextBoxAttr().GetWidth() = size
.GetWidth();
410 if (!GetAttributes()->GetTextBoxAttr().GetHeight().IsValid() || GetAttributes()->GetTextBoxAttr().GetHeight().GetValue() <= 0)
412 GetAttributes()->GetTextBoxAttr().GetHeight() = size
.GetHeight();
417 wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetWidth(), m_width
, m_unitsW
, m_widthCheckbox
);
418 wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetHeight(), m_height
, m_unitsH
, m_heightCheckbox
);
419 wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetTop(), m_offset
, m_unitsOffset
, m_offsetYCheckbox
);
424 bool wxRichTextSizePage::TransferDataFromWindow()
426 GetAttributes()->GetTextBoxAttr().SetFloatMode((wxTextBoxAttrFloatStyle
) m_float
->GetSelection());
427 if (m_float
->GetSelection() == 0)
428 GetAttributes()->GetTextBoxAttr().RemoveFlag(wxTEXT_BOX_ATTR_FLOAT
);
430 if (m_verticalAlignmentCheckbox
->GetValue())
431 GetAttributes()->GetTextBoxAttr().SetVerticalAlignment((wxTextBoxAttrVerticalAlignment
) (m_verticalAlignmentComboBox
->GetSelection() + 1));
434 GetAttributes()->GetTextBoxAttr().SetVerticalAlignment(wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT_NONE
);
435 GetAttributes()->GetTextBoxAttr().RemoveFlag(wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT
);
438 wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetWidth(), m_width
, m_unitsW
, m_widthCheckbox
);
439 wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetHeight(), m_height
, m_unitsH
, m_heightCheckbox
);
440 wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetTop(), m_offset
, m_unitsOffset
, m_offsetYCheckbox
);
445 // Show/hide position controls
446 void wxRichTextSizePage::ShowPositionControls(bool show
)
450 m_parentSizer
->Show(m_positionControls
, show
);
455 // Show/hide floating controls
456 void wxRichTextSizePage::ShowFloatingControls(bool show
)
460 m_parentSizer
->Show(m_floatingControls
, show
);
467 * Get bitmap resources
470 wxBitmap
wxRichTextSizePage::GetBitmapResource( const wxString
& name
)
473 ////@begin wxRichTextSizePage bitmap retrieval
476 ////@end wxRichTextSizePage bitmap retrieval
483 wxIcon
wxRichTextSizePage::GetIconResource( const wxString
& name
)
486 ////@begin wxRichTextSizePage icon retrieval
489 ////@end wxRichTextSizePage icon retrieval
494 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_WIDTH
497 void wxRichTextSizePage::OnRichtextWidthUpdate( wxUpdateUIEvent
& event
)
499 event
.Enable(m_widthCheckbox
->GetValue());
503 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_HEIGHT
506 void wxRichTextSizePage::OnRichtextHeightUpdate( wxUpdateUIEvent
& event
)
508 event
.Enable(m_heightCheckbox
->GetValue());
512 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_OFFSET
515 void wxRichTextSizePage::OnRichtextOffsetUpdate( wxUpdateUIEvent
& event
)
517 event
.Enable(m_offsetYCheckbox
->GetValue());
522 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXT_PARA_UP
525 void wxRichTextSizePage::OnRichtextParaUpClick( wxCommandEvent
& WXUNUSED(event
) )
527 wxRichTextFormattingDialog
* dialog
= wxRichTextFormattingDialog::GetDialog(this);
528 if (!dialog
|| !dialog
->GetObject())
531 // Make sure object attributes are up-to-date
532 dialog
->TransferDataFromWindow();
534 wxRichTextBuffer
* buffer
= dialog
->GetObject()->GetBuffer();
535 wxRichTextParagraphLayoutBox
* container
= dialog
->GetObject()->GetParentContainer();
536 wxRichTextObject
* parent
= dialog
->GetObject()->GetParent();
537 if (!container
|| !parent
|| !buffer
)
540 wxRichTextRange range
= dialog
->GetObject()->GetRange();
541 wxRichTextObjectList::compatibility_iterator iter
= container
->GetChildren().GetFirst();
547 if (iter
->GetData() == parent
)
549 iter
= iter
->GetNext();
553 iter
= iter
->GetPrevious();
557 wxRichTextObject
*obj
= iter
->GetData();
558 wxRichTextRange rg
= obj
->GetRange();
559 // tempObj will be deleted along with the undo object, and a clone of it will be
560 // returned by InsertObjectWithUndo
561 wxRichTextObject
* tempObj
= dialog
->GetObject()->Clone();
563 container
->DeleteRangeWithUndo(range
, buffer
->GetRichTextCtrl(), buffer
);
565 wxRichTextObject
* obj2
= container
->InsertObjectWithUndo(rg
.GetStart(), tempObj
, buffer
->GetRichTextCtrl(), buffer
, 0);
566 dialog
->SetObject(obj2
);
570 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXT_DOWN
573 void wxRichTextSizePage::OnRichtextParaDownClick( wxCommandEvent
& WXUNUSED(event
) )
575 wxRichTextFormattingDialog
* dialog
= wxRichTextFormattingDialog::GetDialog(this);
576 if (!dialog
|| !dialog
->GetObject())
579 // Make sure object attributes are up-to-date
580 dialog
->TransferDataFromWindow();
582 wxRichTextBuffer
* buffer
= dialog
->GetObject()->GetBuffer();
583 wxRichTextParagraphLayoutBox
* container
= dialog
->GetObject()->GetParentContainer();
584 wxRichTextObject
* parent
= dialog
->GetObject()->GetParent();
585 if (!container
|| !parent
|| !buffer
)
588 wxRichTextRange range
= dialog
->GetObject()->GetRange();
590 wxRichTextObjectList::compatibility_iterator iter
= buffer
->GetChildren().GetFirst();
596 if (iter
->GetData() == parent
)
598 iter
= iter
->GetNext();
601 iter
= iter
->GetNext();
605 wxRichTextObject
*obj
= iter
->GetData();
606 wxRichTextRange rg
= obj
->GetRange();
607 // tempObj will be deleted along with the undo object, and a clone of it will be
608 // returned by InsertObjectWithUndo
609 wxRichTextObject
* tempObj
= dialog
->GetObject()->Clone();
611 container
->DeleteRangeWithUndo(range
, buffer
->GetRichTextCtrl(), buffer
);
613 // Minus one because we deleted an object
614 wxRichTextObject
* obj2
= container
->InsertObjectWithUndo(rg
.GetStart()-1, tempObj
, buffer
->GetRichTextCtrl(), buffer
, 0);
615 dialog
->SetObject(obj2
);
620 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_VERTICAL_ALIGNMENT_COMBOBOX
623 void wxRichTextSizePage::OnRichtextVerticalAlignmentComboboxUpdate( wxUpdateUIEvent
& event
)
625 event
.Enable(m_verticalAlignmentCheckbox
->GetValue());