1 /////////////////////////////////////////////////////////////////////////////
2 // Name: richtext/richtextstyledlg.h
3 // Purpose: interface of wxRichTextStyleOrganiserDialog
4 // Author: wxWidgets team
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
11 * Flags for specifying permitted operations
14 #define wxRICHTEXT_ORGANISER_DELETE_STYLES 0x0001
15 #define wxRICHTEXT_ORGANISER_CREATE_STYLES 0x0002
16 #define wxRICHTEXT_ORGANISER_APPLY_STYLES 0x0004
17 #define wxRICHTEXT_ORGANISER_EDIT_STYLES 0x0008
18 #define wxRICHTEXT_ORGANISER_RENAME_STYLES 0x0010
19 #define wxRICHTEXT_ORGANISER_OK_CANCEL 0x0020
20 #define wxRICHTEXT_ORGANISER_RENUMBER 0x0040
22 // The permitted style types to show
23 #define wxRICHTEXT_ORGANISER_SHOW_CHARACTER 0x0100
24 #define wxRICHTEXT_ORGANISER_SHOW_PARAGRAPH 0x0200
25 #define wxRICHTEXT_ORGANISER_SHOW_LIST 0x0400
26 #define wxRICHTEXT_ORGANISER_SHOW_BOX 0x0800
27 #define wxRICHTEXT_ORGANISER_SHOW_ALL 0x1000
29 // Common combinations
30 #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)
31 #define wxRICHTEXT_ORGANISER_BROWSE (wxRICHTEXT_ORGANISER_SHOW_ALL|wxRICHTEXT_ORGANISER_OK_CANCEL)
32 #define wxRICHTEXT_ORGANISER_BROWSE_NUMBERING (wxRICHTEXT_ORGANISER_SHOW_LIST|wxRICHTEXT_ORGANISER_OK_CANCEL|wxRICHTEXT_ORGANISER_RENUMBER)
36 @class wxRichTextStyleOrganiserDialog
38 This class shows a style sheet and allows the user to edit, add and remove styles.
40 It can also be used as a style browser, for example if the application is not
41 using a permanent wxRichTextStyleComboCtrl or wxRichTextStyleListCtrl to
47 class wxRichTextStyleOrganiserDialog
: public wxDialog
53 wxRichTextStyleOrganiserDialog();
58 To create a dialog, pass a bitlist of @a flags (see below), a style sheet, a
59 text control to apply a selected style to (or @NULL), followed by the usual
62 To specify the operations available to the user, pass a combination of these
65 - @b wxRICHTEXT_ORGANISER_DELETE_STYLES: Provides a button for deleting styles.
66 - @b wxRICHTEXT_ORGANISER_CREATE_STYLES: Provides buttons for creating styles.
67 - @b wxRICHTEXT_ORGANISER_APPLY_STYLES: Provides a button for applying the
68 currently selected style to the selection.
69 - @b wxRICHTEXT_ORGANISER_EDIT_STYLES: Provides a button for editing styles.
70 - @b wxRICHTEXT_ORGANISER_RENAME_STYLES: Provides a button for renaming styles.
71 - @b wxRICHTEXT_ORGANISER_OK_CANCEL: Provides OK and Cancel buttons.
72 - @b wxRICHTEXT_ORGANISER_RENUMBER: Provides a checkbox for specifying that
73 the selection should be renumbered.
75 The following flags determine what will be displayed in the style list:
77 - @b wxRICHTEXT_ORGANISER_SHOW_CHARACTER: Displays character styles only.
78 - @b wxRICHTEXT_ORGANISER_SHOW_PARAGRAPH: Displays paragraph styles only.
79 - @b wxRICHTEXT_ORGANISER_SHOW_LIST: Displays list styles only.
80 - @b wxRICHTEXT_ORGANISER_SHOW_ALL: Displays all styles.
82 The following symbols define commonly-used combinations of flags:
84 - @b wxRICHTEXT_ORGANISER_ORGANISE:
85 Enable all style editing operations so the dialog behaves as a style organiser.
86 - @b wxRICHTEXT_ORGANISER_BROWSE:
87 Show a list of all styles and their previews, but only allow application of a
88 style or cancellation of the dialog. This makes the dialog behave as a style browser.
89 - @b wxRICHTEXT_ORGANISER_BROWSE_NUMBERING:
90 Enables only list style browsing, plus a control to specify renumbering.
91 This allows the dialog to be used for applying list styles to the selection.
93 wxRichTextStyleOrganiserDialog(int flags
,
94 wxRichTextStyleSheet
* sheet
,
97 wxWindowID id
= wxID_ANY
,
98 const wxString
& caption
= _("Style Organiser"),
99 const wxPoint
& pos
= wxDefaultPosition
,
100 const wxSize
& size
= wxDefaultSize
,
101 long style
= wxDEFAULT_DIALOG_STYLE
|wxRESIZE_BORDER
|wxSYSTEM_MENU
|wxCLOSE_BOX
);
104 Applies the selected style to selection in the given control or the control
105 passed to the constructor.
107 bool ApplyStyle(wxRichTextCtrl
* ctrl
= NULL
);
110 Creates the dialog. See the ctor.
112 bool Create(int flags
, wxRichTextStyleSheet
* sheet
, wxRichTextCtrl
* ctrl
,
113 wxWindow
* parent
, wxWindowID id
= wxID_ANY
,
114 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
);
117 Returns @true if the user has opted to restart numbering.
119 bool GetRestartNumbering() const;
122 Returns the associated rich text control (if any).
124 wxRichTextCtrl
* GetRichTextCtrl() const;
127 Returns selected style name.
129 wxString
GetSelectedStyle() const;
132 Returns selected style definition.
134 wxRichTextStyleDefinition
* GetSelectedStyleDefinition() const;
137 Returns the associated style sheet.
139 wxRichTextStyleSheet
* GetStyleSheet() const;
142 Sets the flags used to control the interface presented to the user.
144 void SetFlags(int flags
);
147 Checks or unchecks the restart numbering checkbox.
149 void SetRestartNumbering(bool restartNumbering
);
152 Sets the control to be associated with the dialog, for the purposes of applying
153 a style to the selection.
155 void SetRichTextCtrl(wxRichTextCtrl
* ctrl
);
158 Determines whether tooltips will be shown.
160 static void SetShowToolTips(bool show
);
163 Sets the associated style sheet.
165 void SetStyleSheet(wxRichTextStyleSheet
* sheet
);
168 Returns the flags used to control the interface presented to the user.
170 int GetFlags() const;