X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f7770f09be0346f60e14f6dda75ded26927f07d3..8f7173abc4a901249df3ae13a91d3f19874ac269:/samples/richedit/wxllist.h diff --git a/samples/richedit/wxllist.h b/samples/richedit/wxllist.h index 9c70ecbf40..071f490dbf 100644 --- a/samples/richedit/wxllist.h +++ b/samples/richedit/wxllist.h @@ -16,12 +16,12 @@ #include "kbList.h" -#include "wx/wx.h" -#include "wx/print.h" -#include "wx/printdlg.h" -#include "wx/generic/printps.h" -#include "wx/generic/prntdlgg.h" -#include "wx/dataobj.h" +#include +#include +#include +#include +#include +#include // skip the following defines if embedded in M application #ifndef M_BASEDIR @@ -520,12 +520,14 @@ public: /** Finds the object which covers the screen position xpos in this line. @param dc the wxDC to use for calculations + @param llist the layout list to which this line belongs @param xpos the screen x coordinate @param offset where to store the difference between xpos and the object's head @return iterator to the object or NULLIT */ wxLayoutObjectList::iterator FindObjectScreen(wxDC &dc, + wxLayoutList *llist, CoordType xpos, CoordType *offset, bool *found = NULL) const ; @@ -541,11 +543,18 @@ public: functions to export the list. @return iterator to the first object */ - wxLayoutObjectList::iterator GetFirstObject(void) + wxLayoutObjectList::iterator GetFirstObject(void) const { return m_ObjectList.begin(); } + /** Get the last object in the list. + */ + wxLayoutObjectList::iterator GetLastObject(void) const + { + return m_ObjectList.tail(); + } + /** Deletes this line, returns pointer to next line. @param update If true, update all following lines. */ @@ -600,13 +609,14 @@ public: for that position @return pointer to the object */ - wxLayoutObject * FindObjectScreen(wxDC &dc, CoordType xpos, bool - *found = NULL); + wxLayoutObject * FindObjectScreen(wxDC &dc, + CoordType xpos, + bool *found = NULL); /** This sets the style info for the beginning of this line. @param si styleinfo structure */ void ApplyStyle(const wxLayoutStyleInfo &si) - { m_StyleInfo = si; } + { m_StyleInfo = si; } //@} @@ -1043,11 +1053,11 @@ public: /// adds the cursor position to the update rectangle void AddCursorPosToUpdateRect() { - #ifndef WXLAYOUT_USE_CARET - SetUpdateRect(m_CursorScreenPos); - SetUpdateRect(m_CursorScreenPos+m_CursorSize); +#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 +#endif // !WXLAYOUT_USE_CARET } /// Invalidates the update rectangle. void InvalidateUpdateRect(void) { m_UpdateRectValid = false; } @@ -1123,6 +1133,26 @@ public: void IncNumLines() { m_numLines++; } void DecNumLines() { m_numLines--; } + /// get the line by number + wxLayoutLine *GetLine(CoordType index) const + { + wxASSERT_MSG( (0 <= index) && (index < (CoordType)m_numLines), + "invalid index" ); + + wxLayoutLine *line; + CoordType n = index; + for ( line = m_FirstLine; line && n-- > 0; line = line->GetNextLine() ) + ; + + if ( line ) + { + // should be the right one + wxASSERT( line->GetLineNumber() == index ); + } + + return line; + } + private: /// Clear the list. void InternalClear(void);