]> git.saurik.com Git - wxWidgets.git/blame - src/richtext/richtextborderspage.cpp
We need to switch off UI elements before they are laid out. Do this via static functions.
[wxWidgets.git] / src / richtext / richtextborderspage.cpp
CommitLineData
603f702b 1/////////////////////////////////////////////////////////////////////////////
80fdcdb9 2// Name: src/richtext/richtextborderspage.cpp
603f702b
JS
3// Purpose:
4// Author: Julian Smart
5// Modified by:
6// Created: 21/10/2010 11:34:24
7// RCS-ID:
8// Copyright: (c) Julian Smart
9// Licence:
10/////////////////////////////////////////////////////////////////////////////
11
603f702b
JS
12////@begin includes
13#include "wx/imaglist.h"
14////@end includes
15
16#include "wx/richtext/richtextborderspage.h"
17
18////@begin XPM images
19////@end XPM images
20
21
22/*!
23 * wxRichTextBordersPage type definition
24 */
25
26IMPLEMENT_DYNAMIC_CLASS( wxRichTextBordersPage, wxRichTextDialogPage )
27
28
29/*!
30 * wxRichTextBordersPage event table definition
31 */
32
33BEGIN_EVENT_TABLE( wxRichTextBordersPage, wxRichTextDialogPage )
34
35 EVT_CHECKBOX(wxID_ANY, wxRichTextBordersPage::OnCommand)
36 EVT_TEXT(wxID_ANY, wxRichTextBordersPage::OnCommand)
37 EVT_TEXT_ENTER(wxID_ANY, wxRichTextBordersPage::OnCommand)
38 EVT_COMBOBOX(wxID_ANY, wxRichTextBordersPage::OnCommand)
39 EVT_BUTTON(wxID_ANY, wxRichTextBordersPage::OnCommand)
40
41////@begin wxRichTextBordersPage event table entries
42 EVT_CHECKBOX( ID_RICHTEXT_BORDER_LEFT_CHECKBOX, wxRichTextBordersPage::OnRichtextBorderCheckboxClick )
43
44 EVT_UPDATE_UI( ID_RICHTEXT_BORDER_LEFT, wxRichTextBordersPage::OnRichtextBorderLeftUpdate )
45
46 EVT_UPDATE_UI( ID_RICHTEXT_BORDER_LEFT_UNITS, wxRichTextBordersPage::OnRichtextBorderLeftUpdate )
47
48 EVT_UPDATE_UI( ID_RICHTEXT_BORDER_LEFT_STYLE, wxRichTextBordersPage::OnRichtextBorderLeftUpdate )
49
50 EVT_UPDATE_UI( ID_RICHTEXT_BORDER_LEFT_COLOUR, wxRichTextBordersPage::OnRichtextBorderLeftUpdate )
51
52 EVT_CHECKBOX( ID_RICHTEXT_BORDER_RIGHT_CHECKBOX, wxRichTextBordersPage::OnRichtextBorderCheckboxClick )
53
54 EVT_UPDATE_UI( ID_RICHTEXT_BORDER_RIGHT, wxRichTextBordersPage::OnRichtextBorderRightUpdate )
55
56 EVT_UPDATE_UI( ID_RICHTEXT_BORDER_RIGHT_UNITS, wxRichTextBordersPage::OnRichtextBorderRightUpdate )
57
58 EVT_UPDATE_UI( ID_RICHTEXT_BORDER_RIGHT_STYLE, wxRichTextBordersPage::OnRichtextBorderRightUpdate )
59
60 EVT_UPDATE_UI( ID_RICHTEXT_BORDER_RIGHT_COLOUR, wxRichTextBordersPage::OnRichtextBorderRightUpdate )
61
62 EVT_CHECKBOX( ID_RICHTEXT_BORDER_TOP_CHECKBOX, wxRichTextBordersPage::OnRichtextBorderCheckboxClick )
63
64 EVT_UPDATE_UI( ID_RICHTEXT_BORDER_TOP, wxRichTextBordersPage::OnRichtextBorderTopUpdate )
65
66 EVT_UPDATE_UI( ID_RICHTEXT_BORDER_TOP_UNITS, wxRichTextBordersPage::OnRichtextBorderTopUpdate )
67
68 EVT_UPDATE_UI( ID_RICHTEXT_BORDER_TOP_STYLE, wxRichTextBordersPage::OnRichtextBorderTopUpdate )
69
70 EVT_UPDATE_UI( ID_RICHTEXT_BORDER_TOP_COLOUR, wxRichTextBordersPage::OnRichtextBorderTopUpdate )
71
72 EVT_CHECKBOX( ID_RICHTEXT_BORDER_BOTTOM_CHECKBOX, wxRichTextBordersPage::OnRichtextBorderCheckboxClick )
73
74 EVT_UPDATE_UI( ID_RICHTEXT_BORDER_BOTTOM, wxRichTextBordersPage::OnRichtextBorderBottomUpdate )
75
76 EVT_UPDATE_UI( ID_RICHTEXT_BORDER_BOTTOM_UNITS, wxRichTextBordersPage::OnRichtextBorderBottomUpdate )
77
78 EVT_UPDATE_UI( ID_RICHTEXT_BORDER_BOTTOM_STYLE, wxRichTextBordersPage::OnRichtextBorderBottomUpdate )
79
80 EVT_UPDATE_UI( ID_RICHTEXT_BORDER_BOTTOM_COLOUR, wxRichTextBordersPage::OnRichtextBorderBottomUpdate )
81
82 EVT_CHECKBOX( ID_RICHTEXT_OUTLINE_LEFT_CHECKBOX, wxRichTextBordersPage::OnRichtextBorderCheckboxClick )
83
84 EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_LEFT, wxRichTextBordersPage::OnRichtextOutlineLeftUpdate )
85
86 EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_LEFT_UNITS, wxRichTextBordersPage::OnRichtextOutlineLeftUpdate )
87
88 EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_LEFT_STYLE, wxRichTextBordersPage::OnRichtextOutlineLeftUpdate )
89
90 EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_LEFT_COLOUR, wxRichTextBordersPage::OnRichtextOutlineLeftUpdate )
91
92 EVT_CHECKBOX( ID_RICHTEXT_OUTLINE_RIGHT_CHECKBOX, wxRichTextBordersPage::OnRichtextBorderCheckboxClick )
93
94 EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_RIGHT, wxRichTextBordersPage::OnRichtextOutlineRightUpdate )
95
96 EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_RIGHT_UNITS, wxRichTextBordersPage::OnRichtextOutlineRightUpdate )
97
98 EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_RIGHT_STYLE, wxRichTextBordersPage::OnRichtextOutlineRightUpdate )
99
100 EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_RIGHT_COLOUR, wxRichTextBordersPage::OnRichtextOutlineRightUpdate )
101
102 EVT_CHECKBOX( ID_RICHTEXT_OUTLINE_TOP_CHECKBOX, wxRichTextBordersPage::OnRichtextBorderCheckboxClick )
103
104 EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_TOP, wxRichTextBordersPage::OnRichtextOutlineTopUpdate )
105
106 EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_TOP_UNITS, wxRichTextBordersPage::OnRichtextOutlineTopUpdate )
107
108 EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_TOP_STYLE, wxRichTextBordersPage::OnRichtextOutlineTopUpdate )
109
110 EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_TOP_COLOUR, wxRichTextBordersPage::OnRichtextOutlineTopUpdate )
111
112 EVT_CHECKBOX( ID_RICHTEXT_OUTLINE_BOTTOM_CHECKBOX, wxRichTextBordersPage::OnRichtextBorderCheckboxClick )
113
114 EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_BOTTOM, wxRichTextBordersPage::OnRichtextOutlineBottomUpdate )
115
116 EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_BOTTOM_UNITS, wxRichTextBordersPage::OnRichtextOutlineBottomUpdate )
117
118 EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_BOTTOM_STYLE, wxRichTextBordersPage::OnRichtextOutlineBottomUpdate )
119
120 EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_BOTTOM_COLOUR, wxRichTextBordersPage::OnRichtextOutlineBottomUpdate )
121
122////@end wxRichTextBordersPage event table entries
123
124END_EVENT_TABLE()
125
126IMPLEMENT_HELP_PROVISION(wxRichTextBordersPage)
127
128/*!
129 * wxRichTextBordersPage constructors
130 */
131
132wxRichTextBordersPage::wxRichTextBordersPage()
133{
134 Init();
135}
136
137wxRichTextBordersPage::wxRichTextBordersPage( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
138{
139 Init();
140 Create(parent, id, pos, size, style);
141}
142
143
144/*!
145 * wxRichTextBordersPage creator
146 */
147
148bool wxRichTextBordersPage::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
149{
150////@begin wxRichTextBordersPage creation
151 SetExtraStyle(wxWS_EX_VALIDATE_RECURSIVELY);
152 wxRichTextDialogPage::Create( parent, id, pos, size, style );
153
154 CreateControls();
155 if (GetSizer())
156 {
157 GetSizer()->SetSizeHints(this);
158 }
159 Centre();
160////@end wxRichTextBordersPage creation
161 return true;
162}
163
164
165/*!
166 * wxRichTextBordersPage destructor
167 */
168
169wxRichTextBordersPage::~wxRichTextBordersPage()
170{
171////@begin wxRichTextBordersPage destruction
172////@end wxRichTextBordersPage destruction
173}
174
175
176/*!
177 * Member initialisation
178 */
179
180void wxRichTextBordersPage::Init()
181{
182 m_ignoreUpdates = false;
183
184////@begin wxRichTextBordersPage member initialisation
185 m_leftBorderCheckbox = NULL;
186 m_leftBorderWidth = NULL;
187 m_leftBorderWidthUnits = NULL;
188 m_leftBorderStyle = NULL;
189 m_leftBorderColour = NULL;
190 m_rightBorderCheckbox = NULL;
191 m_rightBorderWidth = NULL;
192 m_rightBorderWidthUnits = NULL;
193 m_rightBorderStyle = NULL;
194 m_rightBorderColour = NULL;
195 m_topBorderCheckbox = NULL;
196 m_topBorderWidth = NULL;
197 m_topBorderWidthUnits = NULL;
198 m_topBorderStyle = NULL;
199 m_topBorderColour = NULL;
200 m_bottomBorderCheckbox = NULL;
201 m_bottomBorderWidth = NULL;
202 m_bottomBorderWidthUnits = NULL;
203 m_bottomBorderStyle = NULL;
204 m_bottomBorderColour = NULL;
205 m_leftOutlineCheckbox = NULL;
206 m_leftOutlineWidth = NULL;
207 m_leftOutlineWidthUnits = NULL;
208 m_leftOutlineStyle = NULL;
209 m_leftOutlineColour = NULL;
210 m_rightOutlineCheckbox = NULL;
211 m_rightOutlineWidth = NULL;
212 m_rightOutlineWidthUnits = NULL;
213 m_rightOutlineStyle = NULL;
214 m_rightOutlineColour = NULL;
215 m_topOutlineCheckbox = NULL;
216 m_topOutlineWidth = NULL;
217 m_topOutlineWidthUnits = NULL;
218 m_topOutlineStyle = NULL;
219 m_topOutlineColour = NULL;
220 m_bottomOutlineCheckbox = NULL;
221 m_bottomOutlineWidth = NULL;
222 m_bottomOutlineWidthUnits = NULL;
223 m_bottomOutlineStyle = NULL;
224 m_bottomOutlineColour = NULL;
225 m_borderPreviewCtrl = NULL;
226////@end wxRichTextBordersPage member initialisation
227}
228
229
230/*!
231 * Control creation for wxRichTextBordersPage
232 */
233
234void wxRichTextBordersPage::CreateControls()
235{
236////@begin wxRichTextBordersPage content construction
237 wxRichTextBordersPage* itemRichTextDialogPage1 = this;
238
239 wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
240 itemRichTextDialogPage1->SetSizer(itemBoxSizer2);
241
242 wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxVERTICAL);
243 itemBoxSizer2->Add(itemBoxSizer3, 1, wxGROW|wxALL, 5);
244
245 wxNotebook* itemNotebook4 = new wxNotebook( itemRichTextDialogPage1, ID_RICHTEXTBORDERSPAGE_NOTEBOOK, wxDefaultPosition, wxDefaultSize, wxBK_DEFAULT );
246
247 wxPanel* itemPanel5 = new wxPanel( itemNotebook4, ID_RICHTEXTBORDERSPAGE_BORDERS, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
248 itemPanel5->SetExtraStyle(wxWS_EX_VALIDATE_RECURSIVELY);
249 wxBoxSizer* itemBoxSizer6 = new wxBoxSizer(wxVERTICAL);
250 itemPanel5->SetSizer(itemBoxSizer6);
251
252 wxBoxSizer* itemBoxSizer7 = new wxBoxSizer(wxVERTICAL);
253 itemBoxSizer6->Add(itemBoxSizer7, 0, wxGROW|wxALL, 5);
254 wxBoxSizer* itemBoxSizer8 = new wxBoxSizer(wxHORIZONTAL);
255 itemBoxSizer7->Add(itemBoxSizer8, 0, wxGROW, 5);
256 wxStaticText* itemStaticText9 = new wxStaticText( itemPanel5, wxID_STATIC, _("Border"), wxDefaultPosition, wxDefaultSize, 0 );
257 itemStaticText9->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("")));
258 itemBoxSizer8->Add(itemStaticText9, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
259
260 wxStaticLine* itemStaticLine10 = new wxStaticLine( itemPanel5, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
261 itemBoxSizer8->Add(itemStaticLine10, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
262
263 wxBoxSizer* itemBoxSizer11 = new wxBoxSizer(wxHORIZONTAL);
264 itemBoxSizer7->Add(itemBoxSizer11, 0, wxGROW, 5);
265 itemBoxSizer11->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
266
267 wxFlexGridSizer* itemFlexGridSizer13 = new wxFlexGridSizer(0, 2, 0, 0);
268 itemBoxSizer11->Add(itemFlexGridSizer13, 0, wxGROW, 5);
269 m_leftBorderCheckbox = new wxCheckBox( itemPanel5, ID_RICHTEXT_BORDER_LEFT_CHECKBOX, _("&Left:"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER );
270 m_leftBorderCheckbox->SetValue(false);
271 itemFlexGridSizer13->Add(m_leftBorderCheckbox, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
272
273 wxBoxSizer* itemBoxSizer15 = new wxBoxSizer(wxHORIZONTAL);
274 itemFlexGridSizer13->Add(itemBoxSizer15, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5);
275 m_leftBorderWidth = new wxTextCtrl( itemPanel5, ID_RICHTEXT_BORDER_LEFT, wxEmptyString, wxDefaultPosition, wxSize(50, -1), 0 );
276 itemBoxSizer15->Add(m_leftBorderWidth, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
277
278 wxArrayString m_leftBorderWidthUnitsStrings;
279 m_leftBorderWidthUnitsStrings.Add(_("px"));
280 m_leftBorderWidthUnitsStrings.Add(_("cm"));
281 m_leftBorderWidthUnits = new wxComboBox( itemPanel5, ID_RICHTEXT_BORDER_LEFT_UNITS, _("px"), wxDefaultPosition, wxSize(60, -1), m_leftBorderWidthUnitsStrings, wxCB_READONLY );
282 m_leftBorderWidthUnits->SetStringSelection(_("px"));
283 m_leftBorderWidthUnits->SetHelpText(_("Units for the left border width."));
284 if (wxRichTextBordersPage::ShowToolTips())
285 m_leftBorderWidthUnits->SetToolTip(_("Units for the left border width."));
286 itemBoxSizer15->Add(m_leftBorderWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
287
288 itemBoxSizer15->Add(2, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
289
290 wxArrayString m_leftBorderStyleStrings;
291 m_leftBorderStyle = new wxComboBox( itemPanel5, ID_RICHTEXT_BORDER_LEFT_STYLE, wxEmptyString, wxDefaultPosition, wxDefaultSize, m_leftBorderStyleStrings, wxCB_READONLY );
292 itemBoxSizer15->Add(m_leftBorderStyle, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
293
294 itemBoxSizer15->Add(2, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
295
296 m_leftBorderColour = new wxRichTextColourSwatchCtrl( itemPanel5, ID_RICHTEXT_BORDER_LEFT_COLOUR, wxDefaultPosition, wxSize(40, 20), wxBORDER_THEME );
297 itemBoxSizer15->Add(m_leftBorderColour, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
298
299 m_rightBorderCheckbox = new wxCheckBox( itemPanel5, ID_RICHTEXT_BORDER_RIGHT_CHECKBOX, _("&Right:"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER );
300 m_rightBorderCheckbox->SetValue(false);
301 itemFlexGridSizer13->Add(m_rightBorderCheckbox, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
302
303 wxBoxSizer* itemBoxSizer23 = new wxBoxSizer(wxHORIZONTAL);
304 itemFlexGridSizer13->Add(itemBoxSizer23, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5);
305 m_rightBorderWidth = new wxTextCtrl( itemPanel5, ID_RICHTEXT_BORDER_RIGHT, wxEmptyString, wxDefaultPosition, wxSize(50, -1), 0 );
306 itemBoxSizer23->Add(m_rightBorderWidth, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
307
308 wxArrayString m_rightBorderWidthUnitsStrings;
309 m_rightBorderWidthUnitsStrings.Add(_("px"));
310 m_rightBorderWidthUnitsStrings.Add(_("cm"));
311 m_rightBorderWidthUnits = new wxComboBox( itemPanel5, ID_RICHTEXT_BORDER_RIGHT_UNITS, _("px"), wxDefaultPosition, wxSize(60, -1), m_rightBorderWidthUnitsStrings, wxCB_READONLY );
312 m_rightBorderWidthUnits->SetStringSelection(_("px"));
313 m_rightBorderWidthUnits->SetHelpText(_("Units for the right border width."));
314 if (wxRichTextBordersPage::ShowToolTips())
315 m_rightBorderWidthUnits->SetToolTip(_("Units for the right border width."));
316 itemBoxSizer23->Add(m_rightBorderWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
317
318 itemBoxSizer23->Add(2, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
319
320 wxArrayString m_rightBorderStyleStrings;
321 m_rightBorderStyle = new wxComboBox( itemPanel5, ID_RICHTEXT_BORDER_RIGHT_STYLE, wxEmptyString, wxDefaultPosition, wxDefaultSize, m_rightBorderStyleStrings, wxCB_READONLY );
322 itemBoxSizer23->Add(m_rightBorderStyle, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
323
324 itemBoxSizer23->Add(2, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
325
326 m_rightBorderColour = new wxRichTextColourSwatchCtrl( itemPanel5, ID_RICHTEXT_BORDER_RIGHT_COLOUR, wxDefaultPosition, wxSize(40, 20), wxBORDER_THEME );
327 itemBoxSizer23->Add(m_rightBorderColour, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
328
329 m_topBorderCheckbox = new wxCheckBox( itemPanel5, ID_RICHTEXT_BORDER_TOP_CHECKBOX, _("&Top:"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER );
330 m_topBorderCheckbox->SetValue(false);
331 itemFlexGridSizer13->Add(m_topBorderCheckbox, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
332
333 wxBoxSizer* itemBoxSizer31 = new wxBoxSizer(wxHORIZONTAL);
334 itemFlexGridSizer13->Add(itemBoxSizer31, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5);
335 m_topBorderWidth = new wxTextCtrl( itemPanel5, ID_RICHTEXT_BORDER_TOP, wxEmptyString, wxDefaultPosition, wxSize(50, -1), 0 );
336 itemBoxSizer31->Add(m_topBorderWidth, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
337
338 wxArrayString m_topBorderWidthUnitsStrings;
339 m_topBorderWidthUnitsStrings.Add(_("px"));
340 m_topBorderWidthUnitsStrings.Add(_("cm"));
341 m_topBorderWidthUnits = new wxComboBox( itemPanel5, ID_RICHTEXT_BORDER_TOP_UNITS, _("px"), wxDefaultPosition, wxSize(60, -1), m_topBorderWidthUnitsStrings, wxCB_READONLY );
342 m_topBorderWidthUnits->SetStringSelection(_("px"));
343 m_topBorderWidthUnits->SetHelpText(_("Units for the top border width."));
344 if (wxRichTextBordersPage::ShowToolTips())
345 m_topBorderWidthUnits->SetToolTip(_("Units for the top border width."));
346 itemBoxSizer31->Add(m_topBorderWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
347
348 itemBoxSizer31->Add(2, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
349
350 wxArrayString m_topBorderStyleStrings;
351 m_topBorderStyle = new wxComboBox( itemPanel5, ID_RICHTEXT_BORDER_TOP_STYLE, wxEmptyString, wxDefaultPosition, wxDefaultSize, m_topBorderStyleStrings, wxCB_READONLY );
352 itemBoxSizer31->Add(m_topBorderStyle, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
353
354 itemBoxSizer31->Add(2, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
355
356 m_topBorderColour = new wxRichTextColourSwatchCtrl( itemPanel5, ID_RICHTEXT_BORDER_TOP_COLOUR, wxDefaultPosition, wxSize(40, 20), wxBORDER_THEME );
357 itemBoxSizer31->Add(m_topBorderColour, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
358
359 m_bottomBorderCheckbox = new wxCheckBox( itemPanel5, ID_RICHTEXT_BORDER_BOTTOM_CHECKBOX, _("&Bottom:"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER );
360 m_bottomBorderCheckbox->SetValue(false);
361 itemFlexGridSizer13->Add(m_bottomBorderCheckbox, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
362
363 wxBoxSizer* itemBoxSizer39 = new wxBoxSizer(wxHORIZONTAL);
364 itemFlexGridSizer13->Add(itemBoxSizer39, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5);
365 m_bottomBorderWidth = new wxTextCtrl( itemPanel5, ID_RICHTEXT_BORDER_BOTTOM, wxEmptyString, wxDefaultPosition, wxSize(50, -1), 0 );
366 itemBoxSizer39->Add(m_bottomBorderWidth, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
367
368 wxArrayString m_bottomBorderWidthUnitsStrings;
369 m_bottomBorderWidthUnitsStrings.Add(_("px"));
370 m_bottomBorderWidthUnitsStrings.Add(_("cm"));
371 m_bottomBorderWidthUnits = new wxComboBox( itemPanel5, ID_RICHTEXT_BORDER_BOTTOM_UNITS, _("px"), wxDefaultPosition, wxSize(60, -1), m_bottomBorderWidthUnitsStrings, wxCB_READONLY );
372 m_bottomBorderWidthUnits->SetStringSelection(_("px"));
373 m_bottomBorderWidthUnits->SetHelpText(_("Units for the bottom border width."));
374 if (wxRichTextBordersPage::ShowToolTips())
375 m_bottomBorderWidthUnits->SetToolTip(_("Units for the bottom border width."));
376 itemBoxSizer39->Add(m_bottomBorderWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
377
378 itemBoxSizer39->Add(2, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
379
380 wxArrayString m_bottomBorderStyleStrings;
381 m_bottomBorderStyle = new wxComboBox( itemPanel5, ID_RICHTEXT_BORDER_BOTTOM_STYLE, wxEmptyString, wxDefaultPosition, wxDefaultSize, m_bottomBorderStyleStrings, wxCB_READONLY );
382 itemBoxSizer39->Add(m_bottomBorderStyle, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
383
384 itemBoxSizer39->Add(2, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
385
386 m_bottomBorderColour = new wxRichTextColourSwatchCtrl( itemPanel5, ID_RICHTEXT_BORDER_BOTTOM_COLOUR, wxDefaultPosition, wxSize(40, 20), wxBORDER_THEME );
387 itemBoxSizer39->Add(m_bottomBorderColour, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
388
389 itemNotebook4->AddPage(itemPanel5, _("Border"));
390
391 wxPanel* itemPanel46 = new wxPanel( itemNotebook4, ID_RICHTEXTBORDERSPAGE_OUTLINE, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxTAB_TRAVERSAL );
392 itemPanel46->SetExtraStyle(wxWS_EX_VALIDATE_RECURSIVELY);
393 wxBoxSizer* itemBoxSizer47 = new wxBoxSizer(wxVERTICAL);
394 itemPanel46->SetSizer(itemBoxSizer47);
395
396 wxBoxSizer* itemBoxSizer48 = new wxBoxSizer(wxVERTICAL);
397 itemBoxSizer47->Add(itemBoxSizer48, 0, wxGROW|wxALL, 5);
398 wxBoxSizer* itemBoxSizer49 = new wxBoxSizer(wxHORIZONTAL);
399 itemBoxSizer48->Add(itemBoxSizer49, 0, wxGROW, 5);
400 wxStaticText* itemStaticText50 = new wxStaticText( itemPanel46, wxID_STATIC, _("Outline"), wxDefaultPosition, wxDefaultSize, 0 );
401 itemStaticText50->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("")));
402 itemBoxSizer49->Add(itemStaticText50, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
403
404 wxStaticLine* itemStaticLine51 = new wxStaticLine( itemPanel46, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
405 itemBoxSizer49->Add(itemStaticLine51, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
406
407 wxBoxSizer* itemBoxSizer52 = new wxBoxSizer(wxHORIZONTAL);
408 itemBoxSizer48->Add(itemBoxSizer52, 0, wxGROW, 5);
409 itemBoxSizer52->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
410
411 wxFlexGridSizer* itemFlexGridSizer54 = new wxFlexGridSizer(0, 2, 0, 0);
412 itemBoxSizer52->Add(itemFlexGridSizer54, 0, wxGROW, 5);
413 m_leftOutlineCheckbox = new wxCheckBox( itemPanel46, ID_RICHTEXT_OUTLINE_LEFT_CHECKBOX, _("&Left:"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER );
414 m_leftOutlineCheckbox->SetValue(false);
415 itemFlexGridSizer54->Add(m_leftOutlineCheckbox, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
416
417 wxBoxSizer* itemBoxSizer56 = new wxBoxSizer(wxHORIZONTAL);
418 itemFlexGridSizer54->Add(itemBoxSizer56, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5);
419 m_leftOutlineWidth = new wxTextCtrl( itemPanel46, ID_RICHTEXT_OUTLINE_LEFT, wxEmptyString, wxDefaultPosition, wxSize(50, -1), 0 );
420 itemBoxSizer56->Add(m_leftOutlineWidth, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
421
422 wxArrayString m_leftOutlineWidthUnitsStrings;
423 m_leftOutlineWidthUnitsStrings.Add(_("px"));
424 m_leftOutlineWidthUnitsStrings.Add(_("cm"));
425 m_leftOutlineWidthUnits = new wxComboBox( itemPanel46, ID_RICHTEXT_OUTLINE_LEFT_UNITS, _("px"), wxDefaultPosition, wxSize(60, -1), m_leftOutlineWidthUnitsStrings, wxCB_READONLY );
426 m_leftOutlineWidthUnits->SetStringSelection(_("px"));
427 m_leftOutlineWidthUnits->SetHelpText(_("Units for the left outline width."));
428 if (wxRichTextBordersPage::ShowToolTips())
429 m_leftOutlineWidthUnits->SetToolTip(_("Units for the left outline width."));
430 itemBoxSizer56->Add(m_leftOutlineWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
431
432 itemBoxSizer56->Add(2, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
433
434 wxArrayString m_leftOutlineStyleStrings;
435 m_leftOutlineStyle = new wxComboBox( itemPanel46, ID_RICHTEXT_OUTLINE_LEFT_STYLE, wxEmptyString, wxDefaultPosition, wxDefaultSize, m_leftOutlineStyleStrings, wxCB_READONLY );
436 itemBoxSizer56->Add(m_leftOutlineStyle, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
437
438 itemBoxSizer56->Add(2, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
439
440 m_leftOutlineColour = new wxRichTextColourSwatchCtrl( itemPanel46, ID_RICHTEXT_OUTLINE_LEFT_COLOUR, wxDefaultPosition, wxSize(40, 20), wxBORDER_THEME );
441 itemBoxSizer56->Add(m_leftOutlineColour, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
442
443 m_rightOutlineCheckbox = new wxCheckBox( itemPanel46, ID_RICHTEXT_OUTLINE_RIGHT_CHECKBOX, _("&Right:"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER );
444 m_rightOutlineCheckbox->SetValue(false);
445 itemFlexGridSizer54->Add(m_rightOutlineCheckbox, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
446
447 wxBoxSizer* itemBoxSizer64 = new wxBoxSizer(wxHORIZONTAL);
448 itemFlexGridSizer54->Add(itemBoxSizer64, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5);
449 m_rightOutlineWidth = new wxTextCtrl( itemPanel46, ID_RICHTEXT_OUTLINE_RIGHT, wxEmptyString, wxDefaultPosition, wxSize(50, -1), 0 );
450 itemBoxSizer64->Add(m_rightOutlineWidth, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
451
452 wxArrayString m_rightOutlineWidthUnitsStrings;
453 m_rightOutlineWidthUnitsStrings.Add(_("px"));
454 m_rightOutlineWidthUnitsStrings.Add(_("cm"));
455 m_rightOutlineWidthUnits = new wxComboBox( itemPanel46, ID_RICHTEXT_OUTLINE_RIGHT_UNITS, _("px"), wxDefaultPosition, wxSize(60, -1), m_rightOutlineWidthUnitsStrings, wxCB_READONLY );
456 m_rightOutlineWidthUnits->SetStringSelection(_("px"));
457 m_rightOutlineWidthUnits->SetHelpText(_("Units for the right outline width."));
458 if (wxRichTextBordersPage::ShowToolTips())
459 m_rightOutlineWidthUnits->SetToolTip(_("Units for the right outline width."));
460 itemBoxSizer64->Add(m_rightOutlineWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
461
462 itemBoxSizer64->Add(2, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
463
464 wxArrayString m_rightOutlineStyleStrings;
465 m_rightOutlineStyle = new wxComboBox( itemPanel46, ID_RICHTEXT_OUTLINE_RIGHT_STYLE, wxEmptyString, wxDefaultPosition, wxDefaultSize, m_rightOutlineStyleStrings, wxCB_READONLY );
466 itemBoxSizer64->Add(m_rightOutlineStyle, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
467
468 itemBoxSizer64->Add(2, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
469
470 m_rightOutlineColour = new wxRichTextColourSwatchCtrl( itemPanel46, ID_RICHTEXT_OUTLINE_RIGHT_COLOUR, wxDefaultPosition, wxSize(40, 20), wxBORDER_THEME );
471 itemBoxSizer64->Add(m_rightOutlineColour, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
472
473 m_topOutlineCheckbox = new wxCheckBox( itemPanel46, ID_RICHTEXT_OUTLINE_TOP_CHECKBOX, _("&Top:"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER );
474 m_topOutlineCheckbox->SetValue(false);
475 itemFlexGridSizer54->Add(m_topOutlineCheckbox, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
476
477 wxBoxSizer* itemBoxSizer72 = new wxBoxSizer(wxHORIZONTAL);
478 itemFlexGridSizer54->Add(itemBoxSizer72, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5);
479 m_topOutlineWidth = new wxTextCtrl( itemPanel46, ID_RICHTEXT_OUTLINE_TOP, wxEmptyString, wxDefaultPosition, wxSize(50, -1), 0 );
480 itemBoxSizer72->Add(m_topOutlineWidth, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
481
482 wxArrayString m_topOutlineWidthUnitsStrings;
483 m_topOutlineWidthUnitsStrings.Add(_("px"));
484 m_topOutlineWidthUnitsStrings.Add(_("cm"));
485 m_topOutlineWidthUnits = new wxComboBox( itemPanel46, ID_RICHTEXT_OUTLINE_TOP_UNITS, _("px"), wxDefaultPosition, wxSize(60, -1), m_topOutlineWidthUnitsStrings, wxCB_READONLY );
486 m_topOutlineWidthUnits->SetStringSelection(_("px"));
487 m_topOutlineWidthUnits->SetHelpText(_("Units for the top outline width."));
488 if (wxRichTextBordersPage::ShowToolTips())
489 m_topOutlineWidthUnits->SetToolTip(_("Units for the top outline width."));
490 itemBoxSizer72->Add(m_topOutlineWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
491
492 itemBoxSizer72->Add(2, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
493
494 wxArrayString m_topOutlineStyleStrings;
495 m_topOutlineStyle = new wxComboBox( itemPanel46, ID_RICHTEXT_OUTLINE_TOP_STYLE, wxEmptyString, wxDefaultPosition, wxDefaultSize, m_topOutlineStyleStrings, wxCB_READONLY );
496 itemBoxSizer72->Add(m_topOutlineStyle, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
497
498 itemBoxSizer72->Add(2, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
499
500 m_topOutlineColour = new wxRichTextColourSwatchCtrl( itemPanel46, ID_RICHTEXT_OUTLINE_TOP_COLOUR, wxDefaultPosition, wxSize(40, 20), wxBORDER_THEME );
501 itemBoxSizer72->Add(m_topOutlineColour, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
502
503 m_bottomOutlineCheckbox = new wxCheckBox( itemPanel46, ID_RICHTEXT_OUTLINE_BOTTOM_CHECKBOX, _("&Bottom:"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER );
504 m_bottomOutlineCheckbox->SetValue(false);
505 itemFlexGridSizer54->Add(m_bottomOutlineCheckbox, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
506
507 wxBoxSizer* itemBoxSizer80 = new wxBoxSizer(wxHORIZONTAL);
508 itemFlexGridSizer54->Add(itemBoxSizer80, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5);
509 m_bottomOutlineWidth = new wxTextCtrl( itemPanel46, ID_RICHTEXT_OUTLINE_BOTTOM, wxEmptyString, wxDefaultPosition, wxSize(50, -1), 0 );
510 itemBoxSizer80->Add(m_bottomOutlineWidth, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
511
512 wxArrayString m_bottomOutlineWidthUnitsStrings;
513 m_bottomOutlineWidthUnitsStrings.Add(_("px"));
514 m_bottomOutlineWidthUnitsStrings.Add(_("cm"));
515 m_bottomOutlineWidthUnits = new wxComboBox( itemPanel46, ID_RICHTEXT_OUTLINE_BOTTOM_UNITS, _("px"), wxDefaultPosition, wxSize(60, -1), m_bottomOutlineWidthUnitsStrings, wxCB_READONLY );
516 m_bottomOutlineWidthUnits->SetStringSelection(_("px"));
517 m_bottomOutlineWidthUnits->SetHelpText(_("Units for the bottom outline width."));
518 if (wxRichTextBordersPage::ShowToolTips())
519 m_bottomOutlineWidthUnits->SetToolTip(_("Units for the bottom outline width."));
520 itemBoxSizer80->Add(m_bottomOutlineWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
521
522 itemBoxSizer80->Add(2, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
523
524 wxArrayString m_bottomOutlineStyleStrings;
525 m_bottomOutlineStyle = new wxComboBox( itemPanel46, ID_RICHTEXT_OUTLINE_BOTTOM_STYLE, wxEmptyString, wxDefaultPosition, wxDefaultSize, m_bottomOutlineStyleStrings, wxCB_READONLY );
526 itemBoxSizer80->Add(m_bottomOutlineStyle, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
527
528 itemBoxSizer80->Add(2, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
529
530 m_bottomOutlineColour = new wxRichTextColourSwatchCtrl( itemPanel46, ID_RICHTEXT_OUTLINE_BOTTOM_COLOUR, wxDefaultPosition, wxSize(40, 20), wxBORDER_THEME );
531 itemBoxSizer80->Add(m_bottomOutlineColour, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
532
533 itemNotebook4->AddPage(itemPanel46, _("Outline"));
534
535 itemBoxSizer3->Add(itemNotebook4, 0, wxGROW|wxALL, 5);
536
537 m_borderPreviewCtrl = new wxRichTextBorderPreviewCtrl( itemRichTextDialogPage1, ID_RICHTEXT_BORDER_PREVIEW, wxDefaultPosition, wxSize(60, 60), wxBORDER_THEME );
538 itemBoxSizer3->Add(m_borderPreviewCtrl, 1, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
539
540////@end wxRichTextBordersPage content construction
541
542 m_borderStyles.Add(wxTEXT_BOX_ATTR_BORDER_NONE); m_borderStyleNames.Add(_("None"));
543 m_borderStyles.Add(wxTEXT_BOX_ATTR_BORDER_SOLID); m_borderStyleNames.Add(_("Solid"));
544 m_borderStyles.Add(wxTEXT_BOX_ATTR_BORDER_DOTTED); m_borderStyleNames.Add(_("Dotted"));
545 m_borderStyles.Add(wxTEXT_BOX_ATTR_BORDER_DASHED); m_borderStyleNames.Add(_("Dashed"));
546 m_borderStyles.Add(wxTEXT_BOX_ATTR_BORDER_DOUBLE); m_borderStyleNames.Add(_("Double"));
547 m_borderStyles.Add(wxTEXT_BOX_ATTR_BORDER_GROOVE); m_borderStyleNames.Add(_("Groove"));
548 m_borderStyles.Add(wxTEXT_BOX_ATTR_BORDER_RIDGE); m_borderStyleNames.Add(_("Ridge"));
549 m_borderStyles.Add(wxTEXT_BOX_ATTR_BORDER_INSET); m_borderStyleNames.Add(_("Inset"));
550 m_borderStyles.Add(wxTEXT_BOX_ATTR_BORDER_OUTSET); m_borderStyleNames.Add(_("Outset"));
551
552 m_ignoreUpdates = true;
553
554 FillStyleComboBox(m_leftBorderStyle);
555 FillStyleComboBox(m_rightBorderStyle);
556 FillStyleComboBox(m_topBorderStyle);
557 FillStyleComboBox(m_bottomBorderStyle);
558
559 FillStyleComboBox(m_leftOutlineStyle);
560 FillStyleComboBox(m_rightOutlineStyle);
561 FillStyleComboBox(m_topOutlineStyle);
562 FillStyleComboBox(m_bottomOutlineStyle);
563
564 m_borderPreviewCtrl->SetAttributes(GetAttributes());
565
566 m_ignoreUpdates = false;
567}
568
569
570/*!
571 * Should we show tooltips?
572 */
573
574bool wxRichTextBordersPage::ShowToolTips()
575{
576 return true;
577}
578
579// Updates the preview
580void wxRichTextBordersPage::OnCommand(wxCommandEvent& event)
581{
582 event.Skip();
583 if (m_ignoreUpdates)
584 return;
585
586 if (m_borderPreviewCtrl)
587 {
588 TransferDataFromWindow();
589 m_borderPreviewCtrl->Refresh();
590 }
591}
592
593wxRichTextAttr* wxRichTextBordersPage::GetAttributes()
594{
595 return wxRichTextFormattingDialog::GetDialogAttributes(this);
596}
597
598// Fill style combo
599void wxRichTextBordersPage::FillStyleComboBox(wxComboBox* styleComboBox)
600{
601 styleComboBox->Freeze();
602 styleComboBox->Append(m_borderStyleNames);
603 styleComboBox->Thaw();
604}
605
606bool wxRichTextBordersPage::TransferDataToWindow()
607{
608 m_ignoreUpdates = true;
609
610 // Border
611 SetBorderValue(GetAttributes()->GetTextBoxAttr().GetBorder().GetLeft(), m_leftBorderWidth, m_leftBorderWidthUnits, m_leftBorderCheckbox, m_leftBorderStyle, m_leftBorderColour, m_borderStyles);
612 SetBorderValue(GetAttributes()->GetTextBoxAttr().GetBorder().GetRight(), m_rightBorderWidth, m_rightBorderWidthUnits, m_rightBorderCheckbox, m_rightBorderStyle, m_rightBorderColour, m_borderStyles);
613 SetBorderValue(GetAttributes()->GetTextBoxAttr().GetBorder().GetTop(), m_topBorderWidth, m_topBorderWidthUnits, m_topBorderCheckbox, m_topBorderStyle, m_topBorderColour, m_borderStyles);
614 SetBorderValue(GetAttributes()->GetTextBoxAttr().GetBorder().GetBottom(), m_bottomBorderWidth, m_bottomBorderWidthUnits, m_bottomBorderCheckbox, m_bottomBorderStyle, m_bottomBorderColour, m_borderStyles);
615
616 // Outline
617 SetBorderValue(GetAttributes()->GetTextBoxAttr().GetOutline().GetLeft(), m_leftOutlineWidth, m_leftOutlineWidthUnits, m_leftOutlineCheckbox, m_leftOutlineStyle, m_leftOutlineColour, m_borderStyles);
618 SetBorderValue(GetAttributes()->GetTextBoxAttr().GetOutline().GetRight(), m_rightOutlineWidth, m_rightOutlineWidthUnits, m_rightOutlineCheckbox, m_rightOutlineStyle, m_rightOutlineColour, m_borderStyles);
619 SetBorderValue(GetAttributes()->GetTextBoxAttr().GetOutline().GetTop(), m_topOutlineWidth, m_topOutlineWidthUnits, m_topOutlineCheckbox, m_topOutlineStyle, m_topOutlineColour, m_borderStyles);
620 SetBorderValue(GetAttributes()->GetTextBoxAttr().GetOutline().GetBottom(), m_bottomOutlineWidth, m_bottomOutlineWidthUnits, m_bottomOutlineCheckbox, m_bottomOutlineStyle, m_bottomOutlineColour, m_borderStyles);
621
622 m_ignoreUpdates = false;
623
624 return true;
625}
626
627bool wxRichTextBordersPage::TransferDataFromWindow()
628{
629 // Border
630 GetBorderValue(GetAttributes()->GetTextBoxAttr().GetBorder().GetLeft(), m_leftBorderWidth, m_leftBorderWidthUnits, m_leftBorderCheckbox, m_leftBorderStyle, m_leftBorderColour, m_borderStyles);
631 GetBorderValue(GetAttributes()->GetTextBoxAttr().GetBorder().GetRight(), m_rightBorderWidth, m_rightBorderWidthUnits, m_rightBorderCheckbox, m_rightBorderStyle, m_rightBorderColour, m_borderStyles);
632 GetBorderValue(GetAttributes()->GetTextBoxAttr().GetBorder().GetTop(), m_topBorderWidth, m_topBorderWidthUnits, m_topBorderCheckbox, m_topBorderStyle, m_topBorderColour, m_borderStyles);
633 GetBorderValue(GetAttributes()->GetTextBoxAttr().GetBorder().GetBottom(), m_bottomBorderWidth, m_bottomBorderWidthUnits, m_bottomBorderCheckbox, m_bottomBorderStyle, m_bottomBorderColour, m_borderStyles);
634
635 // Outline
636 GetBorderValue(GetAttributes()->GetTextBoxAttr().GetOutline().GetLeft(), m_leftOutlineWidth, m_leftOutlineWidthUnits, m_leftOutlineCheckbox, m_leftOutlineStyle, m_leftOutlineColour, m_borderStyles);
637 GetBorderValue(GetAttributes()->GetTextBoxAttr().GetOutline().GetRight(), m_rightOutlineWidth, m_rightOutlineWidthUnits, m_rightOutlineCheckbox, m_rightOutlineStyle, m_rightOutlineColour, m_borderStyles);
638 GetBorderValue(GetAttributes()->GetTextBoxAttr().GetOutline().GetTop(), m_topOutlineWidth, m_topOutlineWidthUnits, m_topOutlineCheckbox, m_topOutlineStyle, m_topOutlineColour, m_borderStyles);
639 GetBorderValue(GetAttributes()->GetTextBoxAttr().GetOutline().GetBottom(), m_bottomOutlineWidth, m_bottomOutlineWidthUnits, m_bottomOutlineCheckbox, m_bottomOutlineStyle, m_bottomOutlineColour, m_borderStyles);
640
641 return true;
642}
643
644// Set the border controls
645void wxRichTextBordersPage::SetBorderValue(wxTextAttrBorder& border, /* wxTextAttrBorder& borderToReset, */ wxTextCtrl* widthValueCtrl, wxComboBox* widthUnitsCtrl, wxCheckBox* checkBox,
646 wxComboBox* styleCtrl, wxRichTextColourSwatchCtrl* colourCtrl, const wxArrayInt& borderStyles)
647{
648 if (!border.IsValid())
649 {
650 checkBox->Set3StateValue(wxCHK_UNDETERMINED);
651 widthValueCtrl->SetValue(wxT("1"));
652 widthUnitsCtrl->SetSelection(0);
653 colourCtrl->SetColour(*wxBLACK);
654 styleCtrl->SetSelection(0);
655 }
656 else
657 {
658 wxRichTextFormattingDialog::SetDimensionValue(border.GetWidth(), widthValueCtrl, widthUnitsCtrl, checkBox);
659
660 int sel = borderStyles.Index(border.GetStyle());
661 if (sel == -1)
662 sel = 1;
663 styleCtrl->SetSelection(sel);
664 colourCtrl->SetColour(border.GetColour());
665
666 if (sel == 0)
667 checkBox->Set3StateValue(wxCHK_UNCHECKED);
668 else
669 checkBox->Set3StateValue(wxCHK_CHECKED);
670 }
671}
672
673// Get data from the border controls
674void wxRichTextBordersPage::GetBorderValue(wxTextAttrBorder& border, /* wxTextAttrBorder& borderToReset, */ wxTextCtrl* widthValueCtrl, wxComboBox* widthUnitsCtrl, wxCheckBox* checkBox,
675 wxComboBox* styleCtrl, wxRichTextColourSwatchCtrl* colourCtrl, const wxArrayInt& borderStyles)
676{
677 wxRichTextFormattingDialog::GetDimensionValue(border.GetWidth(), widthValueCtrl, widthUnitsCtrl, checkBox);
678
679 int sel = styleCtrl->GetSelection();
680 border.SetColour(colourCtrl->GetColour());
681
682 if (checkBox->Get3StateValue() == wxCHK_UNDETERMINED)
683 {
684 // When we apply the attributes, we won't apply this one, to leave the original unchanged.
685 border.Reset();
686 // borderToReset.Reset();
687 }
688 else if (checkBox->Get3StateValue() == wxCHK_UNCHECKED)
689 {
690 // We make a note to reset this attribute.
691 // borderToReset.GetWidth().MakeValid();
692 border.SetStyle(wxTEXT_BOX_ATTR_BORDER_NONE);
693 }
694 else
695 {
696 // borderToReset.Reset(); // Don't reset this, in case we were going to previously.
697 if (sel != -1)
698 border.SetStyle(borderStyles[sel]);
699 }
700}
701
702/*!
703 * Get bitmap resources
704 */
705
706wxBitmap wxRichTextBordersPage::GetBitmapResource( const wxString& name )
707{
708 // Bitmap retrieval
709////@begin wxRichTextBordersPage bitmap retrieval
710 wxUnusedVar(name);
711 return wxNullBitmap;
712////@end wxRichTextBordersPage bitmap retrieval
713}
714
715/*!
716 * Get icon resources
717 */
718
719wxIcon wxRichTextBordersPage::GetIconResource( const wxString& name )
720{
721 // Icon retrieval
722////@begin wxRichTextBordersPage icon retrieval
723 wxUnusedVar(name);
724 return wxNullIcon;
725////@end wxRichTextBordersPage icon retrieval
726}
727
728
729/*!
730 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BORDER_LEFT
731 */
732
733void wxRichTextBordersPage::OnRichtextBorderLeftUpdate( wxUpdateUIEvent& event )
734{
735 event.Enable(m_leftBorderCheckbox->Get3StateValue() == wxCHK_CHECKED);
736}
737
738
739/*!
740 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BORDER_RIGHT
741 */
742
743void wxRichTextBordersPage::OnRichtextBorderRightUpdate( wxUpdateUIEvent& event )
744{
745 event.Enable(m_rightBorderCheckbox->Get3StateValue() == wxCHK_CHECKED);
746}
747
748
749/*!
750 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BORDER_TOP
751 */
752
753void wxRichTextBordersPage::OnRichtextBorderTopUpdate( wxUpdateUIEvent& event )
754{
755 event.Enable(m_topBorderCheckbox->Get3StateValue() == wxCHK_CHECKED);
756}
757
758/*!
759 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BORDER_BOTTOM
760 */
761
762void wxRichTextBordersPage::OnRichtextBorderBottomUpdate( wxUpdateUIEvent& event )
763{
764 event.Enable(m_bottomBorderCheckbox->Get3StateValue() == wxCHK_CHECKED);
765}
766
767
768/*!
769 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_OUTLINE_LEFT
770 */
771
772void wxRichTextBordersPage::OnRichtextOutlineLeftUpdate( wxUpdateUIEvent& event )
773{
774 event.Enable(m_leftOutlineCheckbox->Get3StateValue() == wxCHK_CHECKED);
775}
776
777
778/*!
779 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_OUTLINE_RIGHT
780 */
781
782void wxRichTextBordersPage::OnRichtextOutlineRightUpdate( wxUpdateUIEvent& event )
783{
784 event.Enable(m_rightOutlineCheckbox->Get3StateValue() == wxCHK_CHECKED);
785}
786
787
788/*!
789 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_OUTLINE_TOP
790 */
791
792void wxRichTextBordersPage::OnRichtextOutlineTopUpdate( wxUpdateUIEvent& event )
793{
794 event.Enable(m_topOutlineCheckbox->Get3StateValue() == wxCHK_CHECKED);
795}
796
797
798/*!
799 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_OUTLINE_BOTTOM
800 */
801
802void wxRichTextBordersPage::OnRichtextOutlineBottomUpdate( wxUpdateUIEvent& event )
803{
804 event.Enable(m_bottomOutlineCheckbox->Get3StateValue() == wxCHK_CHECKED);
805}
806
807/*!
808 * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXT_BORDER_LEFT_CHECKBOX
809 */
810
811void wxRichTextBordersPage::OnRichtextBorderCheckboxClick( wxCommandEvent& event )
812{
813 if (m_ignoreUpdates)
814 return;
815
816 m_ignoreUpdates = true;
817 wxCheckBox* checkBox = NULL;
818 wxComboBox* comboBox = NULL;
819 if (event.GetId() == ID_RICHTEXT_OUTLINE_LEFT_CHECKBOX)
820 {
821 checkBox = m_leftOutlineCheckbox;
822 comboBox = m_leftOutlineStyle;
823 }
824 else if (event.GetId() == ID_RICHTEXT_OUTLINE_TOP_CHECKBOX)
825 {
826 checkBox = m_topOutlineCheckbox;
827 comboBox = m_topOutlineStyle;
828 }
829 else if (event.GetId() == ID_RICHTEXT_OUTLINE_RIGHT_CHECKBOX)
830 {
831 checkBox = m_rightOutlineCheckbox;
832 comboBox = m_rightOutlineStyle;
833 }
834 else if (event.GetId() == ID_RICHTEXT_OUTLINE_BOTTOM_CHECKBOX)
835 {
836 checkBox = m_bottomOutlineCheckbox;
837 comboBox = m_bottomOutlineStyle;
838 }
839 else if (event.GetId() == ID_RICHTEXT_BORDER_LEFT_CHECKBOX)
840 {
841 checkBox = m_leftBorderCheckbox;
842 comboBox = m_leftBorderStyle;
843 }
844 else if (event.GetId() == ID_RICHTEXT_BORDER_TOP_CHECKBOX)
845 {
846 checkBox = m_topBorderCheckbox;
847 comboBox = m_topBorderStyle;
848 }
849 else if (event.GetId() == ID_RICHTEXT_BORDER_RIGHT_CHECKBOX)
850 {
851 checkBox = m_rightBorderCheckbox;
852 comboBox = m_rightBorderStyle;
853 }
854 else if (event.GetId() == ID_RICHTEXT_BORDER_BOTTOM_CHECKBOX)
855 {
856 checkBox = m_bottomBorderCheckbox;
857 comboBox = m_bottomBorderStyle;
858 }
859
860 if (checkBox && comboBox)
861 {
862 if (checkBox->Get3StateValue() == wxCHK_UNCHECKED || checkBox->Get3StateValue() == wxCHK_UNDETERMINED)
863 comboBox->SetSelection(0);
864 else
865 comboBox->SetSelection(1);
866
867 TransferDataFromWindow();
868 m_borderPreviewCtrl->Refresh();
869 }
870
871 m_ignoreUpdates = false;
872}
873
874BEGIN_EVENT_TABLE(wxRichTextBorderPreviewCtrl, wxWindow)
875 EVT_PAINT(wxRichTextBorderPreviewCtrl::OnPaint)
876END_EVENT_TABLE()
877
878wxRichTextBorderPreviewCtrl::wxRichTextBorderPreviewCtrl(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& sz, long style)
879{
880 if ((style & wxBORDER_MASK) == wxBORDER_DEFAULT)
881 style |= wxBORDER_THEME;
882
883 m_attributes = NULL;
884
885 wxWindow::Create(parent, id, pos, sz, style);
886 SetBackgroundColour(*wxWHITE);
887}
888
889void wxRichTextBorderPreviewCtrl::OnPaint(wxPaintEvent& WXUNUSED(event))
890{
891 wxPaintDC dc(this);
892
893 if (m_attributes)
894 {
895 wxRect rect = GetClientRect();
896
897 int margin = 10;
898 rect.x += margin;
899 rect.y += margin;
900 rect.width -= 2*margin;
901 rect.height -= 2*margin;
902
903 wxRichTextObject::DrawBorder(dc, NULL, m_attributes->GetTextBoxAttr().GetOutline(), rect);
904
905 rect.x += margin;
906 rect.y += margin;
907 rect.width -= 2*margin;
908 rect.height -= 2*margin;
909
910 wxRichTextObject::DrawBorder(dc, NULL, m_attributes->GetTextBoxAttr().GetBorder(), rect);
911 }
912}