+ /** Delete the next word.
+ */
+ void DeleteWord()
+ {
+ wxASSERT(m_CursorLine);
+ m_CursorLine->DeleteWord(m_CursorPos.x);
+ }
+
+ //@}
+
+ /** Finds text in this list.
+ @param needle the text to find
+ @param cpos the position where to start the search
+ @return the cursor coord where it was found or (-1,-1)
+ */
+ wxPoint FindText(const wxString &needle, const wxPoint &cpos = wxPoint(0,0)) const;
+
+ /**@name Formatting options */
+ //@{
+ /// sets font parameters
+ void SetFont(int family, int size, int style,
+ int weight, int underline,
+ wxColour *fg,
+ wxColour *bg);
+
+ /// sets font parameters, colours by name
+ void SetFont(int family=-1, int size = -1, int style=-1,
+ int weight=-1, int underline = -1,
+ wxChar const *fg = NULL,
+ wxChar const *bg = NULL);
+
+ /// changes to the next larger font size
+ inline void SetFontLarger()
+ { SetFont(-1,(12*m_CurrentStyleInfo.size)/10); }
+
+ /// changes to the next smaller font size
+ inline void SetFontSmaller()
+ { SetFont(-1,(10*m_CurrentStyleInfo.size)/12); }
+
+ /// set font family
+ inline void SetFontFamily(int family) { SetFont(family); }
+
+ /// set font size
+ inline void SetFontSize(int size) { SetFont(-1,size); }
+
+ /// set font style
+ inline void SetFontStyle(int style) { SetFont(-1,-1,style); }
+
+ /// set font weight
+ inline void SetFontWeight(int weight) { SetFont(-1,-1,-1,weight); }
+
+ /// toggle underline flag
+ inline void SetFontUnderline(bool ul) { SetFont(-1,-1,-1,-1,(int)ul); }
+
+ /// set font colours by name
+ inline void SetFontColour(wxChar const *fg, wxChar const *bg = NULL)
+ { SetFont(-1,-1,-1,-1,-1,fg,bg); }
+
+ /// set font colours by colour
+ inline void SetFontColour(wxColour *fg, wxColour *bg = NULL)
+ { SetFont(-1,-1,-1,-1,-1,fg,bg); }
+
+ /**
+ Returns a pointer to the default settings.
+ This is only valid temporarily and should not be stored
+ anywhere.
+ @return the default settings of the list
+ */
+ wxLayoutStyleInfo &GetDefaultStyleInfo() { return m_DefaultStyleInfo ; }
+ wxLayoutStyleInfo &GetStyleInfo() { return m_CurrentStyleInfo ; }
+ const wxLayoutStyleInfo &GetStyleInfo() const { return m_CurrentStyleInfo ; }
+ const wxLayoutStyleInfo &GetCursorStyleInfo() const { return m_CursorStyleInfo ; }
+
+ /// is the current font underlined?
+ bool IsFontUnderlined() const { return GetCursorStyleInfo().underline != 0; }
+
+ /// is the current font bold?
+ bool IsFontBold() const { return GetCursorStyleInfo().weight == wxBOLD; }
+
+ /// is the current font italic?
+ bool IsFontItalic() const { return GetCursorStyleInfo().style == wxITALIC; }
+
+ /// set underline if it was off, turn it off if it was on
+ void ToggleFontUnderline()
+ { SetFontUnderline(!IsFontUnderlined()); }
+
+ /// make font bold if it was normal or make it normal if it was bold
+ void ToggleFontWeight()
+ { SetFontWeight(IsFontBold() ? wxNORMAL : wxBOLD); }
+
+ /// make font italic if it was normal or make it normal if it was italic
+ void ToggleFontItalics()
+ { SetFontStyle(IsFontItalic() ? wxNORMAL : wxITALIC); }
+
+ //@}
+
+ /**@name Drawing */
+ //@{
+ /** Draws the complete list on a wxDC.
+ @param dc the wxDC to draw on
+ @param offset an optional offset to shift printout
+ @param top optional y coordinate where to start drawing
+ @param bottom optional y coordinate where to stop drawing
+ @param clipStrictly if set, do not draw objects which reach
+ beyond "bottom". Set this when printing.
+ */
+ void Draw(wxDC &dc,
+ const wxPoint &offset = wxPoint(0,0),
+ CoordType top = -1, CoordType bottom = -1,
+ bool clipStrictly = false);
+
+ /** Calculates new layout for the list, like Draw() but does not
+ actually draw it.
+ @param dc the wxDC to draw on
+ @param bottom optional y coordinate where to stop calculating
+ @param forceAll force re-layout of all lines
+ @param cpos Can hold a cursorposition, and will be overwritten
+ with the corresponding DC position.
+ @param csize Will hold the cursor size relating to cpos.
+ */
+ void Layout(wxDC &dc, CoordType bottom = -1, bool forceAll = false,
+ wxPoint *cpos = NULL,
+ wxPoint *csize = NULL);
+
+ /** Ensure that the whole list will be recalculate on the next call
+ to Layout() or Draw().
+ @param redrawAll true or false to reset it
+ */
+ void ForceTotalLayout(bool redrawAll = true)
+ { m_ReLayoutAll = redrawAll; }
+
+ /** Returns the screen coordinates relating to a given cursor
+ position and the size of the cursor at that position.
+ @param dc for which to calculate it
+ @param cpos Cursor position to look for.
+ @param csize If non-NULL, will be set to the cursor size.
+ @return The cursor position on the DC.
+ */
+ wxPoint GetScreenPos(wxDC &dc, const wxPoint &cpos, wxPoint *csize = NULL);
+
+ /** Calculates new sizes for everything in the list, like Layout()
+ but this is needed after the list got changed.
+ @param dc the wxDC to draw on
+ @param bottom optional y coordinate where to stop calculating
+ */
+ void Recalculate(wxDC &dc, CoordType bottom = -1);
+
+ /** Returns the size of the list in screen coordinates.
+ The return value only makes sense after the list has been
+ drawn.
+ @return a wxPoint holding the maximal x/y coordinates used for
+ drawing
+ */
+ wxPoint GetSize() const;
+
+ /** Returns the cursor position on the screen.
+ */
+ wxPoint GetCursorScreenPos() const;
+
+ /** Draws the cursor.
+ @param active If true, draw a bold cursor to mark window as
+ active.
+ @param translate optional translation of cursor coords on screen
+ */
+ void DrawCursor(wxDC &dc,
+ bool active = true,
+ const wxPoint & translate = wxPoint(0,0));
+
+ /** This function finds an object belonging to a given screen
+ position. It assumes that Layout() has been called before.
+ @param pos screen position
+ @param cursorPos if non NULL, store cursor position in there
+ @param found if used, set this to true if we really found an
+ object, to false if we had to take the object near to it
+ @return pointer to the object
+ */
+ wxLayoutObject * FindObjectScreen(wxDC &dc,
+ wxPoint const pos,
+ wxPoint *cursorPos = NULL,
+ bool *found = NULL);
+
+ /** Called by the objects to update the update rectangle.
+ @param x horizontal coordinate to include in rectangle
+ @param y vertical coordinate to include in rectangle
+ */
+ void SetUpdateRect(CoordType x, CoordType y);
+
+ /** Called by the objects to update the update rectangle.
+ @param p a point to include in it
+ */
+ void SetUpdateRect(const wxPoint &p)
+ { SetUpdateRect(p.x,p.y); }
+
+ /// adds the cursor position to the update rectangle
+ void AddCursorPosToUpdateRect()
+ {
+#ifndef WXLAYOUT_USE_CARET
+ SetUpdateRect(m_CursorScreenPos);
+ SetUpdateRect(m_CursorScreenPos+m_CursorSize);
+//#else - the caret will take care of refreshing itself
+#endif // !WXLAYOUT_USE_CARET
+ }
+
+ /// Invalidates the update rectangle.
+ void InvalidateUpdateRect() { m_UpdateRectValid = false; }
+
+ /// Returns the update rectangle.
+ const wxRect *GetUpdateRect() const { return &m_UpdateRect; }
+ //@}
+
+ /// get the current cursor size
+ const wxPoint& GetCursorSize() const { return m_CursorSize; }
+
+ /**@name For exporting one object after another. */
+ //@{
+ /** Returns a pointer to the first line in the list. */
+ wxLayoutLine *GetFirstLine()
+ {
+ wxASSERT(m_FirstLine);
+ return m_FirstLine;
+ }
+ //@}
+
+ /// Begin selecting text
+ void StartSelection(const wxPoint& cpos = wxPoint(-1,-1),
+ const wxPoint& spos = wxPoint(-1,-1));
+
+ // Continue selecting text
+ void ContinueSelection(const wxPoint& cpos = wxPoint(-1,-1),
+ const wxPoint& spos = wxPoint(-1,-1));
+
+ /// End selecting text.
+ void EndSelection(const wxPoint& cpos = wxPoint(-1,-1),
+ const wxPoint& spos = wxPoint(-1,-1));
+
+ /// Discard the current selection
+ void DiscardSelection();
+
+ /// Are we still selecting text?
+ bool IsSelecting() const;
+
+ /// Is the given point (text coords) selected?
+ bool IsSelected(const wxPoint &cursor) const;
+
+ /// Do we have a non null selection?
+ bool HasSelection() const
+ { return m_Selection.m_valid || m_Selection.m_selecting; }
+
+ /** Return the selection as a wxLayoutList.
+ @param invalidate if true, the selection will be invalidated after this and can no longer be used.
+ @return Another layout list object holding the selection, must be freed by caller
+ */
+ wxLayoutList *GetSelection(class wxLayoutDataObject *wxldo = NULL, bool invalidate = true);
+
+ /// Delete selected bit
+ void DeleteSelection();
+
+ wxLayoutList *Copy(const wxPoint &from = wxPoint(0,0),
+ const wxPoint &to = wxPoint(-1,-1));