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