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