]> git.saurik.com Git - wxWidgets.git/blob - include/wx/richtext/richtextctrl.h
Compile fixes
[wxWidgets.git] / include / wx / richtext / richtextctrl.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/richtext/richtextctrl.h
3 // Purpose: A rich edit control
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_RICHTEXTCTRL_H_
13 #define _WX_RICHTEXTCTRL_H_
14
15 #include "wx/richtext/richtextbuffer.h"
16
17 #if wxUSE_RICHTEXT
18
19 #include "wx/scrolwin.h"
20 #include "wx/caret.h"
21
22 #include "wx/textctrl.h"
23
24 #if !defined(__WXGTK__) && !defined(__WXMAC__)
25 #define wxRICHTEXT_BUFFERED_PAINTING 1
26 #else
27 #define wxRICHTEXT_BUFFERED_PAINTING 0
28 #endif
29
30 class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextStyleDefinition;
31
32 /*!
33 * Styles and flags
34 */
35
36 /* Styles
37 */
38
39 #define wxRE_READONLY 0x0010
40 #define wxRE_MULTILINE 0x0020
41 #define wxRE_CENTRE_CARET 0x8000
42 #define wxRE_CENTER_CARET wxRE_CENTRE_CARET
43
44 /* Flags
45 */
46
47 #define wxRICHTEXT_SHIFT_DOWN 0x01
48 #define wxRICHTEXT_CTRL_DOWN 0x02
49 #define wxRICHTEXT_ALT_DOWN 0x04
50
51 /* Extra flags
52 */
53
54 // Don't draw guide lines around boxes and tables
55 #define wxRICHTEXT_EX_NO_GUIDELINES 0x00000100
56
57
58 /* Defaults
59 */
60
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
75
76 /* Identifiers
77 */
78 #define wxID_RICHTEXT_PROPERTIES1 (wxID_HIGHEST + 1)
79 #define wxID_RICHTEXT_PROPERTIES2 (wxID_HIGHEST + 2)
80 #define wxID_RICHTEXT_PROPERTIES3 (wxID_HIGHEST + 3)
81
82 /*!
83 * Forward declarations
84 */
85
86 #if 0
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
94 #endif
95
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
100 {
101 wxRichTextCtrlSelectionState_Normal,
102 wxRichTextCtrlSelectionState_CommonAncestor
103 };
104
105 /*!
106 * wxRichTextContextMenuPropertiesInfo keeps track of objects that appear in the context menu,
107 * whose properties are available to be edited.
108 */
109
110 class WXDLLIMPEXP_RICHTEXT wxRichTextContextMenuPropertiesInfo
111 {
112 public:
113 wxRichTextContextMenuPropertiesInfo() { Init(); }
114
115 // Operations
116
117 /// Initialisation
118 void Init() {}
119
120 /// Add an item
121 bool AddItem(const wxString& label, wxRichTextObject* obj);
122
123 /// Returns number of menu items were added.
124 int AddMenuItems(wxMenu* menu, int startCmd = wxID_RICHTEXT_PROPERTIES1) const;
125
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);
129
130 /// Clear the items
131 void Clear() { m_objects.Clear(); m_labels.Clear(); }
132
133 // Accessors
134 /// Gets the nth label
135 wxString GetLabel(int n) const { return m_labels[n]; }
136
137 /// Gets the nth object
138 wxRichTextObject* GetObject(int n) const { return m_objects[n]; }
139
140 /// Get objects
141 wxRichTextObjectPtrArray& GetObjects() { return m_objects; }
142 const wxRichTextObjectPtrArray& GetObjects() const { return m_objects; }
143
144 /// Get labels
145 wxArrayString& GetLabels() { return m_labels; }
146 const wxArrayString& GetLabels() const { return m_labels; }
147
148 /// Get number of items
149 int GetCount() const { return m_objects.GetCount(); }
150
151 //wxArrayInt m_ids;
152 wxRichTextObjectPtrArray m_objects;
153 wxArrayString m_labels;
154 };
155
156 /*!
157 * wxRichTextCtrl class declaration
158 */
159
160 class WXDLLIMPEXP_RICHTEXT wxRichTextCtrl : public wxControl,
161 public wxTextCtrlIface,
162 public wxScrollHelper
163 {
164 DECLARE_CLASS( wxRichTextCtrl )
165 DECLARE_EVENT_TABLE()
166
167 public:
168 // Constructors
169
170 wxRichTextCtrl( );
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);
173
174 virtual ~wxRichTextCtrl( );
175
176 // Operations
177
178 /// Creation
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 );
181
182 /// Member initialisation
183 void Init();
184
185 ///// wxTextCtrl compatibility
186
187 // Accessors
188
189 virtual wxString GetRange(long from, long to) const;
190
191 virtual int GetLineLength(long lineNo) const ;
192 virtual wxString GetLineText(long lineNo) const ;
193 virtual int GetNumberOfLines() const ;
194
195 virtual bool IsModified() const ;
196 virtual bool IsEditable() const ;
197
198 // more readable flag testing methods
199 bool IsSingleLine() const { return !HasFlag(wxRE_MULTILINE); }
200 bool IsMultiLine() const { return !IsSingleLine(); }
201
202 // If the return values from and to are the same, there is no selection.
203 virtual void GetSelection(long* from, long* to) const;
204
205 virtual wxString GetStringSelection() const;
206
207 const wxRichTextSelection& GetSelection() const { return m_selection; }
208 wxRichTextSelection& GetSelection() { return m_selection; }
209 void SetSelection(const wxRichTextSelection& sel) { m_selection = sel; }
210
211
212 /// Get filename
213 wxString GetFilename() const { return m_filename; }
214
215 /// Set filename
216 void SetFilename(const wxString& filename) { m_filename = filename; }
217
218 /// Set the threshold in character positions for doing layout optimization during sizing
219 void SetDelayedLayoutThreshold(long threshold) { m_delayedLayoutThreshold = threshold; }
220
221 /// Get the threshold in character positions for doing layout optimization during sizing
222 long GetDelayedLayoutThreshold() const { return m_delayedLayoutThreshold; }
223
224 /// Set text cursor
225 void SetTextCursor(const wxCursor& cursor ) { m_textCursor = cursor; }
226
227 /// Get text cursor
228 wxCursor GetTextCursor() const { return m_textCursor; }
229
230 /// Set URL cursor
231 void SetURLCursor(const wxCursor& cursor ) { m_urlCursor = cursor; }
232
233 /// Get URL cursor
234 wxCursor GetURLCursor() const { return m_urlCursor; }
235
236 /// Are we showing the caret position at the start of a line
237 /// instead of at the end of the previous one?
238 bool GetCaretAtLineStart() const { return m_caretAtLineStart; }
239 void SetCaretAtLineStart(bool atStart) { m_caretAtLineStart = atStart; }
240
241 /// Are we dragging a selection?
242 bool GetDragging() const { return m_dragging; }
243 void SetDragging(bool dragging) { m_dragging = dragging; }
244
245 /// Get/set drag start position
246 const wxPoint& GetDragStart() const { return m_dragStart; }
247 void SetDragStart(const wxPoint& pt) { m_dragStart = pt; }
248
249 #if wxRICHTEXT_BUFFERED_PAINTING
250 /// Get the buffer bitmap
251 const wxBitmap& GetBufferBitmap() const { return m_bufferBitmap; }
252 wxBitmap& GetBufferBitmap() { return m_bufferBitmap; }
253 #endif
254
255 /// Get/set context menu
256 wxMenu* GetContextMenu() const { return m_contextMenu; }
257 void SetContextMenu(wxMenu* menu);
258
259 /// Anchor so we know how to extend the selection
260 /// It's a caret position since it's between two characters.
261 long GetSelectionAnchor() const { return m_selectionAnchor; }
262 void SetSelectionAnchor(long anchor) { m_selectionAnchor = anchor; }
263
264 /// Anchor object if selecting multiple containers.
265 wxRichTextObject* GetSelectionAnchorObject() const { return m_selectionAnchorObject; }
266 void SetSelectionAnchorObject(wxRichTextObject* anchor) { m_selectionAnchorObject = anchor; }
267
268 wxRichTextContextMenuPropertiesInfo& GetContextMenuPropertiesInfo() { return m_contextMenuPropertiesInfo; }
269 const wxRichTextContextMenuPropertiesInfo& GetContextMenuPropertiesInfo() const { return m_contextMenuPropertiesInfo; }
270
271 /// The wxRichTextObject object that currently has the editing focus
272 wxRichTextParagraphLayoutBox* GetFocusObject() const { return m_focusObject; }
273 bool SetFocusObject(wxRichTextParagraphLayoutBox* obj, bool setCaretPosition = true);
274
275 // Operations
276
277 void Invalidate() { GetBuffer().Invalidate(wxRICHTEXT_ALL); }
278
279 // editing
280 virtual void Clear();
281 virtual void Replace(long from, long to, const wxString& value);
282 virtual void Remove(long from, long to);
283
284 // load/save the controls contents from/to the file
285 virtual bool DoLoadFile(const wxString& file, int fileType);
286 virtual bool DoSaveFile(const wxString& file = wxEmptyString,
287 int fileType = wxRICHTEXT_TYPE_ANY);
288
289 /// Set the handler flags, controlling loading and saving
290 void SetHandlerFlags(int flags) { GetBuffer().SetHandlerFlags(flags); }
291
292 /// Get the handler flags, controlling loading and saving
293 int GetHandlerFlags() const { return GetBuffer().GetHandlerFlags(); }
294
295 // sets/clears the dirty flag
296 virtual void MarkDirty();
297 virtual void DiscardEdits();
298
299 // set the max number of characters which may be entered in a single line
300 // text control
301 virtual void SetMaxLength(unsigned long WXUNUSED(len)) { }
302
303 // writing text inserts it at the current position, appending always
304 // inserts it at the end
305 virtual void WriteText(const wxString& text);
306 virtual void AppendText(const wxString& text);
307
308 // text control under some platforms supports the text styles: these
309 // methods allow to apply the given text style to the given selection or to
310 // set/get the style which will be used for all appended text
311 virtual bool SetStyle(long start, long end, const wxTextAttr& style);
312 virtual bool SetStyle(long start, long end, const wxRichTextAttr& style);
313 virtual bool SetStyle(const wxRichTextRange& range, const wxTextAttr& style);
314 virtual bool SetStyle(const wxRichTextRange& range, const wxRichTextAttr& style);
315 virtual bool GetStyle(long position, wxTextAttr& style);
316 virtual bool GetStyle(long position, wxRichTextAttr& style);
317 virtual bool GetStyle(long position, wxRichTextAttr& style, wxRichTextParagraphLayoutBox* container);
318
319 // Set the style for a single object
320 virtual void SetStyle(wxRichTextObject *obj, const wxRichTextAttr& textAttr);
321
322 // get the common set of styles for the range
323 virtual bool GetStyleForRange(const wxRichTextRange& range, wxTextAttr& style);
324 virtual bool GetStyleForRange(const wxRichTextRange& range, wxRichTextAttr& style);
325 virtual bool GetStyleForRange(const wxRichTextRange& range, wxRichTextAttr& style, wxRichTextParagraphLayoutBox* container);
326 // extended style setting operation with flags including:
327 // wxRICHTEXT_SETSTYLE_WITH_UNDO, wxRICHTEXT_SETSTYLE_OPTIMIZE, wxRICHTEXT_SETSTYLE_PARAGRAPHS_ONLY, wxRICHTEXT_SETSTYLE_CHARACTERS_ONLY
328 // see richtextbuffer.h for more details.
329 virtual bool SetStyleEx(const wxRichTextRange& range, const wxRichTextAttr& style, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO);
330
331 /// Get the content (uncombined) attributes for this position.
332 virtual bool GetUncombinedStyle(long position, wxRichTextAttr& style);
333 virtual bool GetUncombinedStyle(long position, wxRichTextAttr& style, wxRichTextParagraphLayoutBox* container);
334
335 virtual bool SetDefaultStyle(const wxTextAttr& style);
336 virtual bool SetDefaultStyle(const wxRichTextAttr& style);
337
338 virtual const wxRichTextAttr& GetDefaultStyleEx() const;
339
340 //virtual const wxTextAttr& GetDefaultStyle() const;
341
342 /// Set list style
343 virtual bool SetListStyle(const wxRichTextRange& range, wxRichTextListStyleDefinition* def, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1);
344 virtual bool SetListStyle(const wxRichTextRange& range, const wxString& defName, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1);
345
346 /// Clear list for given range
347 virtual bool ClearListStyle(const wxRichTextRange& range, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO);
348
349 /// Number/renumber any list elements in the given range
350 /// def/defName can be NULL/empty to indicate that the existing list style should be used.
351 virtual bool NumberList(const wxRichTextRange& range, wxRichTextListStyleDefinition* def = NULL, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1);
352 virtual bool NumberList(const wxRichTextRange& range, const wxString& defName, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1);
353
354 /// Promote the list items within the given range. promoteBy can be a positive or negative number, e.g. 1 or -1
355 /// def/defName can be NULL/empty to indicate that the existing list style should be used.
356 virtual bool PromoteList(int promoteBy, const wxRichTextRange& range, wxRichTextListStyleDefinition* def = NULL, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int specifiedLevel = -1);
357 virtual bool PromoteList(int promoteBy, const wxRichTextRange& range, const wxString& defName, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int specifiedLevel = -1);
358
359 /// Deletes the content in the given range
360 virtual bool Delete(const wxRichTextRange& range);
361
362 // translate between the position (which is just an index in the text ctrl
363 // considering all its contents as a single strings) and (x, y) coordinates
364 // which represent column and line.
365 virtual long XYToPosition(long x, long y) const;
366 virtual bool PositionToXY(long pos, long *x, long *y) const;
367
368 virtual void ShowPosition(long pos);
369
370 // find the character at position given in pixels
371 //
372 // NB: pt is in device coords (not adjusted for the client area origin nor
373 // scrolling)
374 virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, long *pos) const;
375 virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt,
376 wxTextCoord *col,
377 wxTextCoord *row) const;
378
379 // Clipboard operations
380 virtual void Copy();
381 virtual void Cut();
382 virtual void Paste();
383 virtual void DeleteSelection();
384
385 virtual bool CanCopy() const;
386 virtual bool CanCut() const;
387 virtual bool CanPaste() const;
388 virtual bool CanDeleteSelection() const;
389
390 // Undo/redo
391 virtual void Undo();
392 virtual void Redo();
393
394 virtual bool CanUndo() const;
395 virtual bool CanRedo() const;
396
397 // Insertion point
398 virtual void SetInsertionPoint(long pos);
399 virtual void SetInsertionPointEnd();
400 virtual long GetInsertionPoint() const;
401 virtual wxTextPos GetLastPosition() const;
402
403 virtual void SetSelection(long from, long to);
404 virtual void SelectAll();
405 virtual void SetEditable(bool editable);
406
407 /// Returns true if there was a selection and the object containing the selection
408 /// was the same as the current focus object.
409 virtual bool HasSelection() const;
410
411 /// Returns true if there was a selection, whether or not the current focus object
412 /// is the same as the selection's container object.
413 virtual bool HasUnfocusedSelection() const;
414
415 ///// Functionality specific to wxRichTextCtrl
416
417 /// Write an image at the current insertion point. Supply optional type to use
418 /// for internal and file storage of the raw data.
419 virtual bool WriteImage(const wxImage& image, wxBitmapType bitmapType = wxBITMAP_TYPE_PNG,
420 const wxRichTextAttr& textAttr = wxRichTextAttr());
421
422 /// Write a bitmap at the current insertion point. Supply optional type to use
423 /// for internal and file storage of the raw data.
424 virtual bool WriteImage(const wxBitmap& bitmap, wxBitmapType bitmapType = wxBITMAP_TYPE_PNG,
425 const wxRichTextAttr& textAttr = wxRichTextAttr());
426
427 /// Load an image from file and write at the current insertion point.
428 virtual bool WriteImage(const wxString& filename, wxBitmapType bitmapType,
429 const wxRichTextAttr& textAttr = wxRichTextAttr());
430
431 /// Write an image block at the current insertion point.
432 virtual bool WriteImage(const wxRichTextImageBlock& imageBlock,
433 const wxRichTextAttr& textAttr = wxRichTextAttr());
434
435 /// Write a text box at the current insertion point, returning the text box.
436 /// You can then call SetFocusObject() to set the focus to the new object.
437 virtual wxRichTextBox* WriteTextBox(const wxRichTextAttr& textAttr = wxRichTextAttr());
438
439 /// Write a table at the current insertion point, returning the table.
440 /// You can then call SetFocusObject() to set the focus to the new object.
441 virtual wxRichTextTable* WriteTable(int rows, int cols, const wxRichTextAttr& tableAttr = wxRichTextAttr(), const wxRichTextAttr& cellAttr = wxRichTextAttr());
442
443 /// Insert a newline (actually paragraph) at the current insertion point.
444 virtual bool Newline();
445
446 /// Insert a line break at the current insertion point.
447 virtual bool LineBreak();
448
449 /// Set basic (overall) style
450 virtual void SetBasicStyle(const wxRichTextAttr& style) { GetBuffer().SetBasicStyle(style); }
451
452 /// Get basic (overall) style
453 virtual const wxRichTextAttr& GetBasicStyle() const { return GetBuffer().GetBasicStyle(); }
454
455 virtual bool BeginStyle(const wxRichTextAttr& style) { return GetBuffer().BeginStyle(style); }
456
457 /// End the style
458 virtual bool EndStyle() { return GetBuffer().EndStyle(); }
459
460 /// End all styles
461 virtual bool EndAllStyles() { return GetBuffer().EndAllStyles(); }
462
463 /// Begin using bold
464 bool BeginBold() { return GetBuffer().BeginBold(); }
465
466 /// End using bold
467 bool EndBold() { return GetBuffer().EndBold(); }
468
469 /// Begin using italic
470 bool BeginItalic() { return GetBuffer().BeginItalic(); }
471
472 /// End using italic
473 bool EndItalic() { return GetBuffer().EndItalic(); }
474
475 /// Begin using underline
476 bool BeginUnderline() { return GetBuffer().BeginUnderline(); }
477
478 /// End using underline
479 bool EndUnderline() { return GetBuffer().EndUnderline(); }
480
481 /// Begin using point size
482 bool BeginFontSize(int pointSize) { return GetBuffer().BeginFontSize(pointSize); }
483
484 /// End using point size
485 bool EndFontSize() { return GetBuffer().EndFontSize(); }
486
487 /// Begin using this font
488 bool BeginFont(const wxFont& font) { return GetBuffer().BeginFont(font); }
489
490 /// End using a font
491 bool EndFont() { return GetBuffer().EndFont(); }
492
493 /// Begin using this colour
494 bool BeginTextColour(const wxColour& colour) { return GetBuffer().BeginTextColour(colour); }
495
496 /// End using a colour
497 bool EndTextColour() { return GetBuffer().EndTextColour(); }
498
499 /// Begin using alignment
500 bool BeginAlignment(wxTextAttrAlignment alignment) { return GetBuffer().BeginAlignment(alignment); }
501
502 /// End alignment
503 bool EndAlignment() { return GetBuffer().EndAlignment(); }
504
505 /// Begin left indent
506 bool BeginLeftIndent(int leftIndent, int leftSubIndent = 0) { return GetBuffer().BeginLeftIndent(leftIndent, leftSubIndent); }
507
508 /// End left indent
509 bool EndLeftIndent() { return GetBuffer().EndLeftIndent(); }
510
511 /// Begin right indent
512 bool BeginRightIndent(int rightIndent) { return GetBuffer().BeginRightIndent(rightIndent); }
513
514 /// End right indent
515 bool EndRightIndent() { return GetBuffer().EndRightIndent(); }
516
517 /// Begin paragraph spacing
518 bool BeginParagraphSpacing(int before, int after) { return GetBuffer().BeginParagraphSpacing(before, after); }
519
520 /// End paragraph spacing
521 bool EndParagraphSpacing() { return GetBuffer().EndParagraphSpacing(); }
522
523 /// Begin line spacing
524 bool BeginLineSpacing(int lineSpacing) { return GetBuffer().BeginLineSpacing(lineSpacing); }
525
526 /// End line spacing
527 bool EndLineSpacing() { return GetBuffer().EndLineSpacing(); }
528
529 /// Begin numbered bullet
530 bool BeginNumberedBullet(int bulletNumber, int leftIndent, int leftSubIndent, int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_ARABIC|wxTEXT_ATTR_BULLET_STYLE_PERIOD)
531 { return GetBuffer().BeginNumberedBullet(bulletNumber, leftIndent, leftSubIndent, bulletStyle); }
532
533 /// End numbered bullet
534 bool EndNumberedBullet() { return GetBuffer().EndNumberedBullet(); }
535
536 /// Begin symbol bullet
537 bool BeginSymbolBullet(const wxString& symbol, int leftIndent, int leftSubIndent, int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_SYMBOL)
538 { return GetBuffer().BeginSymbolBullet(symbol, leftIndent, leftSubIndent, bulletStyle); }
539
540 /// End symbol bullet
541 bool EndSymbolBullet() { return GetBuffer().EndSymbolBullet(); }
542
543 /// Begin standard bullet
544 bool BeginStandardBullet(const wxString& bulletName, int leftIndent, int leftSubIndent, int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_STANDARD)
545 { return GetBuffer().BeginStandardBullet(bulletName, leftIndent, leftSubIndent, bulletStyle); }
546
547 /// End standard bullet
548 bool EndStandardBullet() { return GetBuffer().EndStandardBullet(); }
549
550 /// Begin named character style
551 bool BeginCharacterStyle(const wxString& characterStyle) { return GetBuffer().BeginCharacterStyle(characterStyle); }
552
553 /// End named character style
554 bool EndCharacterStyle() { return GetBuffer().EndCharacterStyle(); }
555
556 /// Begin named paragraph style
557 bool BeginParagraphStyle(const wxString& paragraphStyle) { return GetBuffer().BeginParagraphStyle(paragraphStyle); }
558
559 /// End named character style
560 bool EndParagraphStyle() { return GetBuffer().EndParagraphStyle(); }
561
562 /// Begin named list style
563 bool BeginListStyle(const wxString& listStyle, int level = 1, int number = 1) { return GetBuffer().BeginListStyle(listStyle, level, number); }
564
565 /// End named character style
566 bool EndListStyle() { return GetBuffer().EndListStyle(); }
567
568 /// Begin URL
569 bool BeginURL(const wxString& url, const wxString& characterStyle = wxEmptyString) { return GetBuffer().BeginURL(url, characterStyle); }
570
571 /// End URL
572 bool EndURL() { return GetBuffer().EndURL(); }
573
574 /// Sets the default style to the style under the cursor
575 bool SetDefaultStyleToCursorStyle();
576
577 /// Clear the selection
578 virtual void SelectNone();
579
580 /// Select the word at the given character position
581 virtual bool SelectWord(long position);
582
583 /// Get/set the selection range in character positions. -1, -1 means no selection.
584 /// The range is in API convention, i.e. a single character selection is denoted
585 /// by (n, n+1)
586 wxRichTextRange GetSelectionRange() const;
587 void SetSelectionRange(const wxRichTextRange& range);
588
589 /// Get/set the selection range in character positions. -2, -2 means no selection
590 /// -1, -1 means select everything.
591 /// The range is in internal format, i.e. a single character selection is denoted
592 /// by (n, n)
593 wxRichTextRange GetInternalSelectionRange() const { return m_selection.GetRange(); }
594 void SetInternalSelectionRange(const wxRichTextRange& range) { m_selection.Set(range, GetFocusObject()); }
595
596 /// Add a new paragraph of text to the end of the buffer
597 virtual wxRichTextRange AddParagraph(const wxString& text);
598
599 /// Add an image
600 virtual wxRichTextRange AddImage(const wxImage& image);
601
602 /// Layout the buffer: which we must do before certain operations, such as
603 /// setting the caret position.
604 virtual bool LayoutContent(bool onlyVisibleRect = false);
605
606 /// Move the caret to the given character position
607 virtual bool MoveCaret(long pos, bool showAtLineStart = false, wxRichTextParagraphLayoutBox* container = NULL);
608
609 /// Move right
610 virtual bool MoveRight(int noPositions = 1, int flags = 0);
611
612 /// Move left
613 virtual bool MoveLeft(int noPositions = 1, int flags = 0);
614
615 /// Move up
616 virtual bool MoveUp(int noLines = 1, int flags = 0);
617
618 /// Move up
619 virtual bool MoveDown(int noLines = 1, int flags = 0);
620
621 /// Move to the end of the line
622 virtual bool MoveToLineEnd(int flags = 0);
623
624 /// Move to the start of the line
625 virtual bool MoveToLineStart(int flags = 0);
626
627 /// Move to the end of the paragraph
628 virtual bool MoveToParagraphEnd(int flags = 0);
629
630 /// Move to the start of the paragraph
631 virtual bool MoveToParagraphStart(int flags = 0);
632
633 /// Move to the start of the buffer
634 virtual bool MoveHome(int flags = 0);
635
636 /// Move to the end of the buffer
637 virtual bool MoveEnd(int flags = 0);
638
639 /// Move n pages up
640 virtual bool PageUp(int noPages = 1, int flags = 0);
641
642 /// Move n pages down
643 virtual bool PageDown(int noPages = 1, int flags = 0);
644
645 /// Move n words left
646 virtual bool WordLeft(int noPages = 1, int flags = 0);
647
648 /// Move n words right
649 virtual bool WordRight(int noPages = 1, int flags = 0);
650
651 /// Returns the buffer associated with the control.
652 wxRichTextBuffer& GetBuffer() { return m_buffer; }
653 const wxRichTextBuffer& GetBuffer() const { return m_buffer; }
654
655 /// Start batching undo history for commands.
656 virtual bool BeginBatchUndo(const wxString& cmdName) { return m_buffer.BeginBatchUndo(cmdName); }
657
658 /// End batching undo history for commands.
659 virtual bool EndBatchUndo() { return m_buffer.EndBatchUndo(); }
660
661 /// Are we batching undo history for commands?
662 virtual bool BatchingUndo() const { return m_buffer.BatchingUndo(); }
663
664 /// Start suppressing undo history for commands.
665 virtual bool BeginSuppressUndo() { return m_buffer.BeginSuppressUndo(); }
666
667 /// End suppressing undo history for commands.
668 virtual bool EndSuppressUndo() { return m_buffer.EndSuppressUndo(); }
669
670 /// Are we suppressing undo history for commands?
671 virtual bool SuppressingUndo() const { return m_buffer.SuppressingUndo(); }
672
673 /// Test if this whole range has character attributes of the specified kind. If any
674 /// of the attributes are different within the range, the test fails. You
675 /// can use this to implement, for example, bold button updating. style must have
676 /// flags indicating which attributes are of interest.
677 virtual bool HasCharacterAttributes(const wxRichTextRange& range, const wxRichTextAttr& style) const
678 {
679 return GetBuffer().HasCharacterAttributes(range.ToInternal(), style);
680 }
681
682 /// Test if this whole range has paragraph attributes of the specified kind. If any
683 /// of the attributes are different within the range, the test fails. You
684 /// can use this to implement, for example, centering button updating. style must have
685 /// flags indicating which attributes are of interest.
686 virtual bool HasParagraphAttributes(const wxRichTextRange& range, const wxRichTextAttr& style) const
687 {
688 return GetBuffer().HasParagraphAttributes(range.ToInternal(), style);
689 }
690
691 /// Is all of the selection bold?
692 virtual bool IsSelectionBold();
693
694 /// Is all of the selection italics?
695 virtual bool IsSelectionItalics();
696
697 /// Is all of the selection underlined?
698 virtual bool IsSelectionUnderlined();
699
700 /// Is all of the selection aligned according to the specified flag?
701 virtual bool IsSelectionAligned(wxTextAttrAlignment alignment);
702
703 /// Apply bold to the selection
704 virtual bool ApplyBoldToSelection();
705
706 /// Apply italic to the selection
707 virtual bool ApplyItalicToSelection();
708
709 /// Apply underline to the selection
710 virtual bool ApplyUnderlineToSelection();
711
712 /// Apply alignment to the selection
713 virtual bool ApplyAlignmentToSelection(wxTextAttrAlignment alignment);
714
715 /// Apply a named style to the selection
716 virtual bool ApplyStyle(wxRichTextStyleDefinition* def);
717
718 /// Set style sheet, if any
719 void SetStyleSheet(wxRichTextStyleSheet* styleSheet) { GetBuffer().SetStyleSheet(styleSheet); }
720 wxRichTextStyleSheet* GetStyleSheet() const { return GetBuffer().GetStyleSheet(); }
721
722 /// Push style sheet to top of stack
723 bool PushStyleSheet(wxRichTextStyleSheet* styleSheet) { return GetBuffer().PushStyleSheet(styleSheet); }
724
725 /// Pop style sheet from top of stack
726 wxRichTextStyleSheet* PopStyleSheet() { return GetBuffer().PopStyleSheet(); }
727
728 /// Apply the style sheet to the buffer, for example if the styles have changed.
729 bool ApplyStyleSheet(wxRichTextStyleSheet* styleSheet = NULL);
730
731 // Command handlers
732
733 void Command(wxCommandEvent& event);
734 void OnDropFiles(wxDropFilesEvent& event);
735 void OnCaptureLost(wxMouseCaptureLostEvent& event);
736 void OnSysColourChanged(wxSysColourChangedEvent& event);
737
738 void OnCut(wxCommandEvent& event);
739 void OnCopy(wxCommandEvent& event);
740 void OnPaste(wxCommandEvent& event);
741 void OnUndo(wxCommandEvent& event);
742 void OnRedo(wxCommandEvent& event);
743 void OnSelectAll(wxCommandEvent& event);
744 void OnProperties(wxCommandEvent& event);
745 void OnClear(wxCommandEvent& event);
746
747 void OnUpdateCut(wxUpdateUIEvent& event);
748 void OnUpdateCopy(wxUpdateUIEvent& event);
749 void OnUpdatePaste(wxUpdateUIEvent& event);
750 void OnUpdateUndo(wxUpdateUIEvent& event);
751 void OnUpdateRedo(wxUpdateUIEvent& event);
752 void OnUpdateSelectAll(wxUpdateUIEvent& event);
753 void OnUpdateProperties(wxUpdateUIEvent& event);
754 void OnUpdateClear(wxUpdateUIEvent& event);
755
756 // Show a context menu for Rich Edit controls (the standard
757 // EDIT control has one already)
758 void OnContextMenu(wxContextMenuEvent& event);
759
760 // Event handlers
761
762 /// Painting
763 void OnPaint(wxPaintEvent& event);
764 void OnEraseBackground(wxEraseEvent& event);
765
766 /// Left-click
767 void OnLeftClick(wxMouseEvent& event);
768
769 /// Left-up
770 void OnLeftUp(wxMouseEvent& event);
771
772 /// Motion
773 void OnMoveMouse(wxMouseEvent& event);
774
775 /// Left-double-click
776 void OnLeftDClick(wxMouseEvent& event);
777
778 /// Middle-click
779 void OnMiddleClick(wxMouseEvent& event);
780
781 /// Right-click
782 void OnRightClick(wxMouseEvent& event);
783
784 /// Key press
785 void OnChar(wxKeyEvent& event);
786
787 /// Sizing
788 void OnSize(wxSizeEvent& event);
789
790 /// Setting/losing focus
791 void OnSetFocus(wxFocusEvent& event);
792 void OnKillFocus(wxFocusEvent& event);
793
794 /// Idle-time processing
795 void OnIdle(wxIdleEvent& event);
796
797 /// Scrolling
798 void OnScroll(wxScrollWinEvent& event);
799
800 /// Set font, and also default attributes
801 virtual bool SetFont(const wxFont& font);
802
803 /// Set up scrollbars, e.g. after a resize
804 virtual void SetupScrollbars(bool atTop = false);
805
806 /// Keyboard navigation
807 virtual bool KeyboardNavigate(int keyCode, int flags);
808
809 /// Paint the background
810 virtual void PaintBackground(wxDC& dc);
811
812 /// Other user defined painting after everything else (i.e. all text) is painted
813 virtual void PaintAboveContent(wxDC& WXUNUSED(dc)) {}
814
815 #if wxRICHTEXT_BUFFERED_PAINTING
816 /// Recreate buffer bitmap if necessary
817 virtual bool RecreateBuffer(const wxSize& size = wxDefaultSize);
818 #endif
819
820 /// Write text
821 virtual void DoWriteText(const wxString& value, int flags = 0);
822
823 /// Should we inherit colours?
824 virtual bool ShouldInheritColours() const { return false; }
825
826 /// Position the caret
827 virtual void PositionCaret(wxRichTextParagraphLayoutBox* container = NULL);
828
829 /// Extend the selection, returning true if the selection was
830 /// changed. Selections are in caret positions.
831 virtual bool ExtendSelection(long oldPosition, long newPosition, int flags);
832
833 /// Scroll into view. This takes a _caret_ position.
834 virtual bool ScrollIntoView(long position, int keyCode);
835
836 /// Refresh the area affected by a selection change
837 bool RefreshForSelectionChange(const wxRichTextSelection& oldSelection, const wxRichTextSelection& newSelection);
838
839 /// The caret position is the character position just before the caret.
840 /// A value of -1 means the caret is at the start of the buffer.
841 void SetCaretPosition(long position, bool showAtLineStart = false) ;
842 long GetCaretPosition() const { return m_caretPosition; }
843
844 /// The adjusted caret position is the character position adjusted to take
845 /// into account whether we're at the start of a paragraph, in which case
846 /// style information should be taken from the next position, not current one.
847 long GetAdjustedCaretPosition(long caretPos) const;
848
849 /// Move caret one visual step forward: this may mean setting a flag
850 /// and keeping the same position if we're going from the end of one line
851 /// to the start of the next, which may be the exact same caret position.
852 void MoveCaretForward(long oldPosition) ;
853
854 /// Move caret one visual step forward: this may mean setting a flag
855 /// and keeping the same position if we're going from the end of one line
856 /// to the start of the next, which may be the exact same caret position.
857 void MoveCaretBack(long oldPosition) ;
858
859 /// Get the caret height and position for the given character position. If container is null,
860 /// the current focus object will be used.
861 bool GetCaretPositionForIndex(long position, wxRect& rect, wxRichTextParagraphLayoutBox* container = NULL);
862
863 /// Gets the line for the visible caret position. If the caret is
864 /// shown at the very end of the line, it means the next character is actually
865 /// on the following line. So let's get the line we're expecting to find
866 /// if this is the case.
867 wxRichTextLine* GetVisibleLineForCaretPosition(long caretPosition) const;
868
869 /// Gets the command processor
870 wxCommandProcessor* GetCommandProcessor() const { return GetBuffer().GetCommandProcessor(); }
871
872 /// Delete content if there is a selection, e.g. when pressing a key.
873 /// Returns the new caret position in newPos, or leaves it if there
874 /// was no action.
875 bool DeleteSelectedContent(long* newPos= NULL);
876
877 /// Transform logical to physical
878 wxPoint GetPhysicalPoint(const wxPoint& ptLogical) const;
879
880 /// Transform physical to logical
881 wxPoint GetLogicalPoint(const wxPoint& ptPhysical) const;
882
883 /// Finds the caret position for the next word. Direction
884 /// is 1 (forward) or -1 (backwards).
885 virtual long FindNextWordPosition(int direction = 1) const;
886
887 /// Is the given position visible on the screen?
888 bool IsPositionVisible(long pos) const;
889
890 /// Returns the first visible position in the current view
891 long GetFirstVisiblePosition() const;
892
893 /// Returns the caret position since the default formatting was changed. As
894 /// soon as this position changes, we no longer reflect the default style
895 /// in the UI. A value of -2 means that we should only reflect the style of the
896 /// content under the caret.
897 long GetCaretPositionForDefaultStyle() const { return m_caretPositionForDefaultStyle; }
898
899 /// Set the caret position for the default style that the user is selecting.
900 void SetCaretPositionForDefaultStyle(long pos) { m_caretPositionForDefaultStyle = pos; }
901
902 /// Should the UI reflect the default style chosen by the user, rather than the style under
903 /// the caret?
904 bool IsDefaultStyleShowing() const { return m_caretPositionForDefaultStyle != -2; }
905
906 /// Convenience function that tells the control to start reflecting the default
907 /// style, since the user is changing it.
908 void SetAndShowDefaultStyle(const wxRichTextAttr& attr)
909 {
910 SetDefaultStyle(attr);
911 SetCaretPositionForDefaultStyle(GetCaretPosition());
912 }
913
914 /// Get the first visible point in the window
915 wxPoint GetFirstVisiblePoint() const;
916
917 // Implementation
918
919 /// Set up the caret for the given position and container, after a mouse click
920 bool SetCaretPositionAfterClick(wxRichTextParagraphLayoutBox* container, long position, int hitTestFlags, bool extendSelection = false);
921
922 /// Find the caret position for the combination of hit-test flags and character position.
923 /// Returns the caret position and also an indication of where to place the caret (caretLineStart)
924 /// since this is ambiguous (same position used for end of line and start of next).
925 long FindCaretPositionForCharacterPosition(long position, int hitTestFlags, wxRichTextParagraphLayoutBox* container,
926 bool& caretLineStart);
927
928 /// Font names take a long time to retrieve, so cache them (on demand)
929 static const wxArrayString& GetAvailableFontNames();
930 static void ClearAvailableFontNames();
931
932 WX_FORWARD_TO_SCROLL_HELPER()
933
934 // implement wxTextEntry methods
935 virtual wxString DoGetValue() const;
936
937 protected:
938 // implement the wxTextEntry pure virtual method
939 virtual wxWindow *GetEditableWindow() { return this; }
940
941 // margins functions
942 virtual bool DoSetMargins(const wxPoint& pt);
943 virtual wxPoint DoGetMargins() const;
944
945 // FIXME: this does not work, it allows this code to compile but will fail
946 // during run-time
947 #ifndef __WXUNIVERSAL__
948 #ifdef __WXMSW__
949 virtual WXHWND GetEditHWND() const { return GetHWND(); }
950 #endif
951 #ifdef __WXMOTIF__
952 virtual WXWidget GetTextWidget() const { return NULL; }
953 #endif
954 #ifdef __WXGTK20__
955 virtual GtkEditable *GetEditable() const { return NULL; }
956 virtual GtkEntry *GetEntry() const { return NULL; }
957 #endif
958 #endif // !__WXUNIVERSAL__
959
960 // Overrides
961 protected:
962
963 virtual wxSize DoGetBestSize() const ;
964
965 virtual void DoSetValue(const wxString& value, int flags = 0);
966
967 virtual void DoThaw();
968
969
970 // Data members
971 private:
972 #if wxRICHTEXT_BUFFERED_PAINTING
973 /// Buffer bitmap
974 wxBitmap m_bufferBitmap;
975 #endif
976
977 /// Text buffer
978 wxRichTextBuffer m_buffer;
979
980 wxMenu* m_contextMenu;
981
982 /// Caret position (1 less than the character position, so -1 is the
983 /// first caret position).
984 long m_caretPosition;
985
986 /// Caret position when the default formatting has been changed. As
987 /// soon as this position changes, we no longer reflect the default style
988 /// in the UI.
989 long m_caretPositionForDefaultStyle;
990
991 /// Selection range in character positions. -2, -2 means no selection.
992 wxRichTextSelection m_selection;
993
994 wxRichTextCtrlSelectionState m_selectionState;
995
996 /// Anchor so we know how to extend the selection
997 /// It's a caret position since it's between two characters.
998 long m_selectionAnchor;
999
1000 /// Anchor object if selecting multiple container objects, such as grid cells.
1001 wxRichTextObject* m_selectionAnchorObject;
1002
1003 /// Are we editable?
1004 bool m_editable;
1005
1006 /// Are we showing the caret position at the start of a line
1007 /// instead of at the end of the previous one?
1008 bool m_caretAtLineStart;
1009
1010 /// Are we dragging a selection?
1011 bool m_dragging;
1012
1013 /// Start position for drag
1014 wxPoint m_dragStart;
1015
1016 /// Do we need full layout in idle?
1017 bool m_fullLayoutRequired;
1018 wxLongLong m_fullLayoutTime;
1019 long m_fullLayoutSavedPosition;
1020
1021 /// Threshold for doing delayed layout
1022 long m_delayedLayoutThreshold;
1023
1024 /// Cursors
1025 wxCursor m_textCursor;
1026 wxCursor m_urlCursor;
1027
1028 static wxArrayString sm_availableFontNames;
1029
1030 wxRichTextContextMenuPropertiesInfo m_contextMenuPropertiesInfo;
1031
1032 /// The object that currently has the editing focus
1033 wxRichTextParagraphLayoutBox* m_focusObject;
1034 };
1035
1036 /*!
1037 * wxRichTextEvent - the event class for wxRichTextCtrl notifications
1038 */
1039
1040 class WXDLLIMPEXP_RICHTEXT wxRichTextEvent : public wxNotifyEvent
1041 {
1042 public:
1043 wxRichTextEvent(wxEventType commandType = wxEVT_NULL, int winid = 0)
1044 : wxNotifyEvent(commandType, winid),
1045 m_flags(0), m_position(-1), m_oldStyleSheet(NULL), m_newStyleSheet(NULL),
1046 m_char((wxChar) 0), m_container(NULL), m_oldContainer(NULL)
1047 { }
1048
1049 wxRichTextEvent(const wxRichTextEvent& event)
1050 : wxNotifyEvent(event),
1051 m_flags(event.m_flags), m_position(-1),
1052 m_oldStyleSheet(event.m_oldStyleSheet), m_newStyleSheet(event.m_newStyleSheet),
1053 m_char((wxChar) 0), m_container(event.m_container), m_oldContainer(event.m_oldContainer)
1054 { }
1055
1056 long GetPosition() const { return m_position; }
1057 void SetPosition(long pos) { m_position = pos; }
1058
1059 int GetFlags() const { return m_flags; }
1060 void SetFlags(int flags) { m_flags = flags; }
1061
1062 wxRichTextStyleSheet* GetOldStyleSheet() const { return m_oldStyleSheet; }
1063 void SetOldStyleSheet(wxRichTextStyleSheet* sheet) { m_oldStyleSheet = sheet; }
1064
1065 wxRichTextStyleSheet* GetNewStyleSheet() const { return m_newStyleSheet; }
1066 void SetNewStyleSheet(wxRichTextStyleSheet* sheet) { m_newStyleSheet = sheet; }
1067
1068 const wxRichTextRange& GetRange() const { return m_range; }
1069 void SetRange(const wxRichTextRange& range) { m_range = range; }
1070
1071 wxChar GetCharacter() const { return m_char; }
1072 void SetCharacter(wxChar ch) { m_char = ch; }
1073
1074 wxRichTextParagraphLayoutBox* GetContainer() const { return m_container; }
1075 void SetContainer(wxRichTextParagraphLayoutBox* container) { m_container = container; }
1076
1077 wxRichTextParagraphLayoutBox* GetOldContainer() const { return m_oldContainer; }
1078 void SetOldContainer(wxRichTextParagraphLayoutBox* container) { m_oldContainer = container; }
1079
1080 virtual wxEvent *Clone() const { return new wxRichTextEvent(*this); }
1081
1082 protected:
1083 int m_flags;
1084 long m_position;
1085 wxRichTextStyleSheet* m_oldStyleSheet;
1086 wxRichTextStyleSheet* m_newStyleSheet;
1087 wxRichTextRange m_range;
1088 wxChar m_char;
1089 wxRichTextParagraphLayoutBox* m_container;
1090 wxRichTextParagraphLayoutBox* m_oldContainer;
1091
1092 private:
1093 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxRichTextEvent)
1094 };
1095
1096 /*!
1097 * wxRichTextCtrl events
1098 */
1099 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_LEFT_CLICK, wxRichTextEvent );
1100 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_RIGHT_CLICK, wxRichTextEvent );
1101 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_MIDDLE_CLICK, wxRichTextEvent );
1102 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_LEFT_DCLICK, wxRichTextEvent );
1103 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_RETURN, wxRichTextEvent );
1104 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_CHARACTER, wxRichTextEvent );
1105 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_DELETE, wxRichTextEvent );
1106
1107 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGING, wxRichTextEvent );
1108 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGED, wxRichTextEvent );
1109 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_STYLESHEET_REPLACING, wxRichTextEvent );
1110 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_STYLESHEET_REPLACED, wxRichTextEvent );
1111
1112 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_CONTENT_INSERTED, wxRichTextEvent );
1113 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_CONTENT_DELETED, wxRichTextEvent );
1114 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_STYLE_CHANGED, wxRichTextEvent );
1115 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_SELECTION_CHANGED, wxRichTextEvent );
1116 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_BUFFER_RESET, wxRichTextEvent );
1117 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_FOCUS_OBJECT_CHANGED, wxRichTextEvent );
1118
1119 typedef void (wxEvtHandler::*wxRichTextEventFunction)(wxRichTextEvent&);
1120
1121 #define wxRichTextEventHandler(func) \
1122 wxEVENT_HANDLER_CAST(wxRichTextEventFunction, func)
1123
1124 #define EVT_RICHTEXT_LEFT_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_LEFT_CLICK, id, -1, wxRichTextEventHandler( fn ), NULL ),
1125 #define EVT_RICHTEXT_RIGHT_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_RIGHT_CLICK, id, -1, wxRichTextEventHandler( fn ), NULL ),
1126 #define EVT_RICHTEXT_MIDDLE_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_MIDDLE_CLICK, id, -1, wxRichTextEventHandler( fn ), NULL ),
1127 #define EVT_RICHTEXT_LEFT_DCLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_LEFT_DCLICK, id, -1, wxRichTextEventHandler( fn ), NULL ),
1128 #define EVT_RICHTEXT_RETURN(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_RETURN, id, -1, wxRichTextEventHandler( fn ), NULL ),
1129 #define EVT_RICHTEXT_CHARACTER(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_CHARACTER, id, -1, wxRichTextEventHandler( fn ), NULL ),
1130 #define EVT_RICHTEXT_DELETE(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_DELETE, id, -1, wxRichTextEventHandler( fn ), NULL ),
1131
1132 #define EVT_RICHTEXT_STYLESHEET_CHANGING(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGING, id, -1, wxRichTextEventHandler( fn ), NULL ),
1133 #define EVT_RICHTEXT_STYLESHEET_CHANGED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGED, id, -1, wxRichTextEventHandler( fn ), NULL ),
1134 #define EVT_RICHTEXT_STYLESHEET_REPLACING(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_STYLESHEET_REPLACING, id, -1, wxRichTextEventHandler( fn ), NULL ),
1135 #define EVT_RICHTEXT_STYLESHEET_REPLACED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_STYLESHEET_REPLACED, id, -1, wxRichTextEventHandler( fn ), NULL ),
1136
1137 #define EVT_RICHTEXT_CONTENT_INSERTED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_CONTENT_INSERTED, id, -1, wxRichTextEventHandler( fn ), NULL ),
1138 #define EVT_RICHTEXT_CONTENT_DELETED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_CONTENT_DELETED, id, -1, wxRichTextEventHandler( fn ), NULL ),
1139 #define EVT_RICHTEXT_STYLE_CHANGED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_STYLE_CHANGED, id, -1, wxRichTextEventHandler( fn ), NULL ),
1140 #define EVT_RICHTEXT_SELECTION_CHANGED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_SELECTION_CHANGED, id, -1, wxRichTextEventHandler( fn ), NULL ),
1141 #define EVT_RICHTEXT_BUFFER_RESET(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_BUFFER_RESET, id, -1, wxRichTextEventHandler( fn ), NULL ),
1142
1143 #endif
1144 // wxUSE_RICHTEXT
1145
1146 #endif
1147 // _WX_RICHTEXTCTRL_H_