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