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_BUTTON 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_BUTTON 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_BUTTON 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_BUTTON 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_BUTTON 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_BUTTON 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_BUTTON 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_BUTTON 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 /// wxEVT_BUTTON event handler for wxID_HELP
195 void OnHelpClick( wxCommandEvent
& event
);
197 ////@end wxRichTextStyleOrganiserDialog event handler declarations
199 ////@begin wxRichTextStyleOrganiserDialog member function declarations
201 /// Retrieves bitmap resources
202 wxBitmap
GetBitmapResource( const wxString
& name
);
204 /// Retrieves icon resources
205 wxIcon
GetIconResource( const wxString
& name
);
206 ////@end wxRichTextStyleOrganiserDialog member function declarations
208 ////@begin wxRichTextStyleOrganiserDialog member variables
209 wxBoxSizer
* m_innerSizer
;
210 wxBoxSizer
* m_buttonSizerParent
;
211 wxRichTextStyleListCtrl
* m_stylesListBox
;
212 wxRichTextCtrl
* m_previewCtrl
;
213 wxBoxSizer
* m_buttonSizer
;
214 wxButton
* m_newCharacter
;
215 wxButton
* m_newParagraph
;
218 wxButton
* m_applyStyle
;
219 wxButton
* m_renameStyle
;
220 wxButton
* m_editStyle
;
221 wxButton
* m_deleteStyle
;
222 wxButton
* m_closeButton
;
223 wxBoxSizer
* m_bottomButtonSizer
;
224 wxCheckBox
* m_restartNumberingCtrl
;
225 wxStdDialogButtonSizer
* m_stdButtonSizer
;
226 wxButton
* m_okButton
;
227 wxButton
* m_cancelButton
;
228 /// Control identifiers
230 ID_RICHTEXTSTYLEORGANISERDIALOG
= 10500,
231 ID_RICHTEXTSTYLEORGANISERDIALOG_STYLES
= 10501,
232 ID_RICHTEXTSTYLEORGANISERDIALOG_CURRENT_STYLE
= 10510,
233 ID_RICHTEXTSTYLEORGANISERDIALOG_PREVIEW
= 10509,
234 ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_CHAR
= 10504,
235 ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_PARA
= 10505,
236 ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_LIST
= 10508,
237 ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_BOX
= 10512,
238 ID_RICHTEXTSTYLEORGANISERDIALOG_APPLY
= 10503,
239 ID_RICHTEXTSTYLEORGANISERDIALOG_RENAME
= 10502,
240 ID_RICHTEXTSTYLEORGANISERDIALOG_EDIT
= 10506,
241 ID_RICHTEXTSTYLEORGANISERDIALOG_DELETE
= 10507,
242 ID_RICHTEXTSTYLEORGANISERDIALOG_RESTART_NUMBERING
= 10511
244 ////@end wxRichTextStyleOrganiserDialog member variables
248 wxRichTextCtrl
* m_richTextCtrl
;
249 wxRichTextStyleSheet
* m_richTextStyleSheet
;
253 static bool sm_showToolTips
;
254 bool m_restartNumbering
;
258 // _RICHTEXTSTYLEDLG_H_