]> git.saurik.com Git - wxWidgets.git/blob - interface/wx/richtext/richtextstyledlg.h
Define __VISUALC__ for ICC under Windows again.
[wxWidgets.git] / interface / wx / richtext / richtextstyledlg.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: richtext/richtextstyledlg.h
3 // Purpose: interface of wxRichTextStyleOrganiserDialog
4 // Author: wxWidgets team
5 // Licence: wxWindows licence
6 /////////////////////////////////////////////////////////////////////////////
7
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
34 /**
35 @class wxRichTextStyleOrganiserDialog
36
37 This class shows a style sheet and allows the user to edit, add and remove styles.
38
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.
42
43 @library{wxrichtext}
44 @category{richtext}
45 */
46 class wxRichTextStyleOrganiserDialog : public wxDialog
47 {
48 public:
49 /**
50 Default ctor.
51 */
52 wxRichTextStyleOrganiserDialog();
53
54 /**
55 Constructor.
56
57 To create a dialog, pass a bitlist of @a flags (see below), a style sheet, a
58 text control to apply a selected style to (or @NULL), followed by the usual
59 window parameters.
60
61 To specify the operations available to the user, pass a combination of these
62 values to @e flags:
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
74 The following flags determine what will be displayed in the style list:
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
81 The following symbols define commonly-used combinations of flags:
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.
91 */
92 wxRichTextStyleOrganiserDialog(int flags,
93 wxRichTextStyleSheet* sheet,
94 wxRichTextCtrl* ctrl,
95 wxWindow* parent,
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);
101
102 /**
103 Applies the selected style to selection in the given control or the control
104 passed to the constructor.
105 */
106 bool ApplyStyle(wxRichTextCtrl* ctrl = NULL);
107
108 /**
109 Creates the dialog. See the ctor.
110 */
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);
114
115 /**
116 Returns @true if the user has opted to restart numbering.
117 */
118 bool GetRestartNumbering() const;
119
120 /**
121 Returns the associated rich text control (if any).
122 */
123 wxRichTextCtrl* GetRichTextCtrl() const;
124
125 /**
126 Returns selected style name.
127 */
128 wxString GetSelectedStyle() const;
129
130 /**
131 Returns selected style definition.
132 */
133 wxRichTextStyleDefinition* GetSelectedStyleDefinition() const;
134
135 /**
136 Returns the associated style sheet.
137 */
138 wxRichTextStyleSheet* GetStyleSheet() const;
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 */
159 static void SetShowToolTips(bool show);
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 */
169 int GetFlags() const;
170 };
171