1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/richtext/richtextctrl.h
3 // Purpose: A rich edit control
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_RICHTEXTCTRL_H_
13 #define _WX_RICHTEXTCTRL_H_
15 #include "wx/richtext/richtextbuffer.h"
19 #include "wx/scrolwin.h"
22 #include "wx/textctrl.h"
24 #if !defined(__WXGTK__) && !defined(__WXMAC__)
25 #define wxRICHTEXT_BUFFERED_PAINTING 1
27 #define wxRICHTEXT_BUFFERED_PAINTING 0
30 class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextStyleDefinition
;
39 #define wxRE_READONLY 0x0010
40 #define wxRE_MULTILINE 0x0020
41 #define wxRE_CENTRE_CARET 0x8000
42 #define wxRE_CENTER_CARET wxRE_CENTRE_CARET
47 #define wxRICHTEXT_SHIFT_DOWN 0x01
48 #define wxRICHTEXT_CTRL_DOWN 0x02
49 #define wxRICHTEXT_ALT_DOWN 0x04
54 // Don't draw guide lines around boxes and tables
55 #define wxRICHTEXT_EX_NO_GUIDELINES 0x00000100
61 #define wxRICHTEXT_DEFAULT_OVERALL_SIZE wxSize(-1, -1)
62 #define wxRICHTEXT_DEFAULT_IMAGE_SIZE wxSize(80, 80)
63 #define wxRICHTEXT_DEFAULT_SPACING 3
64 #define wxRICHTEXT_DEFAULT_MARGIN 3
65 #define wxRICHTEXT_DEFAULT_UNFOCUSSED_BACKGROUND wxColour(175, 175, 175)
66 #define wxRICHTEXT_DEFAULT_FOCUSSED_BACKGROUND wxColour(140, 140, 140)
67 #define wxRICHTEXT_DEFAULT_UNSELECTED_BACKGROUND wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)
68 #define wxRICHTEXT_DEFAULT_TYPE_COLOUR wxColour(0, 0, 200)
69 #define wxRICHTEXT_DEFAULT_FOCUS_RECT_COLOUR wxColour(100, 80, 80)
70 #define wxRICHTEXT_DEFAULT_CARET_WIDTH 2
71 // Minimum buffer size before delayed layout kicks in
72 #define wxRICHTEXT_DEFAULT_DELAYED_LAYOUT_THRESHOLD 20000
73 // Milliseconds before layout occurs after resize
74 #define wxRICHTEXT_DEFAULT_LAYOUT_INTERVAL 50
78 #define wxID_RICHTEXT_PROPERTIES1 (wxID_HIGHEST + 1)
79 #define wxID_RICHTEXT_PROPERTIES2 (wxID_HIGHEST + 2)
80 #define wxID_RICHTEXT_PROPERTIES3 (wxID_HIGHEST + 3)
83 * Forward declarations
87 // Drawing styles/states
88 #define wxRICHTEXT_SELECTED 0x01
89 #define wxRICHTEXT_TAGGED 0x02
90 // The control is focussed
91 #define wxRICHTEXT_FOCUSSED 0x04
92 // The item itself has the focus
93 #define wxRICHTEXT_IS_FOCUS 0x08
96 // Normal selection occurs initially and as user drags within one container.
97 // Common ancestor selection occurs when the user starts dragging across containers
98 // that have a common ancestor, for example the cells in a table.
99 enum wxRichTextCtrlSelectionState
101 wxRichTextCtrlSelectionState_Normal
,
102 wxRichTextCtrlSelectionState_CommonAncestor
106 * wxRichTextContextMenuPropertiesInfo keeps track of objects that appear in the context menu,
107 * whose properties are available to be edited.
110 class WXDLLIMPEXP_RICHTEXT wxRichTextContextMenuPropertiesInfo
113 wxRichTextContextMenuPropertiesInfo() { Init(); }
121 bool AddItem(const wxString
& label
, wxRichTextObject
* obj
);
123 /// Returns number of menu items were added.
124 int AddMenuItems(wxMenu
* menu
, int startCmd
= wxID_RICHTEXT_PROPERTIES1
) const;
126 /// Add appropriate menu items for the current container and clicked on object
127 /// (and container's parent, if appropriate).
128 int AddItems(wxRichTextObject
* container
, wxRichTextObject
* obj
);
131 void Clear() { m_objects
.Clear(); m_labels
.Clear(); }
134 /// Gets the nth label
135 wxString
GetLabel(int n
) const { return m_labels
[n
]; }
137 /// Gets the nth object
138 wxRichTextObject
* GetObject(int n
) const { return m_objects
[n
]; }
141 wxRichTextObjectPtrArray
& GetObjects() { return m_objects
; }
142 const wxRichTextObjectPtrArray
& GetObjects() const { return m_objects
; }
145 wxArrayString
& GetLabels() { return m_labels
; }
146 const wxArrayString
& GetLabels() const { return m_labels
; }
148 /// Get number of items
149 int GetCount() const { return m_objects
.GetCount(); }
152 wxRichTextObjectPtrArray m_objects
;
153 wxArrayString m_labels
;
157 * wxRichTextCtrl class declaration
160 class WXDLLIMPEXP_RICHTEXT wxRichTextCtrl
: public wxControl
,
161 public wxTextCtrlIface
,
162 public wxScrollHelper
164 DECLARE_CLASS( wxRichTextCtrl
)
165 DECLARE_EVENT_TABLE()
171 wxRichTextCtrl( wxWindow
* parent
, wxWindowID id
= -1, const wxString
& value
= wxEmptyString
, const wxPoint
& pos
= wxDefaultPosition
, const wxSize
& size
= wxDefaultSize
,
172 long style
= wxRE_MULTILINE
, const wxValidator
& validator
= wxDefaultValidator
, const wxString
& name
= wxTextCtrlNameStr
);
174 virtual ~wxRichTextCtrl( );
179 bool Create( wxWindow
* parent
, wxWindowID id
= -1, const wxString
& value
= wxEmptyString
, const wxPoint
& pos
= wxDefaultPosition
, const wxSize
& size
= wxDefaultSize
,
180 long style
= wxRE_MULTILINE
, const wxValidator
& validator
= wxDefaultValidator
, const wxString
& name
= wxTextCtrlNameStr
);
182 /// Member initialisation
185 ///// wxTextCtrl compatibility
189 virtual wxString
GetRange(long from
, long to
) const;
191 virtual int GetLineLength(long lineNo
) const ;
192 virtual wxString
GetLineText(long lineNo
) const ;
193 virtual int GetNumberOfLines() const ;
195 virtual bool IsModified() const ;
196 virtual bool IsEditable() const ;
198 // more readable flag testing methods
199 bool IsSingleLine() const { return !HasFlag(wxRE_MULTILINE
); }
200 bool IsMultiLine() const { return !IsSingleLine(); }
202 // If the return values from and to are the same, there is no selection.
203 virtual void GetSelection(long* from
, long* to
) const;
205 virtual wxString
GetStringSelection() const;
207 const wxRichTextSelection
& GetSelection() const { return m_selection
; }
208 wxRichTextSelection
& GetSelection() { return m_selection
; }
209 void SetSelection(const wxRichTextSelection
& sel
) { m_selection
= sel
; }
213 wxString
GetFilename() const { return m_filename
; }
216 void SetFilename(const wxString
& filename
) { m_filename
= filename
; }
218 /// Set the threshold in character positions for doing layout optimization during sizing
219 void SetDelayedLayoutThreshold(long threshold
) { m_delayedLayoutThreshold
= threshold
; }
221 /// Get the threshold in character positions for doing layout optimization during sizing
222 long GetDelayedLayoutThreshold() const { return m_delayedLayoutThreshold
; }
224 bool GetFullLayoutRequired() const { return m_fullLayoutRequired
; }
225 void SetFullLayoutRequired(bool b
) { m_fullLayoutRequired
= b
; }
227 wxLongLong
GetFullLayoutTime() const { return m_fullLayoutTime
; }
228 void SetFullLayoutTime(wxLongLong t
) { m_fullLayoutTime
= t
; }
230 long GetFullLayoutSavedPosition() const { return m_fullLayoutSavedPosition
; }
231 void SetFullLayoutSavedPosition(long p
) { m_fullLayoutSavedPosition
= p
; }
233 // Force any pending layout due to large buffer
234 void ForceDelayedLayout();
237 void SetTextCursor(const wxCursor
& cursor
) { m_textCursor
= cursor
; }
240 wxCursor
GetTextCursor() const { return m_textCursor
; }
243 void SetURLCursor(const wxCursor
& cursor
) { m_urlCursor
= cursor
; }
246 wxCursor
GetURLCursor() const { return m_urlCursor
; }
248 /// Are we showing the caret position at the start of a line
249 /// instead of at the end of the previous one?
250 bool GetCaretAtLineStart() const { return m_caretAtLineStart
; }
251 void SetCaretAtLineStart(bool atStart
) { m_caretAtLineStart
= atStart
; }
253 /// Are we dragging a selection?
254 bool GetDragging() const { return m_dragging
; }
255 void SetDragging(bool dragging
) { m_dragging
= dragging
; }
257 /// Get/set drag start position
258 const wxPoint
& GetDragStart() const { return m_dragStart
; }
259 void SetDragStart(const wxPoint
& pt
) { m_dragStart
= pt
; }
261 #if wxRICHTEXT_BUFFERED_PAINTING
262 /// Get the buffer bitmap
263 const wxBitmap
& GetBufferBitmap() const { return m_bufferBitmap
; }
264 wxBitmap
& GetBufferBitmap() { return m_bufferBitmap
; }
267 /// Get/set context menu
268 wxMenu
* GetContextMenu() const { return m_contextMenu
; }
269 void SetContextMenu(wxMenu
* menu
);
271 /// Anchor so we know how to extend the selection
272 /// It's a caret position since it's between two characters.
273 long GetSelectionAnchor() const { return m_selectionAnchor
; }
274 void SetSelectionAnchor(long anchor
) { m_selectionAnchor
= anchor
; }
276 /// Anchor object if selecting multiple containers.
277 wxRichTextObject
* GetSelectionAnchorObject() const { return m_selectionAnchorObject
; }
278 void SetSelectionAnchorObject(wxRichTextObject
* anchor
) { m_selectionAnchorObject
= anchor
; }
280 wxRichTextContextMenuPropertiesInfo
& GetContextMenuPropertiesInfo() { return m_contextMenuPropertiesInfo
; }
281 const wxRichTextContextMenuPropertiesInfo
& GetContextMenuPropertiesInfo() const { return m_contextMenuPropertiesInfo
; }
283 /// The wxRichTextObject object that currently has the editing focus
284 wxRichTextParagraphLayoutBox
* GetFocusObject() const { return m_focusObject
; }
285 bool SetFocusObject(wxRichTextParagraphLayoutBox
* obj
, bool setCaretPosition
= true);
289 void Invalidate() { GetBuffer().Invalidate(wxRICHTEXT_ALL
); }
292 virtual void Clear();
293 virtual void Replace(long from
, long to
, const wxString
& value
);
294 virtual void Remove(long from
, long to
);
296 // load/save the controls contents from/to the file
297 virtual bool DoLoadFile(const wxString
& file
, int fileType
);
298 virtual bool DoSaveFile(const wxString
& file
= wxEmptyString
,
299 int fileType
= wxRICHTEXT_TYPE_ANY
);
301 /// Set the handler flags, controlling loading and saving
302 void SetHandlerFlags(int flags
) { GetBuffer().SetHandlerFlags(flags
); }
304 /// Get the handler flags, controlling loading and saving
305 int GetHandlerFlags() const { return GetBuffer().GetHandlerFlags(); }
307 // sets/clears the dirty flag
308 virtual void MarkDirty();
309 virtual void DiscardEdits();
311 // set the max number of characters which may be entered in a single line
313 virtual void SetMaxLength(unsigned long WXUNUSED(len
)) { }
315 // writing text inserts it at the current position, appending always
316 // inserts it at the end
317 virtual void WriteText(const wxString
& text
);
318 virtual void AppendText(const wxString
& text
);
320 // text control under some platforms supports the text styles: these
321 // methods allow to apply the given text style to the given selection or to
322 // set/get the style which will be used for all appended text
323 virtual bool SetStyle(long start
, long end
, const wxTextAttr
& style
);
324 virtual bool SetStyle(long start
, long end
, const wxRichTextAttr
& style
);
325 virtual bool SetStyle(const wxRichTextRange
& range
, const wxTextAttr
& style
);
326 virtual bool SetStyle(const wxRichTextRange
& range
, const wxRichTextAttr
& style
);
327 virtual bool GetStyle(long position
, wxTextAttr
& style
);
328 virtual bool GetStyle(long position
, wxRichTextAttr
& style
);
329 virtual bool GetStyle(long position
, wxRichTextAttr
& style
, wxRichTextParagraphLayoutBox
* container
);
331 // Set the style for a single object
332 virtual void SetStyle(wxRichTextObject
*obj
, const wxRichTextAttr
& textAttr
);
334 // get the common set of styles for the range
335 virtual bool GetStyleForRange(const wxRichTextRange
& range
, wxTextAttr
& style
);
336 virtual bool GetStyleForRange(const wxRichTextRange
& range
, wxRichTextAttr
& style
);
337 virtual bool GetStyleForRange(const wxRichTextRange
& range
, wxRichTextAttr
& style
, wxRichTextParagraphLayoutBox
* container
);
338 // extended style setting operation with flags including:
339 // wxRICHTEXT_SETSTYLE_WITH_UNDO, wxRICHTEXT_SETSTYLE_OPTIMIZE, wxRICHTEXT_SETSTYLE_PARAGRAPHS_ONLY, wxRICHTEXT_SETSTYLE_CHARACTERS_ONLY
340 // see richtextbuffer.h for more details.
341 virtual bool SetStyleEx(const wxRichTextRange
& range
, const wxRichTextAttr
& style
, int flags
= wxRICHTEXT_SETSTYLE_WITH_UNDO
);
343 /// Get the content (uncombined) attributes for this position.
344 virtual bool GetUncombinedStyle(long position
, wxRichTextAttr
& style
);
345 virtual bool GetUncombinedStyle(long position
, wxRichTextAttr
& style
, wxRichTextParagraphLayoutBox
* container
);
347 virtual bool SetDefaultStyle(const wxTextAttr
& style
);
348 virtual bool SetDefaultStyle(const wxRichTextAttr
& style
);
350 virtual const wxRichTextAttr
& GetDefaultStyleEx() const;
352 //virtual const wxTextAttr& GetDefaultStyle() const;
355 virtual bool SetListStyle(const wxRichTextRange
& range
, wxRichTextListStyleDefinition
* def
, int flags
= wxRICHTEXT_SETSTYLE_WITH_UNDO
, int startFrom
= 1, int specifiedLevel
= -1);
356 virtual bool SetListStyle(const wxRichTextRange
& range
, const wxString
& defName
, int flags
= wxRICHTEXT_SETSTYLE_WITH_UNDO
, int startFrom
= 1, int specifiedLevel
= -1);
358 /// Clear list for given range
359 virtual bool ClearListStyle(const wxRichTextRange
& range
, int flags
= wxRICHTEXT_SETSTYLE_WITH_UNDO
);
361 /// Number/renumber any list elements in the given range
362 /// def/defName can be NULL/empty to indicate that the existing list style should be used.
363 virtual bool NumberList(const wxRichTextRange
& range
, wxRichTextListStyleDefinition
* def
= NULL
, int flags
= wxRICHTEXT_SETSTYLE_WITH_UNDO
, int startFrom
= 1, int specifiedLevel
= -1);
364 virtual bool NumberList(const wxRichTextRange
& range
, const wxString
& defName
, int flags
= wxRICHTEXT_SETSTYLE_WITH_UNDO
, int startFrom
= 1, int specifiedLevel
= -1);
366 /// Promote the list items within the given range. promoteBy can be a positive or negative number, e.g. 1 or -1
367 /// def/defName can be NULL/empty to indicate that the existing list style should be used.
368 virtual bool PromoteList(int promoteBy
, const wxRichTextRange
& range
, wxRichTextListStyleDefinition
* def
= NULL
, int flags
= wxRICHTEXT_SETSTYLE_WITH_UNDO
, int specifiedLevel
= -1);
369 virtual bool PromoteList(int promoteBy
, const wxRichTextRange
& range
, const wxString
& defName
, int flags
= wxRICHTEXT_SETSTYLE_WITH_UNDO
, int specifiedLevel
= -1);
371 /// Deletes the content in the given range
372 virtual bool Delete(const wxRichTextRange
& range
);
374 // translate between the position (which is just an index in the text ctrl
375 // considering all its contents as a single strings) and (x, y) coordinates
376 // which represent column and line.
377 virtual long XYToPosition(long x
, long y
) const;
378 virtual bool PositionToXY(long pos
, long *x
, long *y
) const;
380 virtual void ShowPosition(long pos
);
382 // find the character at position given in pixels
384 // NB: pt is in device coords (not adjusted for the client area origin nor
386 virtual wxTextCtrlHitTestResult
HitTest(const wxPoint
& pt
, long *pos
) const;
387 virtual wxTextCtrlHitTestResult
HitTest(const wxPoint
& pt
,
389 wxTextCoord
*row
) const;
391 // Clipboard operations
394 virtual void Paste();
395 virtual void DeleteSelection();
397 virtual bool CanCopy() const;
398 virtual bool CanCut() const;
399 virtual bool CanPaste() const;
400 virtual bool CanDeleteSelection() const;
406 virtual bool CanUndo() const;
407 virtual bool CanRedo() const;
410 virtual void SetInsertionPoint(long pos
);
411 virtual void SetInsertionPointEnd();
412 virtual long GetInsertionPoint() const;
413 virtual wxTextPos
GetLastPosition() const;
415 virtual void SetSelection(long from
, long to
);
416 virtual void SelectAll();
417 virtual void SetEditable(bool editable
);
419 /// Returns true if there was a selection and the object containing the selection
420 /// was the same as the current focus object.
421 virtual bool HasSelection() const;
423 /// Returns true if there was a selection, whether or not the current focus object
424 /// is the same as the selection's container object.
425 virtual bool HasUnfocusedSelection() const;
427 ///// Functionality specific to wxRichTextCtrl
429 /// Write an image at the current insertion point. Supply optional type to use
430 /// for internal and file storage of the raw data.
431 virtual bool WriteImage(const wxImage
& image
, wxBitmapType bitmapType
= wxBITMAP_TYPE_PNG
,
432 const wxRichTextAttr
& textAttr
= wxRichTextAttr());
434 /// Write a bitmap at the current insertion point. Supply optional type to use
435 /// for internal and file storage of the raw data.
436 virtual bool WriteImage(const wxBitmap
& bitmap
, wxBitmapType bitmapType
= wxBITMAP_TYPE_PNG
,
437 const wxRichTextAttr
& textAttr
= wxRichTextAttr());
439 /// Load an image from file and write at the current insertion point.
440 virtual bool WriteImage(const wxString
& filename
, wxBitmapType bitmapType
,
441 const wxRichTextAttr
& textAttr
= wxRichTextAttr());
443 /// Write an image block at the current insertion point.
444 virtual bool WriteImage(const wxRichTextImageBlock
& imageBlock
,
445 const wxRichTextAttr
& textAttr
= wxRichTextAttr());
447 /// Write a text box at the current insertion point, returning the text box.
448 /// You can then call SetFocusObject() to set the focus to the new object.
449 virtual wxRichTextBox
* WriteTextBox(const wxRichTextAttr
& textAttr
= wxRichTextAttr());
451 /// Write a table at the current insertion point, returning the table.
452 /// You can then call SetFocusObject() to set the focus to the new object.
453 virtual wxRichTextTable
* WriteTable(int rows
, int cols
, const wxRichTextAttr
& tableAttr
= wxRichTextAttr(), const wxRichTextAttr
& cellAttr
= wxRichTextAttr());
455 /// Insert a newline (actually paragraph) at the current insertion point.
456 virtual bool Newline();
458 /// Insert a line break at the current insertion point.
459 virtual bool LineBreak();
461 /// Set basic (overall) style
462 virtual void SetBasicStyle(const wxRichTextAttr
& style
) { GetBuffer().SetBasicStyle(style
); }
464 /// Get basic (overall) style
465 virtual const wxRichTextAttr
& GetBasicStyle() const { return GetBuffer().GetBasicStyle(); }
467 virtual bool BeginStyle(const wxRichTextAttr
& style
) { return GetBuffer().BeginStyle(style
); }
470 virtual bool EndStyle() { return GetBuffer().EndStyle(); }
473 virtual bool EndAllStyles() { return GetBuffer().EndAllStyles(); }
476 bool BeginBold() { return GetBuffer().BeginBold(); }
479 bool EndBold() { return GetBuffer().EndBold(); }
481 /// Begin using italic
482 bool BeginItalic() { return GetBuffer().BeginItalic(); }
485 bool EndItalic() { return GetBuffer().EndItalic(); }
487 /// Begin using underline
488 bool BeginUnderline() { return GetBuffer().BeginUnderline(); }
490 /// End using underline
491 bool EndUnderline() { return GetBuffer().EndUnderline(); }
493 /// Begin using point size
494 bool BeginFontSize(int pointSize
) { return GetBuffer().BeginFontSize(pointSize
); }
496 /// End using point size
497 bool EndFontSize() { return GetBuffer().EndFontSize(); }
499 /// Begin using this font
500 bool BeginFont(const wxFont
& font
) { return GetBuffer().BeginFont(font
); }
503 bool EndFont() { return GetBuffer().EndFont(); }
505 /// Begin using this colour
506 bool BeginTextColour(const wxColour
& colour
) { return GetBuffer().BeginTextColour(colour
); }
508 /// End using a colour
509 bool EndTextColour() { return GetBuffer().EndTextColour(); }
511 /// Begin using alignment
512 bool BeginAlignment(wxTextAttrAlignment alignment
) { return GetBuffer().BeginAlignment(alignment
); }
515 bool EndAlignment() { return GetBuffer().EndAlignment(); }
517 /// Begin left indent
518 bool BeginLeftIndent(int leftIndent
, int leftSubIndent
= 0) { return GetBuffer().BeginLeftIndent(leftIndent
, leftSubIndent
); }
521 bool EndLeftIndent() { return GetBuffer().EndLeftIndent(); }
523 /// Begin right indent
524 bool BeginRightIndent(int rightIndent
) { return GetBuffer().BeginRightIndent(rightIndent
); }
527 bool EndRightIndent() { return GetBuffer().EndRightIndent(); }
529 /// Begin paragraph spacing
530 bool BeginParagraphSpacing(int before
, int after
) { return GetBuffer().BeginParagraphSpacing(before
, after
); }
532 /// End paragraph spacing
533 bool EndParagraphSpacing() { return GetBuffer().EndParagraphSpacing(); }
535 /// Begin line spacing
536 bool BeginLineSpacing(int lineSpacing
) { return GetBuffer().BeginLineSpacing(lineSpacing
); }
539 bool EndLineSpacing() { return GetBuffer().EndLineSpacing(); }
541 /// Begin numbered bullet
542 bool BeginNumberedBullet(int bulletNumber
, int leftIndent
, int leftSubIndent
, int bulletStyle
= wxTEXT_ATTR_BULLET_STYLE_ARABIC
|wxTEXT_ATTR_BULLET_STYLE_PERIOD
)
543 { return GetBuffer().BeginNumberedBullet(bulletNumber
, leftIndent
, leftSubIndent
, bulletStyle
); }
545 /// End numbered bullet
546 bool EndNumberedBullet() { return GetBuffer().EndNumberedBullet(); }
548 /// Begin symbol bullet
549 bool BeginSymbolBullet(const wxString
& symbol
, int leftIndent
, int leftSubIndent
, int bulletStyle
= wxTEXT_ATTR_BULLET_STYLE_SYMBOL
)
550 { return GetBuffer().BeginSymbolBullet(symbol
, leftIndent
, leftSubIndent
, bulletStyle
); }
552 /// End symbol bullet
553 bool EndSymbolBullet() { return GetBuffer().EndSymbolBullet(); }
555 /// Begin standard bullet
556 bool BeginStandardBullet(const wxString
& bulletName
, int leftIndent
, int leftSubIndent
, int bulletStyle
= wxTEXT_ATTR_BULLET_STYLE_STANDARD
)
557 { return GetBuffer().BeginStandardBullet(bulletName
, leftIndent
, leftSubIndent
, bulletStyle
); }
559 /// End standard bullet
560 bool EndStandardBullet() { return GetBuffer().EndStandardBullet(); }
562 /// Begin named character style
563 bool BeginCharacterStyle(const wxString
& characterStyle
) { return GetBuffer().BeginCharacterStyle(characterStyle
); }
565 /// End named character style
566 bool EndCharacterStyle() { return GetBuffer().EndCharacterStyle(); }
568 /// Begin named paragraph style
569 bool BeginParagraphStyle(const wxString
& paragraphStyle
) { return GetBuffer().BeginParagraphStyle(paragraphStyle
); }
571 /// End named character style
572 bool EndParagraphStyle() { return GetBuffer().EndParagraphStyle(); }
574 /// Begin named list style
575 bool BeginListStyle(const wxString
& listStyle
, int level
= 1, int number
= 1) { return GetBuffer().BeginListStyle(listStyle
, level
, number
); }
577 /// End named character style
578 bool EndListStyle() { return GetBuffer().EndListStyle(); }
581 bool BeginURL(const wxString
& url
, const wxString
& characterStyle
= wxEmptyString
) { return GetBuffer().BeginURL(url
, characterStyle
); }
584 bool EndURL() { return GetBuffer().EndURL(); }
586 /// Sets the default style to the style under the cursor
587 bool SetDefaultStyleToCursorStyle();
589 /// Clear the selection
590 virtual void SelectNone();
592 /// Select the word at the given character position
593 virtual bool SelectWord(long position
);
595 /// Get/set the selection range in character positions. -1, -1 means no selection.
596 /// The range is in API convention, i.e. a single character selection is denoted
598 wxRichTextRange
GetSelectionRange() const;
599 void SetSelectionRange(const wxRichTextRange
& range
);
601 /// Get/set the selection range in character positions. -2, -2 means no selection
602 /// -1, -1 means select everything.
603 /// The range is in internal format, i.e. a single character selection is denoted
605 wxRichTextRange
GetInternalSelectionRange() const { return m_selection
.GetRange(); }
606 void SetInternalSelectionRange(const wxRichTextRange
& range
) { m_selection
.Set(range
, GetFocusObject()); }
608 /// Add a new paragraph of text to the end of the buffer
609 virtual wxRichTextRange
AddParagraph(const wxString
& text
);
612 virtual wxRichTextRange
AddImage(const wxImage
& image
);
614 /// Layout the buffer: which we must do before certain operations, such as
615 /// setting the caret position.
616 virtual bool LayoutContent(bool onlyVisibleRect
= false);
618 /// Move the caret to the given character position
619 virtual bool MoveCaret(long pos
, bool showAtLineStart
= false, wxRichTextParagraphLayoutBox
* container
= NULL
);
622 virtual bool MoveRight(int noPositions
= 1, int flags
= 0);
625 virtual bool MoveLeft(int noPositions
= 1, int flags
= 0);
628 virtual bool MoveUp(int noLines
= 1, int flags
= 0);
631 virtual bool MoveDown(int noLines
= 1, int flags
= 0);
633 /// Move to the end of the line
634 virtual bool MoveToLineEnd(int flags
= 0);
636 /// Move to the start of the line
637 virtual bool MoveToLineStart(int flags
= 0);
639 /// Move to the end of the paragraph
640 virtual bool MoveToParagraphEnd(int flags
= 0);
642 /// Move to the start of the paragraph
643 virtual bool MoveToParagraphStart(int flags
= 0);
645 /// Move to the start of the buffer
646 virtual bool MoveHome(int flags
= 0);
648 /// Move to the end of the buffer
649 virtual bool MoveEnd(int flags
= 0);
652 virtual bool PageUp(int noPages
= 1, int flags
= 0);
654 /// Move n pages down
655 virtual bool PageDown(int noPages
= 1, int flags
= 0);
657 /// Move n words left
658 virtual bool WordLeft(int noPages
= 1, int flags
= 0);
660 /// Move n words right
661 virtual bool WordRight(int noPages
= 1, int flags
= 0);
663 /// Returns the buffer associated with the control.
664 wxRichTextBuffer
& GetBuffer() { return m_buffer
; }
665 const wxRichTextBuffer
& GetBuffer() const { return m_buffer
; }
667 /// Start batching undo history for commands.
668 virtual bool BeginBatchUndo(const wxString
& cmdName
) { return m_buffer
.BeginBatchUndo(cmdName
); }
670 /// End batching undo history for commands.
671 virtual bool EndBatchUndo() { return m_buffer
.EndBatchUndo(); }
673 /// Are we batching undo history for commands?
674 virtual bool BatchingUndo() const { return m_buffer
.BatchingUndo(); }
676 /// Start suppressing undo history for commands.
677 virtual bool BeginSuppressUndo() { return m_buffer
.BeginSuppressUndo(); }
679 /// End suppressing undo history for commands.
680 virtual bool EndSuppressUndo() { return m_buffer
.EndSuppressUndo(); }
682 /// Are we suppressing undo history for commands?
683 virtual bool SuppressingUndo() const { return m_buffer
.SuppressingUndo(); }
685 /// Test if this whole range has character attributes of the specified kind. If any
686 /// of the attributes are different within the range, the test fails. You
687 /// can use this to implement, for example, bold button updating. style must have
688 /// flags indicating which attributes are of interest.
689 virtual bool HasCharacterAttributes(const wxRichTextRange
& range
, const wxRichTextAttr
& style
) const
691 return GetBuffer().HasCharacterAttributes(range
.ToInternal(), style
);
694 /// Test if this whole range has paragraph attributes of the specified kind. If any
695 /// of the attributes are different within the range, the test fails. You
696 /// can use this to implement, for example, centering button updating. style must have
697 /// flags indicating which attributes are of interest.
698 virtual bool HasParagraphAttributes(const wxRichTextRange
& range
, const wxRichTextAttr
& style
) const
700 return GetBuffer().HasParagraphAttributes(range
.ToInternal(), style
);
703 /// Is all of the selection bold?
704 virtual bool IsSelectionBold();
706 /// Is all of the selection italics?
707 virtual bool IsSelectionItalics();
709 /// Is all of the selection underlined?
710 virtual bool IsSelectionUnderlined();
712 /// Is all of the selection aligned according to the specified flag?
713 virtual bool IsSelectionAligned(wxTextAttrAlignment alignment
);
715 /// Apply bold to the selection
716 virtual bool ApplyBoldToSelection();
718 /// Apply italic to the selection
719 virtual bool ApplyItalicToSelection();
721 /// Apply underline to the selection
722 virtual bool ApplyUnderlineToSelection();
724 /// Apply alignment to the selection
725 virtual bool ApplyAlignmentToSelection(wxTextAttrAlignment alignment
);
727 /// Apply a named style to the selection
728 virtual bool ApplyStyle(wxRichTextStyleDefinition
* def
);
730 /// Set style sheet, if any
731 void SetStyleSheet(wxRichTextStyleSheet
* styleSheet
) { GetBuffer().SetStyleSheet(styleSheet
); }
732 wxRichTextStyleSheet
* GetStyleSheet() const { return GetBuffer().GetStyleSheet(); }
734 /// Push style sheet to top of stack
735 bool PushStyleSheet(wxRichTextStyleSheet
* styleSheet
) { return GetBuffer().PushStyleSheet(styleSheet
); }
737 /// Pop style sheet from top of stack
738 wxRichTextStyleSheet
* PopStyleSheet() { return GetBuffer().PopStyleSheet(); }
740 /// Apply the style sheet to the buffer, for example if the styles have changed.
741 bool ApplyStyleSheet(wxRichTextStyleSheet
* styleSheet
= NULL
);
745 void Command(wxCommandEvent
& event
);
746 void OnDropFiles(wxDropFilesEvent
& event
);
747 void OnCaptureLost(wxMouseCaptureLostEvent
& event
);
748 void OnSysColourChanged(wxSysColourChangedEvent
& event
);
750 void OnCut(wxCommandEvent
& event
);
751 void OnCopy(wxCommandEvent
& event
);
752 void OnPaste(wxCommandEvent
& event
);
753 void OnUndo(wxCommandEvent
& event
);
754 void OnRedo(wxCommandEvent
& event
);
755 void OnSelectAll(wxCommandEvent
& event
);
756 void OnProperties(wxCommandEvent
& event
);
757 void OnClear(wxCommandEvent
& event
);
759 void OnUpdateCut(wxUpdateUIEvent
& event
);
760 void OnUpdateCopy(wxUpdateUIEvent
& event
);
761 void OnUpdatePaste(wxUpdateUIEvent
& event
);
762 void OnUpdateUndo(wxUpdateUIEvent
& event
);
763 void OnUpdateRedo(wxUpdateUIEvent
& event
);
764 void OnUpdateSelectAll(wxUpdateUIEvent
& event
);
765 void OnUpdateProperties(wxUpdateUIEvent
& event
);
766 void OnUpdateClear(wxUpdateUIEvent
& event
);
768 // Show a context menu for Rich Edit controls (the standard
769 // EDIT control has one already)
770 void OnContextMenu(wxContextMenuEvent
& event
);
775 void OnPaint(wxPaintEvent
& event
);
776 void OnEraseBackground(wxEraseEvent
& event
);
779 void OnLeftClick(wxMouseEvent
& event
);
782 void OnLeftUp(wxMouseEvent
& event
);
785 void OnMoveMouse(wxMouseEvent
& event
);
787 /// Left-double-click
788 void OnLeftDClick(wxMouseEvent
& event
);
791 void OnMiddleClick(wxMouseEvent
& event
);
794 void OnRightClick(wxMouseEvent
& event
);
797 void OnChar(wxKeyEvent
& event
);
800 void OnSize(wxSizeEvent
& event
);
802 /// Setting/losing focus
803 void OnSetFocus(wxFocusEvent
& event
);
804 void OnKillFocus(wxFocusEvent
& event
);
806 /// Idle-time processing
807 void OnIdle(wxIdleEvent
& event
);
810 void OnScroll(wxScrollWinEvent
& event
);
812 /// Set font, and also default attributes
813 virtual bool SetFont(const wxFont
& font
);
815 /// Set up scrollbars, e.g. after a resize
816 virtual void SetupScrollbars(bool atTop
= false);
818 /// Keyboard navigation
819 virtual bool KeyboardNavigate(int keyCode
, int flags
);
821 /// Paint the background
822 virtual void PaintBackground(wxDC
& dc
);
824 /// Other user defined painting after everything else (i.e. all text) is painted
825 virtual void PaintAboveContent(wxDC
& WXUNUSED(dc
)) {}
827 #if wxRICHTEXT_BUFFERED_PAINTING
828 /// Recreate buffer bitmap if necessary
829 virtual bool RecreateBuffer(const wxSize
& size
= wxDefaultSize
);
833 virtual void DoWriteText(const wxString
& value
, int flags
= 0);
835 /// Should we inherit colours?
836 virtual bool ShouldInheritColours() const { return false; }
838 /// Position the caret
839 virtual void PositionCaret(wxRichTextParagraphLayoutBox
* container
= NULL
);
841 /// Extend the selection, returning true if the selection was
842 /// changed. Selections are in caret positions.
843 virtual bool ExtendSelection(long oldPosition
, long newPosition
, int flags
);
845 /// Scroll into view. This takes a _caret_ position.
846 virtual bool ScrollIntoView(long position
, int keyCode
);
848 /// Refresh the area affected by a selection change
849 bool RefreshForSelectionChange(const wxRichTextSelection
& oldSelection
, const wxRichTextSelection
& newSelection
);
851 /// The caret position is the character position just before the caret.
852 /// A value of -1 means the caret is at the start of the buffer.
853 void SetCaretPosition(long position
, bool showAtLineStart
= false) ;
854 long GetCaretPosition() const { return m_caretPosition
; }
856 /// The adjusted caret position is the character position adjusted to take
857 /// into account whether we're at the start of a paragraph, in which case
858 /// style information should be taken from the next position, not current one.
859 long GetAdjustedCaretPosition(long caretPos
) const;
861 /// Move caret one visual step forward: this may mean setting a flag
862 /// and keeping the same position if we're going from the end of one line
863 /// to the start of the next, which may be the exact same caret position.
864 void MoveCaretForward(long oldPosition
) ;
866 /// Move caret one visual step forward: this may mean setting a flag
867 /// and keeping the same position if we're going from the end of one line
868 /// to the start of the next, which may be the exact same caret position.
869 void MoveCaretBack(long oldPosition
) ;
871 /// Get the caret height and position for the given character position. If container is null,
872 /// the current focus object will be used.
873 bool GetCaretPositionForIndex(long position
, wxRect
& rect
, wxRichTextParagraphLayoutBox
* container
= NULL
);
875 /// Gets the line for the visible caret position. If the caret is
876 /// shown at the very end of the line, it means the next character is actually
877 /// on the following line. So let's get the line we're expecting to find
878 /// if this is the case.
879 wxRichTextLine
* GetVisibleLineForCaretPosition(long caretPosition
) const;
881 /// Gets the command processor
882 wxCommandProcessor
* GetCommandProcessor() const { return GetBuffer().GetCommandProcessor(); }
884 /// Delete content if there is a selection, e.g. when pressing a key.
885 /// Returns the new caret position in newPos, or leaves it if there
887 bool DeleteSelectedContent(long* newPos
= NULL
);
889 /// Transform logical to physical
890 wxPoint
GetPhysicalPoint(const wxPoint
& ptLogical
) const;
892 /// Transform physical to logical
893 wxPoint
GetLogicalPoint(const wxPoint
& ptPhysical
) const;
895 /// Finds the caret position for the next word. Direction
896 /// is 1 (forward) or -1 (backwards).
897 virtual long FindNextWordPosition(int direction
= 1) const;
899 /// Is the given position visible on the screen?
900 bool IsPositionVisible(long pos
) const;
902 /// Returns the first visible position in the current view
903 long GetFirstVisiblePosition() const;
905 /// Returns the caret position since the default formatting was changed. As
906 /// soon as this position changes, we no longer reflect the default style
907 /// in the UI. A value of -2 means that we should only reflect the style of the
908 /// content under the caret.
909 long GetCaretPositionForDefaultStyle() const { return m_caretPositionForDefaultStyle
; }
911 /// Set the caret position for the default style that the user is selecting.
912 void SetCaretPositionForDefaultStyle(long pos
) { m_caretPositionForDefaultStyle
= pos
; }
914 /// Should the UI reflect the default style chosen by the user, rather than the style under
916 bool IsDefaultStyleShowing() const { return m_caretPositionForDefaultStyle
!= -2; }
918 /// Convenience function that tells the control to start reflecting the default
919 /// style, since the user is changing it.
920 void SetAndShowDefaultStyle(const wxRichTextAttr
& attr
)
922 SetDefaultStyle(attr
);
923 SetCaretPositionForDefaultStyle(GetCaretPosition());
926 /// Get the first visible point in the window
927 wxPoint
GetFirstVisiblePoint() const;
931 /// Set up the caret for the given position and container, after a mouse click
932 bool SetCaretPositionAfterClick(wxRichTextParagraphLayoutBox
* container
, long position
, int hitTestFlags
, bool extendSelection
= false);
934 /// Find the caret position for the combination of hit-test flags and character position.
935 /// Returns the caret position and also an indication of where to place the caret (caretLineStart)
936 /// since this is ambiguous (same position used for end of line and start of next).
937 long FindCaretPositionForCharacterPosition(long position
, int hitTestFlags
, wxRichTextParagraphLayoutBox
* container
,
938 bool& caretLineStart
);
940 /// Font names take a long time to retrieve, so cache them (on demand)
941 static const wxArrayString
& GetAvailableFontNames();
942 static void ClearAvailableFontNames();
944 WX_FORWARD_TO_SCROLL_HELPER()
946 // implement wxTextEntry methods
947 virtual wxString
DoGetValue() const;
950 // implement the wxTextEntry pure virtual method
951 virtual wxWindow
*GetEditableWindow() { return this; }
954 virtual bool DoSetMargins(const wxPoint
& pt
);
955 virtual wxPoint
DoGetMargins() const;
957 // FIXME: this does not work, it allows this code to compile but will fail
959 #ifndef __WXUNIVERSAL__
961 virtual WXHWND
GetEditHWND() const { return GetHWND(); }
964 virtual WXWidget
GetTextWidget() const { return NULL
; }
967 virtual GtkEditable
*GetEditable() const { return NULL
; }
968 virtual GtkEntry
*GetEntry() const { return NULL
; }
970 #endif // !__WXUNIVERSAL__
975 virtual wxSize
DoGetBestSize() const ;
977 virtual void DoSetValue(const wxString
& value
, int flags
= 0);
979 virtual void DoThaw();
984 #if wxRICHTEXT_BUFFERED_PAINTING
986 wxBitmap m_bufferBitmap
;
990 wxRichTextBuffer m_buffer
;
992 wxMenu
* m_contextMenu
;
994 /// Caret position (1 less than the character position, so -1 is the
995 /// first caret position).
996 long m_caretPosition
;
998 /// Caret position when the default formatting has been changed. As
999 /// soon as this position changes, we no longer reflect the default style
1001 long m_caretPositionForDefaultStyle
;
1003 /// Selection range in character positions. -2, -2 means no selection.
1004 wxRichTextSelection m_selection
;
1006 wxRichTextCtrlSelectionState m_selectionState
;
1008 /// Anchor so we know how to extend the selection
1009 /// It's a caret position since it's between two characters.
1010 long m_selectionAnchor
;
1012 /// Anchor object if selecting multiple container objects, such as grid cells.
1013 wxRichTextObject
* m_selectionAnchorObject
;
1015 /// Are we editable?
1018 /// Are we showing the caret position at the start of a line
1019 /// instead of at the end of the previous one?
1020 bool m_caretAtLineStart
;
1022 /// Are we dragging a selection?
1025 /// Start position for drag
1026 wxPoint m_dragStart
;
1028 /// Do we need full layout in idle?
1029 bool m_fullLayoutRequired
;
1030 wxLongLong m_fullLayoutTime
;
1031 long m_fullLayoutSavedPosition
;
1033 /// Threshold for doing delayed layout
1034 long m_delayedLayoutThreshold
;
1037 wxCursor m_textCursor
;
1038 wxCursor m_urlCursor
;
1040 static wxArrayString sm_availableFontNames
;
1042 wxRichTextContextMenuPropertiesInfo m_contextMenuPropertiesInfo
;
1044 /// The object that currently has the editing focus
1045 wxRichTextParagraphLayoutBox
* m_focusObject
;
1049 * wxRichTextEvent - the event class for wxRichTextCtrl notifications
1052 class WXDLLIMPEXP_RICHTEXT wxRichTextEvent
: public wxNotifyEvent
1055 wxRichTextEvent(wxEventType commandType
= wxEVT_NULL
, int winid
= 0)
1056 : wxNotifyEvent(commandType
, winid
),
1057 m_flags(0), m_position(-1), m_oldStyleSheet(NULL
), m_newStyleSheet(NULL
),
1058 m_char((wxChar
) 0), m_container(NULL
), m_oldContainer(NULL
)
1061 wxRichTextEvent(const wxRichTextEvent
& event
)
1062 : wxNotifyEvent(event
),
1063 m_flags(event
.m_flags
), m_position(-1),
1064 m_oldStyleSheet(event
.m_oldStyleSheet
), m_newStyleSheet(event
.m_newStyleSheet
),
1065 m_char((wxChar
) 0), m_container(event
.m_container
), m_oldContainer(event
.m_oldContainer
)
1068 long GetPosition() const { return m_position
; }
1069 void SetPosition(long pos
) { m_position
= pos
; }
1071 int GetFlags() const { return m_flags
; }
1072 void SetFlags(int flags
) { m_flags
= flags
; }
1074 wxRichTextStyleSheet
* GetOldStyleSheet() const { return m_oldStyleSheet
; }
1075 void SetOldStyleSheet(wxRichTextStyleSheet
* sheet
) { m_oldStyleSheet
= sheet
; }
1077 wxRichTextStyleSheet
* GetNewStyleSheet() const { return m_newStyleSheet
; }
1078 void SetNewStyleSheet(wxRichTextStyleSheet
* sheet
) { m_newStyleSheet
= sheet
; }
1080 const wxRichTextRange
& GetRange() const { return m_range
; }
1081 void SetRange(const wxRichTextRange
& range
) { m_range
= range
; }
1083 wxChar
GetCharacter() const { return m_char
; }
1084 void SetCharacter(wxChar ch
) { m_char
= ch
; }
1086 wxRichTextParagraphLayoutBox
* GetContainer() const { return m_container
; }
1087 void SetContainer(wxRichTextParagraphLayoutBox
* container
) { m_container
= container
; }
1089 wxRichTextParagraphLayoutBox
* GetOldContainer() const { return m_oldContainer
; }
1090 void SetOldContainer(wxRichTextParagraphLayoutBox
* container
) { m_oldContainer
= container
; }
1092 virtual wxEvent
*Clone() const { return new wxRichTextEvent(*this); }
1097 wxRichTextStyleSheet
* m_oldStyleSheet
;
1098 wxRichTextStyleSheet
* m_newStyleSheet
;
1099 wxRichTextRange m_range
;
1101 wxRichTextParagraphLayoutBox
* m_container
;
1102 wxRichTextParagraphLayoutBox
* m_oldContainer
;
1105 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxRichTextEvent
)
1109 * wxRichTextCtrl events
1111 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT
, wxEVT_COMMAND_RICHTEXT_LEFT_CLICK
, wxRichTextEvent
);
1112 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT
, wxEVT_COMMAND_RICHTEXT_RIGHT_CLICK
, wxRichTextEvent
);
1113 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT
, wxEVT_COMMAND_RICHTEXT_MIDDLE_CLICK
, wxRichTextEvent
);
1114 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT
, wxEVT_COMMAND_RICHTEXT_LEFT_DCLICK
, wxRichTextEvent
);
1115 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT
, wxEVT_COMMAND_RICHTEXT_RETURN
, wxRichTextEvent
);
1116 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT
, wxEVT_COMMAND_RICHTEXT_CHARACTER
, wxRichTextEvent
);
1117 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT
, wxEVT_COMMAND_RICHTEXT_DELETE
, wxRichTextEvent
);
1119 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT
, wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGING
, wxRichTextEvent
);
1120 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT
, wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGED
, wxRichTextEvent
);
1121 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT
, wxEVT_COMMAND_RICHTEXT_STYLESHEET_REPLACING
, wxRichTextEvent
);
1122 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT
, wxEVT_COMMAND_RICHTEXT_STYLESHEET_REPLACED
, wxRichTextEvent
);
1124 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT
, wxEVT_COMMAND_RICHTEXT_CONTENT_INSERTED
, wxRichTextEvent
);
1125 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT
, wxEVT_COMMAND_RICHTEXT_CONTENT_DELETED
, wxRichTextEvent
);
1126 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT
, wxEVT_COMMAND_RICHTEXT_STYLE_CHANGED
, wxRichTextEvent
);
1127 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT
, wxEVT_COMMAND_RICHTEXT_SELECTION_CHANGED
, wxRichTextEvent
);
1128 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT
, wxEVT_COMMAND_RICHTEXT_BUFFER_RESET
, wxRichTextEvent
);
1129 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT
, wxEVT_COMMAND_RICHTEXT_FOCUS_OBJECT_CHANGED
, wxRichTextEvent
);
1131 typedef void (wxEvtHandler::*wxRichTextEventFunction
)(wxRichTextEvent
&);
1133 #define wxRichTextEventHandler(func) \
1134 wxEVENT_HANDLER_CAST(wxRichTextEventFunction, func)
1136 #define EVT_RICHTEXT_LEFT_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_LEFT_CLICK, id, -1, wxRichTextEventHandler( fn ), NULL ),
1137 #define EVT_RICHTEXT_RIGHT_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_RIGHT_CLICK, id, -1, wxRichTextEventHandler( fn ), NULL ),
1138 #define EVT_RICHTEXT_MIDDLE_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_MIDDLE_CLICK, id, -1, wxRichTextEventHandler( fn ), NULL ),
1139 #define EVT_RICHTEXT_LEFT_DCLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_LEFT_DCLICK, id, -1, wxRichTextEventHandler( fn ), NULL ),
1140 #define EVT_RICHTEXT_RETURN(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_RETURN, id, -1, wxRichTextEventHandler( fn ), NULL ),
1141 #define EVT_RICHTEXT_CHARACTER(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_CHARACTER, id, -1, wxRichTextEventHandler( fn ), NULL ),
1142 #define EVT_RICHTEXT_DELETE(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_DELETE, id, -1, wxRichTextEventHandler( fn ), NULL ),
1144 #define EVT_RICHTEXT_STYLESHEET_CHANGING(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGING, id, -1, wxRichTextEventHandler( fn ), NULL ),
1145 #define EVT_RICHTEXT_STYLESHEET_CHANGED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGED, id, -1, wxRichTextEventHandler( fn ), NULL ),
1146 #define EVT_RICHTEXT_STYLESHEET_REPLACING(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_STYLESHEET_REPLACING, id, -1, wxRichTextEventHandler( fn ), NULL ),
1147 #define EVT_RICHTEXT_STYLESHEET_REPLACED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_STYLESHEET_REPLACED, id, -1, wxRichTextEventHandler( fn ), NULL ),
1149 #define EVT_RICHTEXT_CONTENT_INSERTED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_CONTENT_INSERTED, id, -1, wxRichTextEventHandler( fn ), NULL ),
1150 #define EVT_RICHTEXT_CONTENT_DELETED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_CONTENT_DELETED, id, -1, wxRichTextEventHandler( fn ), NULL ),
1151 #define EVT_RICHTEXT_STYLE_CHANGED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_STYLE_CHANGED, id, -1, wxRichTextEventHandler( fn ), NULL ),
1152 #define EVT_RICHTEXT_SELECTION_CHANGED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_SELECTION_CHANGED, id, -1, wxRichTextEventHandler( fn ), NULL ),
1153 #define EVT_RICHTEXT_BUFFER_RESET(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_BUFFER_RESET, id, -1, wxRichTextEventHandler( fn ), NULL ),
1159 // _WX_RICHTEXTCTRL_H_