]>
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 | |
9e7ad1ca FM |
12 | This class shows a style sheet and allows the user to edit, add and remove styles. |
13 | ||
23324ae1 FM |
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: | |
23324ae1 | 24 | /** |
9e7ad1ca FM |
25 | Default ctor. |
26 | */ | |
27 | wxRichTextStyleOrganiserDialog(); | |
28 | ||
29 | /** | |
30 | Constructor. | |
31 | ||
4cc4bfaf | 32 | To create a dialog, pass a bitlist of @a flags (see below), a style sheet, a |
9e7ad1ca FM |
33 | text control to apply a selected style to (or @NULL), followed by the usual |
34 | window parameters. | |
35 | ||
23324ae1 FM |
36 | To specify the operations available to the user, pass a combination of these |
37 | values to @e flags: | |
9e7ad1ca FM |
38 | |
39 | - @b wxRICHTEXT_ORGANISER_DELETE_STYLES: Provides a button for deleting styles. | |
40 | - @b wxRICHTEXT_ORGANISER_CREATE_STYLES: Provides buttons for creating styles. | |
41 | - @b wxRICHTEXT_ORGANISER_APPLY_STYLES: Provides a button for applying the | |
42 | currently selected style to the selection. | |
43 | - @b wxRICHTEXT_ORGANISER_EDIT_STYLES: Provides a button for editing styles. | |
44 | - @b wxRICHTEXT_ORGANISER_RENAME_STYLES: Provides a button for renaming styles. | |
45 | - @b wxRICHTEXT_ORGANISER_OK_CANCEL: Provides OK and Cancel buttons. | |
46 | - @b wxRICHTEXT_ORGANISER_RENUMBER: Provides a checkbox for specifying that | |
47 | the selection should be renumbered. | |
48 | ||
23324ae1 | 49 | The following flags determine what will be displayed in the style list: |
9e7ad1ca FM |
50 | |
51 | - @b wxRICHTEXT_ORGANISER_SHOW_CHARACTER: Displays character styles only. | |
52 | - @b wxRICHTEXT_ORGANISER_SHOW_PARAGRAPH: Displays paragraph styles only. | |
53 | - @b wxRICHTEXT_ORGANISER_SHOW_LIST: Displays list styles only. | |
54 | - @b wxRICHTEXT_ORGANISER_SHOW_ALL: Displays all styles. | |
55 | ||
23324ae1 | 56 | The following symbols define commonly-used combinations of flags: |
9e7ad1ca FM |
57 | |
58 | - @b wxRICHTEXT_ORGANISER_ORGANISE: | |
59 | Enable all style editing operations so the dialog behaves as a style organiser. | |
60 | - @b wxRICHTEXT_ORGANISER_BROWSE: | |
61 | Show a list of all styles and their previews, but only allow application of a | |
62 | style or cancellation of the dialog. This makes the dialog behave as a style browser. | |
63 | - @b wxRICHTEXT_ORGANISER_BROWSE_NUMBERING: | |
64 | Enables only list style browsing, plus a control to specify renumbering. | |
65 | This allows the dialog to be used for applying list styles to the selection. | |
23324ae1 FM |
66 | */ |
67 | wxRichTextStyleOrganiserDialog(int flags, | |
68 | wxRichTextStyleSheet* sheet, | |
69 | wxRichTextCtrl* ctrl, | |
70 | wxWindow* parent, | |
9e7ad1ca FM |
71 | wxWindowID id = wxID_ANY, |
72 | const wxString& caption = _("Style Organiser"), | |
73 | const wxPoint& pos = wxDefaultPosition, | |
74 | const wxSize& size = wxDefaultSize, | |
75 | long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX); | |
23324ae1 FM |
76 | |
77 | /** | |
78 | Applies the selected style to selection in the given control or the control | |
79 | passed to the constructor. | |
80 | */ | |
4cc4bfaf | 81 | bool ApplyStyle(wxRichTextCtrl* ctrl = NULL); |
23324ae1 FM |
82 | |
83 | /** | |
9e7ad1ca | 84 | Creates the dialog. See the ctor. |
23324ae1 | 85 | */ |
9e7ad1ca FM |
86 | bool Create(int flags, |
87 | wxRichTextStyleSheet* sheet, | |
23324ae1 FM |
88 | wxRichTextCtrl* ctrl, |
89 | wxWindow* parent, | |
9e7ad1ca FM |
90 | wxWindowID id = wxID_ANY, |
91 | const wxString& caption = _("Style Organiser"), | |
92 | const wxPoint& pos = wxDefaultPosition, | |
93 | const wxSize& size = wxDefaultSize, | |
94 | long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX); | |
23324ae1 FM |
95 | |
96 | /** | |
97 | Returns @true if the user has opted to restart numbering. | |
98 | */ | |
328f5751 | 99 | bool GetRestartNumbering() const; |
23324ae1 FM |
100 | |
101 | /** | |
102 | Returns the associated rich text control (if any). | |
103 | */ | |
328f5751 | 104 | wxRichTextCtrl* GetRichTextCtrl() const; |
23324ae1 FM |
105 | |
106 | /** | |
107 | Returns selected style name. | |
108 | */ | |
328f5751 | 109 | wxString GetSelectedStyle() const; |
23324ae1 FM |
110 | |
111 | /** | |
112 | Returns selected style definition. | |
113 | */ | |
328f5751 | 114 | wxRichTextStyleDefinition* GetSelectedStyleDefinition() const; |
23324ae1 FM |
115 | |
116 | /** | |
117 | Returns the associated style sheet. | |
118 | */ | |
328f5751 | 119 | wxRichTextStyleSheet* GetStyleSheet() const; |
23324ae1 FM |
120 | |
121 | /** | |
122 | Sets the flags used to control the interface presented to the user. | |
123 | */ | |
124 | void SetFlags(int flags); | |
125 | ||
126 | /** | |
127 | Checks or unchecks the restart numbering checkbox. | |
128 | */ | |
129 | void SetRestartNumbering(bool restartNumbering); | |
130 | ||
131 | /** | |
132 | Sets the control to be associated with the dialog, for the purposes of applying | |
133 | a style to the selection. | |
134 | */ | |
135 | void SetRichTextCtrl(wxRichTextCtrl* ctrl); | |
136 | ||
137 | /** | |
138 | Determines whether tooltips will be shown. | |
139 | */ | |
adaaa686 | 140 | static void SetShowToolTips(bool show); |
23324ae1 FM |
141 | |
142 | /** | |
143 | Sets the associated style sheet. | |
144 | */ | |
145 | void SetStyleSheet(wxRichTextStyleSheet* sheet); | |
146 | ||
147 | /** | |
148 | Returns the flags used to control the interface presented to the user. | |
149 | */ | |
328f5751 | 150 | int GetFlags() const; |
23324ae1 | 151 | }; |
e54c96f1 | 152 |