]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/richtext/richtextstyledlg.h
wxMessageBox off the main thread lost result code.
[wxWidgets.git] / interface / wx / richtext / richtextstyledlg.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: richtext/richtextstyledlg.h
21b447dc 3// Purpose: interface of wxRichTextStyleOrganiserDialog
23324ae1 4// Author: wxWidgets team
526954c5 5// Licence: wxWindows licence
23324ae1
FM
6/////////////////////////////////////////////////////////////////////////////
7
e4d44c92
RD
8
9/*!
10 * Flags for specifying permitted operations
11 */
12
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
20
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
27
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)
32
33
23324ae1
FM
34/**
35 @class wxRichTextStyleOrganiserDialog
7c913512 36
9e7ad1ca
FM
37 This class shows a style sheet and allows the user to edit, add and remove styles.
38
23324ae1
FM
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
41 present styles.
7c913512 42
23324ae1 43 @library{wxrichtext}
21b447dc 44 @category{richtext}
23324ae1
FM
45*/
46class wxRichTextStyleOrganiserDialog : public wxDialog
47{
48public:
23324ae1 49 /**
9e7ad1ca
FM
50 Default ctor.
51 */
52 wxRichTextStyleOrganiserDialog();
53
54 /**
55 Constructor.
56
4cc4bfaf 57 To create a dialog, pass a bitlist of @a flags (see below), a style sheet, a
9e7ad1ca
FM
58 text control to apply a selected style to (or @NULL), followed by the usual
59 window parameters.
60
23324ae1
FM
61 To specify the operations available to the user, pass a combination of these
62 values to @e flags:
9e7ad1ca
FM
63
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.
73
23324ae1 74 The following flags determine what will be displayed in the style list:
9e7ad1ca
FM
75
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.
80
23324ae1 81 The following symbols define commonly-used combinations of flags:
9e7ad1ca
FM
82
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.
23324ae1
FM
91 */
92 wxRichTextStyleOrganiserDialog(int flags,
93 wxRichTextStyleSheet* sheet,
94 wxRichTextCtrl* ctrl,
95 wxWindow* parent,
9e7ad1ca
FM
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);
23324ae1
FM
101
102 /**
103 Applies the selected style to selection in the given control or the control
104 passed to the constructor.
105 */
4cc4bfaf 106 bool ApplyStyle(wxRichTextCtrl* ctrl = NULL);
23324ae1
FM
107
108 /**
9e7ad1ca 109 Creates the dialog. See the ctor.
23324ae1 110 */
5267aefd
FM
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);
23324ae1
FM
114
115 /**
116 Returns @true if the user has opted to restart numbering.
117 */
328f5751 118 bool GetRestartNumbering() const;
23324ae1
FM
119
120 /**
121 Returns the associated rich text control (if any).
122 */
328f5751 123 wxRichTextCtrl* GetRichTextCtrl() const;
23324ae1
FM
124
125 /**
126 Returns selected style name.
127 */
328f5751 128 wxString GetSelectedStyle() const;
23324ae1
FM
129
130 /**
131 Returns selected style definition.
132 */
328f5751 133 wxRichTextStyleDefinition* GetSelectedStyleDefinition() const;
23324ae1
FM
134
135 /**
136 Returns the associated style sheet.
137 */
328f5751 138 wxRichTextStyleSheet* GetStyleSheet() const;
23324ae1
FM
139
140 /**
141 Sets the flags used to control the interface presented to the user.
142 */
143 void SetFlags(int flags);
144
145 /**
146 Checks or unchecks the restart numbering checkbox.
147 */
148 void SetRestartNumbering(bool restartNumbering);
149
150 /**
151 Sets the control to be associated with the dialog, for the purposes of applying
152 a style to the selection.
153 */
154 void SetRichTextCtrl(wxRichTextCtrl* ctrl);
155
156 /**
157 Determines whether tooltips will be shown.
158 */
adaaa686 159 static void SetShowToolTips(bool show);
23324ae1
FM
160
161 /**
162 Sets the associated style sheet.
163 */
164 void SetStyleSheet(wxRichTextStyleSheet* sheet);
165
166 /**
167 Returns the flags used to control the interface presented to the user.
168 */
328f5751 169 int GetFlags() const;
23324ae1 170};
e54c96f1 171