1 /////////////////////////////////////////////////////////////////////////////
2 // Name: richtext/richtextstyledlg.h
3 // Purpose: interface of wxRichTextStyleOrganiserDialog
4 // Author: wxWidgets team
5 // Licence: wxWindows licence
6 /////////////////////////////////////////////////////////////////////////////
10 * Flags for specifying permitted operations
13 #define wxRICHTEXT_ORGANISER_DELETE_STYLES 0x0001
14 #define wxRICHTEXT_ORGANISER_CREATE_STYLES 0x0002
15 #define wxRICHTEXT_ORGANISER_APPLY_STYLES 0x0004
16 #define wxRICHTEXT_ORGANISER_EDIT_STYLES 0x0008
17 #define wxRICHTEXT_ORGANISER_RENAME_STYLES 0x0010
18 #define wxRICHTEXT_ORGANISER_OK_CANCEL 0x0020
19 #define wxRICHTEXT_ORGANISER_RENUMBER 0x0040
21 // The permitted style types to show
22 #define wxRICHTEXT_ORGANISER_SHOW_CHARACTER 0x0100
23 #define wxRICHTEXT_ORGANISER_SHOW_PARAGRAPH 0x0200
24 #define wxRICHTEXT_ORGANISER_SHOW_LIST 0x0400
25 #define wxRICHTEXT_ORGANISER_SHOW_BOX 0x0800
26 #define wxRICHTEXT_ORGANISER_SHOW_ALL 0x1000
28 // Common combinations
29 #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)
30 #define wxRICHTEXT_ORGANISER_BROWSE (wxRICHTEXT_ORGANISER_SHOW_ALL|wxRICHTEXT_ORGANISER_OK_CANCEL)
31 #define wxRICHTEXT_ORGANISER_BROWSE_NUMBERING (wxRICHTEXT_ORGANISER_SHOW_LIST|wxRICHTEXT_ORGANISER_OK_CANCEL|wxRICHTEXT_ORGANISER_RENUMBER)
35 @class wxRichTextStyleOrganiserDialog
37 This class shows a style sheet and allows the user to edit, add and remove styles.
39 It can also be used as a style browser, for example if the application is not
40 using a permanent wxRichTextStyleComboCtrl or wxRichTextStyleListCtrl to
46 class wxRichTextStyleOrganiserDialog
: public wxDialog
52 wxRichTextStyleOrganiserDialog();
57 To create a dialog, pass a bitlist of @a flags (see below), a style sheet, a
58 text control to apply a selected style to (or @NULL), followed by the usual
61 To specify the operations available to the user, pass a combination of these
64 - @b wxRICHTEXT_ORGANISER_DELETE_STYLES: Provides a button for deleting styles.
65 - @b wxRICHTEXT_ORGANISER_CREATE_STYLES: Provides buttons for creating styles.
66 - @b wxRICHTEXT_ORGANISER_APPLY_STYLES: Provides a button for applying the
67 currently selected style to the selection.
68 - @b wxRICHTEXT_ORGANISER_EDIT_STYLES: Provides a button for editing styles.
69 - @b wxRICHTEXT_ORGANISER_RENAME_STYLES: Provides a button for renaming styles.
70 - @b wxRICHTEXT_ORGANISER_OK_CANCEL: Provides OK and Cancel buttons.
71 - @b wxRICHTEXT_ORGANISER_RENUMBER: Provides a checkbox for specifying that
72 the selection should be renumbered.
74 The following flags determine what will be displayed in the style list:
76 - @b wxRICHTEXT_ORGANISER_SHOW_CHARACTER: Displays character styles only.
77 - @b wxRICHTEXT_ORGANISER_SHOW_PARAGRAPH: Displays paragraph styles only.
78 - @b wxRICHTEXT_ORGANISER_SHOW_LIST: Displays list styles only.
79 - @b wxRICHTEXT_ORGANISER_SHOW_ALL: Displays all styles.
81 The following symbols define commonly-used combinations of flags:
83 - @b wxRICHTEXT_ORGANISER_ORGANISE:
84 Enable all style editing operations so the dialog behaves as a style organiser.
85 - @b wxRICHTEXT_ORGANISER_BROWSE:
86 Show a list of all styles and their previews, but only allow application of a
87 style or cancellation of the dialog. This makes the dialog behave as a style browser.
88 - @b wxRICHTEXT_ORGANISER_BROWSE_NUMBERING:
89 Enables only list style browsing, plus a control to specify renumbering.
90 This allows the dialog to be used for applying list styles to the selection.
92 wxRichTextStyleOrganiserDialog(int flags
,
93 wxRichTextStyleSheet
* sheet
,
96 wxWindowID id
= wxID_ANY
,
97 const wxString
& caption
= _("Style Organiser"),
98 const wxPoint
& pos
= wxDefaultPosition
,
99 const wxSize
& size
= wxDefaultSize
,
100 long style
= wxDEFAULT_DIALOG_STYLE
|wxRESIZE_BORDER
|wxSYSTEM_MENU
|wxCLOSE_BOX
);
103 Applies the selected style to selection in the given control or the control
104 passed to the constructor.
106 bool ApplyStyle(wxRichTextCtrl
* ctrl
= NULL
);
109 Creates the dialog. See the ctor.
111 bool Create(int flags
, wxRichTextStyleSheet
* sheet
, wxRichTextCtrl
* ctrl
,
112 wxWindow
* parent
, wxWindowID id
= wxID_ANY
,
113 const wxString
& caption
= wxGetTranslation("Style Organiser"), const wxPoint
& pos
= wxDefaultPosition
, const wxSize
& size
= wxSize(400, 300), long style
= wxDEFAULT_DIALOG_STYLE
|wxRESIZE_BORDER
|wxSYSTEM_MENU
|wxCLOSE_BOX
);
116 Returns @true if the user has opted to restart numbering.
118 bool GetRestartNumbering() const;
121 Returns the associated rich text control (if any).
123 wxRichTextCtrl
* GetRichTextCtrl() const;
126 Returns selected style name.
128 wxString
GetSelectedStyle() const;
131 Returns selected style definition.
133 wxRichTextStyleDefinition
* GetSelectedStyleDefinition() const;
136 Returns the associated style sheet.
138 wxRichTextStyleSheet
* GetStyleSheet() const;
141 Sets the flags used to control the interface presented to the user.
143 void SetFlags(int flags
);
146 Checks or unchecks the restart numbering checkbox.
148 void SetRestartNumbering(bool restartNumbering
);
151 Sets the control to be associated with the dialog, for the purposes of applying
152 a style to the selection.
154 void SetRichTextCtrl(wxRichTextCtrl
* ctrl
);
157 Determines whether tooltips will be shown.
159 static void SetShowToolTips(bool show
);
162 Sets the associated style sheet.
164 void SetStyleSheet(wxRichTextStyleSheet
* sheet
);
167 Returns the flags used to control the interface presented to the user.
169 int GetFlags() const;