documentation for wxAppTraits (patch 1518295 from Francesco)
[wxWidgets.git] / include / wx / richtext / richtextstyles.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/richtext/richtextstyles.h
3 // Purpose: Style management for wxRichTextCtrl
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 2005-09-30
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_RICHTEXTSTYLES_H_
13 #define _WX_RICHTEXTSTYLES_H_
14
15 /*!
16 * Includes
17 */
18
19 #include "wx/defs.h"
20
21 #if wxUSE_RICHTEXT
22
23 #include "wx/richtext/richtextbuffer.h"
24
25 #if wxUSE_HTML
26 #include "wx/htmllbox.h"
27 #endif
28
29 #if wxUSE_COMBOCTRL
30 #include "wx/combo.h"
31 #endif
32
33 #include "wx/choice.h"
34
35 /*!
36 * Forward declarations
37 */
38
39 class WXDLLIMPEXP_RICHTEXT wxRichTextCtrl;
40 class WXDLLIMPEXP_RICHTEXT wxRichTextBuffer;
41
42 /*!
43 * wxRichTextStyleDefinition class declaration
44 * A base class for paragraph and character styles.
45 */
46
47 class WXDLLIMPEXP_RICHTEXT wxRichTextStyleDefinition: public wxObject
48 {
49 DECLARE_CLASS(wxRichTextStyleDefinition)
50 public:
51
52 /// Copy constructors
53 wxRichTextStyleDefinition(const wxRichTextStyleDefinition& def)
54 : wxObject()
55 {
56 Init();
57 Copy(def);
58 }
59
60 /// Default constructor
61 wxRichTextStyleDefinition(const wxString& name = wxEmptyString) { Init(); m_name = name; }
62
63 /// Destructor
64 virtual ~wxRichTextStyleDefinition() {}
65
66 /// Initialises members
67 void Init() {}
68
69 /// Copies from def
70 void Copy(const wxRichTextStyleDefinition& def);
71
72 /// Equality test
73 bool Eq(const wxRichTextStyleDefinition& def) const;
74
75 /// Assignment operator
76 void operator =(const wxRichTextStyleDefinition& def) { Copy(def); }
77
78 /// Equality operator
79 bool operator ==(const wxRichTextStyleDefinition& def) const { return Eq(def); }
80
81 /// Override to clone the object
82 virtual wxRichTextStyleDefinition* Clone() const = 0;
83
84 /// Sets and gets the name of the style
85 void SetName(const wxString& name) { m_name = name; }
86 const wxString& GetName() const { return m_name; }
87
88 /// Sets and gets the style description
89 void SetDescription(const wxString& descr) { m_description = descr; }
90 const wxString& GetDescription() const { return m_description; }
91
92 /// Sets and gets the name of the style that this style is based on
93 void SetBaseStyle(const wxString& name) { m_baseStyle = name; }
94 const wxString& GetBaseStyle() const { return m_baseStyle; }
95
96 /// Sets and gets the style
97 void SetStyle(const wxRichTextAttr& style) { m_style = style; }
98 const wxRichTextAttr& GetStyle() const { return m_style; }
99 wxRichTextAttr& GetStyle() { return m_style; }
100
101 /// Gets the style combined with the base style
102 virtual wxRichTextAttr GetStyleMergedWithBase(const wxRichTextStyleSheet* sheet) const;
103
104 protected:
105 wxString m_name;
106 wxString m_baseStyle;
107 wxString m_description;
108 wxRichTextAttr m_style;
109 };
110
111 /*!
112 * wxRichTextCharacterStyleDefinition class declaration
113 */
114
115 class WXDLLIMPEXP_RICHTEXT wxRichTextCharacterStyleDefinition: public wxRichTextStyleDefinition
116 {
117 DECLARE_DYNAMIC_CLASS(wxRichTextCharacterStyleDefinition)
118 public:
119
120 /// Copy constructor
121 wxRichTextCharacterStyleDefinition(const wxRichTextCharacterStyleDefinition& def): wxRichTextStyleDefinition(def) {}
122
123 /// Default constructor
124 wxRichTextCharacterStyleDefinition(const wxString& name = wxEmptyString):
125 wxRichTextStyleDefinition(name) {}
126
127 /// Destructor
128 virtual ~wxRichTextCharacterStyleDefinition() {}
129
130 /// Clones the object
131 virtual wxRichTextStyleDefinition* Clone() const { return new wxRichTextCharacterStyleDefinition(*this); }
132
133 protected:
134 };
135
136 /*!
137 * wxRichTextParagraphStyleDefinition class declaration
138 */
139
140 class WXDLLIMPEXP_RICHTEXT wxRichTextParagraphStyleDefinition: public wxRichTextStyleDefinition
141 {
142 DECLARE_DYNAMIC_CLASS(wxRichTextParagraphStyleDefinition)
143 public:
144
145 /// Copy constructor
146 wxRichTextParagraphStyleDefinition(const wxRichTextParagraphStyleDefinition& def): wxRichTextStyleDefinition(def) { m_nextStyle = def.m_nextStyle; }
147
148 /// Default constructor
149 wxRichTextParagraphStyleDefinition(const wxString& name = wxEmptyString):
150 wxRichTextStyleDefinition(name) {}
151
152 // Destructor
153 virtual ~wxRichTextParagraphStyleDefinition() {}
154
155 /// Sets and gets the next style
156 void SetNextStyle(const wxString& name) { m_nextStyle = name; }
157 const wxString& GetNextStyle() const { return m_nextStyle; }
158
159 /// Copies from def
160 void Copy(const wxRichTextParagraphStyleDefinition& def);
161
162 /// Assignment operator
163 void operator =(const wxRichTextParagraphStyleDefinition& def) { Copy(def); }
164
165 /// Equality operator
166 bool operator ==(const wxRichTextParagraphStyleDefinition& def) const;
167
168 /// Clones the object
169 virtual wxRichTextStyleDefinition* Clone() const { return new wxRichTextParagraphStyleDefinition(*this); }
170
171 protected:
172
173 /// The next style to use when adding a paragraph after this style.
174 wxString m_nextStyle;
175 };
176
177 /*!
178 * wxRichTextListStyleDefinition class declaration
179 */
180
181 class WXDLLIMPEXP_RICHTEXT wxRichTextListStyleDefinition: public wxRichTextParagraphStyleDefinition
182 {
183 DECLARE_DYNAMIC_CLASS(wxRichTextListStyleDefinition)
184 public:
185
186 /// Copy constructor
187 wxRichTextListStyleDefinition(const wxRichTextListStyleDefinition& def): wxRichTextParagraphStyleDefinition(def) { Init(); Copy(def); }
188
189 /// Default constructor
190 wxRichTextListStyleDefinition(const wxString& name = wxEmptyString):
191 wxRichTextParagraphStyleDefinition(name) { Init(); }
192
193 /// Destructor
194 virtual ~wxRichTextListStyleDefinition() {}
195
196 /// Copies from def
197 void Copy(const wxRichTextListStyleDefinition& def);
198
199 /// Assignment operator
200 void operator =(const wxRichTextListStyleDefinition& def) { Copy(def); }
201
202 /// Equality operator
203 bool operator ==(const wxRichTextListStyleDefinition& def) const;
204
205 /// Clones the object
206 virtual wxRichTextStyleDefinition* Clone() const { return new wxRichTextListStyleDefinition(*this); }
207
208 /// Sets/gets the attributes for the given level
209 void SetLevelAttributes(int i, const wxRichTextAttr& attr);
210 wxRichTextAttr* GetLevelAttributes(int i);
211 const wxRichTextAttr* GetLevelAttributes(int i) const;
212
213 /// Convenience function for setting the major attributes for a list level specification
214 void SetAttributes(int i, int leftIndent, int leftSubIndent, int bulletStyle, const wxString& bulletSymbol = wxEmptyString);
215
216 /// Finds the level corresponding to the given indentation
217 int FindLevelForIndent(int indent) const;
218
219 /// Combine the base and list style with a paragraph style, using the given indent (from which
220 /// an appropriate level is found)
221 wxRichTextAttr CombineWithParagraphStyle(int indent, const wxRichTextAttr& paraStyle, wxRichTextStyleSheet* styleSheet = NULL);
222
223 /// Combine the base and list style, using the given indent (from which
224 /// an appropriate level is found)
225 wxRichTextAttr GetCombinedStyle(int indent, wxRichTextStyleSheet* styleSheet = NULL);
226
227 /// Combine the base and list style, using the given level from which
228 /// an appropriate level is found)
229 wxRichTextAttr GetCombinedStyleForLevel(int level, wxRichTextStyleSheet* styleSheet = NULL);
230
231 /// Gets the number of available levels
232 int GetLevelCount() const { return 10; }
233
234 /// Is this a numbered list?
235 bool IsNumbered(int i) const;
236
237 protected:
238
239 /// The styles for each level (up to 10)
240 wxRichTextAttr m_levelStyles[10];
241 };
242
243 /*!
244 * The style sheet
245 */
246
247 class WXDLLIMPEXP_RICHTEXT wxRichTextStyleSheet: public wxObject
248 {
249 DECLARE_CLASS( wxRichTextStyleSheet )
250
251 public:
252 /// Constructors
253 wxRichTextStyleSheet(const wxRichTextStyleSheet& sheet)
254 : wxObject()
255 {
256 Copy(sheet);
257 }
258 wxRichTextStyleSheet() { Init(); }
259 virtual ~wxRichTextStyleSheet();
260
261 /// Initialisation
262 void Init();
263
264 /// Copy
265 void Copy(const wxRichTextStyleSheet& sheet);
266
267 /// Assignment
268 void operator=(const wxRichTextStyleSheet& sheet) { Copy(sheet); }
269
270 /// Equality
271 bool operator==(const wxRichTextStyleSheet& sheet) const;
272
273 /// Add a definition to the character style list
274 bool AddCharacterStyle(wxRichTextCharacterStyleDefinition* def);
275
276 /// Add a definition to the paragraph style list
277 bool AddParagraphStyle(wxRichTextParagraphStyleDefinition* def);
278
279 /// Add a definition to the list style list
280 bool AddListStyle(wxRichTextListStyleDefinition* def);
281
282 /// Add a definition to the appropriate style list
283 bool AddStyle(wxRichTextStyleDefinition* def);
284
285 /// Remove a character style
286 bool RemoveCharacterStyle(wxRichTextStyleDefinition* def, bool deleteStyle = false) { return RemoveStyle(m_characterStyleDefinitions, def, deleteStyle); }
287
288 /// Remove a paragraph style
289 bool RemoveParagraphStyle(wxRichTextStyleDefinition* def, bool deleteStyle = false) { return RemoveStyle(m_paragraphStyleDefinitions, def, deleteStyle); }
290
291 /// Remove a list style
292 bool RemoveListStyle(wxRichTextStyleDefinition* def, bool deleteStyle = false) { return RemoveStyle(m_listStyleDefinitions, def, deleteStyle); }
293
294 /// Remove a style
295 bool RemoveStyle(wxRichTextStyleDefinition* def, bool deleteStyle = false);
296
297 /// Find a character definition by name
298 wxRichTextCharacterStyleDefinition* FindCharacterStyle(const wxString& name, bool recurse = true) const { return (wxRichTextCharacterStyleDefinition*) FindStyle(m_characterStyleDefinitions, name, recurse); }
299
300 /// Find a paragraph definition by name
301 wxRichTextParagraphStyleDefinition* FindParagraphStyle(const wxString& name, bool recurse = true) const { return (wxRichTextParagraphStyleDefinition*) FindStyle(m_paragraphStyleDefinitions, name, recurse); }
302
303 /// Find a list definition by name
304 wxRichTextListStyleDefinition* FindListStyle(const wxString& name, bool recurse = true) const { return (wxRichTextListStyleDefinition*) FindStyle(m_listStyleDefinitions, name, recurse); }
305
306 /// Find any definition by name
307 wxRichTextStyleDefinition* FindStyle(const wxString& name, bool recurse = true) const;
308
309 /// Return the number of character styles
310 size_t GetCharacterStyleCount() const { return m_characterStyleDefinitions.GetCount(); }
311
312 /// Return the number of paragraph styles
313 size_t GetParagraphStyleCount() const { return m_paragraphStyleDefinitions.GetCount(); }
314
315 /// Return the number of list styles
316 size_t GetListStyleCount() const { return m_listStyleDefinitions.GetCount(); }
317
318 /// Return the nth character style
319 wxRichTextCharacterStyleDefinition* GetCharacterStyle(size_t n) const { return (wxRichTextCharacterStyleDefinition*) m_characterStyleDefinitions.Item(n)->GetData(); }
320
321 /// Return the nth paragraph style
322 wxRichTextParagraphStyleDefinition* GetParagraphStyle(size_t n) const { return (wxRichTextParagraphStyleDefinition*) m_paragraphStyleDefinitions.Item(n)->GetData(); }
323
324 /// Return the nth list style
325 wxRichTextListStyleDefinition* GetListStyle(size_t n) const { return (wxRichTextListStyleDefinition*) m_listStyleDefinitions.Item(n)->GetData(); }
326
327 /// Delete all styles
328 void DeleteStyles();
329
330 /// Insert into list of style sheets
331 bool InsertSheet(wxRichTextStyleSheet* before);
332
333 /// Append to list of style sheets
334 bool AppendSheet(wxRichTextStyleSheet* after);
335
336 /// Unlink from the list of style sheets
337 void Unlink();
338
339 /// Get/set next sheet
340 wxRichTextStyleSheet* GetNextSheet() const { return m_nextSheet; }
341 void SetNextSheet(wxRichTextStyleSheet* sheet) { m_nextSheet = sheet; }
342
343 /// Get/set previous sheet
344 wxRichTextStyleSheet* GetPreviousSheet() const { return m_previousSheet; }
345 void SetPreviousSheet(wxRichTextStyleSheet* sheet) { m_previousSheet = sheet; }
346
347 /// Sets and gets the name of the style sheet
348 void SetName(const wxString& name) { m_name = name; }
349 const wxString& GetName() const { return m_name; }
350
351 /// Sets and gets the style description
352 void SetDescription(const wxString& descr) { m_description = descr; }
353 const wxString& GetDescription() const { return m_description; }
354
355 /// Implementation
356
357 /// Add a definition to one of the style lists
358 bool AddStyle(wxList& list, wxRichTextStyleDefinition* def);
359
360 /// Remove a style
361 bool RemoveStyle(wxList& list, wxRichTextStyleDefinition* def, bool deleteStyle);
362
363 /// Find a definition by name
364 wxRichTextStyleDefinition* FindStyle(const wxList& list, const wxString& name, bool recurse = true) const;
365
366 protected:
367
368 wxString m_description;
369 wxString m_name;
370
371 wxList m_characterStyleDefinitions;
372 wxList m_paragraphStyleDefinitions;
373 wxList m_listStyleDefinitions;
374
375 wxRichTextStyleSheet* m_previousSheet;
376 wxRichTextStyleSheet* m_nextSheet;
377 };
378
379 #if wxUSE_HTML
380 /*!
381 * wxRichTextStyleListBox class declaration
382 * A listbox to display styles.
383 */
384
385 class WXDLLIMPEXP_RICHTEXT wxRichTextStyleListBox: public wxHtmlListBox
386 {
387 DECLARE_CLASS(wxRichTextStyleListBox)
388 DECLARE_EVENT_TABLE()
389
390 public:
391 /// Which type of style definition is currently showing?
392 enum wxRichTextStyleType
393 {
394 wxRICHTEXT_STYLE_ALL,
395 wxRICHTEXT_STYLE_PARAGRAPH,
396 wxRICHTEXT_STYLE_CHARACTER,
397 wxRICHTEXT_STYLE_LIST
398 };
399
400 wxRichTextStyleListBox()
401 {
402 Init();
403 }
404 wxRichTextStyleListBox(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition,
405 const wxSize& size = wxDefaultSize, long style = 0);
406 virtual ~wxRichTextStyleListBox();
407
408 void Init()
409 {
410 m_styleSheet = NULL;
411 m_richTextCtrl = NULL;
412 m_applyOnSelection = false;
413 m_styleType = wxRICHTEXT_STYLE_PARAGRAPH;
414 m_autoSetSelection = true;
415 }
416
417 bool Create(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition,
418 const wxSize& size = wxDefaultSize, long style = 0);
419
420 /// Creates a suitable HTML fragment for a definition
421 wxString CreateHTML(wxRichTextStyleDefinition* def) const;
422
423 /// Associates the control with a style sheet
424 void SetStyleSheet(wxRichTextStyleSheet* styleSheet) { m_styleSheet = styleSheet; }
425 wxRichTextStyleSheet* GetStyleSheet() const { return m_styleSheet; }
426
427 /// Associates the control with a wxRichTextCtrl
428 void SetRichTextCtrl(wxRichTextCtrl* ctrl) { m_richTextCtrl = ctrl; }
429 wxRichTextCtrl* GetRichTextCtrl() const { return m_richTextCtrl; }
430
431 /// Get style for index
432 wxRichTextStyleDefinition* GetStyle(size_t i) const ;
433
434 /// Get index for style name
435 int GetIndexForStyle(const wxString& name) const ;
436
437 /// Set selection for string, returning the index.
438 int SetStyleSelection(const wxString& name);
439
440 /// Updates the list
441 void UpdateStyles();
442
443 /// Apply the style
444 void ApplyStyle(int i);
445
446 /// Left click
447 void OnLeftDown(wxMouseEvent& event);
448
449 /// Left double-click
450 void OnLeftDoubleClick(wxMouseEvent& event);
451
452 /// Auto-select from style under caret in idle time
453 void OnIdle(wxIdleEvent& event);
454
455 /// Convert units in tends of a millimetre to device units
456 int ConvertTenthsMMToPixels(wxDC& dc, int units) const;
457
458 /// Can we set the selection based on the editor caret position?
459 /// Need to override this if being used in a combobox popup
460 virtual bool CanAutoSetSelection() { return m_autoSetSelection; }
461 virtual void SetAutoSetSelection(bool autoSet) { m_autoSetSelection = autoSet; }
462
463 /// Set whether the style should be applied as soon as the item is selected (the default)
464 void SetApplyOnSelection(bool applyOnSel) { m_applyOnSelection = applyOnSel; }
465 bool GetApplyOnSelection() const { return m_applyOnSelection; }
466
467 /// Set the style type to display
468 void SetStyleType(wxRichTextStyleType styleType) { m_styleType = styleType; UpdateStyles(); }
469 wxRichTextStyleType GetStyleType() const { return m_styleType; }
470
471 /// Helper for listbox and combo control
472 static wxString GetStyleToShowInIdleTime(wxRichTextCtrl* ctrl, wxRichTextStyleType styleType);
473
474 protected:
475 /// Returns the HTML for this item
476 virtual wxString OnGetItem(size_t n) const;
477
478 private:
479
480 wxRichTextStyleSheet* m_styleSheet;
481 wxRichTextCtrl* m_richTextCtrl;
482 bool m_applyOnSelection; // if true, applies style on selection
483 wxRichTextStyleType m_styleType; // style type to display
484 bool m_autoSetSelection;
485 };
486
487 /*!
488 * wxRichTextStyleListCtrl class declaration
489 * This is a container for the list control plus a combobox to switch between
490 * style types.
491 */
492
493 #define wxRICHTEXTSTYLELIST_HIDE_TYPE_SELECTOR 0x1000
494
495 class WXDLLIMPEXP_RICHTEXT wxRichTextStyleListCtrl: public wxControl
496 {
497 DECLARE_CLASS(wxRichTextStyleListCtrl)
498 DECLARE_EVENT_TABLE()
499
500 public:
501
502 /// Constructors
503 wxRichTextStyleListCtrl()
504 {
505 Init();
506 }
507
508 wxRichTextStyleListCtrl(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition,
509 const wxSize& size = wxDefaultSize, long style = 0);
510
511 /// Constructors
512 virtual ~wxRichTextStyleListCtrl();
513
514 /// Member initialisation
515 void Init()
516 {
517 m_styleListBox = NULL;
518 m_styleChoice = NULL;
519 m_dontUpdate = false;
520 }
521
522 /// Creates the windows
523 bool Create(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition,
524 const wxSize& size = wxDefaultSize, long style = 0);
525
526 /// Updates the style list box
527 void UpdateStyles();
528
529 /// Associates the control with a style sheet
530 void SetStyleSheet(wxRichTextStyleSheet* styleSheet);
531 wxRichTextStyleSheet* GetStyleSheet() const;
532
533 /// Associates the control with a wxRichTextCtrl
534 void SetRichTextCtrl(wxRichTextCtrl* ctrl);
535 wxRichTextCtrl* GetRichTextCtrl() const;
536
537 /// Set/get the style type to display
538 void SetStyleType(wxRichTextStyleListBox::wxRichTextStyleType styleType);
539 wxRichTextStyleListBox::wxRichTextStyleType GetStyleType() const;
540
541 /// Get the choice index for style type
542 int StyleTypeToIndex(wxRichTextStyleListBox::wxRichTextStyleType styleType);
543
544 /// Get the style type for choice index
545 wxRichTextStyleListBox::wxRichTextStyleType StyleIndexToType(int i);
546
547 /// Get the listbox
548 wxRichTextStyleListBox* GetStyleListBox() const { return m_styleListBox; }
549
550 /// Get the choice
551 wxChoice* GetStyleChoice() const { return m_styleChoice; }
552
553 /// React to style type choice
554 void OnChooseType(wxCommandEvent& event);
555
556 /// Lay out the controls
557 void OnSize(wxSizeEvent& event);
558
559 private:
560
561 wxRichTextStyleListBox* m_styleListBox;
562 wxChoice* m_styleChoice;
563 bool m_dontUpdate;
564 };
565
566 #if wxUSE_COMBOCTRL
567
568 /*!
569 * Style drop-down for a wxComboCtrl
570 */
571
572 class wxRichTextStyleComboPopup : public wxRichTextStyleListBox, public wxComboPopup
573 {
574 public:
575 virtual void Init()
576 {
577 m_itemHere = -1; // hot item in list
578 m_value = -1;
579 }
580
581 virtual bool Create( wxWindow* parent )
582 {
583 return wxRichTextStyleListBox::Create(parent, wxID_ANY,
584 wxPoint(0,0), wxDefaultSize,
585 wxSIMPLE_BORDER);
586 }
587
588 virtual wxWindow *GetControl() { return this; }
589
590 virtual void SetStringValue( const wxString& s );
591
592 virtual wxString GetStringValue() const;
593
594 /// Can we set the selection based on the editor caret position?
595 // virtual bool CanAutoSetSelection() { return ((m_combo == NULL) || !m_combo->IsPopupShown()); }
596 virtual bool CanAutoSetSelection() { return false; }
597
598 //
599 // Popup event handlers
600 //
601
602 // Mouse hot-tracking
603 void OnMouseMove(wxMouseEvent& event);
604
605 // On mouse left, set the value and close the popup
606 void OnMouseClick(wxMouseEvent& WXUNUSED(event));
607
608 protected:
609
610 int m_itemHere; // hot item in popup
611 int m_value;
612
613 private:
614 DECLARE_EVENT_TABLE()
615 };
616
617 /*!
618 * wxRichTextStyleComboCtrl
619 * A combo for applying styles.
620 */
621
622 class WXDLLIMPEXP_RICHTEXT wxRichTextStyleComboCtrl: public wxComboCtrl
623 {
624 DECLARE_CLASS(wxRichTextStyleComboCtrl)
625 DECLARE_EVENT_TABLE()
626
627 public:
628 wxRichTextStyleComboCtrl()
629 {
630 Init();
631 }
632
633 wxRichTextStyleComboCtrl(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition,
634 const wxSize& size = wxDefaultSize, long style = wxCB_READONLY)
635 {
636 Init();
637 Create(parent, id, pos, size, style);
638 }
639
640 virtual ~wxRichTextStyleComboCtrl() {}
641
642 void Init()
643 {
644 m_stylePopup = NULL;
645 }
646
647 bool Create(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition,
648 const wxSize& size = wxDefaultSize, long style = 0);
649
650 /// Updates the list
651 void UpdateStyles() { m_stylePopup->UpdateStyles(); }
652
653 /// Associates the control with a style sheet
654 void SetStyleSheet(wxRichTextStyleSheet* styleSheet) { m_stylePopup->SetStyleSheet(styleSheet); }
655 wxRichTextStyleSheet* GetStyleSheet() const { return m_stylePopup->GetStyleSheet(); }
656
657 /// Associates the control with a wxRichTextCtrl
658 void SetRichTextCtrl(wxRichTextCtrl* ctrl) { m_stylePopup->SetRichTextCtrl(ctrl); }
659 wxRichTextCtrl* GetRichTextCtrl() const { return m_stylePopup->GetRichTextCtrl(); }
660
661 /// Gets the style popup
662 wxRichTextStyleComboPopup* GetStylePopup() const { return m_stylePopup; }
663
664 /// Auto-select from style under caret in idle time
665 void OnIdle(wxIdleEvent& event);
666
667 protected:
668 wxRichTextStyleComboPopup* m_stylePopup;
669 };
670
671 #endif
672 // wxUSE_COMBOCTRL
673
674 #endif
675 // wxUSE_HTML
676
677 #endif
678 // wxUSE_RICHTEXT
679
680 #endif
681 // _WX_RICHTEXTSTYLES_H_