1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/richtext/richtextstyledlg.h
4 // Author: Julian Smart
6 // Created: 10/5/2006 12:05:31 PM
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _RICHTEXTSTYLEDLG_H_
13 #define _RICHTEXTSTYLEDLG_H_
19 #include "wx/richtext/richtextuicustomization.h"
24 #include "wx/richtext/richtextbuffer.h"
25 #include "wx/richtext/richtextstyles.h"
26 #include "wx/richtext/richtextctrl.h"
29 * Forward declarations
32 ////@begin forward declarations
34 class wxRichTextStyleListCtrl
;
36 class wxStdDialogButtonSizer
;
37 ////@end forward declarations
39 class WXDLLIMPEXP_FWD_CORE wxButton
;
40 class WXDLLIMPEXP_FWD_CORE wxCheckBox
;
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
55 * Flags for specifying permitted operations
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
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_BOX 0x0800
71 #define wxRICHTEXT_ORGANISER_SHOW_ALL 0x1000
73 // Common combinations
74 #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)
75 #define wxRICHTEXT_ORGANISER_BROWSE (wxRICHTEXT_ORGANISER_SHOW_ALL|wxRICHTEXT_ORGANISER_OK_CANCEL)
76 #define wxRICHTEXT_ORGANISER_BROWSE_NUMBERING (wxRICHTEXT_ORGANISER_SHOW_LIST|wxRICHTEXT_ORGANISER_OK_CANCEL|wxRICHTEXT_ORGANISER_RENUMBER)
79 * wxRichTextStyleOrganiserDialog class declaration
82 class WXDLLIMPEXP_RICHTEXT wxRichTextStyleOrganiserDialog
: public wxDialog
84 DECLARE_DYNAMIC_CLASS( wxRichTextStyleOrganiserDialog
)
86 DECLARE_HELP_PROVISION()
90 wxRichTextStyleOrganiserDialog( );
91 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
);
94 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
);
96 /// Creates the controls and sizers
97 void CreateControls();
99 /// Initialise member variables
102 /// Transfer data from/to window
103 virtual bool TransferDataFromWindow();
104 virtual bool TransferDataToWindow();
106 /// Set/get style sheet
107 void SetStyleSheet(wxRichTextStyleSheet
* sheet
) { m_richTextStyleSheet
= sheet
; }
108 wxRichTextStyleSheet
* GetStyleSheet() const { return m_richTextStyleSheet
; }
111 void SetRichTextCtrl(wxRichTextCtrl
* ctrl
) { m_richTextCtrl
= ctrl
; }
112 wxRichTextCtrl
* GetRichTextCtrl() const { return m_richTextCtrl
; }
115 void SetFlags(int flags
) { m_flags
= flags
; }
116 int GetFlags() const { return m_flags
; }
118 /// Show preview for given or selected preview
119 void ShowPreview(int sel
= -1);
121 /// Clears the preview
125 void OnListSelection(wxCommandEvent
& event
);
127 /// Get/set restart numbering boolean
128 bool GetRestartNumbering() const { return m_restartNumbering
; }
129 void SetRestartNumbering(bool restartNumbering
) { m_restartNumbering
= restartNumbering
; }
131 /// Get selected style name or definition
132 wxString
GetSelectedStyle() const;
133 wxRichTextStyleDefinition
* GetSelectedStyleDefinition() const;
136 bool ApplyStyle(wxRichTextCtrl
* ctrl
= NULL
);
138 /// Should we show tooltips?
139 static bool ShowToolTips() { return sm_showToolTips
; }
141 /// Determines whether tooltips will be shown
142 static void SetShowToolTips(bool show
) { sm_showToolTips
= show
; }
144 ////@begin wxRichTextStyleOrganiserDialog event handler declarations
146 /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_CHAR
147 void OnNewCharClick( wxCommandEvent
& event
);
149 /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_CHAR
150 void OnNewCharUpdate( wxUpdateUIEvent
& event
);
152 /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_PARA
153 void OnNewParaClick( wxCommandEvent
& event
);
155 /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_PARA
156 void OnNewParaUpdate( wxUpdateUIEvent
& event
);
158 /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_LIST
159 void OnNewListClick( wxCommandEvent
& event
);
161 /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_LIST
162 void OnNewListUpdate( wxUpdateUIEvent
& event
);
164 /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_BOX
165 void OnNewBoxClick( wxCommandEvent
& event
);
167 /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_BOX
168 void OnNewBoxUpdate( wxUpdateUIEvent
& event
);
170 /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_APPLY
171 void OnApplyClick( wxCommandEvent
& event
);
173 /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_APPLY
174 void OnApplyUpdate( wxUpdateUIEvent
& event
);
176 /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_RENAME
177 void OnRenameClick( wxCommandEvent
& event
);
179 /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_RENAME
180 void OnRenameUpdate( wxUpdateUIEvent
& event
);
182 /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_EDIT
183 void OnEditClick( wxCommandEvent
& event
);
185 /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_EDIT
186 void OnEditUpdate( wxUpdateUIEvent
& event
);
188 /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_DELETE
189 void OnDeleteClick( wxCommandEvent
& event
);
191 /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_DELETE
192 void OnDeleteUpdate( wxUpdateUIEvent
& event
);
194 ////@end wxRichTextStyleOrganiserDialog event handler declarations
196 ////@begin wxRichTextStyleOrganiserDialog member function declarations
198 /// Retrieves bitmap resources
199 wxBitmap
GetBitmapResource( const wxString
& name
);
201 /// Retrieves icon resources
202 wxIcon
GetIconResource( const wxString
& name
);
203 ////@end wxRichTextStyleOrganiserDialog member function declarations
205 ////@begin wxRichTextStyleOrganiserDialog member variables
206 wxBoxSizer
* m_innerSizer
;
207 wxBoxSizer
* m_buttonSizerParent
;
208 wxRichTextStyleListCtrl
* m_stylesListBox
;
209 wxRichTextCtrl
* m_previewCtrl
;
210 wxBoxSizer
* m_buttonSizer
;
211 wxButton
* m_newCharacter
;
212 wxButton
* m_newParagraph
;
215 wxButton
* m_applyStyle
;
216 wxButton
* m_renameStyle
;
217 wxButton
* m_editStyle
;
218 wxButton
* m_deleteStyle
;
219 wxButton
* m_closeButton
;
220 wxBoxSizer
* m_bottomButtonSizer
;
221 wxCheckBox
* m_restartNumberingCtrl
;
222 wxStdDialogButtonSizer
* m_stdButtonSizer
;
223 wxButton
* m_okButton
;
224 wxButton
* m_cancelButton
;
225 /// Control identifiers
227 ID_RICHTEXTSTYLEORGANISERDIALOG
= 10500,
228 ID_RICHTEXTSTYLEORGANISERDIALOG_STYLES
= 10501,
229 ID_RICHTEXTSTYLEORGANISERDIALOG_CURRENT_STYLE
= 10510,
230 ID_RICHTEXTSTYLEORGANISERDIALOG_PREVIEW
= 10509,
231 ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_CHAR
= 10504,
232 ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_PARA
= 10505,
233 ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_LIST
= 10508,
234 ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_BOX
= 10512,
235 ID_RICHTEXTSTYLEORGANISERDIALOG_APPLY
= 10503,
236 ID_RICHTEXTSTYLEORGANISERDIALOG_RENAME
= 10502,
237 ID_RICHTEXTSTYLEORGANISERDIALOG_EDIT
= 10506,
238 ID_RICHTEXTSTYLEORGANISERDIALOG_DELETE
= 10507,
239 ID_RICHTEXTSTYLEORGANISERDIALOG_RESTART_NUMBERING
= 10511
241 ////@end wxRichTextStyleOrganiserDialog member variables
245 wxRichTextCtrl
* m_richTextCtrl
;
246 wxRichTextStyleSheet
* m_richTextStyleSheet
;
250 static bool sm_showToolTips
;
251 bool m_restartNumbering
;
255 // _RICHTEXTSTYLEDLG_H_