]> git.saurik.com Git - wxWidgets.git/blob - include/wx/richtext/richtextstyledlg.h
don't use scope resolution operator for Borland in wxPOSIX_IDENT() (part of the fix...
[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 /*!
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 */
51
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
75 class WXDLLIMPEXP_RICHTEXT wxRichTextStyleOrganiserDialog: public wxDialog
76 {
77 DECLARE_DYNAMIC_CLASS( wxRichTextStyleOrganiserDialog )
78 DECLARE_EVENT_TABLE()
79
80 public:
81 /// Constructors
82 wxRichTextStyleOrganiserDialog( );
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 );
84
85 /// Creation
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 );
87
88 /// Creates the controls and sizers
89 void CreateControls();
90
91 /// Initialise member variables
92 void Init();
93
94 /// Transfer data from/to window
95 virtual bool TransferDataFromWindow();
96 virtual bool TransferDataToWindow();
97
98 /// Set/get style sheet
99 void SetStyleSheet(wxRichTextStyleSheet* sheet) { m_richTextStyleSheet = sheet; }
100 wxRichTextStyleSheet* GetStyleSheet() const { return m_richTextStyleSheet; }
101
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; }
109
110 /// Show preview for given or selected preview
111 void ShowPreview(int sel = -1);
112
113 /// Clears the preview
114 void ClearPreview();
115
116 /// List selection
117 void OnListSelection(wxCommandEvent& event);
118
119 /// Get/set restart numbering boolean
120 bool GetRestartNumbering() const { return m_restartNumbering; }
121 void SetRestartNumbering(bool restartNumbering) { m_restartNumbering = restartNumbering; }
122
123 /// Get selected style name or definition
124 wxString GetSelectedStyle() const;
125 wxRichTextStyleDefinition* GetSelectedStyleDefinition() const;
126
127 /// Apply the style
128 bool ApplyStyle(wxRichTextCtrl* ctrl = NULL);
129
130 /// Should we show tooltips?
131 static bool ShowToolTips() { return sm_showToolTips; }
132
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;
229
230 bool m_dontUpdate;
231 int m_flags;
232 static bool sm_showToolTips;
233 bool m_restartNumbering;
234 };
235
236 #endif
237 // _RICHTEXTSTYLEDLG_H_