]> git.saurik.com Git - wxWidgets.git/blobdiff - interface/wx/grid.h
no changes, just reformat, remove extraneous semicolons and inline keywords
[wxWidgets.git] / interface / wx / grid.h
index da7bf9a11774befd82b274ced1f36236785dd44d..c10743259d3294a34fc05ab84a230b80ebe93cbe 100644 (file)
@@ -298,8 +298,6 @@ public:
         arbitrary locations. In such case you may implement this method only
         and leave InsertRows() unimplemented.
 
         arbitrary locations. In such case you may implement this method only
         and leave InsertRows() unimplemented.
 
-        @param pos
-            The position of the first new row.
         @param numRows
             The number of rows to add.
      */
         @param numRows
             The number of rows to add.
      */
@@ -388,16 +386,7 @@ public:
         neither associated with this table by SetAttrProvider() nor created on
         demand by any other methods.
      */
         neither associated with this table by SetAttrProvider() nor created on
         demand by any other methods.
      */
-    wxGridCellAttrProvider *GetAttrProvider() const { return m_attrProvider; }
-
-    /**
-        Returns true if this table supports attributes or false otherwise.
-
-        By default, the table automatically creates a wxGridCellAttrProvider
-        when this function is called if it had no attribute provider before and
-        returns @true.
-     */
-    virtual bool CanHaveAttributes();
+    wxGridCellAttrProvider *GetAttrProvider() const;
 
     /**
         Return the attribute for the given cell.
 
     /**
         Return the attribute for the given cell.
@@ -440,6 +429,15 @@ public:
     virtual void SetColAttr(wxGridCellAttr *attr, int col);
 
     //@}
     virtual void SetColAttr(wxGridCellAttr *attr, int col);
 
     //@}
+
+    /**
+        Returns true if this table supports attributes or false otherwise.
+
+        By default, the table automatically creates a wxGridCellAttrProvider
+        when this function is called if it had no attribute provider before and
+        returns @true.
+     */
+    virtual bool CanHaveAttributes();
 };
 
 
 };
 
 
@@ -467,27 +465,22 @@ public:
     */
     wxGridCellEditor();
 
     */
     wxGridCellEditor();
 
-    /**
-        The dtor is private because only DecRef() can delete us.
-    */
-    ~wxGridCellEditor();
-
     /**
         Fetch the value from the table and prepare the edit control
         to begin editing. Set the focus to the edit control.
     */
     /**
         Fetch the value from the table and prepare the edit control
         to begin editing. Set the focus to the edit control.
     */
-    void BeginEdit(int row, int col, wxGrid* grid);
+    virtual void BeginEdit(int row, int col, wxGrid* grid) = 0;
 
     /**
         Create a new object which is the copy of this one.
     */
 
     /**
         Create a new object which is the copy of this one.
     */
-    wxGridCellEditor* Clone() const;
+    virtual wxGridCellEditor* Clone() const = 0;
 
     /**
         Creates the actual edit control.
     */
 
     /**
         Creates the actual edit control.
     */
-    void Create(wxWindow* parent, wxWindowID id,
-                wxEvtHandler* evtHandler);
+    virtual void Create(wxWindow* parent, wxWindowID id,
+                        wxEvtHandler* evtHandler) = 0;
 
     /**
         Final cleanup.
 
     /**
         Final cleanup.
@@ -498,7 +491,7 @@ public:
         Complete the editing of the current cell. Returns @true if the value has
         changed. If necessary, the control may be destroyed.
     */
         Complete the editing of the current cell. Returns @true if the value has
         changed. If necessary, the control may be destroyed.
     */
-    bool EndEdit(int row, int col, wxGrid* grid);
+    virtual bool EndEdit(int row, int col, wxGrid* grid) = 0;
 
     /**
         Some types of controls on some platforms may need some help
 
     /**
         Some types of controls on some platforms may need some help
@@ -515,13 +508,12 @@ public:
         Draws the part of the cell not occupied by the control: the base class
         version just fills it with background colour from the attribute.
     */
         Draws the part of the cell not occupied by the control: the base class
         version just fills it with background colour from the attribute.
     */
-    void PaintBackground(const wxRect& rectCell,
-                         wxGridCellAttr* attr);
+    virtual void PaintBackground(const wxRect& rectCell, wxGridCellAttr* attr);
 
     /**
         Reset the value in the control back to its starting value.
     */
 
     /**
         Reset the value in the control back to its starting value.
     */
-    void Reset();
+    virtual void Reset() = 0;
 
     /**
         Size and position the edit control.
 
     /**
         Size and position the edit control.
@@ -546,6 +538,13 @@ public:
         that first key if desired.
     */
     virtual void StartingKey(wxKeyEvent& event);
         that first key if desired.
     */
     virtual void StartingKey(wxKeyEvent& event);
+
+protected:
+
+    /**
+        The dtor is private because only DecRef() can delete us.
+    */
+    virtual ~wxGridCellEditor();
 };
 
 
 };
 
 
@@ -627,6 +626,12 @@ public:
     wxGridCellChoiceEditor(size_t count = 0,
                            const wxString choices[] = NULL,
                            bool allowOthers = false);
     wxGridCellChoiceEditor(size_t count = 0,
                            const wxString choices[] = NULL,
                            bool allowOthers = false);
+    /**
+        @param choices
+            An array of strings from which the user can choose.
+        @param allowOthers
+            If allowOthers is @true, the user can type a string not in choices array.
+    */
     wxGridCellChoiceEditor(const wxArrayString& choices,
                            bool allowOthers = false);
     //@}
     wxGridCellChoiceEditor(const wxArrayString& choices,
                            bool allowOthers = false);
     //@}
@@ -723,12 +728,12 @@ public:
     /**
         Returns @true if the Alt key was down at the time of the event.
     */
     /**
         Returns @true if the Alt key was down at the time of the event.
     */
-    bool AltDown();
+    bool AltDown() const;
 
     /**
         Returns @true if the Control key was down at the time of the event.
     */
 
     /**
         Returns @true if the Control key was down at the time of the event.
     */
-    bool ControlDown();
+    bool ControlDown() const;
 
     /**
         Top left corner of the rectangular area that was (de)selected.
 
     /**
         Top left corner of the rectangular area that was (de)selected.
@@ -763,7 +768,7 @@ public:
     /**
         Returns @true if the Meta key was down at the time of the event.
     */
     /**
         Returns @true if the Meta key was down at the time of the event.
     */
-    bool MetaDown();
+    bool MetaDown() const;
 
     /**
         Returns @true if the area was selected, @false otherwise.
 
     /**
         Returns @true if the area was selected, @false otherwise.
@@ -773,7 +778,7 @@ public:
     /**
         Returns @true if the Shift key was down at the time of the event.
     */
     /**
         Returns @true if the Shift key was down at the time of the event.
     */
-    bool ShiftDown();
+    bool ShiftDown() const;
 };
 
 
 };
 
 
@@ -800,7 +805,7 @@ public:
     /**
 
     */
     /**
 
     */
-    wxGridCellRenderer* Clone() const;
+    virtual wxGridCellRenderer* Clone() const = 0;
 
     /**
         Draw the given cell on the provided DC inside the given rectangle
 
     /**
         Draw the given cell on the provided DC inside the given rectangle
@@ -810,15 +815,15 @@ public:
         prepare the DC using the given attribute: it will draw the rectangle
         with the background colour from attr and set the text colour and font.
     */
         prepare the DC using the given attribute: it will draw the rectangle
         with the background colour from attr and set the text colour and font.
     */
-    void Draw(wxGrid& grid, wxGridCellAttr& attr, wxDC& dc,
-              const wxRect& rect, int row, int col,
-              bool isSelected);
+    virtual void Draw(wxGrid& grid, wxGridCellAttr& attr, wxDC& dc,
+                      const wxRect& rect, int row, int col,
+                      bool isSelected) = 0;
 
     /**
         Get the preferred size of the cell for its contents.
     */
 
     /**
         Get the preferred size of the cell for its contents.
     */
-    wxSize GetBestSize(wxGrid& grid, wxGridCellAttr& attr, wxDC& dc,
-                       int row, int col);
+    virtual wxSize GetBestSize(wxGrid& grid, wxGridCellAttr& attr, wxDC& dc,
+                               int row, int col) = 0;
 };
 
 
 };
 
 
@@ -843,10 +848,13 @@ public:
     */
     wxGridCellNumberEditor(int min = -1, int max = -1);
 
     */
     wxGridCellNumberEditor(int min = -1, int max = -1);
 
+
     /**
     /**
-        String representation of the value.
+        Parameters string format is "min,max".
     */
     */
-    wxString GetString() const;
+    virtual void SetParameters(const wxString& params);
+
+protected:
 
     /**
         If the return value is @true, the editor uses a wxSpinCtrl to get user input,
 
     /**
         If the return value is @true, the editor uses a wxSpinCtrl to get user input,
@@ -855,9 +863,9 @@ public:
     bool HasRange() const;
 
     /**
     bool HasRange() const;
 
     /**
-        Parameters string format is "min,max".
+        String representation of the value.
     */
     */
-    virtual void SetParameters(const wxString& params);
+    wxString GetString() const;
 };
 
 
 };
 
 
@@ -891,12 +899,12 @@ public:
     /**
         Returns @true if the Alt key was down at the time of the event.
     */
     /**
         Returns @true if the Alt key was down at the time of the event.
     */
-    bool AltDown();
+    bool AltDown() const;
 
     /**
         Returns @true if the Control key was down at the time of the event.
     */
 
     /**
         Returns @true if the Control key was down at the time of the event.
     */
-    bool ControlDown();
+    bool ControlDown() const;
 
     /**
         Position in pixels at which the event occurred.
 
     /**
         Position in pixels at which the event occurred.
@@ -911,12 +919,12 @@ public:
     /**
         Returns @true if the Meta key was down at the time of the event.
     */
     /**
         Returns @true if the Meta key was down at the time of the event.
     */
-    bool MetaDown();
+    bool MetaDown() const;
 
     /**
         Returns @true if the Shift key was down at the time of the event.
     */
 
     /**
         Returns @true if the Shift key was down at the time of the event.
     */
-    bool ShiftDown();
+    bool ShiftDown() const;
 };
 
 
 };
 
 
@@ -985,27 +993,27 @@ public:
     /**
 
     */
     /**
 
     */
-    const wxColour GetBackgroundColour() const;
+    const wxColour& GetBackgroundColour() const;
 
     /**
 
     */
 
     /**
 
     */
-    wxGridCellEditor* GetEditor(wxGrid* grid, int row, int col) const;
+    wxGridCellEditor* GetEditor(const wxGrid* grid, int row, int col) const;
 
     /**
 
     */
 
     /**
 
     */
-    const wxFont GetFont() const;
+    const wxFont& GetFont() const;
 
     /**
 
     */
 
     /**
 
     */
-    wxGridCellRenderer* GetRenderer(wxGrid* grid, int row, int col) const;
+    wxGridCellRenderer* GetRenderer(const wxGrid* grid, int row, int col) const;
 
     /**
 
     */
 
     /**
 
     */
-    const wxColour GetTextColour() const;
+    const wxColour& GetTextColour() const;
 
     /**
 
 
     /**
 
@@ -1146,12 +1154,12 @@ public:
     /**
         Returns @true if the Alt key was down at the time of the event.
     */
     /**
         Returns @true if the Alt key was down at the time of the event.
     */
-    bool AltDown();
+    bool AltDown() const;
 
     /**
         Returns @true if the Control key was down at the time of the event.
     */
 
     /**
         Returns @true if the Control key was down at the time of the event.
     */
-    bool ControlDown();
+    bool ControlDown() const;
 
     /**
         Column at which the event occurred.
 
     /**
         Column at which the event occurred.
@@ -1171,7 +1179,7 @@ public:
     /**
         Returns @true if the Meta key was down at the time of the event.
     */
     /**
         Returns @true if the Meta key was down at the time of the event.
     */
-    bool MetaDown();
+    bool MetaDown() const;
 
     /**
         Returns @true if the user is selecting grid cells, @false -- if
 
     /**
         Returns @true if the user is selecting grid cells, @false -- if
@@ -1182,7 +1190,7 @@ public:
     /**
         Returns @true if the Shift key was down at the time of the event.
     */
     /**
         Returns @true if the Shift key was down at the time of the event.
     */
-    bool ShiftDown();
+    bool ShiftDown() const;
 };
 
 
 };
 
 
@@ -1489,15 +1497,6 @@ public:
     */
     bool CanEnableCellControl() const;
 
     */
     bool CanEnableCellControl() const;
 
-    /**
-        Returns @true if this grid has support for cell attributes.
-
-        The grid supports attributes if it has the associated table which, in
-        turn, has attributes support, i.e. wxGridTableBase::CanHaveAttributes()
-        returns @true.
-    */
-    bool CanHaveAttributes() const;
-
     //@{
     /**
         Return the rectangle corresponding to the grid cell's size and position
     //@{
     /**
         Return the rectangle corresponding to the grid cell's size and position
@@ -1685,7 +1684,7 @@ public:
     /**
         Overridden wxWindow method.
     */
     /**
         Overridden wxWindow method.
     */
-    void Fit();
+    virtual void Fit();
 
     /**
         Causes immediate repainting of the grid.
 
     /**
         Causes immediate repainting of the grid.
@@ -1721,7 +1720,7 @@ public:
     /**
         Returns a pointer to the editor for the cell at the specified location.
 
     /**
         Returns a pointer to the editor for the cell at the specified location.
 
-        See wxGridCellEditor and the @ref overview_grid "wxGrid overview" 
+        See wxGridCellEditor and the @ref overview_grid "wxGrid overview"
         for more information about cell editors and renderers.
 
         The caller must call DecRef() on the returned pointer.
         for more information about cell editors and renderers.
 
         The caller must call DecRef() on the returned pointer.
@@ -1808,11 +1807,6 @@ public:
     */
     wxString GetColLabelValue(int col) const;
 
     */
     wxString GetColLabelValue(int col) const;
 
-    /**
-        Returns the coordinate of the left border specified column.
-    */
-    int GetColLeft(int col) const;
-
     /**
         Returns the minimal width to which a column may be resized.
 
     /**
         Returns the minimal width to which a column may be resized.
 
@@ -1821,25 +1815,11 @@ public:
     */
     int GetColMinimalAcceptableWidth() const;
 
     */
     int GetColMinimalAcceptableWidth() const;
 
-    /**
-        Get the minimal width of the given column/row.
-
-        The value returned by this function may be different than that returned
-        by GetColMinimalAcceptableWidth() if SetColMinimalWidth() had been
-        called for this column.
-    */
-    int GetColMinimalWidth(int col) const;
-
     /**
         Returns the position of the specified column.
     */
     int GetColPos(int colID) const;
 
     /**
         Returns the position of the specified column.
     */
     int GetColPos(int colID) const;
 
-    /**
-        Returns the coordinate of the right border specified column.
-    */
-    int GetColRight(int col) const;
-
     /**
         Returns the width of the specified column.
     */
     /**
         Returns the width of the specified column.
     */
@@ -2087,15 +2067,6 @@ public:
     */
     int GetRowMinimalAcceptableHeight() const;
 
     */
     int GetRowMinimalAcceptableHeight() const;
 
-    /**
-        Returns the minimal size for the given column.
-
-        The value returned by this function may be different than that returned
-        by GetRowMinimalAcceptableHeight() if SetRowMinimalHeight() had been
-        called for this row.
-    */
-    int GetRowMinimalHeight(int col) const;
-
     /**
         Returns the height of the specified row.
     */
     /**
         Returns the height of the specified row.
     */
@@ -2339,8 +2310,8 @@ public:
         @true even if the cell is only partially visible.
     */
     bool IsVisible(int row, int col, bool wholeCellVisible = true) const;
         @true even if the cell is only partially visible.
     */
     bool IsVisible(int row, int col, bool wholeCellVisible = true) const;
-    const bool IsVisible(const wxGridCellCoords& coords,
-                         bool wholeCellVisible = true) const;
+    bool IsVisible(const wxGridCellCoords& coords,
+                   bool wholeCellVisible = true) const;
     //@}
 
     //@{
     //@}
 
     //@{
@@ -2764,7 +2735,7 @@ public:
 
         The grid will take ownership of the pointer.
 
 
         The grid will take ownership of the pointer.
 
-        See wxGridCellRenderer and the @ref overview_grid "wxGrid overview" 
+        See wxGridCellRenderer and the @ref overview_grid "wxGrid overview"
         for more information about cell editors and renderers.
     */
     void SetDefaultRenderer(wxGridCellRenderer* renderer);
         for more information about cell editors and renderers.
     */
     void SetDefaultRenderer(wxGridCellRenderer* renderer);
@@ -3014,7 +2985,45 @@ public:
 
         Returns @c wxNOT_FOUND if there is no row at the y position.
     */
 
         Returns @c wxNOT_FOUND if there is no row at the y position.
     */
-    int YToRow(int y) const;
+    int YToRow(int y, bool clipToMinMax = false) const;
+
+protected:
+    /**
+        Returns @true if this grid has support for cell attributes.
+
+        The grid supports attributes if it has the associated table which, in
+        turn, has attributes support, i.e. wxGridTableBase::CanHaveAttributes()
+        returns @true.
+    */
+    bool CanHaveAttributes() const;
+
+    /**
+        Get the minimal width of the given column/row.
+
+        The value returned by this function may be different than that returned
+        by GetColMinimalAcceptableWidth() if SetColMinimalWidth() had been
+        called for this column.
+    */
+    int GetColMinimalWidth(int col) const;
+
+    /**
+        Returns the coordinate of the right border specified column.
+    */
+    int GetColRight(int col) const;
+
+    /**
+        Returns the coordinate of the left border specified column.
+    */
+    int GetColLeft(int col) const;
+
+    /**
+        Returns the minimal size for the given column.
+
+        The value returned by this function may be different than that returned
+        by GetRowMinimalAcceptableHeight() if SetRowMinimalHeight() had been
+        called for this row.
+    */
+    int GetRowMinimalHeight(int col) const;
 };
 
 
 };