]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/richtext/richtextstyledlg.h
Fix compilation under dll builds. Wrap source files in wxUSE_WEB checks to allow...
[wxWidgets.git] / include / wx / richtext / richtextstyledlg.h
... / ...
CommitLineData
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#include "wx/richtext/richtextuicustomization.h"
20
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
33class wxBoxSizer;
34class wxRichTextStyleListCtrl;
35class wxRichTextCtrl;
36class wxStdDialogButtonSizer;
37////@end forward declarations
38
39class WXDLLIMPEXP_FWD_CORE wxButton;
40class WXDLLIMPEXP_FWD_CORE wxCheckBox;
41
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 */
57
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
70#define wxRICHTEXT_ORGANISER_SHOW_ALL 0x0800
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
81class WXDLLIMPEXP_RICHTEXT wxRichTextStyleOrganiserDialog: public wxDialog
82{
83 DECLARE_DYNAMIC_CLASS( wxRichTextStyleOrganiserDialog )
84 DECLARE_EVENT_TABLE()
85 DECLARE_HELP_PROVISION()
86
87public:
88 /// Constructors
89 wxRichTextStyleOrganiserDialog( );
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 );
91
92 /// Creation
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 );
94
95 /// Creates the controls and sizers
96 void CreateControls();
97
98 /// Initialise member variables
99 void Init();
100
101 /// Transfer data from/to window
102 virtual bool TransferDataFromWindow();
103 virtual bool TransferDataToWindow();
104
105 /// Set/get style sheet
106 void SetStyleSheet(wxRichTextStyleSheet* sheet) { m_richTextStyleSheet = sheet; }
107 wxRichTextStyleSheet* GetStyleSheet() const { return m_richTextStyleSheet; }
108
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; }
116
117 /// Show preview for given or selected preview
118 void ShowPreview(int sel = -1);
119
120 /// Clears the preview
121 void ClearPreview();
122
123 /// List selection
124 void OnListSelection(wxCommandEvent& event);
125
126 /// Get/set restart numbering boolean
127 bool GetRestartNumbering() const { return m_restartNumbering; }
128 void SetRestartNumbering(bool restartNumbering) { m_restartNumbering = restartNumbering; }
129
130 /// Get selected style name or definition
131 wxString GetSelectedStyle() const;
132 wxRichTextStyleDefinition* GetSelectedStyleDefinition() const;
133
134 /// Apply the style
135 bool ApplyStyle(wxRichTextCtrl* ctrl = NULL);
136
137 /// Should we show tooltips?
138 static bool ShowToolTips() { return sm_showToolTips; }
139
140 /// Determines whether tooltips will be shown
141 static void SetShowToolTips(bool show) { sm_showToolTips = show; }
142
143////@begin wxRichTextStyleOrganiserDialog event handler declarations
144
145 /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_CHAR
146 void OnNewCharClick( wxCommandEvent& event );
147
148 /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_CHAR
149 void OnNewCharUpdate( wxUpdateUIEvent& event );
150
151 /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_PARA
152 void OnNewParaClick( wxCommandEvent& event );
153
154 /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_PARA
155 void OnNewParaUpdate( wxUpdateUIEvent& event );
156
157 /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_LIST
158 void OnNewListClick( wxCommandEvent& event );
159
160 /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_LIST
161 void OnNewListUpdate( wxUpdateUIEvent& event );
162
163 /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_APPLY
164 void OnApplyClick( wxCommandEvent& event );
165
166 /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_APPLY
167 void OnApplyUpdate( wxUpdateUIEvent& event );
168
169 /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_RENAME
170 void OnRenameClick( wxCommandEvent& event );
171
172 /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_RENAME
173 void OnRenameUpdate( wxUpdateUIEvent& event );
174
175 /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_EDIT
176 void OnEditClick( wxCommandEvent& event );
177
178 /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_EDIT
179 void OnEditUpdate( wxUpdateUIEvent& event );
180
181 /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_DELETE
182 void OnDeleteClick( wxCommandEvent& event );
183
184 /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_DELETE
185 void OnDeleteUpdate( wxUpdateUIEvent& event );
186
187////@end wxRichTextStyleOrganiserDialog event handler declarations
188
189////@begin wxRichTextStyleOrganiserDialog member function declarations
190
191 /// Retrieves bitmap resources
192 wxBitmap GetBitmapResource( const wxString& name );
193
194 /// Retrieves icon resources
195 wxIcon GetIconResource( const wxString& name );
196////@end wxRichTextStyleOrganiserDialog member function declarations
197
198////@begin wxRichTextStyleOrganiserDialog member variables
199 wxBoxSizer* m_innerSizer;
200 wxBoxSizer* m_buttonSizerParent;
201 wxRichTextStyleListCtrl* m_stylesListBox;
202 wxRichTextCtrl* m_previewCtrl;
203 wxBoxSizer* m_buttonSizer;
204 wxButton* m_newCharacter;
205 wxButton* m_newParagraph;
206 wxButton* m_newList;
207 wxButton* m_applyStyle;
208 wxButton* m_renameStyle;
209 wxButton* m_editStyle;
210 wxButton* m_deleteStyle;
211 wxButton* m_closeButton;
212 wxBoxSizer* m_bottomButtonSizer;
213 wxCheckBox* m_restartNumberingCtrl;
214 wxStdDialogButtonSizer* m_stdButtonSizer;
215 wxButton* m_okButton;
216 wxButton* m_cancelButton;
217 /// Control identifiers
218 enum {
219 ID_RICHTEXTSTYLEORGANISERDIALOG = 10500,
220 ID_RICHTEXTSTYLEORGANISERDIALOG_STYLES = 10501,
221 ID_RICHTEXTSTYLEORGANISERDIALOG_CURRENT_STYLE = 10510,
222 ID_RICHTEXTSTYLEORGANISERDIALOG_PREVIEW = 10509,
223 ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_CHAR = 10504,
224 ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_PARA = 10505,
225 ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_LIST = 10508,
226 ID_RICHTEXTSTYLEORGANISERDIALOG_APPLY = 10503,
227 ID_RICHTEXTSTYLEORGANISERDIALOG_RENAME = 10502,
228 ID_RICHTEXTSTYLEORGANISERDIALOG_EDIT = 10506,
229 ID_RICHTEXTSTYLEORGANISERDIALOG_DELETE = 10507,
230 ID_RICHTEXTSTYLEORGANISERDIALOG_RESTART_NUMBERING = 10511
231 };
232////@end wxRichTextStyleOrganiserDialog member variables
233
234private:
235
236 wxRichTextCtrl* m_richTextCtrl;
237 wxRichTextStyleSheet* m_richTextStyleSheet;
238
239 bool m_dontUpdate;
240 int m_flags;
241 static bool sm_showToolTips;
242 bool m_restartNumbering;
243};
244
245#endif
246 // _RICHTEXTSTYLEDLG_H_