]>
Commit | Line | Data |
---|---|---|
603f702b | 1 | ///////////////////////////////////////////////////////////////////////////// |
80fdcdb9 | 2 | // Name: wx/richtext/richtextborderspage.h |
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 | ||
12 | #ifndef _RICHTEXTBORDERSPAGE_H_ | |
13 | #define _RICHTEXTBORDERSPAGE_H_ | |
14 | ||
15 | ||
16 | /*! | |
17 | * Includes | |
18 | */ | |
19 | ||
20 | #include "wx/richtext/richtextdialogpage.h" | |
21 | ||
22 | ////@begin includes | |
23 | #include "wx/notebook.h" | |
24 | #include "wx/statline.h" | |
25 | ////@end includes | |
26 | ||
27 | /*! | |
28 | * Forward declarations | |
29 | */ | |
30 | ||
31 | class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextColourSwatchCtrl; | |
32 | class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextBorderPreviewCtrl; | |
33 | ||
34 | /*! | |
35 | * Control identifiers | |
36 | */ | |
37 | ||
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 | |
45 | ||
46 | ||
47 | /*! | |
48 | * wxRichTextBordersPage class declaration | |
49 | */ | |
50 | ||
51 | class WXDLLIMPEXP_RICHTEXT wxRichTextBordersPage: public wxRichTextDialogPage | |
52 | { | |
53 | DECLARE_DYNAMIC_CLASS( wxRichTextBordersPage ) | |
54 | DECLARE_EVENT_TABLE() | |
55 | DECLARE_HELP_PROVISION() | |
56 | ||
57 | public: | |
58 | /// Constructors | |
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 ); | |
61 | ||
62 | /// Creation | |
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 ); | |
64 | ||
65 | /// Destructor | |
66 | ~wxRichTextBordersPage(); | |
67 | ||
68 | /// Initialises member variables | |
69 | void Init(); | |
70 | ||
71 | /// Creates the controls and sizers | |
72 | void CreateControls(); | |
73 | ||
74 | /// Gets the attributes from the formatting dialog | |
75 | wxRichTextAttr* GetAttributes(); | |
76 | ||
77 | /// Data transfer | |
78 | virtual bool TransferDataToWindow(); | |
79 | virtual bool TransferDataFromWindow(); | |
80 | ||
81 | /// Updates the preview | |
82 | void OnCommand(wxCommandEvent& event); | |
83 | ||
84 | /// Fill style combo | |
85 | virtual void FillStyleComboBox(wxComboBox* styleComboBox); | |
86 | ||
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); | |
90 | ||
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); | |
94 | ||
95 | ////@begin wxRichTextBordersPage event handler declarations | |
96 | ||
97 | /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXT_BORDER_LEFT_CHECKBOX | |
98 | void OnRichtextBorderCheckboxClick( wxCommandEvent& event ); | |
99 | ||
100 | /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BORDER_LEFT | |
101 | void OnRichtextBorderLeftUpdate( wxUpdateUIEvent& event ); | |
102 | ||
103 | /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BORDER_RIGHT | |
104 | void OnRichtextBorderRightUpdate( wxUpdateUIEvent& event ); | |
105 | ||
106 | /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BORDER_TOP | |
107 | void OnRichtextBorderTopUpdate( wxUpdateUIEvent& event ); | |
108 | ||
109 | /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BORDER_BOTTOM | |
110 | void OnRichtextBorderBottomUpdate( wxUpdateUIEvent& event ); | |
111 | ||
112 | /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_OUTLINE_LEFT | |
113 | void OnRichtextOutlineLeftUpdate( wxUpdateUIEvent& event ); | |
114 | ||
115 | /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_OUTLINE_RIGHT | |
116 | void OnRichtextOutlineRightUpdate( wxUpdateUIEvent& event ); | |
117 | ||
118 | /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_OUTLINE_TOP | |
119 | void OnRichtextOutlineTopUpdate( wxUpdateUIEvent& event ); | |
120 | ||
121 | /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_OUTLINE_BOTTOM | |
122 | void OnRichtextOutlineBottomUpdate( wxUpdateUIEvent& event ); | |
123 | ||
124 | ////@end wxRichTextBordersPage event handler declarations | |
125 | ||
126 | ////@begin wxRichTextBordersPage member function declarations | |
127 | ||
128 | /// Retrieves bitmap resources | |
129 | wxBitmap GetBitmapResource( const wxString& name ); | |
130 | ||
131 | /// Retrieves icon resources | |
132 | wxIcon GetIconResource( const wxString& name ); | |
133 | ////@end wxRichTextBordersPage member function declarations | |
134 | ||
135 | /// Should we show tooltips? | |
136 | static bool ShowToolTips(); | |
137 | ||
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 | |
181 | enum { | |
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 | |
227 | }; | |
228 | ////@end wxRichTextBordersPage member variables | |
229 | ||
230 | wxArrayInt m_borderStyles; | |
231 | wxArrayString m_borderStyleNames; | |
232 | bool m_ignoreUpdates; | |
233 | }; | |
234 | ||
235 | class WXDLLIMPEXP_RICHTEXT wxRichTextBorderPreviewCtrl : public wxWindow | |
236 | { | |
237 | public: | |
238 | wxRichTextBorderPreviewCtrl(wxWindow *parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& sz = wxDefaultSize, long style = 0); | |
239 | ||
240 | void SetAttributes(wxRichTextAttr* attr) { m_attributes = attr; } | |
241 | wxRichTextAttr* GetAttributes() const { return m_attributes; } | |
242 | ||
243 | private: | |
244 | wxRichTextAttr* m_attributes; | |
245 | ||
246 | void OnPaint(wxPaintEvent& event); | |
247 | DECLARE_EVENT_TABLE() | |
248 | }; | |
249 | ||
250 | #endif | |
251 | // _RICHTEXTBORDERSPAGE_H_ |