1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/richtext/richtextborderspage.cpp
4 // Author: Julian Smart
6 // Created: 21/10/2010 11:34:24
8 // Copyright: (c) Julian Smart
10 /////////////////////////////////////////////////////////////////////////////
13 #include "wx/imaglist.h"
16 #include "wx/richtext/richtextborderspage.h"
23 * wxRichTextBordersPage type definition
26 IMPLEMENT_DYNAMIC_CLASS( wxRichTextBordersPage
, wxRichTextDialogPage
)
30 * wxRichTextBordersPage event table definition
33 BEGIN_EVENT_TABLE( wxRichTextBordersPage
, wxRichTextDialogPage
)
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
)
41 ////@begin wxRichTextBordersPage event table entries
42 EVT_CHECKBOX( ID_RICHTEXT_BORDER_LEFT_CHECKBOX
, wxRichTextBordersPage::OnRichtextBorderCheckboxClick
)
44 EVT_UPDATE_UI( ID_RICHTEXT_BORDER_LEFT
, wxRichTextBordersPage::OnRichtextBorderLeftUpdate
)
46 EVT_UPDATE_UI( ID_RICHTEXT_BORDER_LEFT_UNITS
, wxRichTextBordersPage::OnRichtextBorderLeftUpdate
)
48 EVT_UPDATE_UI( ID_RICHTEXT_BORDER_LEFT_STYLE
, wxRichTextBordersPage::OnRichtextBorderLeftUpdate
)
50 EVT_UPDATE_UI( ID_RICHTEXT_BORDER_LEFT_COLOUR
, wxRichTextBordersPage::OnRichtextBorderLeftUpdate
)
52 EVT_CHECKBOX( ID_RICHTEXT_BORDER_RIGHT_CHECKBOX
, wxRichTextBordersPage::OnRichtextBorderCheckboxClick
)
54 EVT_UPDATE_UI( ID_RICHTEXT_BORDER_RIGHT
, wxRichTextBordersPage::OnRichtextBorderRightUpdate
)
56 EVT_UPDATE_UI( ID_RICHTEXT_BORDER_RIGHT_UNITS
, wxRichTextBordersPage::OnRichtextBorderRightUpdate
)
58 EVT_UPDATE_UI( ID_RICHTEXT_BORDER_RIGHT_STYLE
, wxRichTextBordersPage::OnRichtextBorderRightUpdate
)
60 EVT_UPDATE_UI( ID_RICHTEXT_BORDER_RIGHT_COLOUR
, wxRichTextBordersPage::OnRichtextBorderRightUpdate
)
62 EVT_CHECKBOX( ID_RICHTEXT_BORDER_TOP_CHECKBOX
, wxRichTextBordersPage::OnRichtextBorderCheckboxClick
)
64 EVT_UPDATE_UI( ID_RICHTEXT_BORDER_TOP
, wxRichTextBordersPage::OnRichtextBorderTopUpdate
)
66 EVT_UPDATE_UI( ID_RICHTEXT_BORDER_TOP_UNITS
, wxRichTextBordersPage::OnRichtextBorderTopUpdate
)
68 EVT_UPDATE_UI( ID_RICHTEXT_BORDER_TOP_STYLE
, wxRichTextBordersPage::OnRichtextBorderTopUpdate
)
70 EVT_UPDATE_UI( ID_RICHTEXT_BORDER_TOP_COLOUR
, wxRichTextBordersPage::OnRichtextBorderTopUpdate
)
72 EVT_CHECKBOX( ID_RICHTEXT_BORDER_BOTTOM_CHECKBOX
, wxRichTextBordersPage::OnRichtextBorderCheckboxClick
)
74 EVT_UPDATE_UI( ID_RICHTEXT_BORDER_BOTTOM
, wxRichTextBordersPage::OnRichtextBorderBottomUpdate
)
76 EVT_UPDATE_UI( ID_RICHTEXT_BORDER_BOTTOM_UNITS
, wxRichTextBordersPage::OnRichtextBorderBottomUpdate
)
78 EVT_UPDATE_UI( ID_RICHTEXT_BORDER_BOTTOM_STYLE
, wxRichTextBordersPage::OnRichtextBorderBottomUpdate
)
80 EVT_UPDATE_UI( ID_RICHTEXT_BORDER_BOTTOM_COLOUR
, wxRichTextBordersPage::OnRichtextBorderBottomUpdate
)
82 EVT_CHECKBOX( ID_RICHTEXT_OUTLINE_LEFT_CHECKBOX
, wxRichTextBordersPage::OnRichtextBorderCheckboxClick
)
84 EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_LEFT
, wxRichTextBordersPage::OnRichtextOutlineLeftUpdate
)
86 EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_LEFT_UNITS
, wxRichTextBordersPage::OnRichtextOutlineLeftUpdate
)
88 EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_LEFT_STYLE
, wxRichTextBordersPage::OnRichtextOutlineLeftUpdate
)
90 EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_LEFT_COLOUR
, wxRichTextBordersPage::OnRichtextOutlineLeftUpdate
)
92 EVT_CHECKBOX( ID_RICHTEXT_OUTLINE_RIGHT_CHECKBOX
, wxRichTextBordersPage::OnRichtextBorderCheckboxClick
)
94 EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_RIGHT
, wxRichTextBordersPage::OnRichtextOutlineRightUpdate
)
96 EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_RIGHT_UNITS
, wxRichTextBordersPage::OnRichtextOutlineRightUpdate
)
98 EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_RIGHT_STYLE
, wxRichTextBordersPage::OnRichtextOutlineRightUpdate
)
100 EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_RIGHT_COLOUR
, wxRichTextBordersPage::OnRichtextOutlineRightUpdate
)
102 EVT_CHECKBOX( ID_RICHTEXT_OUTLINE_TOP_CHECKBOX
, wxRichTextBordersPage::OnRichtextBorderCheckboxClick
)
104 EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_TOP
, wxRichTextBordersPage::OnRichtextOutlineTopUpdate
)
106 EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_TOP_UNITS
, wxRichTextBordersPage::OnRichtextOutlineTopUpdate
)
108 EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_TOP_STYLE
, wxRichTextBordersPage::OnRichtextOutlineTopUpdate
)
110 EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_TOP_COLOUR
, wxRichTextBordersPage::OnRichtextOutlineTopUpdate
)
112 EVT_CHECKBOX( ID_RICHTEXT_OUTLINE_BOTTOM_CHECKBOX
, wxRichTextBordersPage::OnRichtextBorderCheckboxClick
)
114 EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_BOTTOM
, wxRichTextBordersPage::OnRichtextOutlineBottomUpdate
)
116 EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_BOTTOM_UNITS
, wxRichTextBordersPage::OnRichtextOutlineBottomUpdate
)
118 EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_BOTTOM_STYLE
, wxRichTextBordersPage::OnRichtextOutlineBottomUpdate
)
120 EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_BOTTOM_COLOUR
, wxRichTextBordersPage::OnRichtextOutlineBottomUpdate
)
122 ////@end wxRichTextBordersPage event table entries
126 IMPLEMENT_HELP_PROVISION(wxRichTextBordersPage
)
129 * wxRichTextBordersPage constructors
132 wxRichTextBordersPage::wxRichTextBordersPage()
137 wxRichTextBordersPage::wxRichTextBordersPage( wxWindow
* parent
, wxWindowID id
, const wxPoint
& pos
, const wxSize
& size
, long style
)
140 Create(parent
, id
, pos
, size
, style
);
145 * wxRichTextBordersPage creator
148 bool wxRichTextBordersPage::Create( wxWindow
* parent
, wxWindowID id
, const wxPoint
& pos
, const wxSize
& size
, long style
)
150 ////@begin wxRichTextBordersPage creation
151 SetExtraStyle(wxWS_EX_VALIDATE_RECURSIVELY
);
152 wxRichTextDialogPage::Create( parent
, id
, pos
, size
, style
);
157 GetSizer()->SetSizeHints(this);
160 ////@end wxRichTextBordersPage creation
166 * wxRichTextBordersPage destructor
169 wxRichTextBordersPage::~wxRichTextBordersPage()
171 ////@begin wxRichTextBordersPage destruction
172 ////@end wxRichTextBordersPage destruction
177 * Member initialisation
180 void wxRichTextBordersPage::Init()
182 m_ignoreUpdates
= false;
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
231 * Control creation for wxRichTextBordersPage
234 void wxRichTextBordersPage::CreateControls()
236 ////@begin wxRichTextBordersPage content construction
237 wxRichTextBordersPage
* itemRichTextDialogPage1
= this;
239 wxBoxSizer
* itemBoxSizer2
= new wxBoxSizer(wxVERTICAL
);
240 itemRichTextDialogPage1
->SetSizer(itemBoxSizer2
);
242 wxBoxSizer
* itemBoxSizer3
= new wxBoxSizer(wxVERTICAL
);
243 itemBoxSizer2
->Add(itemBoxSizer3
, 1, wxGROW
|wxALL
, 5);
245 wxNotebook
* itemNotebook4
= new wxNotebook( itemRichTextDialogPage1
, ID_RICHTEXTBORDERSPAGE_NOTEBOOK
, wxDefaultPosition
, wxDefaultSize
, wxBK_DEFAULT
);
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
);
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);
260 wxStaticLine
* itemStaticLine10
= new wxStaticLine( itemPanel5
, wxID_STATIC
, wxDefaultPosition
, wxDefaultSize
, wxLI_HORIZONTAL
);
261 itemBoxSizer8
->Add(itemStaticLine10
, 1, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
263 wxBoxSizer
* itemBoxSizer11
= new wxBoxSizer(wxHORIZONTAL
);
264 itemBoxSizer7
->Add(itemBoxSizer11
, 0, wxGROW
, 5);
265 itemBoxSizer11
->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
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);
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);
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);
288 itemBoxSizer15
->Add(2, 5, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 2);
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);
294 itemBoxSizer15
->Add(2, 5, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 2);
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);
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);
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);
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);
318 itemBoxSizer23
->Add(2, 5, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 2);
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);
324 itemBoxSizer23
->Add(2, 5, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 2);
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);
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);
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);
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);
348 itemBoxSizer31
->Add(2, 5, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 2);
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);
354 itemBoxSizer31
->Add(2, 5, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 2);
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);
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);
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);
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);
378 itemBoxSizer39
->Add(2, 5, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 2);
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);
384 itemBoxSizer39
->Add(2, 5, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 2);
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);
389 itemNotebook4
->AddPage(itemPanel5
, _("Border"));
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
);
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);
404 wxStaticLine
* itemStaticLine51
= new wxStaticLine( itemPanel46
, wxID_STATIC
, wxDefaultPosition
, wxDefaultSize
, wxLI_HORIZONTAL
);
405 itemBoxSizer49
->Add(itemStaticLine51
, 1, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
407 wxBoxSizer
* itemBoxSizer52
= new wxBoxSizer(wxHORIZONTAL
);
408 itemBoxSizer48
->Add(itemBoxSizer52
, 0, wxGROW
, 5);
409 itemBoxSizer52
->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
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);
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);
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);
432 itemBoxSizer56
->Add(2, 5, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 2);
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);
438 itemBoxSizer56
->Add(2, 5, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 2);
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);
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);
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);
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);
462 itemBoxSizer64
->Add(2, 5, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 2);
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);
468 itemBoxSizer64
->Add(2, 5, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 2);
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);
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);
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);
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);
492 itemBoxSizer72
->Add(2, 5, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 2);
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);
498 itemBoxSizer72
->Add(2, 5, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 2);
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);
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);
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);
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);
522 itemBoxSizer80
->Add(2, 5, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 2);
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);
528 itemBoxSizer80
->Add(2, 5, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 2);
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);
533 itemNotebook4
->AddPage(itemPanel46
, _("Outline"));
535 itemBoxSizer3
->Add(itemNotebook4
, 0, wxGROW
|wxALL
, 5);
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);
540 ////@end wxRichTextBordersPage content construction
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"));
552 m_ignoreUpdates
= true;
554 FillStyleComboBox(m_leftBorderStyle
);
555 FillStyleComboBox(m_rightBorderStyle
);
556 FillStyleComboBox(m_topBorderStyle
);
557 FillStyleComboBox(m_bottomBorderStyle
);
559 FillStyleComboBox(m_leftOutlineStyle
);
560 FillStyleComboBox(m_rightOutlineStyle
);
561 FillStyleComboBox(m_topOutlineStyle
);
562 FillStyleComboBox(m_bottomOutlineStyle
);
564 m_borderPreviewCtrl
->SetAttributes(GetAttributes());
566 m_ignoreUpdates
= false;
571 * Should we show tooltips?
574 bool wxRichTextBordersPage::ShowToolTips()
579 // Updates the preview
580 void wxRichTextBordersPage::OnCommand(wxCommandEvent
& event
)
586 if (m_borderPreviewCtrl
)
588 TransferDataFromWindow();
589 m_borderPreviewCtrl
->Refresh();
593 wxRichTextAttr
* wxRichTextBordersPage::GetAttributes()
595 return wxRichTextFormattingDialog::GetDialogAttributes(this);
599 void wxRichTextBordersPage::FillStyleComboBox(wxComboBox
* styleComboBox
)
601 styleComboBox
->Freeze();
602 styleComboBox
->Append(m_borderStyleNames
);
603 styleComboBox
->Thaw();
606 bool wxRichTextBordersPage::TransferDataToWindow()
608 m_ignoreUpdates
= true;
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
);
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
);
622 m_ignoreUpdates
= false;
627 bool wxRichTextBordersPage::TransferDataFromWindow()
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
);
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
);
644 // Set the border controls
645 void wxRichTextBordersPage::SetBorderValue(wxTextAttrBorder
& border
, /* wxTextAttrBorder& borderToReset, */ wxTextCtrl
* widthValueCtrl
, wxComboBox
* widthUnitsCtrl
, wxCheckBox
* checkBox
,
646 wxComboBox
* styleCtrl
, wxRichTextColourSwatchCtrl
* colourCtrl
, const wxArrayInt
& borderStyles
)
648 if (!border
.IsValid())
650 checkBox
->Set3StateValue(wxCHK_UNDETERMINED
);
651 widthValueCtrl
->SetValue(wxT("1"));
652 widthUnitsCtrl
->SetSelection(0);
653 colourCtrl
->SetColour(*wxBLACK
);
654 styleCtrl
->SetSelection(0);
658 wxRichTextFormattingDialog::SetDimensionValue(border
.GetWidth(), widthValueCtrl
, widthUnitsCtrl
, checkBox
);
660 int sel
= borderStyles
.Index(border
.GetStyle());
663 styleCtrl
->SetSelection(sel
);
664 colourCtrl
->SetColour(border
.GetColour());
667 checkBox
->Set3StateValue(wxCHK_UNCHECKED
);
669 checkBox
->Set3StateValue(wxCHK_CHECKED
);
673 // Get data from the border controls
674 void wxRichTextBordersPage::GetBorderValue(wxTextAttrBorder
& border
, /* wxTextAttrBorder& borderToReset, */ wxTextCtrl
* widthValueCtrl
, wxComboBox
* widthUnitsCtrl
, wxCheckBox
* checkBox
,
675 wxComboBox
* styleCtrl
, wxRichTextColourSwatchCtrl
* colourCtrl
, const wxArrayInt
& borderStyles
)
677 wxRichTextFormattingDialog::GetDimensionValue(border
.GetWidth(), widthValueCtrl
, widthUnitsCtrl
, checkBox
);
679 int sel
= styleCtrl
->GetSelection();
680 border
.SetColour(colourCtrl
->GetColour());
682 if (checkBox
->Get3StateValue() == wxCHK_UNDETERMINED
)
684 // When we apply the attributes, we won't apply this one, to leave the original unchanged.
686 // borderToReset.Reset();
688 else if (checkBox
->Get3StateValue() == wxCHK_UNCHECKED
)
690 // We make a note to reset this attribute.
691 // borderToReset.GetWidth().MakeValid();
692 border
.SetStyle(wxTEXT_BOX_ATTR_BORDER_NONE
);
696 // borderToReset.Reset(); // Don't reset this, in case we were going to previously.
698 border
.SetStyle(borderStyles
[sel
]);
703 * Get bitmap resources
706 wxBitmap
wxRichTextBordersPage::GetBitmapResource( const wxString
& name
)
709 ////@begin wxRichTextBordersPage bitmap retrieval
712 ////@end wxRichTextBordersPage bitmap retrieval
719 wxIcon
wxRichTextBordersPage::GetIconResource( const wxString
& name
)
722 ////@begin wxRichTextBordersPage icon retrieval
725 ////@end wxRichTextBordersPage icon retrieval
730 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BORDER_LEFT
733 void wxRichTextBordersPage::OnRichtextBorderLeftUpdate( wxUpdateUIEvent
& event
)
735 event
.Enable(m_leftBorderCheckbox
->Get3StateValue() == wxCHK_CHECKED
);
740 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BORDER_RIGHT
743 void wxRichTextBordersPage::OnRichtextBorderRightUpdate( wxUpdateUIEvent
& event
)
745 event
.Enable(m_rightBorderCheckbox
->Get3StateValue() == wxCHK_CHECKED
);
750 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BORDER_TOP
753 void wxRichTextBordersPage::OnRichtextBorderTopUpdate( wxUpdateUIEvent
& event
)
755 event
.Enable(m_topBorderCheckbox
->Get3StateValue() == wxCHK_CHECKED
);
759 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BORDER_BOTTOM
762 void wxRichTextBordersPage::OnRichtextBorderBottomUpdate( wxUpdateUIEvent
& event
)
764 event
.Enable(m_bottomBorderCheckbox
->Get3StateValue() == wxCHK_CHECKED
);
769 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_OUTLINE_LEFT
772 void wxRichTextBordersPage::OnRichtextOutlineLeftUpdate( wxUpdateUIEvent
& event
)
774 event
.Enable(m_leftOutlineCheckbox
->Get3StateValue() == wxCHK_CHECKED
);
779 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_OUTLINE_RIGHT
782 void wxRichTextBordersPage::OnRichtextOutlineRightUpdate( wxUpdateUIEvent
& event
)
784 event
.Enable(m_rightOutlineCheckbox
->Get3StateValue() == wxCHK_CHECKED
);
789 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_OUTLINE_TOP
792 void wxRichTextBordersPage::OnRichtextOutlineTopUpdate( wxUpdateUIEvent
& event
)
794 event
.Enable(m_topOutlineCheckbox
->Get3StateValue() == wxCHK_CHECKED
);
799 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_OUTLINE_BOTTOM
802 void wxRichTextBordersPage::OnRichtextOutlineBottomUpdate( wxUpdateUIEvent
& event
)
804 event
.Enable(m_bottomOutlineCheckbox
->Get3StateValue() == wxCHK_CHECKED
);
808 * wxEVT_CHECKBOX event handler for ID_RICHTEXT_BORDER_LEFT_CHECKBOX
811 void wxRichTextBordersPage::OnRichtextBorderCheckboxClick( wxCommandEvent
& event
)
816 m_ignoreUpdates
= true;
817 wxCheckBox
* checkBox
= NULL
;
818 wxComboBox
* comboBox
= NULL
;
819 if (event
.GetId() == ID_RICHTEXT_OUTLINE_LEFT_CHECKBOX
)
821 checkBox
= m_leftOutlineCheckbox
;
822 comboBox
= m_leftOutlineStyle
;
824 else if (event
.GetId() == ID_RICHTEXT_OUTLINE_TOP_CHECKBOX
)
826 checkBox
= m_topOutlineCheckbox
;
827 comboBox
= m_topOutlineStyle
;
829 else if (event
.GetId() == ID_RICHTEXT_OUTLINE_RIGHT_CHECKBOX
)
831 checkBox
= m_rightOutlineCheckbox
;
832 comboBox
= m_rightOutlineStyle
;
834 else if (event
.GetId() == ID_RICHTEXT_OUTLINE_BOTTOM_CHECKBOX
)
836 checkBox
= m_bottomOutlineCheckbox
;
837 comboBox
= m_bottomOutlineStyle
;
839 else if (event
.GetId() == ID_RICHTEXT_BORDER_LEFT_CHECKBOX
)
841 checkBox
= m_leftBorderCheckbox
;
842 comboBox
= m_leftBorderStyle
;
844 else if (event
.GetId() == ID_RICHTEXT_BORDER_TOP_CHECKBOX
)
846 checkBox
= m_topBorderCheckbox
;
847 comboBox
= m_topBorderStyle
;
849 else if (event
.GetId() == ID_RICHTEXT_BORDER_RIGHT_CHECKBOX
)
851 checkBox
= m_rightBorderCheckbox
;
852 comboBox
= m_rightBorderStyle
;
854 else if (event
.GetId() == ID_RICHTEXT_BORDER_BOTTOM_CHECKBOX
)
856 checkBox
= m_bottomBorderCheckbox
;
857 comboBox
= m_bottomBorderStyle
;
860 if (checkBox
&& comboBox
)
862 if (checkBox
->Get3StateValue() == wxCHK_UNCHECKED
|| checkBox
->Get3StateValue() == wxCHK_UNDETERMINED
)
863 comboBox
->SetSelection(0);
865 comboBox
->SetSelection(1);
867 TransferDataFromWindow();
868 m_borderPreviewCtrl
->Refresh();
871 m_ignoreUpdates
= false;
874 BEGIN_EVENT_TABLE(wxRichTextBorderPreviewCtrl
, wxWindow
)
875 EVT_PAINT(wxRichTextBorderPreviewCtrl::OnPaint
)
878 wxRichTextBorderPreviewCtrl::wxRichTextBorderPreviewCtrl(wxWindow
*parent
, wxWindowID id
, const wxPoint
& pos
, const wxSize
& sz
, long style
)
880 if ((style
& wxBORDER_MASK
) == wxBORDER_DEFAULT
)
881 style
|= wxBORDER_THEME
;
885 wxWindow::Create(parent
, id
, pos
, sz
, style
);
886 SetBackgroundColour(*wxWHITE
);
889 void wxRichTextBorderPreviewCtrl::OnPaint(wxPaintEvent
& WXUNUSED(event
))
895 wxRect rect
= GetClientRect();
900 rect
.width
-= 2*margin
;
901 rect
.height
-= 2*margin
;
903 wxRichTextObject::DrawBorder(dc
, NULL
, m_attributes
->GetTextBoxAttr().GetOutline(), rect
);
907 rect
.width
-= 2*margin
;
908 rect
.height
-= 2*margin
;
910 wxRichTextObject::DrawBorder(dc
, NULL
, m_attributes
->GetTextBoxAttr().GetBorder(), rect
);