X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/cd8ba0d9e4f7f3a650cffff4dd99c11b75a86ceb..dec53e5a560eeaffd5927f000101dd473fd83c13:/include/wx/richtext/richtextctrl.h diff --git a/include/wx/richtext/richtextctrl.h b/include/wx/richtext/richtextctrl.h index aa17c9f7d9..35e84f2d8d 100644 --- a/include/wx/richtext/richtextctrl.h +++ b/include/wx/richtext/richtextctrl.h @@ -38,6 +38,8 @@ class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextStyleDefinition; #define wxRE_READONLY 0x0010 #define wxRE_MULTILINE 0x0020 +#define wxRE_CENTRE_CARET 0x8000 +#define wxRE_CENTER_CARET wxRE_CENTRE_CARET /* Flags */ @@ -46,6 +48,13 @@ class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextStyleDefinition; #define wxRICHTEXT_CTRL_DOWN 0x02 #define wxRICHTEXT_ALT_DOWN 0x04 +/* Extra flags + */ + +// Don't draw guide lines around boxes and tables +#define wxRICHTEXT_EX_NO_GUIDELINES 0x00000100 + + /* Defaults */ @@ -64,14 +73,17 @@ class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextStyleDefinition; // Milliseconds before layout occurs after resize #define wxRICHTEXT_DEFAULT_LAYOUT_INTERVAL 50 -/*! - * Forward declarations +/* Identifiers */ +#define wxID_RICHTEXT_PROPERTIES1 (wxID_HIGHEST + 1) +#define wxID_RICHTEXT_PROPERTIES2 (wxID_HIGHEST + 2) +#define wxID_RICHTEXT_PROPERTIES3 (wxID_HIGHEST + 3) /*! - * wxRichTextItem class declaration + * Forward declarations */ +#if 0 // Drawing styles/states #define wxRICHTEXT_SELECTED 0x01 #define wxRICHTEXT_TAGGED 0x02 @@ -79,6 +91,67 @@ class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextStyleDefinition; #define wxRICHTEXT_FOCUSSED 0x04 // The item itself has the focus #define wxRICHTEXT_IS_FOCUS 0x08 +#endif + +// Normal selection occurs initially and as user drags within one container. +// Common ancestor selection occurs when the user starts dragging across containers +// that have a common ancestor, for example the cells in a table. +enum wxRichTextCtrlSelectionState +{ + wxRichTextCtrlSelectionState_Normal, + wxRichTextCtrlSelectionState_CommonAncestor +}; + +/*! + * wxRichTextContextMenuPropertiesInfo keeps track of objects that appear in the context menu, + * whose properties are available to be edited. + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextContextMenuPropertiesInfo +{ +public: + wxRichTextContextMenuPropertiesInfo() { Init(); } + +// Operations + + /// Initialisation + void Init() {} + + /// Add an item + bool AddItem(const wxString& label, wxRichTextObject* obj); + + /// Returns number of menu items were added. + int AddMenuItems(wxMenu* menu, int startCmd = wxID_RICHTEXT_PROPERTIES1) const; + + /// Add appropriate menu items for the current container and clicked on object + /// (and container's parent, if appropriate). + int AddItems(wxRichTextObject* container, wxRichTextObject* obj); + + /// Clear the items + void Clear() { m_objects.Clear(); m_labels.Clear(); } + +// Accessors + /// Gets the nth label + wxString GetLabel(int n) const { return m_labels[n]; } + + /// Gets the nth object + wxRichTextObject* GetObject(int n) const { return m_objects[n]; } + + /// Get objects + wxRichTextObjectPtrArray& GetObjects() { return m_objects; } + const wxRichTextObjectPtrArray& GetObjects() const { return m_objects; } + + /// Get labels + wxArrayString& GetLabels() { return m_labels; } + const wxArrayString& GetLabels() const { return m_labels; } + + /// Get number of items + int GetCount() const { return m_objects.GetCount(); } + + //wxArrayInt m_ids; + wxRichTextObjectPtrArray m_objects; + wxArrayString m_labels; +}; /*! * wxRichTextCtrl class declaration @@ -113,8 +186,6 @@ public: // Accessors - virtual wxString GetValue() const; - virtual wxString GetRange(long from, long to) const; virtual int GetLineLength(long lineNo) const ; @@ -133,6 +204,11 @@ public: virtual wxString GetStringSelection() const; + const wxRichTextSelection& GetSelection() const { return m_selection; } + wxRichTextSelection& GetSelection() { return m_selection; } + void SetSelection(const wxRichTextSelection& sel) { m_selection = sel; } + + /// Get filename wxString GetFilename() const { return m_filename; } @@ -145,8 +221,73 @@ public: /// Get the threshold in character positions for doing layout optimization during sizing long GetDelayedLayoutThreshold() const { return m_delayedLayoutThreshold; } + bool GetFullLayoutRequired() const { return m_fullLayoutRequired; } + void SetFullLayoutRequired(bool b) { m_fullLayoutRequired = b; } + + wxLongLong GetFullLayoutTime() const { return m_fullLayoutTime; } + void SetFullLayoutTime(wxLongLong t) { m_fullLayoutTime = t; } + + long GetFullLayoutSavedPosition() const { return m_fullLayoutSavedPosition; } + void SetFullLayoutSavedPosition(long p) { m_fullLayoutSavedPosition = p; } + + // Force any pending layout due to large buffer + void ForceDelayedLayout(); + + /// Set text cursor + void SetTextCursor(const wxCursor& cursor ) { m_textCursor = cursor; } + + /// Get text cursor + wxCursor GetTextCursor() const { return m_textCursor; } + + /// Set URL cursor + void SetURLCursor(const wxCursor& cursor ) { m_urlCursor = cursor; } + + /// Get URL cursor + wxCursor GetURLCursor() const { return m_urlCursor; } + + /// Are we showing the caret position at the start of a line + /// instead of at the end of the previous one? + bool GetCaretAtLineStart() const { return m_caretAtLineStart; } + void SetCaretAtLineStart(bool atStart) { m_caretAtLineStart = atStart; } + + /// Are we dragging a selection? + bool GetDragging() const { return m_dragging; } + void SetDragging(bool dragging) { m_dragging = dragging; } + + /// Get/set drag start position + const wxPoint& GetDragStart() const { return m_dragStart; } + void SetDragStart(const wxPoint& pt) { m_dragStart = pt; } + +#if wxRICHTEXT_BUFFERED_PAINTING + /// Get the buffer bitmap + const wxBitmap& GetBufferBitmap() const { return m_bufferBitmap; } + wxBitmap& GetBufferBitmap() { return m_bufferBitmap; } +#endif + + /// Get/set context menu + wxMenu* GetContextMenu() const { return m_contextMenu; } + void SetContextMenu(wxMenu* menu); + + /// Anchor so we know how to extend the selection + /// It's a caret position since it's between two characters. + long GetSelectionAnchor() const { return m_selectionAnchor; } + void SetSelectionAnchor(long anchor) { m_selectionAnchor = anchor; } + + /// Anchor object if selecting multiple containers. + wxRichTextObject* GetSelectionAnchorObject() const { return m_selectionAnchorObject; } + void SetSelectionAnchorObject(wxRichTextObject* anchor) { m_selectionAnchorObject = anchor; } + + wxRichTextContextMenuPropertiesInfo& GetContextMenuPropertiesInfo() { return m_contextMenuPropertiesInfo; } + const wxRichTextContextMenuPropertiesInfo& GetContextMenuPropertiesInfo() const { return m_contextMenuPropertiesInfo; } + + /// The wxRichTextObject object that currently has the editing focus + wxRichTextParagraphLayoutBox* GetFocusObject() const { return m_focusObject; } + bool SetFocusObject(wxRichTextParagraphLayoutBox* obj, bool setCaretPosition = true); + // Operations + void Invalidate() { GetBuffer().Invalidate(wxRICHTEXT_ALL); } + // editing virtual void Clear(); virtual void Replace(long from, long to, const wxString& value); @@ -154,7 +295,8 @@ public: // load/save the controls contents from/to the file virtual bool DoLoadFile(const wxString& file, int fileType); - virtual bool DoSaveFile(const wxString& file = wxEmptyString, int fileType = wxRICHTEXT_TYPE_ANY); + virtual bool DoSaveFile(const wxString& file = wxEmptyString, + int fileType = wxRICHTEXT_TYPE_ANY); /// Set the handler flags, controlling loading and saving void SetHandlerFlags(int flags) { GetBuffer().SetHandlerFlags(flags); } @@ -179,24 +321,35 @@ public: // methods allow to apply the given text style to the given selection or to // set/get the style which will be used for all appended text virtual bool SetStyle(long start, long end, const wxTextAttr& style); + virtual bool SetStyle(long start, long end, const wxRichTextAttr& style); virtual bool SetStyle(const wxRichTextRange& range, const wxTextAttr& style); + virtual bool SetStyle(const wxRichTextRange& range, const wxRichTextAttr& style); virtual bool GetStyle(long position, wxTextAttr& style); + virtual bool GetStyle(long position, wxRichTextAttr& style); + virtual bool GetStyle(long position, wxRichTextAttr& style, wxRichTextParagraphLayoutBox* container); + + // Set the style for a single object + virtual void SetStyle(wxRichTextObject *obj, const wxRichTextAttr& textAttr); // get the common set of styles for the range virtual bool GetStyleForRange(const wxRichTextRange& range, wxTextAttr& style); + virtual bool GetStyleForRange(const wxRichTextRange& range, wxRichTextAttr& style); + virtual bool GetStyleForRange(const wxRichTextRange& range, wxRichTextAttr& style, wxRichTextParagraphLayoutBox* container); // extended style setting operation with flags including: // wxRICHTEXT_SETSTYLE_WITH_UNDO, wxRICHTEXT_SETSTYLE_OPTIMIZE, wxRICHTEXT_SETSTYLE_PARAGRAPHS_ONLY, wxRICHTEXT_SETSTYLE_CHARACTERS_ONLY // see richtextbuffer.h for more details. - virtual bool SetStyleEx(const wxRichTextRange& range, const wxTextAttr& style, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO); + virtual bool SetStyleEx(const wxRichTextRange& range, const wxRichTextAttr& style, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO); /// Get the content (uncombined) attributes for this position. - virtual bool GetUncombinedStyle(long position, wxTextAttr& style); + virtual bool GetUncombinedStyle(long position, wxRichTextAttr& style); + virtual bool GetUncombinedStyle(long position, wxRichTextAttr& style, wxRichTextParagraphLayoutBox* container); virtual bool SetDefaultStyle(const wxTextAttr& style); + virtual bool SetDefaultStyle(const wxRichTextAttr& style); - virtual const wxTextAttr& GetDefaultStyleEx() const { return GetDefaultStyle(); } + virtual const wxRichTextAttr& GetDefaultStyleEx() const; - virtual const wxTextAttr& GetDefaultStyle() const; + //virtual const wxTextAttr& GetDefaultStyle() const; /// Set list style virtual bool SetListStyle(const wxRichTextRange& range, wxRichTextListStyleDefinition* def, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1); @@ -263,23 +416,41 @@ public: virtual void SelectAll(); virtual void SetEditable(bool editable); + /// Returns true if there was a selection and the object containing the selection + /// was the same as the current focus object. virtual bool HasSelection() const; + /// Returns true if there was a selection, whether or not the current focus object + /// is the same as the selection's container object. + virtual bool HasUnfocusedSelection() const; + ///// Functionality specific to wxRichTextCtrl /// Write an image at the current insertion point. Supply optional type to use /// for internal and file storage of the raw data. - virtual bool WriteImage(const wxImage& image, int bitmapType = wxBITMAP_TYPE_PNG); + virtual bool WriteImage(const wxImage& image, wxBitmapType bitmapType = wxBITMAP_TYPE_PNG, + const wxRichTextAttr& textAttr = wxRichTextAttr()); /// Write a bitmap at the current insertion point. Supply optional type to use /// for internal and file storage of the raw data. - virtual bool WriteImage(const wxBitmap& bitmap, int bitmapType = wxBITMAP_TYPE_PNG); + virtual bool WriteImage(const wxBitmap& bitmap, wxBitmapType bitmapType = wxBITMAP_TYPE_PNG, + const wxRichTextAttr& textAttr = wxRichTextAttr()); /// Load an image from file and write at the current insertion point. - virtual bool WriteImage(const wxString& filename, int bitmapType); + virtual bool WriteImage(const wxString& filename, wxBitmapType bitmapType, + const wxRichTextAttr& textAttr = wxRichTextAttr()); /// Write an image block at the current insertion point. - virtual bool WriteImage(const wxRichTextImageBlock& imageBlock); + virtual bool WriteImage(const wxRichTextImageBlock& imageBlock, + const wxRichTextAttr& textAttr = wxRichTextAttr()); + + /// Write a text box at the current insertion point, returning the text box. + /// You can then call SetFocusObject() to set the focus to the new object. + virtual wxRichTextBox* WriteTextBox(const wxRichTextAttr& textAttr = wxRichTextAttr()); + + /// Write a table at the current insertion point, returning the table. + /// You can then call SetFocusObject() to set the focus to the new object. + virtual wxRichTextTable* WriteTable(int rows, int cols, const wxRichTextAttr& tableAttr = wxRichTextAttr(), const wxRichTextAttr& cellAttr = wxRichTextAttr()); /// Insert a newline (actually paragraph) at the current insertion point. virtual bool Newline(); @@ -288,12 +459,12 @@ public: virtual bool LineBreak(); /// Set basic (overall) style - virtual void SetBasicStyle(const wxTextAttr& style) { GetBuffer().SetBasicStyle(style); } + virtual void SetBasicStyle(const wxRichTextAttr& style) { GetBuffer().SetBasicStyle(style); } /// Get basic (overall) style - virtual const wxTextAttr& GetBasicStyle() const { return GetBuffer().GetBasicStyle(); } + virtual const wxRichTextAttr& GetBasicStyle() const { return GetBuffer().GetBasicStyle(); } - virtual bool BeginStyle(const wxTextAttr& style) { return GetBuffer().BeginStyle(style); } + virtual bool BeginStyle(const wxRichTextAttr& style) { return GetBuffer().BeginStyle(style); } /// End the style virtual bool EndStyle() { return GetBuffer().EndStyle(); } @@ -427,11 +598,12 @@ public: wxRichTextRange GetSelectionRange() const; void SetSelectionRange(const wxRichTextRange& range); - /// Get/set the selection range in character positions. -1, -1 means no selection. + /// Get/set the selection range in character positions. -2, -2 means no selection + /// -1, -1 means select everything. /// The range is in internal format, i.e. a single character selection is denoted /// by (n, n) - const wxRichTextRange& GetInternalSelectionRange() const { return m_selectionRange; } - void SetInternalSelectionRange(const wxRichTextRange& range) { m_selectionRange = range; } + wxRichTextRange GetInternalSelectionRange() const { return m_selection.GetRange(); } + void SetInternalSelectionRange(const wxRichTextRange& range) { m_selection.Set(range, GetFocusObject()); } /// Add a new paragraph of text to the end of the buffer virtual wxRichTextRange AddParagraph(const wxString& text); @@ -444,7 +616,7 @@ public: virtual bool LayoutContent(bool onlyVisibleRect = false); /// Move the caret to the given character position - virtual bool MoveCaret(long pos, bool showAtLineStart = false); + virtual bool MoveCaret(long pos, bool showAtLineStart = false, wxRichTextParagraphLayoutBox* container = NULL); /// Move right virtual bool MoveRight(int noPositions = 1, int flags = 0); @@ -514,7 +686,7 @@ public: /// of the attributes are different within the range, the test fails. You /// can use this to implement, for example, bold button updating. style must have /// flags indicating which attributes are of interest. - virtual bool HasCharacterAttributes(const wxRichTextRange& range, const wxTextAttr& style) const + virtual bool HasCharacterAttributes(const wxRichTextRange& range, const wxRichTextAttr& style) const { return GetBuffer().HasCharacterAttributes(range.ToInternal(), style); } @@ -523,7 +695,7 @@ public: /// of the attributes are different within the range, the test fails. You /// can use this to implement, for example, centering button updating. style must have /// flags indicating which attributes are of interest. - virtual bool HasParagraphAttributes(const wxRichTextRange& range, const wxTextAttr& style) const + virtual bool HasParagraphAttributes(const wxRichTextRange& range, const wxRichTextAttr& style) const { return GetBuffer().HasParagraphAttributes(range.ToInternal(), style); } @@ -581,6 +753,7 @@ public: void OnUndo(wxCommandEvent& event); void OnRedo(wxCommandEvent& event); void OnSelectAll(wxCommandEvent& event); + void OnProperties(wxCommandEvent& event); void OnClear(wxCommandEvent& event); void OnUpdateCut(wxUpdateUIEvent& event); @@ -589,6 +762,7 @@ public: void OnUpdateUndo(wxUpdateUIEvent& event); void OnUpdateRedo(wxUpdateUIEvent& event); void OnUpdateSelectAll(wxUpdateUIEvent& event); + void OnUpdateProperties(wxUpdateUIEvent& event); void OnUpdateClear(wxUpdateUIEvent& event); // Show a context menu for Rich Edit controls (the standard @@ -647,14 +821,14 @@ public: /// Paint the background virtual void PaintBackground(wxDC& dc); + /// Other user defined painting after everything else (i.e. all text) is painted + virtual void PaintAboveContent(wxDC& WXUNUSED(dc)) {} + #if wxRICHTEXT_BUFFERED_PAINTING /// Recreate buffer bitmap if necessary virtual bool RecreateBuffer(const wxSize& size = wxDefaultSize); #endif - /// Set the selection - virtual void DoSetSelection(long from, long to, bool scrollCaret = true); - /// Write text virtual void DoWriteText(const wxString& value, int flags = 0); @@ -662,7 +836,7 @@ public: virtual bool ShouldInheritColours() const { return false; } /// Position the caret - virtual void PositionCaret(); + virtual void PositionCaret(wxRichTextParagraphLayoutBox* container = NULL); /// Extend the selection, returning true if the selection was /// changed. Selections are in caret positions. @@ -671,6 +845,9 @@ public: /// Scroll into view. This takes a _caret_ position. virtual bool ScrollIntoView(long position, int keyCode); + /// Refresh the area affected by a selection change + bool RefreshForSelectionChange(const wxRichTextSelection& oldSelection, const wxRichTextSelection& newSelection); + /// The caret position is the character position just before the caret. /// A value of -1 means the caret is at the start of the buffer. void SetCaretPosition(long position, bool showAtLineStart = false) ; @@ -691,8 +868,9 @@ public: /// to the start of the next, which may be the exact same caret position. void MoveCaretBack(long oldPosition) ; - /// Get the caret height and position for the given character position - bool GetCaretPositionForIndex(long position, wxRect& rect); + /// Get the caret height and position for the given character position. If container is null, + /// the current focus object will be used. + bool GetCaretPositionForIndex(long position, wxRect& rect, wxRichTextParagraphLayoutBox* container = NULL); /// Gets the line for the visible caret position. If the caret is /// shown at the very end of the line, it means the next character is actually @@ -739,7 +917,7 @@ public: /// Convenience function that tells the control to start reflecting the default /// style, since the user is changing it. - void SetAndShowDefaultStyle(const wxTextAttr& attr) + void SetAndShowDefaultStyle(const wxRichTextAttr& attr) { SetDefaultStyle(attr); SetCaretPositionForDefaultStyle(GetCaretPosition()); @@ -750,11 +928,46 @@ public: // Implementation - /// Font names take a long time to retrieve, so cache them (on demand) - static const wxArrayString& GetAvailableFontNames(); - static void ClearAvailableFontNames(); + /// Set up the caret for the given position and container, after a mouse click + bool SetCaretPositionAfterClick(wxRichTextParagraphLayoutBox* container, long position, int hitTestFlags, bool extendSelection = false); + + /// Find the caret position for the combination of hit-test flags and character position. + /// Returns the caret position and also an indication of where to place the caret (caretLineStart) + /// since this is ambiguous (same position used for end of line and start of next). + long FindCaretPositionForCharacterPosition(long position, int hitTestFlags, wxRichTextParagraphLayoutBox* container, + bool& caretLineStart); + + /// Font names take a long time to retrieve, so cache them (on demand) + static const wxArrayString& GetAvailableFontNames(); + static void ClearAvailableFontNames(); + + WX_FORWARD_TO_SCROLL_HELPER() + + // implement wxTextEntry methods + virtual wxString DoGetValue() const; - WX_FORWARD_TO_SCROLL_HELPER() +protected: + // implement the wxTextEntry pure virtual method + virtual wxWindow *GetEditableWindow() { return this; } + + // margins functions + virtual bool DoSetMargins(const wxPoint& pt); + virtual wxPoint DoGetMargins() const; + + // FIXME: this does not work, it allows this code to compile but will fail + // during run-time +#ifndef __WXUNIVERSAL__ +#ifdef __WXMSW__ + virtual WXHWND GetEditHWND() const { return GetHWND(); } +#endif +#ifdef __WXMOTIF__ + virtual WXWidget GetTextWidget() const { return NULL; } +#endif +#ifdef __WXGTK20__ + virtual GtkEditable *GetEditable() const { return NULL; } + virtual GtkEntry *GetEntry() const { return NULL; } +#endif +#endif // !__WXUNIVERSAL__ // Overrides protected: @@ -788,12 +1001,17 @@ private: long m_caretPositionForDefaultStyle; /// Selection range in character positions. -2, -2 means no selection. - wxRichTextRange m_selectionRange; + wxRichTextSelection m_selection; + + wxRichTextCtrlSelectionState m_selectionState; /// Anchor so we know how to extend the selection /// It's a caret position since it's between two characters. long m_selectionAnchor; + /// Anchor object if selecting multiple container objects, such as grid cells. + wxRichTextObject* m_selectionAnchorObject; + /// Are we editable? bool m_editable; @@ -820,6 +1038,11 @@ private: wxCursor m_urlCursor; static wxArrayString sm_availableFontNames; + + wxRichTextContextMenuPropertiesInfo m_contextMenuPropertiesInfo; + + /// The object that currently has the editing focus + wxRichTextParagraphLayoutBox* m_focusObject; }; /*! @@ -832,14 +1055,14 @@ public: wxRichTextEvent(wxEventType commandType = wxEVT_NULL, int winid = 0) : wxNotifyEvent(commandType, winid), m_flags(0), m_position(-1), m_oldStyleSheet(NULL), m_newStyleSheet(NULL), - m_char((wxChar) 0) + m_char((wxChar) 0), m_container(NULL), m_oldContainer(NULL) { } wxRichTextEvent(const wxRichTextEvent& event) : wxNotifyEvent(event), m_flags(event.m_flags), m_position(-1), m_oldStyleSheet(event.m_oldStyleSheet), m_newStyleSheet(event.m_newStyleSheet), - m_char((wxChar) 0) + m_char((wxChar) 0), m_container(event.m_container), m_oldContainer(event.m_oldContainer) { } long GetPosition() const { return m_position; } @@ -860,15 +1083,23 @@ public: wxChar GetCharacter() const { return m_char; } void SetCharacter(wxChar ch) { m_char = ch; } + wxRichTextParagraphLayoutBox* GetContainer() const { return m_container; } + void SetContainer(wxRichTextParagraphLayoutBox* container) { m_container = container; } + + wxRichTextParagraphLayoutBox* GetOldContainer() const { return m_oldContainer; } + void SetOldContainer(wxRichTextParagraphLayoutBox* container) { m_oldContainer = container; } + virtual wxEvent *Clone() const { return new wxRichTextEvent(*this); } protected: - int m_flags; - long m_position; - wxRichTextStyleSheet* m_oldStyleSheet; - wxRichTextStyleSheet* m_newStyleSheet; - wxRichTextRange m_range; - wxChar m_char; + int m_flags; + long m_position; + wxRichTextStyleSheet* m_oldStyleSheet; + wxRichTextStyleSheet* m_newStyleSheet; + wxRichTextRange m_range; + wxChar m_char; + wxRichTextParagraphLayoutBox* m_container; + wxRichTextParagraphLayoutBox* m_oldContainer; private: DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxRichTextEvent) @@ -877,48 +1108,49 @@ private: /*! * wxRichTextCtrl events */ -extern WXDLLIMPEXP_RICHTEXT const wxEventType wxEVT_COMMAND_RICHTEXT_LEFT_CLICK; -extern WXDLLIMPEXP_RICHTEXT const wxEventType wxEVT_COMMAND_RICHTEXT_RIGHT_CLICK; -extern WXDLLIMPEXP_RICHTEXT const wxEventType wxEVT_COMMAND_RICHTEXT_MIDDLE_CLICK; -extern WXDLLIMPEXP_RICHTEXT const wxEventType wxEVT_COMMAND_RICHTEXT_LEFT_DCLICK; -extern WXDLLIMPEXP_RICHTEXT const wxEventType wxEVT_COMMAND_RICHTEXT_RETURN; -extern WXDLLIMPEXP_RICHTEXT const wxEventType wxEVT_COMMAND_RICHTEXT_CHARACTER; -extern WXDLLIMPEXP_RICHTEXT const wxEventType wxEVT_COMMAND_RICHTEXT_DELETE; - -extern WXDLLIMPEXP_RICHTEXT const wxEventType wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGING; -extern WXDLLIMPEXP_RICHTEXT const wxEventType wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGED; -extern WXDLLIMPEXP_RICHTEXT const wxEventType wxEVT_COMMAND_RICHTEXT_STYLESHEET_REPLACING; -extern WXDLLIMPEXP_RICHTEXT const wxEventType wxEVT_COMMAND_RICHTEXT_STYLESHEET_REPLACED; - -extern WXDLLIMPEXP_RICHTEXT const wxEventType wxEVT_COMMAND_RICHTEXT_CONTENT_INSERTED; -extern WXDLLIMPEXP_RICHTEXT const wxEventType wxEVT_COMMAND_RICHTEXT_CONTENT_DELETED; -extern WXDLLIMPEXP_RICHTEXT const wxEventType wxEVT_COMMAND_RICHTEXT_STYLE_CHANGED; -extern WXDLLIMPEXP_RICHTEXT const wxEventType wxEVT_COMMAND_RICHTEXT_SELECTION_CHANGED; -extern WXDLLIMPEXP_RICHTEXT const wxEventType wxEVT_COMMAND_RICHTEXT_BUFFER_RESET; +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_LEFT_CLICK, wxRichTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_RIGHT_CLICK, wxRichTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_MIDDLE_CLICK, wxRichTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_LEFT_DCLICK, wxRichTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_RETURN, wxRichTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_CHARACTER, wxRichTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_DELETE, wxRichTextEvent ); + +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGING, wxRichTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGED, wxRichTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_STYLESHEET_REPLACING, wxRichTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_STYLESHEET_REPLACED, wxRichTextEvent ); + +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_CONTENT_INSERTED, wxRichTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_CONTENT_DELETED, wxRichTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_STYLE_CHANGED, wxRichTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_SELECTION_CHANGED, wxRichTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_BUFFER_RESET, wxRichTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_FOCUS_OBJECT_CHANGED, wxRichTextEvent ); typedef void (wxEvtHandler::*wxRichTextEventFunction)(wxRichTextEvent&); #define wxRichTextEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxRichTextEventFunction, &func) - -#define EVT_RICHTEXT_LEFT_CLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_LEFT_CLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxRichTextEventFunction, & fn ), NULL ), -#define EVT_RICHTEXT_RIGHT_CLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_RIGHT_CLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxRichTextEventFunction, & fn ), NULL ), -#define EVT_RICHTEXT_MIDDLE_CLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_MIDDLE_CLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxRichTextEventFunction, & fn ), NULL ), -#define EVT_RICHTEXT_LEFT_DCLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_LEFT_DCLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxRichTextEventFunction, & fn ), NULL ), -#define EVT_RICHTEXT_RETURN(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_RETURN, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxRichTextEventFunction, & fn ), NULL ), -#define EVT_RICHTEXT_CHARACTER(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_CHARACTER, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxRichTextEventFunction, & fn ), NULL ), -#define EVT_RICHTEXT_DELETE(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_DELETE, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxRichTextEventFunction, & fn ), NULL ), - -#define EVT_RICHTEXT_STYLESHEET_CHANGING(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGING, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxRichTextEventFunction, & fn ), NULL ), -#define EVT_RICHTEXT_STYLESHEET_CHANGED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGED, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxRichTextEventFunction, & fn ), NULL ), -#define EVT_RICHTEXT_STYLESHEET_REPLACING(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_STYLESHEET_REPLACING, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxRichTextEventFunction, & fn ), NULL ), -#define EVT_RICHTEXT_STYLESHEET_REPLACED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_STYLESHEET_REPLACED, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxRichTextEventFunction, & fn ), NULL ), - -#define EVT_RICHTEXT_CONTENT_INSERTED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_CONTENT_INSERTED, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxRichTextEventFunction, & fn ), NULL ), -#define EVT_RICHTEXT_CONTENT_DELETED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_CONTENT_DELETED, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxRichTextEventFunction, & fn ), NULL ), -#define EVT_RICHTEXT_STYLE_CHANGED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_STYLE_CHANGED, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxRichTextEventFunction, & fn ), NULL ), -#define EVT_RICHTEXT_SELECTION_CHANGED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_SELECTION_CHANGED, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxRichTextEventFunction, & fn ), NULL ), -#define EVT_RICHTEXT_BUFFER_RESET(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_BUFFER_RESET, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxRichTextEventFunction, & fn ), NULL ), + wxEVENT_HANDLER_CAST(wxRichTextEventFunction, func) + +#define EVT_RICHTEXT_LEFT_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_LEFT_CLICK, id, -1, wxRichTextEventHandler( fn ), NULL ), +#define EVT_RICHTEXT_RIGHT_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_RIGHT_CLICK, id, -1, wxRichTextEventHandler( fn ), NULL ), +#define EVT_RICHTEXT_MIDDLE_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_MIDDLE_CLICK, id, -1, wxRichTextEventHandler( fn ), NULL ), +#define EVT_RICHTEXT_LEFT_DCLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_LEFT_DCLICK, id, -1, wxRichTextEventHandler( fn ), NULL ), +#define EVT_RICHTEXT_RETURN(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_RETURN, id, -1, wxRichTextEventHandler( fn ), NULL ), +#define EVT_RICHTEXT_CHARACTER(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_CHARACTER, id, -1, wxRichTextEventHandler( fn ), NULL ), +#define EVT_RICHTEXT_DELETE(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_DELETE, id, -1, wxRichTextEventHandler( fn ), NULL ), + +#define EVT_RICHTEXT_STYLESHEET_CHANGING(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGING, id, -1, wxRichTextEventHandler( fn ), NULL ), +#define EVT_RICHTEXT_STYLESHEET_CHANGED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGED, id, -1, wxRichTextEventHandler( fn ), NULL ), +#define EVT_RICHTEXT_STYLESHEET_REPLACING(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_STYLESHEET_REPLACING, id, -1, wxRichTextEventHandler( fn ), NULL ), +#define EVT_RICHTEXT_STYLESHEET_REPLACED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_STYLESHEET_REPLACED, id, -1, wxRichTextEventHandler( fn ), NULL ), + +#define EVT_RICHTEXT_CONTENT_INSERTED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_CONTENT_INSERTED, id, -1, wxRichTextEventHandler( fn ), NULL ), +#define EVT_RICHTEXT_CONTENT_DELETED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_CONTENT_DELETED, id, -1, wxRichTextEventHandler( fn ), NULL ), +#define EVT_RICHTEXT_STYLE_CHANGED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_STYLE_CHANGED, id, -1, wxRichTextEventHandler( fn ), NULL ), +#define EVT_RICHTEXT_SELECTION_CHANGED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_SELECTION_CHANGED, id, -1, wxRichTextEventHandler( fn ), NULL ), +#define EVT_RICHTEXT_BUFFER_RESET(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_BUFFER_RESET, id, -1, wxRichTextEventHandler( fn ), NULL ), #endif // wxUSE_RICHTEXT