1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/richtext/richtextstyles.h
3 // Purpose: Style management for wxRichTextCtrl
4 // Author: Julian Smart
7 // Copyright: (c) Julian Smart
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_RICHTEXTSTYLES_H_
12 #define _WX_RICHTEXTSTYLES_H_
22 #include "wx/richtext/richtextbuffer.h"
25 #include "wx/htmllbox.h"
32 #include "wx/choice.h"
35 * Forward declarations
38 class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextCtrl
;
39 class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextBuffer
;
42 * wxRichTextStyleDefinition class declaration
43 * A base class for paragraph and character styles.
46 class WXDLLIMPEXP_RICHTEXT wxRichTextStyleDefinition
: public wxObject
48 DECLARE_CLASS(wxRichTextStyleDefinition
)
52 wxRichTextStyleDefinition(const wxRichTextStyleDefinition
& def
)
59 /// Default constructor
60 wxRichTextStyleDefinition(const wxString
& name
= wxEmptyString
) { Init(); m_name
= name
; }
63 virtual ~wxRichTextStyleDefinition() {}
65 /// Initialises members
69 void Copy(const wxRichTextStyleDefinition
& def
);
72 bool Eq(const wxRichTextStyleDefinition
& def
) const;
74 /// Assignment operator
75 void operator =(const wxRichTextStyleDefinition
& def
) { Copy(def
); }
78 bool operator ==(const wxRichTextStyleDefinition
& def
) const { return Eq(def
); }
80 /// Override to clone the object
81 virtual wxRichTextStyleDefinition
* Clone() const = 0;
83 /// Sets and gets the name of the style
84 void SetName(const wxString
& name
) { m_name
= name
; }
85 const wxString
& GetName() const { return m_name
; }
87 /// Sets and gets the style description
88 void SetDescription(const wxString
& descr
) { m_description
= descr
; }
89 const wxString
& GetDescription() const { return m_description
; }
91 /// Sets and gets the name of the style that this style is based on
92 void SetBaseStyle(const wxString
& name
) { m_baseStyle
= name
; }
93 const wxString
& GetBaseStyle() const { return m_baseStyle
; }
95 /// Sets and gets the style
96 void SetStyle(const wxRichTextAttr
& style
) { m_style
= style
; }
97 const wxRichTextAttr
& GetStyle() const { return m_style
; }
98 wxRichTextAttr
& GetStyle() { return m_style
; }
100 /// Gets the style combined with the base style
101 virtual wxRichTextAttr
GetStyleMergedWithBase(const wxRichTextStyleSheet
* sheet
) const;
104 Returns the definition's properties.
106 wxRichTextProperties
& GetProperties() { return m_properties
; }
109 Returns the definition's properties.
111 const wxRichTextProperties
& GetProperties() const { return m_properties
; }
114 Sets the definition's properties.
116 void SetProperties(const wxRichTextProperties
& props
) { m_properties
= props
; }
120 wxString m_baseStyle
;
121 wxString m_description
;
122 wxRichTextAttr m_style
;
123 wxRichTextProperties m_properties
;
127 * wxRichTextCharacterStyleDefinition class declaration
130 class WXDLLIMPEXP_RICHTEXT wxRichTextCharacterStyleDefinition
: public wxRichTextStyleDefinition
132 DECLARE_DYNAMIC_CLASS(wxRichTextCharacterStyleDefinition
)
136 wxRichTextCharacterStyleDefinition(const wxRichTextCharacterStyleDefinition
& def
): wxRichTextStyleDefinition(def
) {}
138 /// Default constructor
139 wxRichTextCharacterStyleDefinition(const wxString
& name
= wxEmptyString
):
140 wxRichTextStyleDefinition(name
) {}
143 virtual ~wxRichTextCharacterStyleDefinition() {}
145 /// Clones the object
146 virtual wxRichTextStyleDefinition
* Clone() const { return new wxRichTextCharacterStyleDefinition(*this); }
152 * wxRichTextParagraphStyleDefinition class declaration
155 class WXDLLIMPEXP_RICHTEXT wxRichTextParagraphStyleDefinition
: public wxRichTextStyleDefinition
157 DECLARE_DYNAMIC_CLASS(wxRichTextParagraphStyleDefinition
)
161 wxRichTextParagraphStyleDefinition(const wxRichTextParagraphStyleDefinition
& def
): wxRichTextStyleDefinition(def
) { m_nextStyle
= def
.m_nextStyle
; }
163 /// Default constructor
164 wxRichTextParagraphStyleDefinition(const wxString
& name
= wxEmptyString
):
165 wxRichTextStyleDefinition(name
) {}
168 virtual ~wxRichTextParagraphStyleDefinition() {}
170 /// Sets and gets the next style
171 void SetNextStyle(const wxString
& name
) { m_nextStyle
= name
; }
172 const wxString
& GetNextStyle() const { return m_nextStyle
; }
175 void Copy(const wxRichTextParagraphStyleDefinition
& def
);
177 /// Assignment operator
178 void operator =(const wxRichTextParagraphStyleDefinition
& def
) { Copy(def
); }
180 /// Equality operator
181 bool operator ==(const wxRichTextParagraphStyleDefinition
& def
) const;
183 /// Clones the object
184 virtual wxRichTextStyleDefinition
* Clone() const { return new wxRichTextParagraphStyleDefinition(*this); }
188 /// The next style to use when adding a paragraph after this style.
189 wxString m_nextStyle
;
193 * wxRichTextListStyleDefinition class declaration
196 class WXDLLIMPEXP_RICHTEXT wxRichTextListStyleDefinition
: public wxRichTextParagraphStyleDefinition
198 DECLARE_DYNAMIC_CLASS(wxRichTextListStyleDefinition
)
202 wxRichTextListStyleDefinition(const wxRichTextListStyleDefinition
& def
): wxRichTextParagraphStyleDefinition(def
) { Init(); Copy(def
); }
204 /// Default constructor
205 wxRichTextListStyleDefinition(const wxString
& name
= wxEmptyString
):
206 wxRichTextParagraphStyleDefinition(name
) { Init(); }
209 virtual ~wxRichTextListStyleDefinition() {}
212 void Copy(const wxRichTextListStyleDefinition
& def
);
214 /// Assignment operator
215 void operator =(const wxRichTextListStyleDefinition
& def
) { Copy(def
); }
217 /// Equality operator
218 bool operator ==(const wxRichTextListStyleDefinition
& def
) const;
220 /// Clones the object
221 virtual wxRichTextStyleDefinition
* Clone() const { return new wxRichTextListStyleDefinition(*this); }
223 /// Sets/gets the attributes for the given level
224 void SetLevelAttributes(int i
, const wxRichTextAttr
& attr
);
225 wxRichTextAttr
* GetLevelAttributes(int i
);
226 const wxRichTextAttr
* GetLevelAttributes(int i
) const;
228 /// Convenience function for setting the major attributes for a list level specification
229 void SetAttributes(int i
, int leftIndent
, int leftSubIndent
, int bulletStyle
, const wxString
& bulletSymbol
= wxEmptyString
);
231 /// Finds the level corresponding to the given indentation
232 int FindLevelForIndent(int indent
) const;
234 /// Combine the base and list style with a paragraph style, using the given indent (from which
235 /// an appropriate level is found)
236 wxRichTextAttr
CombineWithParagraphStyle(int indent
, const wxRichTextAttr
& paraStyle
, wxRichTextStyleSheet
* styleSheet
= NULL
);
238 /// Combine the base and list style, using the given indent (from which
239 /// an appropriate level is found)
240 wxRichTextAttr
GetCombinedStyle(int indent
, wxRichTextStyleSheet
* styleSheet
= NULL
);
242 /// Combine the base and list style, using the given level from which
243 /// an appropriate level is found)
244 wxRichTextAttr
GetCombinedStyleForLevel(int level
, wxRichTextStyleSheet
* styleSheet
= NULL
);
246 /// Gets the number of available levels
247 int GetLevelCount() const { return 10; }
249 /// Is this a numbered list?
250 bool IsNumbered(int i
) const;
254 /// The styles for each level (up to 10)
255 wxRichTextAttr m_levelStyles
[10];
259 * wxRichTextBoxStyleDefinition class declaration, for box attributes in objects such as wxRichTextBox.
262 class WXDLLIMPEXP_RICHTEXT wxRichTextBoxStyleDefinition
: public wxRichTextStyleDefinition
264 DECLARE_DYNAMIC_CLASS(wxRichTextBoxStyleDefinition
)
268 wxRichTextBoxStyleDefinition(const wxRichTextBoxStyleDefinition
& def
): wxRichTextStyleDefinition(def
) { Copy(def
); }
270 /// Default constructor
271 wxRichTextBoxStyleDefinition(const wxString
& name
= wxEmptyString
):
272 wxRichTextStyleDefinition(name
) {}
275 virtual ~wxRichTextBoxStyleDefinition() {}
278 void Copy(const wxRichTextBoxStyleDefinition
& def
);
280 /// Assignment operator
281 void operator =(const wxRichTextBoxStyleDefinition
& def
) { Copy(def
); }
283 /// Equality operator
284 bool operator ==(const wxRichTextBoxStyleDefinition
& def
) const;
286 /// Clones the object
287 virtual wxRichTextStyleDefinition
* Clone() const { return new wxRichTextBoxStyleDefinition(*this); }
296 class WXDLLIMPEXP_RICHTEXT wxRichTextStyleSheet
: public wxObject
298 DECLARE_CLASS( wxRichTextStyleSheet
)
302 wxRichTextStyleSheet(const wxRichTextStyleSheet
& sheet
)
308 wxRichTextStyleSheet() { Init(); }
309 virtual ~wxRichTextStyleSheet();
315 void Copy(const wxRichTextStyleSheet
& sheet
);
318 void operator=(const wxRichTextStyleSheet
& sheet
) { Copy(sheet
); }
321 bool operator==(const wxRichTextStyleSheet
& sheet
) const;
323 /// Add a definition to the character style list
324 bool AddCharacterStyle(wxRichTextCharacterStyleDefinition
* def
);
326 /// Add a definition to the paragraph style list
327 bool AddParagraphStyle(wxRichTextParagraphStyleDefinition
* def
);
329 /// Add a definition to the list style list
330 bool AddListStyle(wxRichTextListStyleDefinition
* def
);
332 /// Add a definition to the box style list
333 bool AddBoxStyle(wxRichTextBoxStyleDefinition
* def
);
335 /// Add a definition to the appropriate style list
336 bool AddStyle(wxRichTextStyleDefinition
* def
);
338 /// Remove a character style
339 bool RemoveCharacterStyle(wxRichTextStyleDefinition
* def
, bool deleteStyle
= false) { return RemoveStyle(m_characterStyleDefinitions
, def
, deleteStyle
); }
341 /// Remove a paragraph style
342 bool RemoveParagraphStyle(wxRichTextStyleDefinition
* def
, bool deleteStyle
= false) { return RemoveStyle(m_paragraphStyleDefinitions
, def
, deleteStyle
); }
344 /// Remove a list style
345 bool RemoveListStyle(wxRichTextStyleDefinition
* def
, bool deleteStyle
= false) { return RemoveStyle(m_listStyleDefinitions
, def
, deleteStyle
); }
347 /// Remove a box style
348 bool RemoveBoxStyle(wxRichTextStyleDefinition
* def
, bool deleteStyle
= false) { return RemoveStyle(m_boxStyleDefinitions
, def
, deleteStyle
); }
351 bool RemoveStyle(wxRichTextStyleDefinition
* def
, bool deleteStyle
= false);
353 /// Find a character definition by name
354 wxRichTextCharacterStyleDefinition
* FindCharacterStyle(const wxString
& name
, bool recurse
= true) const { return (wxRichTextCharacterStyleDefinition
*) FindStyle(m_characterStyleDefinitions
, name
, recurse
); }
356 /// Find a paragraph definition by name
357 wxRichTextParagraphStyleDefinition
* FindParagraphStyle(const wxString
& name
, bool recurse
= true) const { return (wxRichTextParagraphStyleDefinition
*) FindStyle(m_paragraphStyleDefinitions
, name
, recurse
); }
359 /// Find a list definition by name
360 wxRichTextListStyleDefinition
* FindListStyle(const wxString
& name
, bool recurse
= true) const { return (wxRichTextListStyleDefinition
*) FindStyle(m_listStyleDefinitions
, name
, recurse
); }
362 /// Find a box definition by name
363 wxRichTextBoxStyleDefinition
* FindBoxStyle(const wxString
& name
, bool recurse
= true) const { return (wxRichTextBoxStyleDefinition
*) FindStyle(m_boxStyleDefinitions
, name
, recurse
); }
365 /// Find any definition by name
366 wxRichTextStyleDefinition
* FindStyle(const wxString
& name
, bool recurse
= true) const;
368 /// Return the number of character styles
369 size_t GetCharacterStyleCount() const { return m_characterStyleDefinitions
.GetCount(); }
371 /// Return the number of paragraph styles
372 size_t GetParagraphStyleCount() const { return m_paragraphStyleDefinitions
.GetCount(); }
374 /// Return the number of list styles
375 size_t GetListStyleCount() const { return m_listStyleDefinitions
.GetCount(); }
377 /// Return the number of box styles
378 size_t GetBoxStyleCount() const { return m_boxStyleDefinitions
.GetCount(); }
380 /// Return the nth character style
381 wxRichTextCharacterStyleDefinition
* GetCharacterStyle(size_t n
) const { return (wxRichTextCharacterStyleDefinition
*) m_characterStyleDefinitions
.Item(n
)->GetData(); }
383 /// Return the nth paragraph style
384 wxRichTextParagraphStyleDefinition
* GetParagraphStyle(size_t n
) const { return (wxRichTextParagraphStyleDefinition
*) m_paragraphStyleDefinitions
.Item(n
)->GetData(); }
386 /// Return the nth list style
387 wxRichTextListStyleDefinition
* GetListStyle(size_t n
) const { return (wxRichTextListStyleDefinition
*) m_listStyleDefinitions
.Item(n
)->GetData(); }
389 /// Return the nth box style
390 wxRichTextBoxStyleDefinition
* GetBoxStyle(size_t n
) const { return (wxRichTextBoxStyleDefinition
*) m_boxStyleDefinitions
.Item(n
)->GetData(); }
392 /// Delete all styles
395 /// Insert into list of style sheets
396 bool InsertSheet(wxRichTextStyleSheet
* before
);
398 /// Append to list of style sheets
399 bool AppendSheet(wxRichTextStyleSheet
* after
);
401 /// Unlink from the list of style sheets
404 /// Get/set next sheet
405 wxRichTextStyleSheet
* GetNextSheet() const { return m_nextSheet
; }
406 void SetNextSheet(wxRichTextStyleSheet
* sheet
) { m_nextSheet
= sheet
; }
408 /// Get/set previous sheet
409 wxRichTextStyleSheet
* GetPreviousSheet() const { return m_previousSheet
; }
410 void SetPreviousSheet(wxRichTextStyleSheet
* sheet
) { m_previousSheet
= sheet
; }
412 /// Sets and gets the name of the style sheet
413 void SetName(const wxString
& name
) { m_name
= name
; }
414 const wxString
& GetName() const { return m_name
; }
416 /// Sets and gets the style description
417 void SetDescription(const wxString
& descr
) { m_description
= descr
; }
418 const wxString
& GetDescription() const { return m_description
; }
421 Returns the sheet's properties.
423 wxRichTextProperties
& GetProperties() { return m_properties
; }
426 Returns the sheet's properties.
428 const wxRichTextProperties
& GetProperties() const { return m_properties
; }
431 Sets the sheet's properties.
433 void SetProperties(const wxRichTextProperties
& props
) { m_properties
= props
; }
437 /// Add a definition to one of the style lists
438 bool AddStyle(wxList
& list
, wxRichTextStyleDefinition
* def
);
441 bool RemoveStyle(wxList
& list
, wxRichTextStyleDefinition
* def
, bool deleteStyle
);
443 /// Find a definition by name
444 wxRichTextStyleDefinition
* FindStyle(const wxList
& list
, const wxString
& name
, bool recurse
= true) const;
448 wxString m_description
;
451 wxList m_characterStyleDefinitions
;
452 wxList m_paragraphStyleDefinitions
;
453 wxList m_listStyleDefinitions
;
454 wxList m_boxStyleDefinitions
;
456 wxRichTextStyleSheet
* m_previousSheet
;
457 wxRichTextStyleSheet
* m_nextSheet
;
458 wxRichTextProperties m_properties
;
463 * wxRichTextStyleListBox class declaration
464 * A listbox to display styles.
467 class WXDLLIMPEXP_RICHTEXT wxRichTextStyleListBox
: public wxHtmlListBox
469 DECLARE_CLASS(wxRichTextStyleListBox
)
470 DECLARE_EVENT_TABLE()
473 /// Which type of style definition is currently showing?
474 enum wxRichTextStyleType
476 wxRICHTEXT_STYLE_ALL
,
477 wxRICHTEXT_STYLE_PARAGRAPH
,
478 wxRICHTEXT_STYLE_CHARACTER
,
479 wxRICHTEXT_STYLE_LIST
,
483 wxRichTextStyleListBox()
487 wxRichTextStyleListBox(wxWindow
* parent
, wxWindowID id
= wxID_ANY
, const wxPoint
& pos
= wxDefaultPosition
,
488 const wxSize
& size
= wxDefaultSize
, long style
= 0);
489 virtual ~wxRichTextStyleListBox();
494 m_richTextCtrl
= NULL
;
495 m_applyOnSelection
= false;
496 m_styleType
= wxRICHTEXT_STYLE_PARAGRAPH
;
497 m_autoSetSelection
= true;
500 bool Create(wxWindow
* parent
, wxWindowID id
= wxID_ANY
, const wxPoint
& pos
= wxDefaultPosition
,
501 const wxSize
& size
= wxDefaultSize
, long style
= 0);
503 /// Creates a suitable HTML fragment for a definition
504 wxString
CreateHTML(wxRichTextStyleDefinition
* def
) const;
506 /// Associates the control with a style sheet
507 void SetStyleSheet(wxRichTextStyleSheet
* styleSheet
) { m_styleSheet
= styleSheet
; }
508 wxRichTextStyleSheet
* GetStyleSheet() const { return m_styleSheet
; }
510 /// Associates the control with a wxRichTextCtrl
511 void SetRichTextCtrl(wxRichTextCtrl
* ctrl
) { m_richTextCtrl
= ctrl
; }
512 wxRichTextCtrl
* GetRichTextCtrl() const { return m_richTextCtrl
; }
514 /// Get style for index
515 wxRichTextStyleDefinition
* GetStyle(size_t i
) const ;
517 /// Get index for style name
518 int GetIndexForStyle(const wxString
& name
) const ;
520 /// Set selection for string, returning the index.
521 int SetStyleSelection(const wxString
& name
);
527 void ApplyStyle(int i
);
530 void OnLeftDown(wxMouseEvent
& event
);
532 /// Left double-click
533 void OnLeftDoubleClick(wxMouseEvent
& event
);
535 /// Auto-select from style under caret in idle time
536 void OnIdle(wxIdleEvent
& event
);
538 /// Convert units in tends of a millimetre to device units
539 int ConvertTenthsMMToPixels(wxDC
& dc
, int units
) const;
541 /// Can we set the selection based on the editor caret position?
542 /// Need to override this if being used in a combobox popup
543 virtual bool CanAutoSetSelection() { return m_autoSetSelection
; }
544 virtual void SetAutoSetSelection(bool autoSet
) { m_autoSetSelection
= autoSet
; }
546 /// Set whether the style should be applied as soon as the item is selected (the default)
547 void SetApplyOnSelection(bool applyOnSel
) { m_applyOnSelection
= applyOnSel
; }
548 bool GetApplyOnSelection() const { return m_applyOnSelection
; }
550 /// Set the style type to display
551 void SetStyleType(wxRichTextStyleType styleType
) { m_styleType
= styleType
; UpdateStyles(); }
552 wxRichTextStyleType
GetStyleType() const { return m_styleType
; }
554 /// Helper for listbox and combo control
555 static wxString
GetStyleToShowInIdleTime(wxRichTextCtrl
* ctrl
, wxRichTextStyleType styleType
);
558 /// Returns the HTML for this item
559 virtual wxString
OnGetItem(size_t n
) const;
563 wxRichTextStyleSheet
* m_styleSheet
;
564 wxRichTextCtrl
* m_richTextCtrl
;
565 bool m_applyOnSelection
; // if true, applies style on selection
566 wxRichTextStyleType m_styleType
; // style type to display
567 bool m_autoSetSelection
;
568 wxArrayString m_styleNames
;
572 * wxRichTextStyleListCtrl class declaration
573 * This is a container for the list control plus a combobox to switch between
577 #define wxRICHTEXTSTYLELIST_HIDE_TYPE_SELECTOR 0x1000
579 class WXDLLIMPEXP_RICHTEXT wxRichTextStyleListCtrl
: public wxControl
581 DECLARE_CLASS(wxRichTextStyleListCtrl
)
582 DECLARE_EVENT_TABLE()
587 wxRichTextStyleListCtrl()
592 wxRichTextStyleListCtrl(wxWindow
* parent
, wxWindowID id
= wxID_ANY
, const wxPoint
& pos
= wxDefaultPosition
,
593 const wxSize
& size
= wxDefaultSize
, long style
= 0);
596 virtual ~wxRichTextStyleListCtrl();
598 /// Member initialisation
601 m_styleListBox
= NULL
;
602 m_styleChoice
= NULL
;
603 m_dontUpdate
= false;
606 /// Creates the windows
607 bool Create(wxWindow
* parent
, wxWindowID id
= wxID_ANY
, const wxPoint
& pos
= wxDefaultPosition
,
608 const wxSize
& size
= wxDefaultSize
, long style
= 0);
610 /// Updates the style list box
613 /// Associates the control with a style sheet
614 void SetStyleSheet(wxRichTextStyleSheet
* styleSheet
);
615 wxRichTextStyleSheet
* GetStyleSheet() const;
617 /// Associates the control with a wxRichTextCtrl
618 void SetRichTextCtrl(wxRichTextCtrl
* ctrl
);
619 wxRichTextCtrl
* GetRichTextCtrl() const;
621 /// Set/get the style type to display
622 void SetStyleType(wxRichTextStyleListBox::wxRichTextStyleType styleType
);
623 wxRichTextStyleListBox::wxRichTextStyleType
GetStyleType() const;
625 /// Get the choice index for style type
626 int StyleTypeToIndex(wxRichTextStyleListBox::wxRichTextStyleType styleType
);
628 /// Get the style type for choice index
629 wxRichTextStyleListBox::wxRichTextStyleType
StyleIndexToType(int i
);
632 wxRichTextStyleListBox
* GetStyleListBox() const { return m_styleListBox
; }
635 wxChoice
* GetStyleChoice() const { return m_styleChoice
; }
637 /// React to style type choice
638 void OnChooseType(wxCommandEvent
& event
);
640 /// Lay out the controls
641 void OnSize(wxSizeEvent
& event
);
645 wxRichTextStyleListBox
* m_styleListBox
;
646 wxChoice
* m_styleChoice
;
653 * Style drop-down for a wxComboCtrl
656 class wxRichTextStyleComboPopup
: public wxRichTextStyleListBox
, public wxComboPopup
661 m_itemHere
= -1; // hot item in list
665 virtual bool Create( wxWindow
* parent
);
667 virtual wxWindow
*GetControl() { return this; }
669 virtual void SetStringValue( const wxString
& s
);
671 virtual wxString
GetStringValue() const;
673 /// Can we set the selection based on the editor caret position?
674 // virtual bool CanAutoSetSelection() { return ((m_combo == NULL) || !m_combo->IsPopupShown()); }
675 virtual bool CanAutoSetSelection() { return false; }
678 // Popup event handlers
681 // Mouse hot-tracking
682 void OnMouseMove(wxMouseEvent
& event
);
684 // On mouse left, set the value and close the popup
685 void OnMouseClick(wxMouseEvent
& WXUNUSED(event
));
689 int m_itemHere
; // hot item in popup
693 DECLARE_EVENT_TABLE()
697 * wxRichTextStyleComboCtrl
698 * A combo for applying styles.
701 class WXDLLIMPEXP_RICHTEXT wxRichTextStyleComboCtrl
: public wxComboCtrl
703 DECLARE_CLASS(wxRichTextStyleComboCtrl
)
704 DECLARE_EVENT_TABLE()
707 wxRichTextStyleComboCtrl()
712 wxRichTextStyleComboCtrl(wxWindow
* parent
, wxWindowID id
= wxID_ANY
, const wxPoint
& pos
= wxDefaultPosition
,
713 const wxSize
& size
= wxDefaultSize
, long style
= wxCB_READONLY
)
716 Create(parent
, id
, pos
, size
, style
);
719 virtual ~wxRichTextStyleComboCtrl() {}
726 bool Create(wxWindow
* parent
, wxWindowID id
= wxID_ANY
, const wxPoint
& pos
= wxDefaultPosition
,
727 const wxSize
& size
= wxDefaultSize
, long style
= 0);
730 void UpdateStyles() { m_stylePopup
->UpdateStyles(); }
732 /// Associates the control with a style sheet
733 void SetStyleSheet(wxRichTextStyleSheet
* styleSheet
) { m_stylePopup
->SetStyleSheet(styleSheet
); }
734 wxRichTextStyleSheet
* GetStyleSheet() const { return m_stylePopup
->GetStyleSheet(); }
736 /// Associates the control with a wxRichTextCtrl
737 void SetRichTextCtrl(wxRichTextCtrl
* ctrl
) { m_stylePopup
->SetRichTextCtrl(ctrl
); }
738 wxRichTextCtrl
* GetRichTextCtrl() const { return m_stylePopup
->GetRichTextCtrl(); }
740 /// Gets the style popup
741 wxRichTextStyleComboPopup
* GetStylePopup() const { return m_stylePopup
; }
743 /// Auto-select from style under caret in idle time
744 void OnIdle(wxIdleEvent
& event
);
747 wxRichTextStyleComboPopup
* m_stylePopup
;
760 // _WX_RICHTEXTSTYLES_H_