]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: richtext/richtextstyles.h | |
21b447dc | 3 | // Purpose: interface of wxRichTextStyleListCtrl |
23324ae1 | 4 | // Author: wxWidgets team |
526954c5 | 5 | // Licence: wxWindows licence |
23324ae1 FM |
6 | ///////////////////////////////////////////////////////////////////////////// |
7 | ||
8 | /** | |
9 | @class wxRichTextStyleListCtrl | |
7c913512 | 10 | |
9e7ad1ca FM |
11 | This class incorporates a wxRichTextStyleListBox and a choice control that |
12 | allows the user to select the category of style to view. | |
13 | ||
23324ae1 | 14 | It is demonstrated in the wxRichTextCtrl sample in @c samples/richtext. |
7c913512 | 15 | |
23324ae1 | 16 | To use wxRichTextStyleListCtrl, add the control to your window hierarchy and |
9e7ad1ca FM |
17 | call wxRichTextStyleListCtrl::SetStyleType with one of |
18 | wxRichTextStyleListBox::wxRICHTEXT_STYLE_ALL, | |
23324ae1 FM |
19 | wxRichTextStyleListBox::wxRICHTEXT_STYLE_PARAGRAPH, |
20 | wxRichTextStyleListBox::wxRICHTEXT_STYLE_CHARACTER and | |
21 | wxRichTextStyleListBox::wxRICHTEXT_STYLE_LIST to set the current view. | |
9e7ad1ca | 22 | |
23324ae1 | 23 | Associate the control with a style sheet and rich text control with |
9e7ad1ca FM |
24 | SetStyleSheet and SetRichTextCtrl, so that when a style is double-clicked, |
25 | it is applied to the selection. | |
7c913512 | 26 | |
23324ae1 | 27 | @beginStyleTable |
8c6791e4 | 28 | @style{wxRICHTEXTSTYLELIST_HIDE_TYPE_SELECTOR} |
23324ae1 FM |
29 | This style hides the category selection control. |
30 | @endStyleTable | |
7c913512 | 31 | |
23324ae1 | 32 | @library{wxrichtext} |
9e7ad1ca | 33 | @category{richtext} |
23324ae1 FM |
34 | */ |
35 | class wxRichTextStyleListCtrl : public wxControl | |
36 | { | |
37 | public: | |
38 | //@{ | |
39 | /** | |
40 | Constructors. | |
41 | */ | |
42 | wxRichTextStyleListCtrl(wxWindow* parent, | |
43 | wxWindowID id = wxID_ANY, | |
44 | const wxPoint& pos = wxDefaultPosition, | |
45 | const wxSize& size = wxDefaultSize, | |
46 | long style = 0); | |
7c913512 | 47 | wxRichTextStyleListCtrl(); |
23324ae1 FM |
48 | //@} |
49 | ||
50 | /** | |
51 | Creates the windows. | |
52 | */ | |
53 | bool Create(wxWindow* parent, wxWindowID id = wxID_ANY, | |
54 | const wxPoint& pos = wxDefaultPosition, | |
55 | const wxSize& size = wxDefaultSize, | |
56 | long style = 0); | |
57 | ||
58 | /** | |
59 | Returns the associated rich text control, if any. | |
60 | */ | |
328f5751 | 61 | wxRichTextCtrl* GetRichTextCtrl() const; |
23324ae1 FM |
62 | |
63 | /** | |
64 | Returns the wxChoice control used for selecting the style category. | |
65 | */ | |
328f5751 | 66 | wxChoice* GetStyleChoice() const; |
23324ae1 FM |
67 | |
68 | /** | |
69 | Returns the wxListBox control used to view the style list. | |
70 | */ | |
328f5751 | 71 | wxRichTextStyleListBox* GetStyleListBox() const; |
23324ae1 FM |
72 | |
73 | /** | |
74 | Returns the associated style sheet, if any. | |
75 | */ | |
328f5751 | 76 | wxRichTextStyleSheet* GetStyleSheet() const; |
23324ae1 FM |
77 | |
78 | /** | |
79 | Returns the type of style to show in the list box. | |
80 | */ | |
328f5751 | 81 | wxRichTextStyleListBox::wxRichTextStyleType GetStyleType() const; |
23324ae1 FM |
82 | |
83 | /** | |
84 | Associates the control with a wxRichTextCtrl. | |
85 | */ | |
86 | void SetRichTextCtrl(wxRichTextCtrl* ctrl); | |
87 | ||
88 | /** | |
89 | Associates the control with a style sheet. | |
90 | */ | |
91 | void SetStyleSheet(wxRichTextStyleSheet* styleSheet); | |
92 | ||
93 | /** | |
9e7ad1ca FM |
94 | Sets the style type to display. |
95 | ||
96 | One of | |
97 | - wxRichTextStyleListBox::wxRICHTEXT_STYLE_ALL, | |
98 | - wxRichTextStyleListBox::wxRICHTEXT_STYLE_PARAGRAPH, | |
99 | - wxRichTextStyleListBox::wxRICHTEXT_STYLE_CHARACTER | |
100 | - wxRichTextStyleListBox::wxRICHTEXT_STYLE_LIST. | |
23324ae1 FM |
101 | */ |
102 | void SetStyleType(wxRichTextStyleListBox::wxRichTextStyleType styleType); | |
103 | ||
104 | /** | |
105 | Updates the style list box. | |
106 | */ | |
107 | void UpdateStyles(); | |
108 | }; | |
109 | ||
110 | ||
e54c96f1 | 111 | |
23324ae1 FM |
112 | /** |
113 | @class wxRichTextStyleDefinition | |
7c913512 | 114 | |
23324ae1 | 115 | This is a base class for paragraph and character styles. |
7c913512 | 116 | |
23324ae1 | 117 | @library{wxrichtext} |
9e7ad1ca | 118 | @category{richtext} |
23324ae1 FM |
119 | */ |
120 | class wxRichTextStyleDefinition : public wxObject | |
121 | { | |
122 | public: | |
123 | /** | |
124 | Constructor. | |
125 | */ | |
126 | wxRichTextStyleDefinition(const wxString& name = wxEmptyString); | |
127 | ||
128 | /** | |
129 | Destructor. | |
130 | */ | |
adaaa686 | 131 | virtual ~wxRichTextStyleDefinition(); |
23324ae1 FM |
132 | |
133 | /** | |
134 | Returns the style on which this style is based. | |
135 | */ | |
5267aefd | 136 | const wxString& GetBaseStyle() const; |
23324ae1 FM |
137 | |
138 | /** | |
139 | Returns the style's description. | |
140 | */ | |
5267aefd | 141 | const wxString& GetDescription() const; |
23324ae1 FM |
142 | |
143 | /** | |
144 | Returns the style name. | |
145 | */ | |
5267aefd | 146 | const wxString& GetName() const; |
23324ae1 FM |
147 | |
148 | //@{ | |
149 | /** | |
150 | Returns the attributes associated with this style. | |
151 | */ | |
e4d44c92 RD |
152 | wxRichTextAttr GetStyle() const; |
153 | const wxRichTextAttr GetStyle() const; | |
23324ae1 FM |
154 | //@} |
155 | ||
156 | /** | |
157 | Returns the style attributes combined with the attributes of the specified base | |
158 | style, if any. This function works recursively. | |
159 | */ | |
e4d44c92 | 160 | virtual wxRichTextAttr GetStyleMergedWithBase(const wxRichTextStyleSheet* sheet) const; |
23324ae1 FM |
161 | |
162 | /** | |
163 | Sets the name of the style that this style is based on. | |
164 | */ | |
165 | void SetBaseStyle(const wxString& name); | |
166 | ||
167 | /** | |
168 | Sets the style description. | |
169 | */ | |
170 | void SetDescription(const wxString& descr); | |
171 | ||
172 | /** | |
173 | Sets the name of the style. | |
174 | */ | |
175 | void SetName(const wxString& name); | |
176 | ||
177 | /** | |
178 | Sets the attributes for this style. | |
179 | */ | |
e4d44c92 | 180 | void SetStyle(const wxRichTextAttr& style); |
c6182d48 JS |
181 | |
182 | /** | |
183 | Returns the definition's properties. | |
184 | */ | |
185 | wxRichTextProperties& GetProperties(); | |
186 | ||
187 | /** | |
188 | Returns the definition's properties. | |
189 | */ | |
190 | const wxRichTextProperties& GetProperties() const; | |
191 | ||
192 | /** | |
193 | Sets the definition's properties. | |
194 | */ | |
195 | void SetProperties(const wxRichTextProperties& props); | |
23324ae1 FM |
196 | }; |
197 | ||
198 | ||
e54c96f1 | 199 | |
23324ae1 FM |
200 | /** |
201 | @class wxRichTextParagraphStyleDefinition | |
7c913512 | 202 | |
23324ae1 FM |
203 | This class represents a paragraph style definition, usually added to a |
204 | wxRichTextStyleSheet. | |
7c913512 | 205 | |
23324ae1 | 206 | @library{wxrichtext} |
21b447dc | 207 | @category{richtext} |
23324ae1 FM |
208 | */ |
209 | class wxRichTextParagraphStyleDefinition : public wxRichTextStyleDefinition | |
210 | { | |
211 | public: | |
212 | /** | |
213 | Constructor. | |
214 | */ | |
215 | wxRichTextParagraphStyleDefinition(const wxString& name = wxEmptyString); | |
216 | ||
217 | /** | |
218 | Destructor. | |
219 | */ | |
adaaa686 | 220 | virtual ~wxRichTextParagraphStyleDefinition(); |
23324ae1 FM |
221 | |
222 | /** | |
223 | Returns the style that should normally follow this style. | |
224 | */ | |
5267aefd | 225 | const wxString& GetNextStyle() const; |
23324ae1 FM |
226 | |
227 | /** | |
228 | Sets the style that should normally follow this style. | |
229 | */ | |
230 | void SetNextStyle(const wxString& name); | |
231 | }; | |
232 | ||
233 | ||
e54c96f1 | 234 | |
23324ae1 FM |
235 | /** |
236 | @class wxRichTextStyleListBox | |
7c913512 | 237 | |
23324ae1 FM |
238 | This is a listbox that can display the styles in a wxRichTextStyleSheet, |
239 | and apply the selection to an associated wxRichTextCtrl. | |
7c913512 | 240 | |
23324ae1 | 241 | See @c samples/richtext for an example of how to use it. |
7c913512 | 242 | |
23324ae1 | 243 | @library{wxrichtext} |
21b447dc | 244 | @category{richtext} |
7c913512 | 245 | |
9e7ad1ca | 246 | @see wxRichTextStyleComboCtrl, @ref overview_richtextctrl |
23324ae1 FM |
247 | */ |
248 | class wxRichTextStyleListBox : public wxHtmlListBox | |
249 | { | |
250 | public: | |
e4d44c92 RD |
251 | |
252 | /// Which type of style definition is currently showing? | |
253 | enum wxRichTextStyleType | |
254 | { | |
255 | wxRICHTEXT_STYLE_ALL, | |
256 | wxRICHTEXT_STYLE_PARAGRAPH, | |
257 | wxRICHTEXT_STYLE_CHARACTER, | |
258 | wxRICHTEXT_STYLE_LIST, | |
259 | wxRICHTEXT_STYLE_BOX | |
260 | }; | |
261 | ||
23324ae1 FM |
262 | /** |
263 | Constructor. | |
264 | */ | |
265 | wxRichTextStyleListBox(wxWindow* parent, | |
266 | wxWindowID id = wxID_ANY, | |
267 | const wxPoint& pos = wxDefaultPosition, | |
268 | const wxSize& size = wxDefaultSize, | |
269 | long style = 0); | |
270 | ||
271 | /** | |
272 | Destructor. | |
273 | */ | |
adaaa686 | 274 | virtual ~wxRichTextStyleListBox(); |
23324ae1 FM |
275 | |
276 | /** | |
277 | Applies the @e ith style to the associated rich text control. | |
278 | */ | |
279 | void ApplyStyle(int i); | |
280 | ||
281 | /** | |
282 | Converts units in tenths of a millimetre to device units. | |
283 | */ | |
328f5751 | 284 | int ConvertTenthsMMToPixels(wxDC& dc, int units) const; |
23324ae1 FM |
285 | |
286 | /** | |
287 | Creates a suitable HTML fragment for a definition. | |
288 | */ | |
328f5751 | 289 | wxString CreateHTML(wxRichTextStyleDefinition* def) const; |
23324ae1 FM |
290 | |
291 | /** | |
292 | If the return value is @true, clicking on a style name in the list will | |
9e7ad1ca | 293 | immediately apply the style to the associated rich text control. |
23324ae1 | 294 | */ |
328f5751 | 295 | bool GetApplyOnSelection() const; |
23324ae1 FM |
296 | |
297 | /** | |
298 | Returns the wxRichTextCtrl associated with this listbox. | |
299 | */ | |
328f5751 | 300 | wxRichTextCtrl* GetRichTextCtrl() const; |
23324ae1 FM |
301 | |
302 | /** | |
303 | Gets a style for a listbox index. | |
304 | */ | |
328f5751 | 305 | wxRichTextStyleDefinition* GetStyle(size_t i) const; |
23324ae1 FM |
306 | |
307 | /** | |
308 | Returns the style sheet associated with this listbox. | |
309 | */ | |
328f5751 | 310 | wxRichTextStyleSheet* GetStyleSheet() const; |
23324ae1 FM |
311 | |
312 | /** | |
313 | Returns the type of style to show in the list box. | |
314 | */ | |
328f5751 | 315 | wxRichTextStyleListBox::wxRichTextStyleType GetStyleType() const; |
23324ae1 | 316 | |
23324ae1 FM |
317 | /** |
318 | Implements left click behaviour, applying the clicked style to the | |
319 | wxRichTextCtrl. | |
320 | */ | |
321 | void OnLeftDown(wxMouseEvent& event); | |
322 | ||
23324ae1 | 323 | /** |
4cc4bfaf | 324 | If @a applyOnSelection is @true, clicking on a style name in the list will |
9e7ad1ca | 325 | immediately apply the style to the associated rich text control. |
23324ae1 FM |
326 | */ |
327 | void SetApplyOnSelection(bool applyOnSelection); | |
328 | ||
329 | /** | |
330 | Associates the listbox with a wxRichTextCtrl. | |
331 | */ | |
332 | void SetRichTextCtrl(wxRichTextCtrl* ctrl); | |
333 | ||
334 | /** | |
335 | Associates the control with a style sheet. | |
336 | */ | |
337 | void SetStyleSheet(wxRichTextStyleSheet* styleSheet); | |
338 | ||
339 | /** | |
340 | Sets the style type to display. One of | |
9e7ad1ca FM |
341 | - wxRichTextStyleListBox::wxRICHTEXT_STYLE_ALL, |
342 | - wxRichTextStyleListBox::wxRICHTEXT_STYLE_PARAGRAPH, | |
343 | - wxRichTextStyleListBox::wxRICHTEXT_STYLE_CHARACTER | |
344 | - wxRichTextStyleListBox::wxRICHTEXT_STYLE_LIST. | |
23324ae1 FM |
345 | */ |
346 | void SetStyleType(wxRichTextStyleListBox::wxRichTextStyleType styleType); | |
347 | ||
348 | /** | |
349 | Updates the list from the associated style sheet. | |
350 | */ | |
351 | void UpdateStyles(); | |
5e6e278d FM |
352 | |
353 | protected: | |
354 | ||
355 | /** | |
356 | Returns the HTML for this item. | |
357 | */ | |
358 | virtual wxString OnGetItem(size_t n) const; | |
23324ae1 FM |
359 | }; |
360 | ||
361 | ||
e54c96f1 | 362 | |
23324ae1 FM |
363 | /** |
364 | @class wxRichTextStyleComboCtrl | |
7c913512 | 365 | |
23324ae1 FM |
366 | This is a combo control that can display the styles in a wxRichTextStyleSheet, |
367 | and apply the selection to an associated wxRichTextCtrl. | |
7c913512 | 368 | |
23324ae1 | 369 | See @c samples/richtext for an example of how to use it. |
7c913512 | 370 | |
23324ae1 | 371 | @library{wxrichtext} |
21b447dc | 372 | @category{richtext} |
7c913512 | 373 | |
9e7ad1ca | 374 | @see wxRichTextStyleListBox, @ref overview_richtextctrl |
23324ae1 FM |
375 | */ |
376 | class wxRichTextStyleComboCtrl : public wxComboCtrl | |
377 | { | |
378 | public: | |
379 | /** | |
380 | Constructor. | |
381 | */ | |
382 | wxRichTextStyleComboCtrl(wxWindow* parent, | |
383 | wxWindowID id = wxID_ANY, | |
384 | const wxPoint& pos = wxDefaultPosition, | |
385 | const wxSize& size = wxDefaultSize, | |
386 | long style = 0); | |
387 | ||
388 | /** | |
389 | Destructor. | |
390 | */ | |
adaaa686 | 391 | virtual ~wxRichTextStyleComboCtrl(); |
23324ae1 FM |
392 | |
393 | /** | |
394 | Returns the wxRichTextCtrl associated with this control. | |
395 | */ | |
328f5751 | 396 | wxRichTextCtrl* GetRichTextCtrl() const; |
23324ae1 FM |
397 | |
398 | /** | |
399 | Returns the style sheet associated with this control. | |
400 | */ | |
328f5751 | 401 | wxRichTextStyleSheet* GetStyleSheet() const; |
23324ae1 FM |
402 | |
403 | /** | |
404 | Associates the control with a wxRichTextCtrl. | |
405 | */ | |
406 | void SetRichTextCtrl(wxRichTextCtrl* ctrl); | |
407 | ||
408 | /** | |
409 | Associates the control with a style sheet. | |
410 | */ | |
411 | void SetStyleSheet(wxRichTextStyleSheet* styleSheet); | |
412 | ||
413 | /** | |
414 | Updates the combo control from the associated style sheet. | |
415 | */ | |
416 | void UpdateStyles(); | |
417 | }; | |
418 | ||
419 | ||
e54c96f1 | 420 | |
23324ae1 FM |
421 | /** |
422 | @class wxRichTextCharacterStyleDefinition | |
7c913512 | 423 | |
23324ae1 FM |
424 | This class represents a character style definition, usually added to a |
425 | wxRichTextStyleSheet. | |
7c913512 | 426 | |
23324ae1 | 427 | @library{wxrichtext} |
21b447dc | 428 | @category{richtext} |
23324ae1 FM |
429 | */ |
430 | class wxRichTextCharacterStyleDefinition : public wxRichTextStyleDefinition | |
431 | { | |
432 | public: | |
433 | /** | |
434 | Constructor. | |
435 | */ | |
436 | wxRichTextCharacterStyleDefinition(const wxString& name = wxEmptyString); | |
437 | ||
438 | /** | |
439 | Destructor. | |
440 | */ | |
adaaa686 | 441 | virtual ~wxRichTextCharacterStyleDefinition(); |
23324ae1 FM |
442 | }; |
443 | ||
444 | ||
e54c96f1 | 445 | |
23324ae1 FM |
446 | /** |
447 | @class wxRichTextListStyleDefinition | |
7c913512 | 448 | |
23324ae1 FM |
449 | This class represents a list style definition, usually added to a |
450 | wxRichTextStyleSheet. | |
7c913512 | 451 | |
9e7ad1ca FM |
452 | The class inherits paragraph attributes from wxRichTextStyleParagraphDefinition, |
453 | and adds 10 further attribute objects, one for each level of a list. | |
23324ae1 | 454 | When applying a list style to a paragraph, the list style's base and |
9e7ad1ca FM |
455 | appropriate level attributes are merged with the paragraph's existing attributes. |
456 | ||
457 | You can apply a list style to one or more paragraphs using wxRichTextCtrl::SetListStyle. | |
458 | You can also use the functions wxRichTextCtrl::NumberList, wxRichTextCtrl::PromoteList and | |
459 | wxRichTextCtrl::ClearListStyle. | |
460 | ||
461 | As usual, there are wxRichTextBuffer versions of these functions | |
23324ae1 | 462 | so that you can apply them directly to a buffer without requiring a control. |
7c913512 | 463 | |
23324ae1 | 464 | @library{wxrichtext} |
21b447dc | 465 | @category{richtext} |
23324ae1 FM |
466 | */ |
467 | class wxRichTextListStyleDefinition : public wxRichTextParagraphStyleDefinition | |
468 | { | |
469 | public: | |
470 | /** | |
471 | Constructor. | |
472 | */ | |
473 | wxRichTextListStyleDefinition(const wxString& name = wxEmptyString); | |
474 | ||
475 | /** | |
476 | Destructor. | |
477 | */ | |
adaaa686 | 478 | virtual ~wxRichTextListStyleDefinition(); |
23324ae1 FM |
479 | |
480 | /** | |
481 | This function combines the given paragraph style with the list style's base | |
482 | attributes and level style matching the given indent, returning the combined attributes. | |
9e7ad1ca | 483 | |
4cc4bfaf | 484 | If @a styleSheet is specified, the base style for this definition will also be |
23324ae1 FM |
485 | included in the result. |
486 | */ | |
e4d44c92 RD |
487 | wxRichTextAttr CombineWithParagraphStyle(int indent, |
488 | const wxRichTextAttr& paraStyle, | |
4cc4bfaf | 489 | wxRichTextStyleSheet* styleSheet = NULL); |
23324ae1 FM |
490 | |
491 | /** | |
492 | This function finds the level (from 0 to 9) whose indentation attribute mostly | |
4cc4bfaf | 493 | closely matches @a indent (expressed in tenths of a millimetre). |
23324ae1 | 494 | */ |
328f5751 | 495 | int FindLevelForIndent(int indent) const; |
23324ae1 FM |
496 | |
497 | /** | |
498 | This function combines the list style's base attributes and the level style | |
499 | matching the given indent, returning the combined attributes. | |
9e7ad1ca | 500 | |
4cc4bfaf | 501 | If @a styleSheet is specified, the base style for this definition will also be |
23324ae1 FM |
502 | included in the result. |
503 | */ | |
e4d44c92 | 504 | wxRichTextAttr GetCombinedStyle(int indent, |
fadc2df6 | 505 | wxRichTextStyleSheet* styleSheet = NULL); |
23324ae1 FM |
506 | |
507 | /** | |
508 | This function combines the list style's base attributes and the style for the | |
509 | specified level, returning the combined attributes. | |
9e7ad1ca | 510 | |
4cc4bfaf | 511 | If @a styleSheet is specified, the base style for this definition will also be |
23324ae1 FM |
512 | included in the result. |
513 | */ | |
51795e33 | 514 | |
e4d44c92 RD |
515 | wxRichTextAttr GetCombinedStyleForLevel(int level, |
516 | wxRichTextStyleSheet* styleSheet = NULL); | |
23324ae1 FM |
517 | |
518 | /** | |
4cc4bfaf | 519 | Returns the style for the given level. @a level is a number between 0 and 9. |
23324ae1 | 520 | */ |
e4d44c92 | 521 | const wxRichTextAttr* GetLevelAttributes(int level) const; |
23324ae1 FM |
522 | |
523 | /** | |
524 | Returns the number of levels. This is hard-wired to 10. | |
23324ae1 FM |
525 | Returns the style for the given level. @e level is a number between 0 and 9. |
526 | */ | |
328f5751 | 527 | int GetLevelCount() const; |
23324ae1 FM |
528 | |
529 | /** | |
530 | Returns @true if the given level has numbered list attributes. | |
531 | */ | |
5267aefd | 532 | bool IsNumbered(int level) const; |
23324ae1 | 533 | |
23324ae1 | 534 | /** |
4cc4bfaf | 535 | Sets the style for the given level. @a level is a number between 0 and 9. |
23324ae1 FM |
536 | The first and most flexible form uses a wxTextAttr object, while the second |
537 | form is for convenient setting of the most commonly-used attributes. | |
538 | */ | |
e4d44c92 | 539 | void SetLevelAttributes(int level, const wxRichTextAttr& attr); |
23324ae1 FM |
540 | }; |
541 | ||
542 | ||
e54c96f1 | 543 | |
23324ae1 FM |
544 | /** |
545 | @class wxRichTextStyleSheet | |
7c913512 | 546 | |
23324ae1 FM |
547 | A style sheet contains named paragraph and character styles that make it |
548 | easy for a user to apply combinations of attributes to a wxRichTextCtrl. | |
7c913512 | 549 | |
9e7ad1ca FM |
550 | You can use a wxRichTextStyleListBox in your user interface to show available |
551 | styles to the user, and allow application of styles to the control. | |
7c913512 | 552 | |
23324ae1 | 553 | @library{wxrichtext} |
21b447dc | 554 | @category{richtext} |
23324ae1 FM |
555 | */ |
556 | class wxRichTextStyleSheet : public wxObject | |
557 | { | |
558 | public: | |
559 | /** | |
560 | Constructor. | |
561 | */ | |
562 | wxRichTextStyleSheet(); | |
563 | ||
564 | /** | |
565 | Destructor. | |
566 | */ | |
adaaa686 | 567 | virtual ~wxRichTextStyleSheet(); |
23324ae1 FM |
568 | |
569 | /** | |
570 | Adds a definition to the character style list. | |
571 | */ | |
572 | bool AddCharacterStyle(wxRichTextCharacterStyleDefinition* def); | |
573 | ||
574 | /** | |
575 | Adds a definition to the list style list. | |
576 | */ | |
577 | bool AddListStyle(wxRichTextListStyleDefinition* def); | |
578 | ||
579 | /** | |
580 | Adds a definition to the paragraph style list. | |
581 | */ | |
582 | bool AddParagraphStyle(wxRichTextParagraphStyleDefinition* def); | |
583 | ||
584 | /** | |
585 | Adds a definition to the appropriate style list. | |
586 | */ | |
587 | bool AddStyle(wxRichTextStyleDefinition* def); | |
588 | ||
589 | /** | |
590 | Deletes all styles. | |
591 | */ | |
592 | void DeleteStyles(); | |
593 | ||
594 | /** | |
595 | Finds a character definition by name. | |
596 | */ | |
5267aefd FM |
597 | wxRichTextCharacterStyleDefinition* FindCharacterStyle(const wxString& name, |
598 | bool recurse = true) const; | |
23324ae1 FM |
599 | |
600 | /** | |
601 | Finds a list definition by name. | |
602 | */ | |
5267aefd FM |
603 | wxRichTextListStyleDefinition* FindListStyle(const wxString& name, |
604 | bool recurse = true) const; | |
23324ae1 FM |
605 | |
606 | /** | |
607 | Finds a paragraph definition by name. | |
608 | */ | |
5267aefd FM |
609 | wxRichTextParagraphStyleDefinition* FindParagraphStyle(const wxString& name, |
610 | bool recurse = true) const; | |
23324ae1 FM |
611 | |
612 | /** | |
613 | Finds a style definition by name. | |
614 | */ | |
328f5751 | 615 | wxRichTextStyleDefinition* FindStyle(const wxString& name) const; |
23324ae1 FM |
616 | |
617 | /** | |
618 | Returns the @e nth character style. | |
619 | */ | |
328f5751 | 620 | wxRichTextCharacterStyleDefinition* GetCharacterStyle(size_t n) const; |
23324ae1 FM |
621 | |
622 | /** | |
623 | Returns the number of character styles. | |
624 | */ | |
328f5751 | 625 | size_t GetCharacterStyleCount() const; |
23324ae1 FM |
626 | |
627 | /** | |
628 | Returns the style sheet's description. | |
629 | */ | |
5267aefd | 630 | const wxString& GetDescription() const; |
23324ae1 FM |
631 | |
632 | /** | |
633 | Returns the @e nth list style. | |
634 | */ | |
328f5751 | 635 | wxRichTextListStyleDefinition* GetListStyle(size_t n) const; |
23324ae1 FM |
636 | |
637 | /** | |
638 | Returns the number of list styles. | |
639 | */ | |
328f5751 | 640 | size_t GetListStyleCount() const; |
23324ae1 FM |
641 | |
642 | /** | |
643 | Returns the style sheet's name. | |
644 | */ | |
5267aefd | 645 | const wxString& GetName() const; |
23324ae1 FM |
646 | |
647 | /** | |
648 | Returns the @e nth paragraph style. | |
649 | */ | |
328f5751 | 650 | wxRichTextParagraphStyleDefinition* GetParagraphStyle(size_t n) const; |
23324ae1 FM |
651 | |
652 | /** | |
653 | Returns the number of paragraph styles. | |
654 | */ | |
328f5751 | 655 | size_t GetParagraphStyleCount() const; |
23324ae1 FM |
656 | |
657 | /** | |
658 | Removes a character style. | |
659 | */ | |
660 | bool RemoveCharacterStyle(wxRichTextStyleDefinition* def, | |
4cc4bfaf | 661 | bool deleteStyle = false); |
23324ae1 FM |
662 | |
663 | /** | |
664 | Removes a list style. | |
665 | */ | |
666 | bool RemoveListStyle(wxRichTextStyleDefinition* def, | |
4cc4bfaf | 667 | bool deleteStyle = false); |
23324ae1 FM |
668 | |
669 | /** | |
670 | Removes a paragraph style. | |
671 | */ | |
672 | bool RemoveParagraphStyle(wxRichTextStyleDefinition* def, | |
4cc4bfaf | 673 | bool deleteStyle = false); |
23324ae1 FM |
674 | |
675 | /** | |
676 | Removes a style. | |
677 | */ | |
678 | bool RemoveStyle(wxRichTextStyleDefinition* def, | |
4cc4bfaf | 679 | bool deleteStyle = false); |
23324ae1 FM |
680 | |
681 | /** | |
682 | Sets the style sheet's description. | |
683 | */ | |
684 | void SetDescription(const wxString& descr); | |
685 | ||
686 | /** | |
687 | Sets the style sheet's name. | |
688 | */ | |
689 | void SetName(const wxString& name); | |
c6182d48 JS |
690 | |
691 | /** | |
692 | Returns the sheet's properties. | |
693 | */ | |
694 | wxRichTextProperties& GetProperties(); | |
695 | ||
696 | /** | |
697 | Returns the sheet's properties. | |
698 | */ | |
699 | const wxRichTextProperties& GetProperties() const; | |
700 | ||
701 | /** | |
702 | Sets the sheet's properties. | |
703 | */ | |
704 | void SetProperties(const wxRichTextProperties& props); | |
23324ae1 | 705 | }; |
e54c96f1 | 706 |