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_
22 #include "wx/richtext/richtextbuffer.h"
23 #include "wx/richtext/richtextstyles.h"
24 #include "wx/richtext/richtextctrl.h"
27 * Forward declarations
30 ////@begin forward declarations
32 class wxRichTextStyleListCtrl
;
34 ////@end forward declarations
36 class WXDLLIMPEXP_FWD_CORE wxButton
;
37 class WXDLLIMPEXP_FWD_CORE wxCheckBox
;
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
52 * Flags for specifying permitted operations
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
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
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)
75 * wxRichTextStyleOrganiserDialog class declaration
78 class WXDLLIMPEXP_RICHTEXT wxRichTextStyleOrganiserDialog
: public wxDialog
80 DECLARE_DYNAMIC_CLASS( wxRichTextStyleOrganiserDialog
)
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
);
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
);
91 /// Creates the controls and sizers
92 void CreateControls();
94 /// Initialise member variables
97 /// Transfer data from/to window
98 virtual bool TransferDataFromWindow();
99 virtual bool TransferDataToWindow();
101 /// Set/get style sheet
102 void SetStyleSheet(wxRichTextStyleSheet
* sheet
) { m_richTextStyleSheet
= sheet
; }
103 wxRichTextStyleSheet
* GetStyleSheet() const { return m_richTextStyleSheet
; }
106 void SetRichTextCtrl(wxRichTextCtrl
* ctrl
) { m_richTextCtrl
= ctrl
; }
107 wxRichTextCtrl
* GetRichTextCtrl() const { return m_richTextCtrl
; }
110 void SetFlags(int flags
) { m_flags
= flags
; }
111 int GetFlags() const { return m_flags
; }
113 /// Show preview for given or selected preview
114 void ShowPreview(int sel
= -1);
116 /// Clears the preview
120 void OnListSelection(wxCommandEvent
& event
);
122 /// Get/set restart numbering boolean
123 bool GetRestartNumbering() const { return m_restartNumbering
; }
124 void SetRestartNumbering(bool restartNumbering
) { m_restartNumbering
= restartNumbering
; }
126 /// Get selected style name or definition
127 wxString
GetSelectedStyle() const;
128 wxRichTextStyleDefinition
* GetSelectedStyleDefinition() const;
131 bool ApplyStyle(wxRichTextCtrl
* ctrl
= NULL
);
133 /// Should we show tooltips?
134 static bool ShowToolTips() { return sm_showToolTips
; }
136 /// Determines whether tooltips will be shown
137 static void SetShowToolTips(bool show
) { sm_showToolTips
= show
; }
139 ////@begin wxRichTextStyleOrganiserDialog event handler declarations
141 /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_CHAR
142 void OnNewCharClick( wxCommandEvent
& event
);
144 /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_CHAR
145 void OnNewCharUpdate( wxUpdateUIEvent
& event
);
147 /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_PARA
148 void OnNewParaClick( wxCommandEvent
& event
);
150 /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_PARA
151 void OnNewParaUpdate( wxUpdateUIEvent
& event
);
153 /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_LIST
154 void OnNewListClick( wxCommandEvent
& event
);
156 /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_LIST
157 void OnNewListUpdate( wxUpdateUIEvent
& event
);
159 /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_APPLY
160 void OnApplyClick( wxCommandEvent
& event
);
162 /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_APPLY
163 void OnApplyUpdate( wxUpdateUIEvent
& event
);
165 /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_RENAME
166 void OnRenameClick( wxCommandEvent
& event
);
168 /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_RENAME
169 void OnRenameUpdate( wxUpdateUIEvent
& event
);
171 /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_EDIT
172 void OnEditClick( wxCommandEvent
& event
);
174 /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_EDIT
175 void OnEditUpdate( wxUpdateUIEvent
& event
);
177 /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_DELETE
178 void OnDeleteClick( wxCommandEvent
& event
);
180 /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_DELETE
181 void OnDeleteUpdate( wxUpdateUIEvent
& event
);
183 ////@end wxRichTextStyleOrganiserDialog event handler declarations
185 ////@begin wxRichTextStyleOrganiserDialog member function declarations
187 /// Retrieves bitmap resources
188 wxBitmap
GetBitmapResource( const wxString
& name
);
190 /// Retrieves icon resources
191 wxIcon
GetIconResource( const wxString
& name
);
192 ////@end wxRichTextStyleOrganiserDialog member function declarations
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
;
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
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
227 ////@end wxRichTextStyleOrganiserDialog member variables
231 wxRichTextCtrl
* m_richTextCtrl
;
232 wxRichTextStyleSheet
* m_richTextStyleSheet
;
236 static bool sm_showToolTips
;
237 bool m_restartNumbering
;
241 // _RICHTEXTSTYLEDLG_H_