1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/richtext/richtextborderspage.h
4 // Author: Julian Smart
6 // Created: 21/10/2010 11:34:24
8 // Copyright: (c) Julian Smart
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _RICHTEXTBORDERSPAGE_H_
13 #define _RICHTEXTBORDERSPAGE_H_
20 #include "wx/richtext/richtextdialogpage.h"
23 #include "wx/notebook.h"
24 #include "wx/statline.h"
28 * Forward declarations
31 class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextColourSwatchCtrl
;
32 class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextBorderPreviewCtrl
;
38 ////@begin control identifiers
39 #define SYMBOL_WXRICHTEXTBORDERSPAGE_STYLE wxTAB_TRAVERSAL
40 #define SYMBOL_WXRICHTEXTBORDERSPAGE_TITLE wxEmptyString
41 #define SYMBOL_WXRICHTEXTBORDERSPAGE_IDNAME ID_RICHTEXTBORDERSPAGE
42 #define SYMBOL_WXRICHTEXTBORDERSPAGE_SIZE wxSize(400, 300)
43 #define SYMBOL_WXRICHTEXTBORDERSPAGE_POSITION wxDefaultPosition
44 ////@end control identifiers
48 * wxRichTextBordersPage class declaration
51 class WXDLLIMPEXP_RICHTEXT wxRichTextBordersPage
: public wxRichTextDialogPage
53 DECLARE_DYNAMIC_CLASS( wxRichTextBordersPage
)
55 DECLARE_HELP_PROVISION()
59 wxRichTextBordersPage();
60 wxRichTextBordersPage( wxWindow
* parent
, wxWindowID id
= SYMBOL_WXRICHTEXTBORDERSPAGE_IDNAME
, const wxPoint
& pos
= SYMBOL_WXRICHTEXTBORDERSPAGE_POSITION
, const wxSize
& size
= SYMBOL_WXRICHTEXTBORDERSPAGE_SIZE
, long style
= SYMBOL_WXRICHTEXTBORDERSPAGE_STYLE
);
63 bool Create( wxWindow
* parent
, wxWindowID id
= SYMBOL_WXRICHTEXTBORDERSPAGE_IDNAME
, const wxPoint
& pos
= SYMBOL_WXRICHTEXTBORDERSPAGE_POSITION
, const wxSize
& size
= SYMBOL_WXRICHTEXTBORDERSPAGE_SIZE
, long style
= SYMBOL_WXRICHTEXTBORDERSPAGE_STYLE
);
66 ~wxRichTextBordersPage();
68 /// Initialises member variables
71 /// Creates the controls and sizers
72 void CreateControls();
74 /// Gets the attributes from the formatting dialog
75 wxRichTextAttr
* GetAttributes();
78 virtual bool TransferDataToWindow();
79 virtual bool TransferDataFromWindow();
81 /// Updates the preview
82 void OnCommand(wxCommandEvent
& event
);
85 virtual void FillStyleComboBox(wxComboBox
* styleComboBox
);
87 /// Set the border controls
88 static void SetBorderValue(wxTextAttrBorder
& border
, /* wxTextAttrBorder& borderToReset, */ wxTextCtrl
* widthValueCtrl
, wxComboBox
* widthUnitsCtrl
, wxCheckBox
* checkBox
,
89 wxComboBox
* styleCtrl
, wxRichTextColourSwatchCtrl
* colourCtrl
, const wxArrayInt
& borderStyles
);
91 /// Get data from the border controls
92 static void GetBorderValue(wxTextAttrBorder
& border
, /* wxTextAttrBorder& borderToReset, */ wxTextCtrl
* widthValueCtrl
, wxComboBox
* widthUnitsCtrl
, wxCheckBox
* checkBox
,
93 wxComboBox
* styleCtrl
, wxRichTextColourSwatchCtrl
* colourCtrl
, const wxArrayInt
& borderStyles
);
95 ////@begin wxRichTextBordersPage event handler declarations
97 /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXT_BORDER_LEFT_CHECKBOX
98 void OnRichtextBorderCheckboxClick( wxCommandEvent
& event
);
100 /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BORDER_LEFT
101 void OnRichtextBorderLeftUpdate( wxUpdateUIEvent
& event
);
103 /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BORDER_RIGHT
104 void OnRichtextBorderRightUpdate( wxUpdateUIEvent
& event
);
106 /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BORDER_TOP
107 void OnRichtextBorderTopUpdate( wxUpdateUIEvent
& event
);
109 /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BORDER_BOTTOM
110 void OnRichtextBorderBottomUpdate( wxUpdateUIEvent
& event
);
112 /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_OUTLINE_LEFT
113 void OnRichtextOutlineLeftUpdate( wxUpdateUIEvent
& event
);
115 /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_OUTLINE_RIGHT
116 void OnRichtextOutlineRightUpdate( wxUpdateUIEvent
& event
);
118 /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_OUTLINE_TOP
119 void OnRichtextOutlineTopUpdate( wxUpdateUIEvent
& event
);
121 /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_OUTLINE_BOTTOM
122 void OnRichtextOutlineBottomUpdate( wxUpdateUIEvent
& event
);
124 ////@end wxRichTextBordersPage event handler declarations
126 ////@begin wxRichTextBordersPage member function declarations
128 /// Retrieves bitmap resources
129 wxBitmap
GetBitmapResource( const wxString
& name
);
131 /// Retrieves icon resources
132 wxIcon
GetIconResource( const wxString
& name
);
133 ////@end wxRichTextBordersPage member function declarations
135 /// Should we show tooltips?
136 static bool ShowToolTips();
138 ////@begin wxRichTextBordersPage member variables
139 wxCheckBox
* m_leftBorderCheckbox
;
140 wxTextCtrl
* m_leftBorderWidth
;
141 wxComboBox
* m_leftBorderWidthUnits
;
142 wxComboBox
* m_leftBorderStyle
;
143 wxRichTextColourSwatchCtrl
* m_leftBorderColour
;
144 wxCheckBox
* m_rightBorderCheckbox
;
145 wxTextCtrl
* m_rightBorderWidth
;
146 wxComboBox
* m_rightBorderWidthUnits
;
147 wxComboBox
* m_rightBorderStyle
;
148 wxRichTextColourSwatchCtrl
* m_rightBorderColour
;
149 wxCheckBox
* m_topBorderCheckbox
;
150 wxTextCtrl
* m_topBorderWidth
;
151 wxComboBox
* m_topBorderWidthUnits
;
152 wxComboBox
* m_topBorderStyle
;
153 wxRichTextColourSwatchCtrl
* m_topBorderColour
;
154 wxCheckBox
* m_bottomBorderCheckbox
;
155 wxTextCtrl
* m_bottomBorderWidth
;
156 wxComboBox
* m_bottomBorderWidthUnits
;
157 wxComboBox
* m_bottomBorderStyle
;
158 wxRichTextColourSwatchCtrl
* m_bottomBorderColour
;
159 wxCheckBox
* m_leftOutlineCheckbox
;
160 wxTextCtrl
* m_leftOutlineWidth
;
161 wxComboBox
* m_leftOutlineWidthUnits
;
162 wxComboBox
* m_leftOutlineStyle
;
163 wxRichTextColourSwatchCtrl
* m_leftOutlineColour
;
164 wxCheckBox
* m_rightOutlineCheckbox
;
165 wxTextCtrl
* m_rightOutlineWidth
;
166 wxComboBox
* m_rightOutlineWidthUnits
;
167 wxComboBox
* m_rightOutlineStyle
;
168 wxRichTextColourSwatchCtrl
* m_rightOutlineColour
;
169 wxCheckBox
* m_topOutlineCheckbox
;
170 wxTextCtrl
* m_topOutlineWidth
;
171 wxComboBox
* m_topOutlineWidthUnits
;
172 wxComboBox
* m_topOutlineStyle
;
173 wxRichTextColourSwatchCtrl
* m_topOutlineColour
;
174 wxCheckBox
* m_bottomOutlineCheckbox
;
175 wxTextCtrl
* m_bottomOutlineWidth
;
176 wxComboBox
* m_bottomOutlineWidthUnits
;
177 wxComboBox
* m_bottomOutlineStyle
;
178 wxRichTextColourSwatchCtrl
* m_bottomOutlineColour
;
179 wxRichTextBorderPreviewCtrl
* m_borderPreviewCtrl
;
180 /// Control identifiers
182 ID_RICHTEXTBORDERSPAGE
= 10800,
183 ID_RICHTEXTBORDERSPAGE_NOTEBOOK
= 10801,
184 ID_RICHTEXTBORDERSPAGE_BORDERS
= 10802,
185 ID_RICHTEXT_BORDER_LEFT_CHECKBOX
= 10803,
186 ID_RICHTEXT_BORDER_LEFT
= 10804,
187 ID_RICHTEXT_BORDER_LEFT_UNITS
= 10805,
188 ID_RICHTEXT_BORDER_LEFT_STYLE
= 10806,
189 ID_RICHTEXT_BORDER_LEFT_COLOUR
= 10807,
190 ID_RICHTEXT_BORDER_RIGHT_CHECKBOX
= 10808,
191 ID_RICHTEXT_BORDER_RIGHT
= 10809,
192 ID_RICHTEXT_BORDER_RIGHT_UNITS
= 10810,
193 ID_RICHTEXT_BORDER_RIGHT_STYLE
= 10811,
194 ID_RICHTEXT_BORDER_RIGHT_COLOUR
= 10812,
195 ID_RICHTEXT_BORDER_TOP_CHECKBOX
= 10813,
196 ID_RICHTEXT_BORDER_TOP
= 10814,
197 ID_RICHTEXT_BORDER_TOP_UNITS
= 10815,
198 ID_RICHTEXT_BORDER_TOP_STYLE
= 10816,
199 ID_RICHTEXT_BORDER_TOP_COLOUR
= 10817,
200 ID_RICHTEXT_BORDER_BOTTOM_CHECKBOX
= 10818,
201 ID_RICHTEXT_BORDER_BOTTOM
= 10819,
202 ID_RICHTEXT_BORDER_BOTTOM_UNITS
= 10820,
203 ID_RICHTEXT_BORDER_BOTTOM_STYLE
= 10821,
204 ID_RICHTEXT_BORDER_BOTTOM_COLOUR
= 10822,
205 ID_RICHTEXTBORDERSPAGE_OUTLINE
= 10823,
206 ID_RICHTEXT_OUTLINE_LEFT_CHECKBOX
= 10824,
207 ID_RICHTEXT_OUTLINE_LEFT
= 10825,
208 ID_RICHTEXT_OUTLINE_LEFT_UNITS
= 10826,
209 ID_RICHTEXT_OUTLINE_LEFT_STYLE
= 10827,
210 ID_RICHTEXT_OUTLINE_LEFT_COLOUR
= 10828,
211 ID_RICHTEXT_OUTLINE_RIGHT_CHECKBOX
= 10829,
212 ID_RICHTEXT_OUTLINE_RIGHT
= 10830,
213 ID_RICHTEXT_OUTLINE_RIGHT_UNITS
= 10831,
214 ID_RICHTEXT_OUTLINE_RIGHT_STYLE
= 10832,
215 ID_RICHTEXT_OUTLINE_RIGHT_COLOUR
= 10833,
216 ID_RICHTEXT_OUTLINE_TOP_CHECKBOX
= 10834,
217 ID_RICHTEXT_OUTLINE_TOP
= 10835,
218 ID_RICHTEXT_OUTLINE_TOP_UNITS
= 10836,
219 ID_RICHTEXT_OUTLINE_TOP_STYLE
= 10837,
220 ID_RICHTEXT_OUTLINE_TOP_COLOUR
= 10838,
221 ID_RICHTEXT_OUTLINE_BOTTOM_CHECKBOX
= 10839,
222 ID_RICHTEXT_OUTLINE_BOTTOM
= 10840,
223 ID_RICHTEXT_OUTLINE_BOTTOM_UNITS
= 10841,
224 ID_RICHTEXT_OUTLINE_BOTTOM_STYLE
= 10842,
225 ID_RICHTEXT_OUTLINE_BOTTOM_COLOUR
= 10843,
226 ID_RICHTEXT_BORDER_PREVIEW
= 10844
228 ////@end wxRichTextBordersPage member variables
230 wxArrayInt m_borderStyles
;
231 wxArrayString m_borderStyleNames
;
232 bool m_ignoreUpdates
;
235 class WXDLLIMPEXP_RICHTEXT wxRichTextBorderPreviewCtrl
: public wxWindow
238 wxRichTextBorderPreviewCtrl(wxWindow
*parent
, wxWindowID id
= wxID_ANY
, const wxPoint
& pos
= wxDefaultPosition
, const wxSize
& sz
= wxDefaultSize
, long style
= 0);
240 void SetAttributes(wxRichTextAttr
* attr
) { m_attributes
= attr
; }
241 wxRichTextAttr
* GetAttributes() const { return m_attributes
; }
244 wxRichTextAttr
* m_attributes
;
246 void OnPaint(wxPaintEvent
& event
);
247 DECLARE_EVENT_TABLE()
251 // _RICHTEXTBORDERSPAGE_H_