]>
Commit | Line | Data |
---|---|---|
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 | ||
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_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 | ||
68 | END_EVENT_TABLE() | |
69 | ||
70 | IMPLEMENT_HELP_PROVISION(wxRichTextSizePage) | |
71 | ||
72 | /*! | |
73 | * wxRichTextSizePage constructors | |
74 | */ | |
75 | ||
76 | wxRichTextSizePage::wxRichTextSizePage() | |
77 | { | |
78 | Init(); | |
79 | } | |
80 | ||
81 | wxRichTextSizePage::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 | ||
92 | bool 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 | ||
112 | wxRichTextSizePage::~wxRichTextSizePage() | |
113 | { | |
114 | ////@begin wxRichTextSizePage destruction | |
115 | ////@end wxRichTextSizePage destruction | |
116 | } | |
117 | ||
118 | ||
119 | /*! | |
120 | * Member initialisation | |
121 | */ | |
122 | ||
123 | void 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 | ||
164 | void 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 | ||
495 | wxRichTextAttr* wxRichTextSizePage::GetAttributes() | |
496 | { | |
497 | return wxRichTextFormattingDialog::GetDialogAttributes(this); | |
498 | } | |
499 | ||
500 | /*! | |
501 | * Should we show tooltips? | |
502 | */ | |
503 | ||
504 | bool wxRichTextSizePage::ShowToolTips() | |
505 | { | |
506 | return true; | |
507 | } | |
508 | ||
509 | bool 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 | ||
536 | if (dialog && dialog->GetObject()) | |
537 | { | |
538 | wxTextAttrSize size = dialog->GetObject()->GetNaturalSize(); | |
539 | if (size.GetWidth().IsValid() && size.GetHeight().IsValid()) | |
540 | { | |
541 | if (!GetAttributes()->GetTextBoxAttr().GetWidth().IsValid() || GetAttributes()->GetTextBoxAttr().GetWidth().GetValue() <= 0) | |
542 | { | |
543 | GetAttributes()->GetTextBoxAttr().GetWidth() = size.GetWidth(); | |
544 | } | |
545 | ||
546 | if (!GetAttributes()->GetTextBoxAttr().GetHeight().IsValid() || GetAttributes()->GetTextBoxAttr().GetHeight().GetValue() <= 0) | |
547 | { | |
548 | GetAttributes()->GetTextBoxAttr().GetHeight() = size.GetHeight(); | |
549 | } | |
550 | } | |
551 | } | |
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); | |
303f0be7 JS |
555 | wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetMinSize().GetWidth(), m_minWidth, m_unitsMinW, m_minWidthCheckbox); |
556 | wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetMinSize().GetHeight(), m_minHeight, m_unitsMinH, m_minHeightCheckbox); | |
557 | wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetMaxSize().GetWidth(), m_maxWidth, m_unitsMaxW, m_maxWidthCheckbox); | |
558 | wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetMaxSize().GetHeight(), m_maxHeight, m_unitsMaxH, m_maxHeightCheckbox); | |
603f702b JS |
559 | wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetTop(), m_offset, m_unitsOffset, m_offsetYCheckbox); |
560 | ||
561 | return true; | |
562 | } | |
563 | ||
564 | bool wxRichTextSizePage::TransferDataFromWindow() | |
565 | { | |
566 | GetAttributes()->GetTextBoxAttr().SetFloatMode((wxTextBoxAttrFloatStyle) m_float->GetSelection()); | |
567 | if (m_float->GetSelection() == 0) | |
568 | GetAttributes()->GetTextBoxAttr().RemoveFlag(wxTEXT_BOX_ATTR_FLOAT); | |
569 | ||
570 | if (m_verticalAlignmentCheckbox->GetValue()) | |
571 | GetAttributes()->GetTextBoxAttr().SetVerticalAlignment((wxTextBoxAttrVerticalAlignment) (m_verticalAlignmentComboBox->GetSelection() + 1)); | |
572 | else | |
573 | { | |
574 | GetAttributes()->GetTextBoxAttr().SetVerticalAlignment(wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT_NONE); | |
575 | GetAttributes()->GetTextBoxAttr().RemoveFlag(wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT); | |
576 | } | |
577 | ||
578 | wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetWidth(), m_width, m_unitsW, m_widthCheckbox); | |
579 | wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetHeight(), m_height, m_unitsH, m_heightCheckbox); | |
303f0be7 JS |
580 | wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetMinSize().GetWidth(), m_minWidth, m_unitsMinW, m_minWidthCheckbox); |
581 | wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetMinSize().GetHeight(), m_minHeight, m_unitsMinH, m_minHeightCheckbox); | |
582 | wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetMaxSize().GetWidth(), m_maxWidth, m_unitsMaxW, m_maxWidthCheckbox); | |
583 | wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetMaxSize().GetHeight(), m_maxHeight, m_unitsMaxH, m_maxHeightCheckbox); | |
603f702b JS |
584 | wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetTop(), m_offset, m_unitsOffset, m_offsetYCheckbox); |
585 | ||
586 | return true; | |
587 | } | |
588 | ||
589 | // Show/hide position controls | |
590 | void wxRichTextSizePage::ShowPositionControls(bool show) | |
591 | { | |
592 | if (m_parentSizer) | |
593 | { | |
594 | m_parentSizer->Show(m_positionControls, show); | |
595 | Layout(); | |
596 | } | |
597 | } | |
598 | ||
599 | // Show/hide floating controls | |
600 | void wxRichTextSizePage::ShowFloatingControls(bool show) | |
601 | { | |
602 | if (m_parentSizer) | |
603 | { | |
604 | m_parentSizer->Show(m_floatingControls, show); | |
605 | Layout(); | |
606 | } | |
607 | } | |
608 | ||
609 | ||
610 | /*! | |
611 | * Get bitmap resources | |
612 | */ | |
613 | ||
614 | wxBitmap wxRichTextSizePage::GetBitmapResource( const wxString& name ) | |
615 | { | |
616 | // Bitmap retrieval | |
617 | ////@begin wxRichTextSizePage bitmap retrieval | |
618 | wxUnusedVar(name); | |
619 | return wxNullBitmap; | |
620 | ////@end wxRichTextSizePage bitmap retrieval | |
621 | } | |
622 | ||
623 | /*! | |
624 | * Get icon resources | |
625 | */ | |
626 | ||
627 | wxIcon wxRichTextSizePage::GetIconResource( const wxString& name ) | |
628 | { | |
629 | // Icon retrieval | |
630 | ////@begin wxRichTextSizePage icon retrieval | |
631 | wxUnusedVar(name); | |
632 | return wxNullIcon; | |
633 | ////@end wxRichTextSizePage icon retrieval | |
634 | } | |
635 | ||
636 | ||
637 | /*! | |
638 | * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_WIDTH | |
639 | */ | |
640 | ||
641 | void wxRichTextSizePage::OnRichtextWidthUpdate( wxUpdateUIEvent& event ) | |
642 | { | |
643 | event.Enable(m_widthCheckbox->GetValue()); | |
644 | } | |
645 | ||
646 | /*! | |
647 | * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_HEIGHT | |
648 | */ | |
649 | ||
650 | void wxRichTextSizePage::OnRichtextHeightUpdate( wxUpdateUIEvent& event ) | |
651 | { | |
652 | event.Enable(m_heightCheckbox->GetValue()); | |
653 | } | |
654 | ||
655 | /*! | |
656 | * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_OFFSET | |
657 | */ | |
658 | ||
659 | void wxRichTextSizePage::OnRichtextOffsetUpdate( wxUpdateUIEvent& event ) | |
660 | { | |
661 | event.Enable(m_offsetYCheckbox->GetValue()); | |
662 | } | |
663 | ||
664 | ||
665 | /*! | |
666 | * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXT_PARA_UP | |
667 | */ | |
668 | ||
669 | void wxRichTextSizePage::OnRichtextParaUpClick( wxCommandEvent& WXUNUSED(event) ) | |
670 | { | |
671 | wxRichTextFormattingDialog* dialog = wxRichTextFormattingDialog::GetDialog(this); | |
672 | if (!dialog || !dialog->GetObject()) | |
673 | return; | |
4e63bfb9 | 674 | |
603f702b JS |
675 | // Make sure object attributes are up-to-date |
676 | dialog->TransferDataFromWindow(); | |
4e63bfb9 | 677 | |
603f702b JS |
678 | wxRichTextBuffer* buffer = dialog->GetObject()->GetBuffer(); |
679 | wxRichTextParagraphLayoutBox* container = dialog->GetObject()->GetParentContainer(); | |
680 | wxRichTextObject* parent = dialog->GetObject()->GetParent(); | |
681 | if (!container || !parent || !buffer) | |
682 | return; | |
683 | ||
684 | wxRichTextRange range = dialog->GetObject()->GetRange(); | |
685 | wxRichTextObjectList::compatibility_iterator iter = container->GetChildren().GetFirst(); | |
686 | if (!iter) | |
687 | return; | |
688 | ||
689 | while (iter) | |
690 | { | |
691 | if (iter->GetData() == parent) | |
692 | break; | |
693 | iter = iter->GetNext(); | |
694 | } | |
695 | if (!iter) | |
696 | return; | |
697 | iter = iter->GetPrevious(); | |
698 | if (!iter) | |
699 | return; | |
700 | ||
701 | wxRichTextObject *obj = iter->GetData(); | |
702 | wxRichTextRange rg = obj->GetRange(); | |
703 | // tempObj will be deleted along with the undo object, and a clone of it will be | |
704 | // returned by InsertObjectWithUndo | |
705 | wxRichTextObject* tempObj = dialog->GetObject()->Clone(); | |
706 | ||
707 | container->DeleteRangeWithUndo(range, buffer->GetRichTextCtrl(), buffer); | |
708 | ||
4e63bfb9 | 709 | wxRichTextObject* obj2 = container->InsertObjectWithUndo(buffer, rg.GetStart(), tempObj, buffer->GetRichTextCtrl(), 0); |
603f702b JS |
710 | dialog->SetObject(obj2); |
711 | } | |
712 | ||
713 | /*! | |
714 | * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXT_DOWN | |
715 | */ | |
716 | ||
717 | void wxRichTextSizePage::OnRichtextParaDownClick( wxCommandEvent& WXUNUSED(event) ) | |
718 | { | |
719 | wxRichTextFormattingDialog* dialog = wxRichTextFormattingDialog::GetDialog(this); | |
720 | if (!dialog || !dialog->GetObject()) | |
721 | return; | |
4e63bfb9 | 722 | |
603f702b JS |
723 | // Make sure object attributes are up-to-date |
724 | dialog->TransferDataFromWindow(); | |
4e63bfb9 | 725 | |
603f702b JS |
726 | wxRichTextBuffer* buffer = dialog->GetObject()->GetBuffer(); |
727 | wxRichTextParagraphLayoutBox* container = dialog->GetObject()->GetParentContainer(); | |
728 | wxRichTextObject* parent = dialog->GetObject()->GetParent(); | |
729 | if (!container || !parent || !buffer) | |
730 | return; | |
731 | ||
732 | wxRichTextRange range = dialog->GetObject()->GetRange(); | |
733 | ||
734 | wxRichTextObjectList::compatibility_iterator iter = buffer->GetChildren().GetFirst(); | |
735 | if (!iter) | |
736 | return; | |
737 | ||
738 | while (iter) | |
739 | { | |
740 | if (iter->GetData() == parent) | |
741 | break; | |
742 | iter = iter->GetNext(); | |
743 | } | |
744 | ||
745 | iter = iter->GetNext(); | |
746 | if (!iter) | |
747 | return; | |
748 | ||
749 | wxRichTextObject *obj = iter->GetData(); | |
750 | wxRichTextRange rg = obj->GetRange(); | |
751 | // tempObj will be deleted along with the undo object, and a clone of it will be | |
752 | // returned by InsertObjectWithUndo | |
753 | wxRichTextObject* tempObj = dialog->GetObject()->Clone(); | |
754 | ||
755 | container->DeleteRangeWithUndo(range, buffer->GetRichTextCtrl(), buffer); | |
756 | ||
757 | // Minus one because we deleted an object | |
4e63bfb9 | 758 | wxRichTextObject* obj2 = container->InsertObjectWithUndo(buffer, rg.GetStart()-1, tempObj, buffer->GetRichTextCtrl(), 0); |
603f702b JS |
759 | dialog->SetObject(obj2); |
760 | } | |
761 | ||
762 | ||
763 | /*! | |
764 | * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_VERTICAL_ALIGNMENT_COMBOBOX | |
765 | */ | |
766 | ||
767 | void wxRichTextSizePage::OnRichtextVerticalAlignmentComboboxUpdate( wxUpdateUIEvent& event ) | |
768 | { | |
769 | event.Enable(m_verticalAlignmentCheckbox->GetValue()); | |
770 | } | |
771 | ||
303f0be7 JS |
772 | |
773 | /*! | |
774 | * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_MIN_WIDTH | |
775 | */ | |
776 | ||
777 | void wxRichTextSizePage::OnRichtextMinWidthUpdate( wxUpdateUIEvent& event ) | |
778 | { | |
779 | event.Enable(m_minWidthCheckbox->GetValue()); | |
780 | } | |
781 | ||
782 | /*! | |
783 | * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_MIN_HEIGHT | |
784 | */ | |
785 | ||
786 | void wxRichTextSizePage::OnRichtextMinHeightUpdate( wxUpdateUIEvent& event ) | |
787 | { | |
788 | event.Enable(m_minHeightCheckbox->GetValue()); | |
789 | } | |
790 | ||
791 | ||
792 | /*! | |
793 | * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_MAX_WIDTH | |
794 | */ | |
795 | ||
796 | void wxRichTextSizePage::OnRichtextMaxWidthUpdate( wxUpdateUIEvent& event ) | |
797 | { | |
798 | event.Enable(m_maxWidthCheckbox->GetValue()); | |
799 | } | |
800 | ||
801 | ||
802 | /*! | |
803 | * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_MAX_HEIGHT | |
804 | */ | |
805 | ||
806 | void wxRichTextSizePage::OnRichtextMaxHeightUpdate( wxUpdateUIEvent& event ) | |
807 | { | |
808 | event.Enable(m_maxHeightCheckbox->GetValue()); | |
809 | } |