]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/richedit/wxllist.h
Changed Ungetch(void *, ...) to Ungetch(const void *, ...)
[wxWidgets.git] / samples / richedit / wxllist.h
index 9c70ecbf407274cc0d533dd36c0a6b7771bbf634..071f490dbfb628df61e279005b1e4d258f7ae9d2 100644 (file)
 
 #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   <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>
 
 // 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);