1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/richtext/richtextstyles.h
3 // Purpose: Style management for wxRichTextCtrl
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_RICHTEXTSTYLES_H_
13 #define _WX_RICHTEXTSTYLES_H_
23 #include "wx/richtext/richtextbuffer.h"
26 #include "wx/htmllbox.h"
33 #include "wx/choice.h"
36 * Forward declarations
39 class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextCtrl
;
40 class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextBuffer
;
43 * wxRichTextStyleDefinition class declaration
44 * A base class for paragraph and character styles.
47 class WXDLLIMPEXP_RICHTEXT wxRichTextStyleDefinition
: public wxObject
49 DECLARE_CLASS(wxRichTextStyleDefinition
)
53 wxRichTextStyleDefinition(const wxRichTextStyleDefinition
& def
)
60 /// Default constructor
61 wxRichTextStyleDefinition(const wxString
& name
= wxEmptyString
) { Init(); m_name
= name
; }
64 virtual ~wxRichTextStyleDefinition() {}
66 /// Initialises members
70 void Copy(const wxRichTextStyleDefinition
& def
);
73 bool Eq(const wxRichTextStyleDefinition
& def
) const;
75 /// Assignment operator
76 void operator =(const wxRichTextStyleDefinition
& def
) { Copy(def
); }
79 bool operator ==(const wxRichTextStyleDefinition
& def
) const { return Eq(def
); }
81 /// Override to clone the object
82 virtual wxRichTextStyleDefinition
* Clone() const = 0;
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
; }
88 /// Sets and gets the style description
89 void SetDescription(const wxString
& descr
) { m_description
= descr
; }
90 const wxString
& GetDescription() const { return m_description
; }
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
; }
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
; }
101 /// Gets the style combined with the base style
102 virtual wxRichTextAttr
GetStyleMergedWithBase(const wxRichTextStyleSheet
* sheet
) const;
105 Returns the definition's properties.
107 wxRichTextProperties
& GetProperties() { return m_properties
; }
110 Returns the definition's properties.
112 const wxRichTextProperties
& GetProperties() const { return m_properties
; }
115 Sets the definition's properties.
117 void SetProperties(const wxRichTextProperties
& props
) { m_properties
= props
; }
121 wxString m_baseStyle
;
122 wxString m_description
;
123 wxRichTextAttr m_style
;
124 wxRichTextProperties m_properties
;
128 * wxRichTextCharacterStyleDefinition class declaration
131 class WXDLLIMPEXP_RICHTEXT wxRichTextCharacterStyleDefinition
: public wxRichTextStyleDefinition
133 DECLARE_DYNAMIC_CLASS(wxRichTextCharacterStyleDefinition
)
137 wxRichTextCharacterStyleDefinition(const wxRichTextCharacterStyleDefinition
& def
): wxRichTextStyleDefinition(def
) {}
139 /// Default constructor
140 wxRichTextCharacterStyleDefinition(const wxString
& name
= wxEmptyString
):
141 wxRichTextStyleDefinition(name
) {}
144 virtual ~wxRichTextCharacterStyleDefinition() {}
146 /// Clones the object
147 virtual wxRichTextStyleDefinition
* Clone() const { return new wxRichTextCharacterStyleDefinition(*this); }
153 * wxRichTextParagraphStyleDefinition class declaration
156 class WXDLLIMPEXP_RICHTEXT wxRichTextParagraphStyleDefinition
: public wxRichTextStyleDefinition
158 DECLARE_DYNAMIC_CLASS(wxRichTextParagraphStyleDefinition
)
162 wxRichTextParagraphStyleDefinition(const wxRichTextParagraphStyleDefinition
& def
): wxRichTextStyleDefinition(def
) { m_nextStyle
= def
.m_nextStyle
; }
164 /// Default constructor
165 wxRichTextParagraphStyleDefinition(const wxString
& name
= wxEmptyString
):
166 wxRichTextStyleDefinition(name
) {}
169 virtual ~wxRichTextParagraphStyleDefinition() {}
171 /// Sets and gets the next style
172 void SetNextStyle(const wxString
& name
) { m_nextStyle
= name
; }
173 const wxString
& GetNextStyle() const { return m_nextStyle
; }
176 void Copy(const wxRichTextParagraphStyleDefinition
& def
);
178 /// Assignment operator
179 void operator =(const wxRichTextParagraphStyleDefinition
& def
) { Copy(def
); }
181 /// Equality operator
182 bool operator ==(const wxRichTextParagraphStyleDefinition
& def
) const;
184 /// Clones the object
185 virtual wxRichTextStyleDefinition
* Clone() const { return new wxRichTextParagraphStyleDefinition(*this); }
189 /// The next style to use when adding a paragraph after this style.
190 wxString m_nextStyle
;
194 * wxRichTextListStyleDefinition class declaration
197 class WXDLLIMPEXP_RICHTEXT wxRichTextListStyleDefinition
: public wxRichTextParagraphStyleDefinition
199 DECLARE_DYNAMIC_CLASS(wxRichTextListStyleDefinition
)
203 wxRichTextListStyleDefinition(const wxRichTextListStyleDefinition
& def
): wxRichTextParagraphStyleDefinition(def
) { Init(); Copy(def
); }
205 /// Default constructor
206 wxRichTextListStyleDefinition(const wxString
& name
= wxEmptyString
):
207 wxRichTextParagraphStyleDefinition(name
) { Init(); }
210 virtual ~wxRichTextListStyleDefinition() {}
213 void Copy(const wxRichTextListStyleDefinition
& def
);
215 /// Assignment operator
216 void operator =(const wxRichTextListStyleDefinition
& def
) { Copy(def
); }
218 /// Equality operator
219 bool operator ==(const wxRichTextListStyleDefinition
& def
) const;
221 /// Clones the object
222 virtual wxRichTextStyleDefinition
* Clone() const { return new wxRichTextListStyleDefinition(*this); }
224 /// Sets/gets the attributes for the given level
225 void SetLevelAttributes(int i
, const wxRichTextAttr
& attr
);
226 wxRichTextAttr
* GetLevelAttributes(int i
);
227 const wxRichTextAttr
* GetLevelAttributes(int i
) const;
229 /// Convenience function for setting the major attributes for a list level specification
230 void SetAttributes(int i
, int leftIndent
, int leftSubIndent
, int bulletStyle
, const wxString
& bulletSymbol
= wxEmptyString
);
232 /// Finds the level corresponding to the given indentation
233 int FindLevelForIndent(int indent
) const;
235 /// Combine the base and list style with a paragraph style, using the given indent (from which
236 /// an appropriate level is found)
237 wxRichTextAttr
CombineWithParagraphStyle(int indent
, const wxRichTextAttr
& paraStyle
, wxRichTextStyleSheet
* styleSheet
= NULL
);
239 /// Combine the base and list style, using the given indent (from which
240 /// an appropriate level is found)
241 wxRichTextAttr
GetCombinedStyle(int indent
, wxRichTextStyleSheet
* styleSheet
= NULL
);
243 /// Combine the base and list style, using the given level from which
244 /// an appropriate level is found)
245 wxRichTextAttr
GetCombinedStyleForLevel(int level
, wxRichTextStyleSheet
* styleSheet
= NULL
);
247 /// Gets the number of available levels
248 int GetLevelCount() const { return 10; }
250 /// Is this a numbered list?
251 bool IsNumbered(int i
) const;
255 /// The styles for each level (up to 10)
256 wxRichTextAttr m_levelStyles
[10];
260 * wxRichTextBoxStyleDefinition class declaration, for box attributes in objects such as wxRichTextBox.
263 class WXDLLIMPEXP_RICHTEXT wxRichTextBoxStyleDefinition
: public wxRichTextStyleDefinition
265 DECLARE_DYNAMIC_CLASS(wxRichTextBoxStyleDefinition
)
269 wxRichTextBoxStyleDefinition(const wxRichTextBoxStyleDefinition
& def
): wxRichTextStyleDefinition(def
) { Copy(def
); }
271 /// Default constructor
272 wxRichTextBoxStyleDefinition(const wxString
& name
= wxEmptyString
):
273 wxRichTextStyleDefinition(name
) {}
276 virtual ~wxRichTextBoxStyleDefinition() {}
279 void Copy(const wxRichTextBoxStyleDefinition
& def
);
281 /// Assignment operator
282 void operator =(const wxRichTextBoxStyleDefinition
& def
) { Copy(def
); }
284 /// Equality operator
285 bool operator ==(const wxRichTextBoxStyleDefinition
& def
) const;
287 /// Clones the object
288 virtual wxRichTextStyleDefinition
* Clone() const { return new wxRichTextBoxStyleDefinition(*this); }
297 class WXDLLIMPEXP_RICHTEXT wxRichTextStyleSheet
: public wxObject
299 DECLARE_CLASS( wxRichTextStyleSheet
)
303 wxRichTextStyleSheet(const wxRichTextStyleSheet
& sheet
)
309 wxRichTextStyleSheet() { Init(); }
310 virtual ~wxRichTextStyleSheet();
316 void Copy(const wxRichTextStyleSheet
& sheet
);
319 void operator=(const wxRichTextStyleSheet
& sheet
) { Copy(sheet
); }
322 bool operator==(const wxRichTextStyleSheet
& sheet
) const;
324 /// Add a definition to the character style list
325 bool AddCharacterStyle(wxRichTextCharacterStyleDefinition
* def
);
327 /// Add a definition to the paragraph style list
328 bool AddParagraphStyle(wxRichTextParagraphStyleDefinition
* def
);
330 /// Add a definition to the list style list
331 bool AddListStyle(wxRichTextListStyleDefinition
* def
);
333 /// Add a definition to the box style list
334 bool AddBoxStyle(wxRichTextBoxStyleDefinition
* def
);
336 /// Add a definition to the appropriate style list
337 bool AddStyle(wxRichTextStyleDefinition
* def
);
339 /// Remove a character style
340 bool RemoveCharacterStyle(wxRichTextStyleDefinition
* def
, bool deleteStyle
= false) { return RemoveStyle(m_characterStyleDefinitions
, def
, deleteStyle
); }
342 /// Remove a paragraph style
343 bool RemoveParagraphStyle(wxRichTextStyleDefinition
* def
, bool deleteStyle
= false) { return RemoveStyle(m_paragraphStyleDefinitions
, def
, deleteStyle
); }
345 /// Remove a list style
346 bool RemoveListStyle(wxRichTextStyleDefinition
* def
, bool deleteStyle
= false) { return RemoveStyle(m_listStyleDefinitions
, def
, deleteStyle
); }
348 /// Remove a box style
349 bool RemoveBoxStyle(wxRichTextStyleDefinition
* def
, bool deleteStyle
= false) { return RemoveStyle(m_boxStyleDefinitions
, def
, deleteStyle
); }
352 bool RemoveStyle(wxRichTextStyleDefinition
* def
, bool deleteStyle
= false);
354 /// Find a character definition by name
355 wxRichTextCharacterStyleDefinition
* FindCharacterStyle(const wxString
& name
, bool recurse
= true) const { return (wxRichTextCharacterStyleDefinition
*) FindStyle(m_characterStyleDefinitions
, name
, recurse
); }
357 /// Find a paragraph definition by name
358 wxRichTextParagraphStyleDefinition
* FindParagraphStyle(const wxString
& name
, bool recurse
= true) const { return (wxRichTextParagraphStyleDefinition
*) FindStyle(m_paragraphStyleDefinitions
, name
, recurse
); }
360 /// Find a list definition by name
361 wxRichTextListStyleDefinition
* FindListStyle(const wxString
& name
, bool recurse
= true) const { return (wxRichTextListStyleDefinition
*) FindStyle(m_listStyleDefinitions
, name
, recurse
); }
363 /// Find a box definition by name
364 wxRichTextBoxStyleDefinition
* FindBoxStyle(const wxString
& name
, bool recurse
= true) const { return (wxRichTextBoxStyleDefinition
*) FindStyle(m_boxStyleDefinitions
, name
, recurse
); }
366 /// Find any definition by name
367 wxRichTextStyleDefinition
* FindStyle(const wxString
& name
, bool recurse
= true) const;
369 /// Return the number of character styles
370 size_t GetCharacterStyleCount() const { return m_characterStyleDefinitions
.GetCount(); }
372 /// Return the number of paragraph styles
373 size_t GetParagraphStyleCount() const { return m_paragraphStyleDefinitions
.GetCount(); }
375 /// Return the number of list styles
376 size_t GetListStyleCount() const { return m_listStyleDefinitions
.GetCount(); }
378 /// Return the number of box styles
379 size_t GetBoxStyleCount() const { return m_boxStyleDefinitions
.GetCount(); }
381 /// Return the nth character style
382 wxRichTextCharacterStyleDefinition
* GetCharacterStyle(size_t n
) const { return (wxRichTextCharacterStyleDefinition
*) m_characterStyleDefinitions
.Item(n
)->GetData(); }
384 /// Return the nth paragraph style
385 wxRichTextParagraphStyleDefinition
* GetParagraphStyle(size_t n
) const { return (wxRichTextParagraphStyleDefinition
*) m_paragraphStyleDefinitions
.Item(n
)->GetData(); }
387 /// Return the nth list style
388 wxRichTextListStyleDefinition
* GetListStyle(size_t n
) const { return (wxRichTextListStyleDefinition
*) m_listStyleDefinitions
.Item(n
)->GetData(); }
390 /// Return the nth box style
391 wxRichTextBoxStyleDefinition
* GetBoxStyle(size_t n
) const { return (wxRichTextBoxStyleDefinition
*) m_boxStyleDefinitions
.Item(n
)->GetData(); }
393 /// Delete all styles
396 /// Insert into list of style sheets
397 bool InsertSheet(wxRichTextStyleSheet
* before
);
399 /// Append to list of style sheets
400 bool AppendSheet(wxRichTextStyleSheet
* after
);
402 /// Unlink from the list of style sheets
405 /// Get/set next sheet
406 wxRichTextStyleSheet
* GetNextSheet() const { return m_nextSheet
; }
407 void SetNextSheet(wxRichTextStyleSheet
* sheet
) { m_nextSheet
= sheet
; }
409 /// Get/set previous sheet
410 wxRichTextStyleSheet
* GetPreviousSheet() const { return m_previousSheet
; }
411 void SetPreviousSheet(wxRichTextStyleSheet
* sheet
) { m_previousSheet
= sheet
; }
413 /// Sets and gets the name of the style sheet
414 void SetName(const wxString
& name
) { m_name
= name
; }
415 const wxString
& GetName() const { return m_name
; }
417 /// Sets and gets the style description
418 void SetDescription(const wxString
& descr
) { m_description
= descr
; }
419 const wxString
& GetDescription() const { return m_description
; }
422 Returns the sheet's properties.
424 wxRichTextProperties
& GetProperties() { return m_properties
; }
427 Returns the sheet's properties.
429 const wxRichTextProperties
& GetProperties() const { return m_properties
; }
432 Sets the sheet's properties.
434 void SetProperties(const wxRichTextProperties
& props
) { m_properties
= props
; }
438 /// Add a definition to one of the style lists
439 bool AddStyle(wxList
& list
, wxRichTextStyleDefinition
* def
);
442 bool RemoveStyle(wxList
& list
, wxRichTextStyleDefinition
* def
, bool deleteStyle
);
444 /// Find a definition by name
445 wxRichTextStyleDefinition
* FindStyle(const wxList
& list
, const wxString
& name
, bool recurse
= true) const;
449 wxString m_description
;
452 wxList m_characterStyleDefinitions
;
453 wxList m_paragraphStyleDefinitions
;
454 wxList m_listStyleDefinitions
;
455 wxList m_boxStyleDefinitions
;
457 wxRichTextStyleSheet
* m_previousSheet
;
458 wxRichTextStyleSheet
* m_nextSheet
;
459 wxRichTextProperties m_properties
;
464 * wxRichTextStyleListBox class declaration
465 * A listbox to display styles.
468 class WXDLLIMPEXP_RICHTEXT wxRichTextStyleListBox
: public wxHtmlListBox
470 DECLARE_CLASS(wxRichTextStyleListBox
)
471 DECLARE_EVENT_TABLE()
474 /// Which type of style definition is currently showing?
475 enum wxRichTextStyleType
477 wxRICHTEXT_STYLE_ALL
,
478 wxRICHTEXT_STYLE_PARAGRAPH
,
479 wxRICHTEXT_STYLE_CHARACTER
,
480 wxRICHTEXT_STYLE_LIST
,
484 wxRichTextStyleListBox()
488 wxRichTextStyleListBox(wxWindow
* parent
, wxWindowID id
= wxID_ANY
, const wxPoint
& pos
= wxDefaultPosition
,
489 const wxSize
& size
= wxDefaultSize
, long style
= 0);
490 virtual ~wxRichTextStyleListBox();
495 m_richTextCtrl
= NULL
;
496 m_applyOnSelection
= false;
497 m_styleType
= wxRICHTEXT_STYLE_PARAGRAPH
;
498 m_autoSetSelection
= true;
501 bool Create(wxWindow
* parent
, wxWindowID id
= wxID_ANY
, const wxPoint
& pos
= wxDefaultPosition
,
502 const wxSize
& size
= wxDefaultSize
, long style
= 0);
504 /// Creates a suitable HTML fragment for a definition
505 wxString
CreateHTML(wxRichTextStyleDefinition
* def
) const;
507 /// Associates the control with a style sheet
508 void SetStyleSheet(wxRichTextStyleSheet
* styleSheet
) { m_styleSheet
= styleSheet
; }
509 wxRichTextStyleSheet
* GetStyleSheet() const { return m_styleSheet
; }
511 /// Associates the control with a wxRichTextCtrl
512 void SetRichTextCtrl(wxRichTextCtrl
* ctrl
) { m_richTextCtrl
= ctrl
; }
513 wxRichTextCtrl
* GetRichTextCtrl() const { return m_richTextCtrl
; }
515 /// Get style for index
516 wxRichTextStyleDefinition
* GetStyle(size_t i
) const ;
518 /// Get index for style name
519 int GetIndexForStyle(const wxString
& name
) const ;
521 /// Set selection for string, returning the index.
522 int SetStyleSelection(const wxString
& name
);
528 void ApplyStyle(int i
);
531 void OnLeftDown(wxMouseEvent
& event
);
533 /// Left double-click
534 void OnLeftDoubleClick(wxMouseEvent
& event
);
536 /// Auto-select from style under caret in idle time
537 void OnIdle(wxIdleEvent
& event
);
539 /// Convert units in tends of a millimetre to device units
540 int ConvertTenthsMMToPixels(wxDC
& dc
, int units
) const;
542 /// Can we set the selection based on the editor caret position?
543 /// Need to override this if being used in a combobox popup
544 virtual bool CanAutoSetSelection() { return m_autoSetSelection
; }
545 virtual void SetAutoSetSelection(bool autoSet
) { m_autoSetSelection
= autoSet
; }
547 /// Set whether the style should be applied as soon as the item is selected (the default)
548 void SetApplyOnSelection(bool applyOnSel
) { m_applyOnSelection
= applyOnSel
; }
549 bool GetApplyOnSelection() const { return m_applyOnSelection
; }
551 /// Set the style type to display
552 void SetStyleType(wxRichTextStyleType styleType
) { m_styleType
= styleType
; UpdateStyles(); }
553 wxRichTextStyleType
GetStyleType() const { return m_styleType
; }
555 /// Helper for listbox and combo control
556 static wxString
GetStyleToShowInIdleTime(wxRichTextCtrl
* ctrl
, wxRichTextStyleType styleType
);
559 /// Returns the HTML for this item
560 virtual wxString
OnGetItem(size_t n
) const;
564 wxRichTextStyleSheet
* m_styleSheet
;
565 wxRichTextCtrl
* m_richTextCtrl
;
566 bool m_applyOnSelection
; // if true, applies style on selection
567 wxRichTextStyleType m_styleType
; // style type to display
568 bool m_autoSetSelection
;
569 wxArrayString m_styleNames
;
573 * wxRichTextStyleListCtrl class declaration
574 * This is a container for the list control plus a combobox to switch between
578 #define wxRICHTEXTSTYLELIST_HIDE_TYPE_SELECTOR 0x1000
580 class WXDLLIMPEXP_RICHTEXT wxRichTextStyleListCtrl
: public wxControl
582 DECLARE_CLASS(wxRichTextStyleListCtrl
)
583 DECLARE_EVENT_TABLE()
588 wxRichTextStyleListCtrl()
593 wxRichTextStyleListCtrl(wxWindow
* parent
, wxWindowID id
= wxID_ANY
, const wxPoint
& pos
= wxDefaultPosition
,
594 const wxSize
& size
= wxDefaultSize
, long style
= 0);
597 virtual ~wxRichTextStyleListCtrl();
599 /// Member initialisation
602 m_styleListBox
= NULL
;
603 m_styleChoice
= NULL
;
604 m_dontUpdate
= false;
607 /// Creates the windows
608 bool Create(wxWindow
* parent
, wxWindowID id
= wxID_ANY
, const wxPoint
& pos
= wxDefaultPosition
,
609 const wxSize
& size
= wxDefaultSize
, long style
= 0);
611 /// Updates the style list box
614 /// Associates the control with a style sheet
615 void SetStyleSheet(wxRichTextStyleSheet
* styleSheet
);
616 wxRichTextStyleSheet
* GetStyleSheet() const;
618 /// Associates the control with a wxRichTextCtrl
619 void SetRichTextCtrl(wxRichTextCtrl
* ctrl
);
620 wxRichTextCtrl
* GetRichTextCtrl() const;
622 /// Set/get the style type to display
623 void SetStyleType(wxRichTextStyleListBox::wxRichTextStyleType styleType
);
624 wxRichTextStyleListBox::wxRichTextStyleType
GetStyleType() const;
626 /// Get the choice index for style type
627 int StyleTypeToIndex(wxRichTextStyleListBox::wxRichTextStyleType styleType
);
629 /// Get the style type for choice index
630 wxRichTextStyleListBox::wxRichTextStyleType
StyleIndexToType(int i
);
633 wxRichTextStyleListBox
* GetStyleListBox() const { return m_styleListBox
; }
636 wxChoice
* GetStyleChoice() const { return m_styleChoice
; }
638 /// React to style type choice
639 void OnChooseType(wxCommandEvent
& event
);
641 /// Lay out the controls
642 void OnSize(wxSizeEvent
& event
);
646 wxRichTextStyleListBox
* m_styleListBox
;
647 wxChoice
* m_styleChoice
;
654 * Style drop-down for a wxComboCtrl
657 class wxRichTextStyleComboPopup
: public wxRichTextStyleListBox
, public wxComboPopup
662 m_itemHere
= -1; // hot item in list
666 virtual bool Create( wxWindow
* parent
);
668 virtual wxWindow
*GetControl() { return this; }
670 virtual void SetStringValue( const wxString
& s
);
672 virtual wxString
GetStringValue() const;
674 /// Can we set the selection based on the editor caret position?
675 // virtual bool CanAutoSetSelection() { return ((m_combo == NULL) || !m_combo->IsPopupShown()); }
676 virtual bool CanAutoSetSelection() { return false; }
679 // Popup event handlers
682 // Mouse hot-tracking
683 void OnMouseMove(wxMouseEvent
& event
);
685 // On mouse left, set the value and close the popup
686 void OnMouseClick(wxMouseEvent
& WXUNUSED(event
));
690 int m_itemHere
; // hot item in popup
694 DECLARE_EVENT_TABLE()
698 * wxRichTextStyleComboCtrl
699 * A combo for applying styles.
702 class WXDLLIMPEXP_RICHTEXT wxRichTextStyleComboCtrl
: public wxComboCtrl
704 DECLARE_CLASS(wxRichTextStyleComboCtrl
)
705 DECLARE_EVENT_TABLE()
708 wxRichTextStyleComboCtrl()
713 wxRichTextStyleComboCtrl(wxWindow
* parent
, wxWindowID id
= wxID_ANY
, const wxPoint
& pos
= wxDefaultPosition
,
714 const wxSize
& size
= wxDefaultSize
, long style
= wxCB_READONLY
)
717 Create(parent
, id
, pos
, size
, style
);
720 virtual ~wxRichTextStyleComboCtrl() {}
727 bool Create(wxWindow
* parent
, wxWindowID id
= wxID_ANY
, const wxPoint
& pos
= wxDefaultPosition
,
728 const wxSize
& size
= wxDefaultSize
, long style
= 0);
731 void UpdateStyles() { m_stylePopup
->UpdateStyles(); }
733 /// Associates the control with a style sheet
734 void SetStyleSheet(wxRichTextStyleSheet
* styleSheet
) { m_stylePopup
->SetStyleSheet(styleSheet
); }
735 wxRichTextStyleSheet
* GetStyleSheet() const { return m_stylePopup
->GetStyleSheet(); }
737 /// Associates the control with a wxRichTextCtrl
738 void SetRichTextCtrl(wxRichTextCtrl
* ctrl
) { m_stylePopup
->SetRichTextCtrl(ctrl
); }
739 wxRichTextCtrl
* GetRichTextCtrl() const { return m_stylePopup
->GetRichTextCtrl(); }
741 /// Gets the style popup
742 wxRichTextStyleComboPopup
* GetStylePopup() const { return m_stylePopup
; }
744 /// Auto-select from style under caret in idle time
745 void OnIdle(wxIdleEvent
& event
);
748 wxRichTextStyleComboPopup
* m_stylePopup
;
761 // _WX_RICHTEXTSTYLES_H_