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