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