]>
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 | */ | |
e4d44c92 RD |
153 | wxRichTextAttr GetStyle() const; |
154 | const wxRichTextAttr 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 | */ | |
e4d44c92 | 161 | virtual wxRichTextAttr 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 | */ | |
e4d44c92 | 181 | void SetStyle(const wxRichTextAttr& 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: | |
e4d44c92 RD |
252 | |
253 | /// Which type of style definition is currently showing? | |
254 | enum wxRichTextStyleType | |
255 | { | |
256 | wxRICHTEXT_STYLE_ALL, | |
257 | wxRICHTEXT_STYLE_PARAGRAPH, | |
258 | wxRICHTEXT_STYLE_CHARACTER, | |
259 | wxRICHTEXT_STYLE_LIST, | |
260 | wxRICHTEXT_STYLE_BOX | |
261 | }; | |
262 | ||
23324ae1 FM |
263 | /** |
264 | Constructor. | |
265 | */ | |
266 | wxRichTextStyleListBox(wxWindow* parent, | |
267 | wxWindowID id = wxID_ANY, | |
268 | const wxPoint& pos = wxDefaultPosition, | |
269 | const wxSize& size = wxDefaultSize, | |
270 | long style = 0); | |
271 | ||
272 | /** | |
273 | Destructor. | |
274 | */ | |
adaaa686 | 275 | virtual ~wxRichTextStyleListBox(); |
23324ae1 FM |
276 | |
277 | /** | |
278 | Applies the @e ith style to the associated rich text control. | |
279 | */ | |
280 | void ApplyStyle(int i); | |
281 | ||
282 | /** | |
283 | Converts units in tenths of a millimetre to device units. | |
284 | */ | |
328f5751 | 285 | int ConvertTenthsMMToPixels(wxDC& dc, int units) const; |
23324ae1 FM |
286 | |
287 | /** | |
288 | Creates a suitable HTML fragment for a definition. | |
289 | */ | |
328f5751 | 290 | wxString CreateHTML(wxRichTextStyleDefinition* def) const; |
23324ae1 FM |
291 | |
292 | /** | |
293 | If the return value is @true, clicking on a style name in the list will | |
9e7ad1ca | 294 | immediately apply the style to the associated rich text control. |
23324ae1 | 295 | */ |
328f5751 | 296 | bool GetApplyOnSelection() const; |
23324ae1 FM |
297 | |
298 | /** | |
299 | Returns the wxRichTextCtrl associated with this listbox. | |
300 | */ | |
328f5751 | 301 | wxRichTextCtrl* GetRichTextCtrl() const; |
23324ae1 FM |
302 | |
303 | /** | |
304 | Gets a style for a listbox index. | |
305 | */ | |
328f5751 | 306 | wxRichTextStyleDefinition* GetStyle(size_t i) const; |
23324ae1 FM |
307 | |
308 | /** | |
309 | Returns the style sheet associated with this listbox. | |
310 | */ | |
328f5751 | 311 | wxRichTextStyleSheet* GetStyleSheet() const; |
23324ae1 FM |
312 | |
313 | /** | |
314 | Returns the type of style to show in the list box. | |
315 | */ | |
328f5751 | 316 | wxRichTextStyleListBox::wxRichTextStyleType GetStyleType() const; |
23324ae1 | 317 | |
23324ae1 FM |
318 | /** |
319 | Implements left click behaviour, applying the clicked style to the | |
320 | wxRichTextCtrl. | |
321 | */ | |
322 | void OnLeftDown(wxMouseEvent& event); | |
323 | ||
23324ae1 | 324 | /** |
4cc4bfaf | 325 | If @a applyOnSelection is @true, clicking on a style name in the list will |
9e7ad1ca | 326 | immediately apply the style to the associated rich text control. |
23324ae1 FM |
327 | */ |
328 | void SetApplyOnSelection(bool applyOnSelection); | |
329 | ||
330 | /** | |
331 | Associates the listbox with a wxRichTextCtrl. | |
332 | */ | |
333 | void SetRichTextCtrl(wxRichTextCtrl* ctrl); | |
334 | ||
335 | /** | |
336 | Associates the control with a style sheet. | |
337 | */ | |
338 | void SetStyleSheet(wxRichTextStyleSheet* styleSheet); | |
339 | ||
340 | /** | |
341 | Sets the style type to display. One of | |
9e7ad1ca FM |
342 | - wxRichTextStyleListBox::wxRICHTEXT_STYLE_ALL, |
343 | - wxRichTextStyleListBox::wxRICHTEXT_STYLE_PARAGRAPH, | |
344 | - wxRichTextStyleListBox::wxRICHTEXT_STYLE_CHARACTER | |
345 | - wxRichTextStyleListBox::wxRICHTEXT_STYLE_LIST. | |
23324ae1 FM |
346 | */ |
347 | void SetStyleType(wxRichTextStyleListBox::wxRichTextStyleType styleType); | |
348 | ||
349 | /** | |
350 | Updates the list from the associated style sheet. | |
351 | */ | |
352 | void UpdateStyles(); | |
5e6e278d FM |
353 | |
354 | protected: | |
355 | ||
356 | /** | |
357 | Returns the HTML for this item. | |
358 | */ | |
359 | virtual wxString OnGetItem(size_t n) const; | |
23324ae1 FM |
360 | }; |
361 | ||
362 | ||
e54c96f1 | 363 | |
23324ae1 FM |
364 | /** |
365 | @class wxRichTextStyleComboCtrl | |
7c913512 | 366 | |
23324ae1 FM |
367 | This is a combo control that can display the styles in a wxRichTextStyleSheet, |
368 | and apply the selection to an associated wxRichTextCtrl. | |
7c913512 | 369 | |
23324ae1 | 370 | See @c samples/richtext for an example of how to use it. |
7c913512 | 371 | |
23324ae1 | 372 | @library{wxrichtext} |
21b447dc | 373 | @category{richtext} |
7c913512 | 374 | |
9e7ad1ca | 375 | @see wxRichTextStyleListBox, @ref overview_richtextctrl |
23324ae1 FM |
376 | */ |
377 | class wxRichTextStyleComboCtrl : public wxComboCtrl | |
378 | { | |
379 | public: | |
380 | /** | |
381 | Constructor. | |
382 | */ | |
383 | wxRichTextStyleComboCtrl(wxWindow* parent, | |
384 | wxWindowID id = wxID_ANY, | |
385 | const wxPoint& pos = wxDefaultPosition, | |
386 | const wxSize& size = wxDefaultSize, | |
387 | long style = 0); | |
388 | ||
389 | /** | |
390 | Destructor. | |
391 | */ | |
adaaa686 | 392 | virtual ~wxRichTextStyleComboCtrl(); |
23324ae1 FM |
393 | |
394 | /** | |
395 | Returns the wxRichTextCtrl associated with this control. | |
396 | */ | |
328f5751 | 397 | wxRichTextCtrl* GetRichTextCtrl() const; |
23324ae1 FM |
398 | |
399 | /** | |
400 | Returns the style sheet associated with this control. | |
401 | */ | |
328f5751 | 402 | wxRichTextStyleSheet* GetStyleSheet() const; |
23324ae1 FM |
403 | |
404 | /** | |
405 | Associates the control with a wxRichTextCtrl. | |
406 | */ | |
407 | void SetRichTextCtrl(wxRichTextCtrl* ctrl); | |
408 | ||
409 | /** | |
410 | Associates the control with a style sheet. | |
411 | */ | |
412 | void SetStyleSheet(wxRichTextStyleSheet* styleSheet); | |
413 | ||
414 | /** | |
415 | Updates the combo control from the associated style sheet. | |
416 | */ | |
417 | void UpdateStyles(); | |
418 | }; | |
419 | ||
420 | ||
e54c96f1 | 421 | |
23324ae1 FM |
422 | /** |
423 | @class wxRichTextCharacterStyleDefinition | |
7c913512 | 424 | |
23324ae1 FM |
425 | This class represents a character style definition, usually added to a |
426 | wxRichTextStyleSheet. | |
7c913512 | 427 | |
23324ae1 | 428 | @library{wxrichtext} |
21b447dc | 429 | @category{richtext} |
23324ae1 FM |
430 | */ |
431 | class wxRichTextCharacterStyleDefinition : public wxRichTextStyleDefinition | |
432 | { | |
433 | public: | |
434 | /** | |
435 | Constructor. | |
436 | */ | |
437 | wxRichTextCharacterStyleDefinition(const wxString& name = wxEmptyString); | |
438 | ||
439 | /** | |
440 | Destructor. | |
441 | */ | |
adaaa686 | 442 | virtual ~wxRichTextCharacterStyleDefinition(); |
23324ae1 FM |
443 | }; |
444 | ||
445 | ||
e54c96f1 | 446 | |
23324ae1 FM |
447 | /** |
448 | @class wxRichTextListStyleDefinition | |
7c913512 | 449 | |
23324ae1 FM |
450 | This class represents a list style definition, usually added to a |
451 | wxRichTextStyleSheet. | |
7c913512 | 452 | |
9e7ad1ca FM |
453 | The class inherits paragraph attributes from wxRichTextStyleParagraphDefinition, |
454 | and adds 10 further attribute objects, one for each level of a list. | |
23324ae1 | 455 | When applying a list style to a paragraph, the list style's base and |
9e7ad1ca FM |
456 | appropriate level attributes are merged with the paragraph's existing attributes. |
457 | ||
458 | You can apply a list style to one or more paragraphs using wxRichTextCtrl::SetListStyle. | |
459 | You can also use the functions wxRichTextCtrl::NumberList, wxRichTextCtrl::PromoteList and | |
460 | wxRichTextCtrl::ClearListStyle. | |
461 | ||
462 | As usual, there are wxRichTextBuffer versions of these functions | |
23324ae1 | 463 | so that you can apply them directly to a buffer without requiring a control. |
7c913512 | 464 | |
23324ae1 | 465 | @library{wxrichtext} |
21b447dc | 466 | @category{richtext} |
23324ae1 FM |
467 | */ |
468 | class wxRichTextListStyleDefinition : public wxRichTextParagraphStyleDefinition | |
469 | { | |
470 | public: | |
471 | /** | |
472 | Constructor. | |
473 | */ | |
474 | wxRichTextListStyleDefinition(const wxString& name = wxEmptyString); | |
475 | ||
476 | /** | |
477 | Destructor. | |
478 | */ | |
adaaa686 | 479 | virtual ~wxRichTextListStyleDefinition(); |
23324ae1 FM |
480 | |
481 | /** | |
482 | This function combines the given paragraph style with the list style's base | |
483 | attributes and level style matching the given indent, returning the combined attributes. | |
9e7ad1ca | 484 | |
4cc4bfaf | 485 | If @a styleSheet is specified, the base style for this definition will also be |
23324ae1 FM |
486 | included in the result. |
487 | */ | |
e4d44c92 RD |
488 | wxRichTextAttr CombineWithParagraphStyle(int indent, |
489 | const wxRichTextAttr& paraStyle, | |
4cc4bfaf | 490 | wxRichTextStyleSheet* styleSheet = NULL); |
23324ae1 FM |
491 | |
492 | /** | |
493 | This function finds the level (from 0 to 9) whose indentation attribute mostly | |
4cc4bfaf | 494 | closely matches @a indent (expressed in tenths of a millimetre). |
23324ae1 | 495 | */ |
328f5751 | 496 | int FindLevelForIndent(int indent) const; |
23324ae1 FM |
497 | |
498 | /** | |
499 | This function combines the list style's base attributes and the level style | |
500 | matching the given indent, returning the combined attributes. | |
9e7ad1ca | 501 | |
4cc4bfaf | 502 | If @a styleSheet is specified, the base style for this definition will also be |
23324ae1 FM |
503 | included in the result. |
504 | */ | |
e4d44c92 | 505 | wxRichTextAttr GetCombinedStyle(int indent, |
fadc2df6 | 506 | wxRichTextStyleSheet* styleSheet = NULL); |
23324ae1 FM |
507 | |
508 | /** | |
509 | This function combines the list style's base attributes and the style for the | |
510 | specified level, returning the combined attributes. | |
9e7ad1ca | 511 | |
4cc4bfaf | 512 | If @a styleSheet is specified, the base style for this definition will also be |
23324ae1 FM |
513 | included in the result. |
514 | */ | |
51795e33 | 515 | |
e4d44c92 RD |
516 | wxRichTextAttr GetCombinedStyleForLevel(int level, |
517 | wxRichTextStyleSheet* styleSheet = NULL); | |
23324ae1 FM |
518 | |
519 | /** | |
4cc4bfaf | 520 | Returns the style for the given level. @a level is a number between 0 and 9. |
23324ae1 | 521 | */ |
e4d44c92 | 522 | const wxRichTextAttr* GetLevelAttributes(int level) const; |
23324ae1 FM |
523 | |
524 | /** | |
525 | Returns the number of levels. This is hard-wired to 10. | |
23324ae1 FM |
526 | Returns the style for the given level. @e level is a number between 0 and 9. |
527 | */ | |
328f5751 | 528 | int GetLevelCount() const; |
23324ae1 FM |
529 | |
530 | /** | |
531 | Returns @true if the given level has numbered list attributes. | |
532 | */ | |
5267aefd | 533 | bool IsNumbered(int level) const; |
23324ae1 | 534 | |
23324ae1 | 535 | /** |
4cc4bfaf | 536 | Sets the style for the given level. @a level is a number between 0 and 9. |
23324ae1 FM |
537 | The first and most flexible form uses a wxTextAttr object, while the second |
538 | form is for convenient setting of the most commonly-used attributes. | |
539 | */ | |
e4d44c92 | 540 | void SetLevelAttributes(int level, const wxRichTextAttr& attr); |
23324ae1 FM |
541 | }; |
542 | ||
543 | ||
e54c96f1 | 544 | |
23324ae1 FM |
545 | /** |
546 | @class wxRichTextStyleSheet | |
7c913512 | 547 | |
23324ae1 FM |
548 | A style sheet contains named paragraph and character styles that make it |
549 | easy for a user to apply combinations of attributes to a wxRichTextCtrl. | |
7c913512 | 550 | |
9e7ad1ca FM |
551 | You can use a wxRichTextStyleListBox in your user interface to show available |
552 | styles to the user, and allow application of styles to the control. | |
7c913512 | 553 | |
23324ae1 | 554 | @library{wxrichtext} |
21b447dc | 555 | @category{richtext} |
23324ae1 FM |
556 | */ |
557 | class wxRichTextStyleSheet : public wxObject | |
558 | { | |
559 | public: | |
560 | /** | |
561 | Constructor. | |
562 | */ | |
563 | wxRichTextStyleSheet(); | |
564 | ||
565 | /** | |
566 | Destructor. | |
567 | */ | |
adaaa686 | 568 | virtual ~wxRichTextStyleSheet(); |
23324ae1 FM |
569 | |
570 | /** | |
571 | Adds a definition to the character style list. | |
572 | */ | |
573 | bool AddCharacterStyle(wxRichTextCharacterStyleDefinition* def); | |
574 | ||
575 | /** | |
576 | Adds a definition to the list style list. | |
577 | */ | |
578 | bool AddListStyle(wxRichTextListStyleDefinition* def); | |
579 | ||
580 | /** | |
581 | Adds a definition to the paragraph style list. | |
582 | */ | |
583 | bool AddParagraphStyle(wxRichTextParagraphStyleDefinition* def); | |
584 | ||
585 | /** | |
586 | Adds a definition to the appropriate style list. | |
587 | */ | |
588 | bool AddStyle(wxRichTextStyleDefinition* def); | |
589 | ||
590 | /** | |
591 | Deletes all styles. | |
592 | */ | |
593 | void DeleteStyles(); | |
594 | ||
595 | /** | |
596 | Finds a character definition by name. | |
597 | */ | |
5267aefd FM |
598 | wxRichTextCharacterStyleDefinition* FindCharacterStyle(const wxString& name, |
599 | bool recurse = true) const; | |
23324ae1 FM |
600 | |
601 | /** | |
602 | Finds a list definition by name. | |
603 | */ | |
5267aefd FM |
604 | wxRichTextListStyleDefinition* FindListStyle(const wxString& name, |
605 | bool recurse = true) const; | |
23324ae1 FM |
606 | |
607 | /** | |
608 | Finds a paragraph definition by name. | |
609 | */ | |
5267aefd FM |
610 | wxRichTextParagraphStyleDefinition* FindParagraphStyle(const wxString& name, |
611 | bool recurse = true) const; | |
23324ae1 FM |
612 | |
613 | /** | |
614 | Finds a style definition by name. | |
615 | */ | |
328f5751 | 616 | wxRichTextStyleDefinition* FindStyle(const wxString& name) const; |
23324ae1 FM |
617 | |
618 | /** | |
619 | Returns the @e nth character style. | |
620 | */ | |
328f5751 | 621 | wxRichTextCharacterStyleDefinition* GetCharacterStyle(size_t n) const; |
23324ae1 FM |
622 | |
623 | /** | |
624 | Returns the number of character styles. | |
625 | */ | |
328f5751 | 626 | size_t GetCharacterStyleCount() const; |
23324ae1 FM |
627 | |
628 | /** | |
629 | Returns the style sheet's description. | |
630 | */ | |
5267aefd | 631 | const wxString& GetDescription() const; |
23324ae1 FM |
632 | |
633 | /** | |
634 | Returns the @e nth list style. | |
635 | */ | |
328f5751 | 636 | wxRichTextListStyleDefinition* GetListStyle(size_t n) const; |
23324ae1 FM |
637 | |
638 | /** | |
639 | Returns the number of list styles. | |
640 | */ | |
328f5751 | 641 | size_t GetListStyleCount() const; |
23324ae1 FM |
642 | |
643 | /** | |
644 | Returns the style sheet's name. | |
645 | */ | |
5267aefd | 646 | const wxString& GetName() const; |
23324ae1 FM |
647 | |
648 | /** | |
649 | Returns the @e nth paragraph style. | |
650 | */ | |
328f5751 | 651 | wxRichTextParagraphStyleDefinition* GetParagraphStyle(size_t n) const; |
23324ae1 FM |
652 | |
653 | /** | |
654 | Returns the number of paragraph styles. | |
655 | */ | |
328f5751 | 656 | size_t GetParagraphStyleCount() const; |
23324ae1 FM |
657 | |
658 | /** | |
659 | Removes a character style. | |
660 | */ | |
661 | bool RemoveCharacterStyle(wxRichTextStyleDefinition* def, | |
4cc4bfaf | 662 | bool deleteStyle = false); |
23324ae1 FM |
663 | |
664 | /** | |
665 | Removes a list style. | |
666 | */ | |
667 | bool RemoveListStyle(wxRichTextStyleDefinition* def, | |
4cc4bfaf | 668 | bool deleteStyle = false); |
23324ae1 FM |
669 | |
670 | /** | |
671 | Removes a paragraph style. | |
672 | */ | |
673 | bool RemoveParagraphStyle(wxRichTextStyleDefinition* def, | |
4cc4bfaf | 674 | bool deleteStyle = false); |
23324ae1 FM |
675 | |
676 | /** | |
677 | Removes a style. | |
678 | */ | |
679 | bool RemoveStyle(wxRichTextStyleDefinition* def, | |
4cc4bfaf | 680 | bool deleteStyle = false); |
23324ae1 FM |
681 | |
682 | /** | |
683 | Sets the style sheet's description. | |
684 | */ | |
685 | void SetDescription(const wxString& descr); | |
686 | ||
687 | /** | |
688 | Sets the style sheet's name. | |
689 | */ | |
690 | void SetName(const wxString& name); | |
c6182d48 JS |
691 | |
692 | /** | |
693 | Returns the sheet's properties. | |
694 | */ | |
695 | wxRichTextProperties& GetProperties(); | |
696 | ||
697 | /** | |
698 | Returns the sheet's properties. | |
699 | */ | |
700 | const wxRichTextProperties& GetProperties() const; | |
701 | ||
702 | /** | |
703 | Sets the sheet's properties. | |
704 | */ | |
705 | void SetProperties(const wxRichTextProperties& props); | |
23324ae1 | 706 | }; |
e54c96f1 | 707 |