]>
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 | ||
ce7fe42e | 146 | /// wxEVT_BUTTON event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_CHAR |
dadd4f55 JS |
147 | void OnNewCharClick( wxCommandEvent& event ); |
148 | ||
149 | /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_CHAR | |
150 | void OnNewCharUpdate( wxUpdateUIEvent& event ); | |
151 | ||
ce7fe42e | 152 | /// wxEVT_BUTTON event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_PARA |
dadd4f55 JS |
153 | void OnNewParaClick( wxCommandEvent& event ); |
154 | ||
155 | /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_PARA | |
156 | void OnNewParaUpdate( wxUpdateUIEvent& event ); | |
157 | ||
ce7fe42e | 158 | /// wxEVT_BUTTON event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_LIST |
dadd4f55 JS |
159 | void OnNewListClick( wxCommandEvent& event ); |
160 | ||
161 | /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_LIST | |
162 | void OnNewListUpdate( wxUpdateUIEvent& event ); | |
163 | ||
ce7fe42e | 164 | /// wxEVT_BUTTON event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_BOX |
cd720353 JS |
165 | void OnNewBoxClick( wxCommandEvent& event ); |
166 | ||
167 | /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_BOX | |
168 | void OnNewBoxUpdate( wxUpdateUIEvent& event ); | |
169 | ||
ce7fe42e | 170 | /// wxEVT_BUTTON event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_APPLY |
dadd4f55 JS |
171 | void OnApplyClick( wxCommandEvent& event ); |
172 | ||
173 | /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_APPLY | |
174 | void OnApplyUpdate( wxUpdateUIEvent& event ); | |
175 | ||
ce7fe42e | 176 | /// wxEVT_BUTTON event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_RENAME |
dadd4f55 JS |
177 | void OnRenameClick( wxCommandEvent& event ); |
178 | ||
179 | /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_RENAME | |
180 | void OnRenameUpdate( wxUpdateUIEvent& event ); | |
181 | ||
ce7fe42e | 182 | /// wxEVT_BUTTON event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_EDIT |
dadd4f55 JS |
183 | void OnEditClick( wxCommandEvent& event ); |
184 | ||
185 | /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_EDIT | |
186 | void OnEditUpdate( wxUpdateUIEvent& event ); | |
187 | ||
ce7fe42e | 188 | /// wxEVT_BUTTON event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_DELETE |
dadd4f55 JS |
189 | void OnDeleteClick( wxCommandEvent& event ); |
190 | ||
191 | /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_DELETE | |
192 | void OnDeleteUpdate( wxUpdateUIEvent& event ); | |
193 | ||
ce7fe42e | 194 | /// wxEVT_BUTTON event handler for wxID_HELP |
3bb084c4 JS |
195 | void OnHelpClick( wxCommandEvent& event ); |
196 | ||
dadd4f55 JS |
197 | ////@end wxRichTextStyleOrganiserDialog event handler declarations |
198 | ||
199 | ////@begin wxRichTextStyleOrganiserDialog member function declarations | |
200 | ||
201 | /// Retrieves bitmap resources | |
202 | wxBitmap GetBitmapResource( const wxString& name ); | |
203 | ||
204 | /// Retrieves icon resources | |
205 | wxIcon GetIconResource( const wxString& name ); | |
206 | ////@end wxRichTextStyleOrganiserDialog member function declarations | |
207 | ||
208 | ////@begin wxRichTextStyleOrganiserDialog member variables | |
209 | wxBoxSizer* m_innerSizer; | |
210 | wxBoxSizer* m_buttonSizerParent; | |
211 | wxRichTextStyleListCtrl* m_stylesListBox; | |
212 | wxRichTextCtrl* m_previewCtrl; | |
213 | wxBoxSizer* m_buttonSizer; | |
214 | wxButton* m_newCharacter; | |
215 | wxButton* m_newParagraph; | |
216 | wxButton* m_newList; | |
cd720353 | 217 | wxButton* m_newBox; |
dadd4f55 JS |
218 | wxButton* m_applyStyle; |
219 | wxButton* m_renameStyle; | |
220 | wxButton* m_editStyle; | |
221 | wxButton* m_deleteStyle; | |
222 | wxButton* m_closeButton; | |
223 | wxBoxSizer* m_bottomButtonSizer; | |
224 | wxCheckBox* m_restartNumberingCtrl; | |
603f702b | 225 | wxStdDialogButtonSizer* m_stdButtonSizer; |
dadd4f55 JS |
226 | wxButton* m_okButton; |
227 | wxButton* m_cancelButton; | |
228 | /// Control identifiers | |
229 | enum { | |
230 | ID_RICHTEXTSTYLEORGANISERDIALOG = 10500, | |
231 | ID_RICHTEXTSTYLEORGANISERDIALOG_STYLES = 10501, | |
ce04fea5 | 232 | ID_RICHTEXTSTYLEORGANISERDIALOG_CURRENT_STYLE = 10510, |
dadd4f55 JS |
233 | ID_RICHTEXTSTYLEORGANISERDIALOG_PREVIEW = 10509, |
234 | ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_CHAR = 10504, | |
235 | ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_PARA = 10505, | |
236 | ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_LIST = 10508, | |
cd720353 | 237 | ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_BOX = 10512, |
dadd4f55 JS |
238 | ID_RICHTEXTSTYLEORGANISERDIALOG_APPLY = 10503, |
239 | ID_RICHTEXTSTYLEORGANISERDIALOG_RENAME = 10502, | |
240 | ID_RICHTEXTSTYLEORGANISERDIALOG_EDIT = 10506, | |
241 | ID_RICHTEXTSTYLEORGANISERDIALOG_DELETE = 10507, | |
242 | ID_RICHTEXTSTYLEORGANISERDIALOG_RESTART_NUMBERING = 10511 | |
243 | }; | |
244 | ////@end wxRichTextStyleOrganiserDialog member variables | |
245 | ||
246 | private: | |
247 | ||
248 | wxRichTextCtrl* m_richTextCtrl; | |
249 | wxRichTextStyleSheet* m_richTextStyleSheet; | |
41a85215 | 250 | |
dadd4f55 JS |
251 | bool m_dontUpdate; |
252 | int m_flags; | |
253 | static bool sm_showToolTips; | |
254 | bool m_restartNumbering; | |
255 | }; | |
256 | ||
257 | #endif | |
258 | // _RICHTEXTSTYLEDLG_H_ |