]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: richtext/richtextstyledlg.h | |
21b447dc | 3 | // Purpose: interface of wxRichTextStyleOrganiserDialog |
23324ae1 FM |
4 | // Author: wxWidgets team |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows license | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | /** | |
10 | @class wxRichTextStyleOrganiserDialog | |
7c913512 | 11 | |
23324ae1 FM |
12 | This class shows a style sheet and allows the user to edit, add and remove |
13 | styles. | |
14 | It can also be used as a style browser, for example if the application is not | |
15 | using a permanent wxRichTextStyleComboCtrl or wxRichTextStyleListCtrl to | |
16 | present styles. | |
7c913512 | 17 | |
23324ae1 | 18 | @library{wxrichtext} |
21b447dc | 19 | @category{richtext} |
23324ae1 FM |
20 | */ |
21 | class wxRichTextStyleOrganiserDialog : public wxDialog | |
22 | { | |
23 | public: | |
24 | //@{ | |
25 | /** | |
26 | Constructors. | |
4cc4bfaf | 27 | To create a dialog, pass a bitlist of @a flags (see below), a style sheet, a |
23324ae1 | 28 | text control to apply a selected style to (or @NULL), followed by the usual window parameters. |
23324ae1 FM |
29 | To specify the operations available to the user, pass a combination of these |
30 | values to @e flags: | |
31 | ||
23324ae1 FM |
32 | @b wxRICHTEXT_ORGANISER_DELETE_STYLES |
33 | ||
23324ae1 FM |
34 | Provides a button for deleting styles. |
35 | ||
36 | @b wxRICHTEXT_ORGANISER_CREATE_STYLES | |
37 | ||
23324ae1 FM |
38 | Provides buttons for creating styles. |
39 | ||
40 | @b wxRICHTEXT_ORGANISER_APPLY_STYLES | |
41 | ||
23324ae1 FM |
42 | Provides a button for applying the currently selected style to the selection. |
43 | ||
44 | @b wxRICHTEXT_ORGANISER_EDIT_STYLES | |
45 | ||
23324ae1 FM |
46 | Provides a button for editing styles. |
47 | ||
48 | @b wxRICHTEXT_ORGANISER_RENAME_STYLES | |
49 | ||
23324ae1 FM |
50 | Provides a button for renaming styles. |
51 | ||
52 | @b wxRICHTEXT_ORGANISER_OK_CANCEL | |
53 | ||
23324ae1 FM |
54 | Provides OK and Cancel buttons. |
55 | ||
56 | @b wxRICHTEXT_ORGANISER_RENUMBER | |
57 | ||
23324ae1 FM |
58 | Provides a checkbox for specifying that the selection should be renumbered. |
59 | ||
60 | The following flags determine what will be displayed in the style list: | |
61 | ||
23324ae1 FM |
62 | @b wxRICHTEXT_ORGANISER_SHOW_CHARACTER |
63 | ||
23324ae1 FM |
64 | Displays character styles only. |
65 | ||
66 | @b wxRICHTEXT_ORGANISER_SHOW_PARAGRAPH | |
67 | ||
23324ae1 FM |
68 | Displays paragraph styles only. |
69 | ||
70 | @b wxRICHTEXT_ORGANISER_SHOW_LIST | |
71 | ||
23324ae1 FM |
72 | Displays list styles only. |
73 | ||
74 | @b wxRICHTEXT_ORGANISER_SHOW_ALL | |
75 | ||
23324ae1 FM |
76 | Displays all styles. |
77 | ||
78 | The following symbols define commonly-used combinations of flags: | |
79 | ||
23324ae1 FM |
80 | @b wxRICHTEXT_ORGANISER_ORGANISE |
81 | ||
23324ae1 FM |
82 | Enable all style editing operations so the dialog behaves as a style organiser. |
83 | ||
84 | @b wxRICHTEXT_ORGANISER_BROWSE | |
85 | ||
23324ae1 FM |
86 | Show a list of all styles and their previews, but only allow application of a |
87 | style or | |
88 | cancellation of the dialog. This makes the dialog behave as a style browser. | |
89 | ||
90 | @b wxRICHTEXT_ORGANISER_BROWSE_NUMBERING | |
91 | ||
23324ae1 FM |
92 | Enables only list style browsing, plus a control to specify renumbering. This |
93 | allows the dialog to be used for applying list styles to the selection. | |
94 | */ | |
95 | wxRichTextStyleOrganiserDialog(int flags, | |
96 | wxRichTextStyleSheet* sheet, | |
97 | wxRichTextCtrl* ctrl, | |
98 | wxWindow* parent, | |
99 | wxWindowID id = wxID_ANY); | |
7c913512 FM |
100 | const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX) |
101 | wxRichTextStyleOrganiserDialog(); | |
23324ae1 FM |
102 | //@} |
103 | ||
104 | /** | |
105 | Applies the selected style to selection in the given control or the control | |
106 | passed to the constructor. | |
107 | */ | |
4cc4bfaf | 108 | bool ApplyStyle(wxRichTextCtrl* ctrl = NULL); |
23324ae1 FM |
109 | |
110 | /** | |
328f5751 FM |
111 | , wxPoint&@e pos = wxDefaultPosition, wxSize&@e size = wxDefaultSize, @b |
112 | long@e style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX) | |
23324ae1 FM |
113 | Creates the dialog. See |
114 | */ | |
115 | bool Create(int flags, wxRichTextStyleSheet* sheet, | |
116 | wxRichTextCtrl* ctrl, | |
117 | wxWindow* parent, | |
328f5751 | 118 | wxWindowID id = wxID_ANY) const; |
23324ae1 FM |
119 | |
120 | /** | |
121 | Returns @true if the user has opted to restart numbering. | |
122 | */ | |
328f5751 | 123 | bool GetRestartNumbering() const; |
23324ae1 FM |
124 | |
125 | /** | |
126 | Returns the associated rich text control (if any). | |
127 | */ | |
328f5751 | 128 | wxRichTextCtrl* GetRichTextCtrl() const; |
23324ae1 FM |
129 | |
130 | /** | |
131 | Returns selected style name. | |
132 | */ | |
328f5751 | 133 | wxString GetSelectedStyle() const; |
23324ae1 FM |
134 | |
135 | /** | |
136 | Returns selected style definition. | |
137 | */ | |
328f5751 | 138 | wxRichTextStyleDefinition* GetSelectedStyleDefinition() const; |
23324ae1 FM |
139 | |
140 | /** | |
141 | Returns the associated style sheet. | |
142 | */ | |
328f5751 | 143 | wxRichTextStyleSheet* GetStyleSheet() const; |
23324ae1 FM |
144 | |
145 | /** | |
146 | Sets the flags used to control the interface presented to the user. | |
147 | */ | |
148 | void SetFlags(int flags); | |
149 | ||
150 | /** | |
151 | Checks or unchecks the restart numbering checkbox. | |
152 | */ | |
153 | void SetRestartNumbering(bool restartNumbering); | |
154 | ||
155 | /** | |
156 | Sets the control to be associated with the dialog, for the purposes of applying | |
157 | a style to the selection. | |
158 | */ | |
159 | void SetRichTextCtrl(wxRichTextCtrl* ctrl); | |
160 | ||
161 | /** | |
162 | Determines whether tooltips will be shown. | |
163 | */ | |
adaaa686 | 164 | static void SetShowToolTips(bool show); |
23324ae1 FM |
165 | |
166 | /** | |
167 | Sets the associated style sheet. | |
168 | */ | |
169 | void SetStyleSheet(wxRichTextStyleSheet* sheet); | |
170 | ||
171 | /** | |
172 | Returns the flags used to control the interface presented to the user. | |
173 | */ | |
328f5751 | 174 | int GetFlags() const; |
23324ae1 | 175 | }; |
e54c96f1 | 176 |