]>
Commit | Line | Data |
---|---|---|
dadd4f55 | 1 | ///////////////////////////////////////////////////////////////////////////// |
41a85215 WS |
2 | // Name: wx/richtext/richtextstyledlg.h |
3 | // Purpose: | |
dadd4f55 | 4 | // Author: Julian Smart |
41a85215 | 5 | // Modified by: |
dadd4f55 | 6 | // Created: 10/5/2006 12:05:31 PM |
41a85215 | 7 | // RCS-ID: $Id$ |
dadd4f55 | 8 | // Copyright: (c) Julian Smart |
41a85215 | 9 | // Licence: wxWindows licence |
dadd4f55 JS |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _RICHTEXTSTYLEDLG_H_ | |
13 | #define _RICHTEXTSTYLEDLG_H_ | |
14 | ||
15 | /*! | |
16 | * Includes | |
17 | */ | |
18 | ||
603f702b JS |
19 | #include "wx/richtext/richtextuicustomization.h" |
20 | ||
dadd4f55 JS |
21 | ////@begin includes |
22 | ////@end includes | |
23 | ||
24 | #include "wx/richtext/richtextbuffer.h" | |
25 | #include "wx/richtext/richtextstyles.h" | |
26 | #include "wx/richtext/richtextctrl.h" | |
27 | ||
28 | /*! | |
29 | * Forward declarations | |
30 | */ | |
31 | ||
32 | ////@begin forward declarations | |
33 | class wxBoxSizer; | |
34 | class wxRichTextStyleListCtrl; | |
35 | class wxRichTextCtrl; | |
603f702b | 36 | class wxStdDialogButtonSizer; |
dadd4f55 JS |
37 | ////@end forward declarations |
38 | ||
ab44f4bf JS |
39 | class WXDLLIMPEXP_FWD_CORE wxButton; |
40 | class WXDLLIMPEXP_FWD_CORE wxCheckBox; | |
41 | ||
dadd4f55 JS |
42 | /*! |
43 | * Control identifiers | |
44 | */ | |
45 | ||
46 | ////@begin control identifiers | |
47 | #define SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_STYLE wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX | |
48 | #define SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_TITLE _("Style Organiser") | |
49 | #define SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_IDNAME ID_RICHTEXTSTYLEORGANISERDIALOG | |
50 | #define SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_SIZE wxSize(400, 300) | |
51 | #define SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_POSITION wxDefaultPosition | |
52 | ////@end control identifiers | |
53 | ||
54 | /*! | |
55 | * Flags for specifying permitted operations | |
56 | */ | |
41a85215 | 57 | |
dadd4f55 JS |
58 | #define wxRICHTEXT_ORGANISER_DELETE_STYLES 0x0001 |
59 | #define wxRICHTEXT_ORGANISER_CREATE_STYLES 0x0002 | |
60 | #define wxRICHTEXT_ORGANISER_APPLY_STYLES 0x0004 | |
61 | #define wxRICHTEXT_ORGANISER_EDIT_STYLES 0x0008 | |
62 | #define wxRICHTEXT_ORGANISER_RENAME_STYLES 0x0010 | |
63 | #define wxRICHTEXT_ORGANISER_OK_CANCEL 0x0020 | |
64 | #define wxRICHTEXT_ORGANISER_RENUMBER 0x0040 | |
65 | ||
66 | // The permitted style types to show | |
67 | #define wxRICHTEXT_ORGANISER_SHOW_CHARACTER 0x0100 | |
68 | #define wxRICHTEXT_ORGANISER_SHOW_PARAGRAPH 0x0200 | |
69 | #define wxRICHTEXT_ORGANISER_SHOW_LIST 0x0400 | |
cd720353 JS |
70 | #define wxRICHTEXT_ORGANISER_SHOW_BOX 0x0800 |
71 | #define wxRICHTEXT_ORGANISER_SHOW_ALL 0x1000 | |
dadd4f55 JS |
72 | |
73 | // Common combinations | |
74 | #define wxRICHTEXT_ORGANISER_ORGANISE (wxRICHTEXT_ORGANISER_SHOW_ALL|wxRICHTEXT_ORGANISER_DELETE_STYLES|wxRICHTEXT_ORGANISER_CREATE_STYLES|wxRICHTEXT_ORGANISER_APPLY_STYLES|wxRICHTEXT_ORGANISER_EDIT_STYLES|wxRICHTEXT_ORGANISER_RENAME_STYLES) | |
75 | #define wxRICHTEXT_ORGANISER_BROWSE (wxRICHTEXT_ORGANISER_SHOW_ALL|wxRICHTEXT_ORGANISER_OK_CANCEL) | |
76 | #define wxRICHTEXT_ORGANISER_BROWSE_NUMBERING (wxRICHTEXT_ORGANISER_SHOW_LIST|wxRICHTEXT_ORGANISER_OK_CANCEL|wxRICHTEXT_ORGANISER_RENUMBER) | |
77 | ||
78 | /*! | |
79 | * wxRichTextStyleOrganiserDialog class declaration | |
80 | */ | |
81 | ||
8987e7d6 | 82 | class WXDLLIMPEXP_RICHTEXT wxRichTextStyleOrganiserDialog: public wxDialog |
41a85215 | 83 | { |
dadd4f55 JS |
84 | DECLARE_DYNAMIC_CLASS( wxRichTextStyleOrganiserDialog ) |
85 | DECLARE_EVENT_TABLE() | |
603f702b | 86 | DECLARE_HELP_PROVISION() |
dadd4f55 JS |
87 | |
88 | public: | |
89 | /// Constructors | |
90 | wxRichTextStyleOrganiserDialog( ); | |
8871035d | 91 | wxRichTextStyleOrganiserDialog( int flags, wxRichTextStyleSheet* sheet, wxRichTextCtrl* ctrl, wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& caption = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_TITLE, const wxPoint& pos = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_SIZE, long style = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_STYLE ); |
dadd4f55 JS |
92 | |
93 | /// Creation | |
8871035d | 94 | bool Create( int flags, wxRichTextStyleSheet* sheet, wxRichTextCtrl* ctrl, wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& caption = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_TITLE, const wxPoint& pos = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_SIZE, long style = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_STYLE ); |
dadd4f55 JS |
95 | |
96 | /// Creates the controls and sizers | |
97 | void CreateControls(); | |
41a85215 | 98 | |
dadd4f55 JS |
99 | /// Initialise member variables |
100 | void Init(); | |
101 | ||
102 | /// Transfer data from/to window | |
103 | virtual bool TransferDataFromWindow(); | |
104 | virtual bool TransferDataToWindow(); | |
41a85215 | 105 | |
dadd4f55 JS |
106 | /// Set/get style sheet |
107 | void SetStyleSheet(wxRichTextStyleSheet* sheet) { m_richTextStyleSheet = sheet; } | |
108 | wxRichTextStyleSheet* GetStyleSheet() const { return m_richTextStyleSheet; } | |
41a85215 | 109 | |
dadd4f55 JS |
110 | /// Set/get control |
111 | void SetRichTextCtrl(wxRichTextCtrl* ctrl) { m_richTextCtrl = ctrl; } | |
112 | wxRichTextCtrl* GetRichTextCtrl() const { return m_richTextCtrl; } | |
113 | ||
114 | /// Set/get flags | |
115 | void SetFlags(int flags) { m_flags = flags; } | |
116 | int GetFlags() const { return m_flags; } | |
41a85215 | 117 | |
dadd4f55 JS |
118 | /// Show preview for given or selected preview |
119 | void ShowPreview(int sel = -1); | |
41a85215 | 120 | |
dadd4f55 JS |
121 | /// Clears the preview |
122 | void ClearPreview(); | |
41a85215 | 123 | |
dadd4f55 JS |
124 | /// List selection |
125 | void OnListSelection(wxCommandEvent& event); | |
41a85215 | 126 | |
dadd4f55 JS |
127 | /// Get/set restart numbering boolean |
128 | bool GetRestartNumbering() const { return m_restartNumbering; } | |
129 | void SetRestartNumbering(bool restartNumbering) { m_restartNumbering = restartNumbering; } | |
41a85215 | 130 | |
dadd4f55 JS |
131 | /// Get selected style name or definition |
132 | wxString GetSelectedStyle() const; | |
133 | wxRichTextStyleDefinition* GetSelectedStyleDefinition() const; | |
41a85215 | 134 | |
dadd4f55 JS |
135 | /// Apply the style |
136 | bool ApplyStyle(wxRichTextCtrl* ctrl = NULL); | |
137 | ||
138 | /// Should we show tooltips? | |
139 | static bool ShowToolTips() { return sm_showToolTips; } | |
41a85215 | 140 | |
dadd4f55 JS |
141 | /// Determines whether tooltips will be shown |
142 | static void SetShowToolTips(bool show) { sm_showToolTips = show; } | |
143 | ||
144 | ////@begin wxRichTextStyleOrganiserDialog event handler declarations | |
145 | ||
146 | /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_CHAR | |
147 | void OnNewCharClick( wxCommandEvent& event ); | |
148 | ||
149 | /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_CHAR | |
150 | void OnNewCharUpdate( wxUpdateUIEvent& event ); | |
151 | ||
152 | /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_PARA | |
153 | void OnNewParaClick( wxCommandEvent& event ); | |
154 | ||
155 | /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_PARA | |
156 | void OnNewParaUpdate( wxUpdateUIEvent& event ); | |
157 | ||
158 | /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_LIST | |
159 | void OnNewListClick( wxCommandEvent& event ); | |
160 | ||
161 | /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_LIST | |
162 | void OnNewListUpdate( wxUpdateUIEvent& event ); | |
163 | ||
cd720353 JS |
164 | /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_BOX |
165 | void OnNewBoxClick( wxCommandEvent& event ); | |
166 | ||
167 | /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_BOX | |
168 | void OnNewBoxUpdate( wxUpdateUIEvent& event ); | |
169 | ||
dadd4f55 JS |
170 | /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_APPLY |
171 | void OnApplyClick( wxCommandEvent& event ); | |
172 | ||
173 | /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_APPLY | |
174 | void OnApplyUpdate( wxUpdateUIEvent& event ); | |
175 | ||
176 | /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_RENAME | |
177 | void OnRenameClick( wxCommandEvent& event ); | |
178 | ||
179 | /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_RENAME | |
180 | void OnRenameUpdate( wxUpdateUIEvent& event ); | |
181 | ||
182 | /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_EDIT | |
183 | void OnEditClick( wxCommandEvent& event ); | |
184 | ||
185 | /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_EDIT | |
186 | void OnEditUpdate( wxUpdateUIEvent& event ); | |
187 | ||
188 | /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_DELETE | |
189 | void OnDeleteClick( wxCommandEvent& event ); | |
190 | ||
191 | /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_DELETE | |
192 | void OnDeleteUpdate( wxUpdateUIEvent& event ); | |
193 | ||
194 | ////@end wxRichTextStyleOrganiserDialog event handler declarations | |
195 | ||
196 | ////@begin wxRichTextStyleOrganiserDialog member function declarations | |
197 | ||
198 | /// Retrieves bitmap resources | |
199 | wxBitmap GetBitmapResource( const wxString& name ); | |
200 | ||
201 | /// Retrieves icon resources | |
202 | wxIcon GetIconResource( const wxString& name ); | |
203 | ////@end wxRichTextStyleOrganiserDialog member function declarations | |
204 | ||
205 | ////@begin wxRichTextStyleOrganiserDialog member variables | |
206 | wxBoxSizer* m_innerSizer; | |
207 | wxBoxSizer* m_buttonSizerParent; | |
208 | wxRichTextStyleListCtrl* m_stylesListBox; | |
209 | wxRichTextCtrl* m_previewCtrl; | |
210 | wxBoxSizer* m_buttonSizer; | |
211 | wxButton* m_newCharacter; | |
212 | wxButton* m_newParagraph; | |
213 | wxButton* m_newList; | |
cd720353 | 214 | wxButton* m_newBox; |
dadd4f55 JS |
215 | wxButton* m_applyStyle; |
216 | wxButton* m_renameStyle; | |
217 | wxButton* m_editStyle; | |
218 | wxButton* m_deleteStyle; | |
219 | wxButton* m_closeButton; | |
220 | wxBoxSizer* m_bottomButtonSizer; | |
221 | wxCheckBox* m_restartNumberingCtrl; | |
603f702b | 222 | wxStdDialogButtonSizer* m_stdButtonSizer; |
dadd4f55 JS |
223 | wxButton* m_okButton; |
224 | wxButton* m_cancelButton; | |
225 | /// Control identifiers | |
226 | enum { | |
227 | ID_RICHTEXTSTYLEORGANISERDIALOG = 10500, | |
228 | ID_RICHTEXTSTYLEORGANISERDIALOG_STYLES = 10501, | |
ce04fea5 | 229 | ID_RICHTEXTSTYLEORGANISERDIALOG_CURRENT_STYLE = 10510, |
dadd4f55 JS |
230 | ID_RICHTEXTSTYLEORGANISERDIALOG_PREVIEW = 10509, |
231 | ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_CHAR = 10504, | |
232 | ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_PARA = 10505, | |
233 | ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_LIST = 10508, | |
cd720353 | 234 | ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_BOX = 10512, |
dadd4f55 JS |
235 | ID_RICHTEXTSTYLEORGANISERDIALOG_APPLY = 10503, |
236 | ID_RICHTEXTSTYLEORGANISERDIALOG_RENAME = 10502, | |
237 | ID_RICHTEXTSTYLEORGANISERDIALOG_EDIT = 10506, | |
238 | ID_RICHTEXTSTYLEORGANISERDIALOG_DELETE = 10507, | |
239 | ID_RICHTEXTSTYLEORGANISERDIALOG_RESTART_NUMBERING = 10511 | |
240 | }; | |
241 | ////@end wxRichTextStyleOrganiserDialog member variables | |
242 | ||
243 | private: | |
244 | ||
245 | wxRichTextCtrl* m_richTextCtrl; | |
246 | wxRichTextStyleSheet* m_richTextStyleSheet; | |
41a85215 | 247 | |
dadd4f55 JS |
248 | bool m_dontUpdate; |
249 | int m_flags; | |
250 | static bool sm_showToolTips; | |
251 | bool m_restartNumbering; | |
252 | }; | |
253 | ||
254 | #endif | |
255 | // _RICHTEXTSTYLEDLG_H_ |