X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4f51b983c2a62ad6536589a2aae5894f1ed4cf07..cda337fbb030b9cc032a6ef1e2508b7c9af95876:/interface/wx/richtext/richtextctrl.h diff --git a/interface/wx/richtext/richtextctrl.h b/interface/wx/richtext/richtextctrl.h index 74a0af4f77..7cbe45a4d1 100644 --- a/interface/wx/richtext/richtextctrl.h +++ b/interface/wx/richtext/richtextctrl.h @@ -111,7 +111,7 @@ public: Adds appropriate menu items for the current container and clicked on object (and container's parent, if appropriate). */ - int AddItems(wxRichTextObject* container, wxRichTextObject* obj); + int AddItems(wxRichTextCtrl* ctrl, wxRichTextObject* container, wxRichTextObject* obj); /** Clears the items. @@ -392,24 +392,44 @@ public: void SetCaretAtLineStart(bool atStart) { m_caretAtLineStart = atStart; } /** - Returns @true if we are dragging a selection. + Returns @true if we are extending a selection. */ bool GetDragging() const { return m_dragging; } /** - Sets a flag to remember if we are dragging a selection. + Sets a flag to remember if we are extending a selection. */ void SetDragging(bool dragging) { m_dragging = dragging; } /** - Returns the drag start position. + Are we trying to start Drag'n'Drop? */ - const wxPoint& GetDragStart() const { return m_dragStart; } + bool GetPreDrag() const { return m_preDrag; } /** - Sets the drag start position. + Set if we're trying to start Drag'n'Drop */ - void SetDragStart(const wxPoint& pt) { m_dragStart = pt; } + void SetPreDrag(bool pd) { m_preDrag = pd; } + + /** + Get the possible Drag'n'Drop start point + */ + const wxPoint GetDragStartPoint() const { return m_dragStartPoint; } + + /** + Set the possible Drag'n'Drop start point + */ + void SetDragStartPoint(wxPoint sp) { m_dragStartPoint = sp; } + + /** + Get the possible Drag'n'Drop start time + */ + const wxDateTime GetDragStartTime() const { return m_dragStartTime; } + + /** + Set the possible Drag'n'Drop start time + */ + void SetDragStartTime(wxDateTime st) { m_dragStartTime = st; } #if wxRICHTEXT_BUFFERED_PAINTING //@{ @@ -471,8 +491,15 @@ public: */ wxRichTextParagraphLayoutBox* GetFocusObject() const { return m_focusObject; } + /** + Setter for m_focusObject. + */ + void StoreFocusObject(wxRichTextParagraphLayoutBox* obj); + /** Sets the wxRichTextObject object that currently has the editing focus. + @param setCaretPosition + Optionally set the caret position. */ bool SetFocusObject(wxRichTextParagraphLayoutBox* obj, bool setCaretPosition = true); @@ -783,6 +810,28 @@ public: virtual bool PromoteList(int promoteBy, const wxRichTextRange& range, const wxString& defName, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int specifiedLevel = -1); //@} + /** + Sets the properties for the given range, passing flags to determine how the + attributes are set. You can merge properties or replace them. + + The end point of range is specified as the last character position of the span + of text, plus one. So, for example, to set the properties for a character at + position 5, use the range (5,6). + + @a flags may contain a bit list of the following values: + - wxRICHTEXT_SETSPROPERTIES_NONE: no flag. + - wxRICHTEXT_SETPROPERTIES_WITH_UNDO: specifies that this operation should be + undoable. + - wxRICHTEXT_SETPROPERTIES_PARAGRAPHS_ONLY: specifies that the properties should only be + applied to paragraphs, and not the content. + - wxRICHTEXT_SETPROPERTIES_CHARACTERS_ONLY: specifies that the properties should only be + applied to characters, and not the paragraph. + - wxRICHTEXT_SETPROPERTIES_RESET: resets (clears) the existing properties before applying + the new properties. + - wxRICHTEXT_SETPROPERTIES_REMOVE: removes the specified properties. + */ + virtual bool SetProperties(const wxRichTextRange& range, const wxRichTextProperties& properties, int flags = wxRICHTEXT_SETPROPERTIES_WITH_UNDO); + /** Deletes the content within the given range. */ @@ -813,6 +862,11 @@ public: virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, wxTextCoord *col, wxTextCoord *row) const; + + /** + Finds the container at the given point, which is assumed to be in client coordinates. + */ + wxRichTextParagraphLayoutBox* FindContainerAtPoint(const wxPoint pt, long& position, int& hit, wxRichTextObject* hitObj, int flags = 0); //@} // Clipboard operations @@ -1537,6 +1591,50 @@ public: */ bool ApplyStyleSheet(wxRichTextStyleSheet* styleSheet = NULL); + /** + Shows the given context menu, optionally adding appropriate property-editing commands for the current position in the object hierarchy. + */ + virtual bool ShowContextMenu(wxMenu* menu, const wxPoint& pt, bool addPropertyCommands); + + /** + Prepares the context menu, optionally adding appropriate property-editing commands. + Returns the number of property commands added. + */ + virtual int PrepareContextMenu(wxMenu* menu, const wxPoint& pt, bool addPropertyCommands); + + /** + Returns @true if we can edit the object's properties via a GUI. + */ + virtual bool CanEditProperties(wxRichTextObject* obj) const; + + /** + Edits the object's properties via a GUI. + */ + virtual bool EditProperties(wxRichTextObject* obj, wxWindow* parent); + + /** + Gets the object's properties menu label. + */ + virtual wxString GetPropertiesMenuLabel(wxRichTextObject* obj); + + /** + Prepares the content just before insertion (or after buffer reset). Called by the same function in wxRichTextBuffer. + Currently is only called if undo mode is on. + */ + virtual void PrepareContent(wxRichTextParagraphLayoutBox& WXUNUSED(container)) {} + + /** + Can we delete this range? + Sends an event to the control. + */ + virtual bool CanDeleteRange(wxRichTextParagraphLayoutBox& container, const wxRichTextRange& range) const; + + /** + Can we insert content at this position? + Sends an event to the control. + */ + virtual bool CanInsertContent(wxRichTextParagraphLayoutBox& container, long pos) const; + // Command handlers /** @@ -1928,6 +2026,11 @@ public: long FindCaretPositionForCharacterPosition(long position, int hitTestFlags, wxRichTextParagraphLayoutBox* container, bool& caretLineStart); + /** + Processes mouse movement in order to change the cursor + */ + virtual bool ProcessMouseMovement(wxRichTextParagraphLayoutBox* container, wxRichTextObject* obj, long position, const wxPoint& pos); + /** Font names take a long time to retrieve, so cache them (on demand). */ @@ -1980,7 +2083,7 @@ protected: // Data members -private: +protected: #if wxRICHTEXT_BUFFERED_PAINTING /// Buffer bitmap wxBitmap m_bufferBitmap; @@ -2022,9 +2125,6 @@ private: /// Are we dragging a selection? bool m_dragging; - /// Start position for drag - wxPoint m_dragStart; - /// Do we need full layout in idle? bool m_fullLayoutRequired; wxLongLong m_fullLayoutTime; @@ -2061,7 +2161,7 @@ private: Process a @c wxEVT_COMMAND_RICHTEXT_MIDDLE_CLICK event, generated when the user releases the middle mouse button over an object. @event{EVT_RICHTEXT_LEFT_DCLICK(id, func)} - Process a @c wxEVT_COMMAND_RICHTEXT_DLEFT_CLICK event, generated when the user + Process a @c wxEVT_COMMAND_RICHTEXT_LEFT_DCLICK event, generated when the user double-clicks an object. @event{EVT_RICHTEXT_RETURN(id, func)} Process a @c wxEVT_COMMAND_RICHTEXT_RETURN event, generated when the user @@ -2092,6 +2192,9 @@ private: when the control's stylesheet has been replaced, for example when a file is loaded into the control. Valid event functions: GetOldStyleSheet, GetNewStyleSheet. + @event{EVT_RICHTEXT_PROPERTIES_CHANGED(id, func)} + Process a @c wxEVT_COMMAND_RICHTEXT_PROPERTIES_CHANGED event, generated when + properties have been applied to the control. Valid event functions: GetPosition, GetRange. @event{EVT_RICHTEXT_CONTENT_INSERTED(id, func)} Process a @c wxEVT_COMMAND_RICHTEXT_CONTENT_INSERTED event, generated when content has been inserted into the control.