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