+class WXDLLIMPEXP_FWD_ADV wxGrid;
+class WXDLLIMPEXP_FWD_ADV wxGridCellAttr;
+class WXDLLIMPEXP_FWD_ADV wxGridCellAttrProviderData;
+class WXDLLIMPEXP_FWD_ADV wxGridColLabelWindow;
+class WXDLLIMPEXP_FWD_ADV wxGridCornerLabelWindow;
+class WXDLLIMPEXP_FWD_ADV wxGridRowLabelWindow;
+class WXDLLIMPEXP_FWD_ADV wxGridWindow;
+class WXDLLIMPEXP_FWD_ADV wxGridTypeRegistry;
+class WXDLLIMPEXP_FWD_ADV wxGridSelection;
+
+class WXDLLIMPEXP_FWD_CORE wxHeaderCtrl;
+class WXDLLIMPEXP_FWD_CORE wxCheckBox;
+class WXDLLIMPEXP_FWD_CORE wxComboBox;
+class WXDLLIMPEXP_FWD_CORE wxTextCtrl;
+#if wxUSE_SPINCTRL
+class WXDLLIMPEXP_FWD_CORE wxSpinCtrl;
+#endif
+
+class wxGridFixedIndicesSet;
+
+class wxGridOperations;
+class wxGridRowOperations;
+class wxGridColumnOperations;
+class wxGridDirectionOperations;
+
+
+// ----------------------------------------------------------------------------
+// macros
+// ----------------------------------------------------------------------------
+
+#define wxSafeIncRef(p) if ( p ) (p)->IncRef()
+#define wxSafeDecRef(p) if ( p ) (p)->DecRef()
+
+// ----------------------------------------------------------------------------
+// wxGridCellWorker: common base class for wxGridCellRenderer and
+// wxGridCellEditor
+//
+// NB: this is more an implementation convenience than a design issue, so this
+// class is not documented and is not public at all
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxGridCellWorker : public wxClientDataContainer, public wxRefCounter
+{
+public:
+ wxGridCellWorker() { }
+
+ // interpret renderer parameters: arbitrary string whose interpretatin is
+ // left to the derived classes
+ virtual void SetParameters(const wxString& params);
+
+protected:
+ // virtual dtor for any base class - private because only DecRef() can
+ // delete us
+ virtual ~wxGridCellWorker();
+
+private:
+ // suppress the stupid gcc warning about the class having private dtor and
+ // no friends
+ friend class wxGridCellWorkerDummyFriend;
+};
+
+// ----------------------------------------------------------------------------
+// wxGridCellRenderer: this class is responsible for actually drawing the cell
+// in the grid. You may pass it to the wxGridCellAttr (below) to change the
+// format of one given cell or to wxGrid::SetDefaultRenderer() to change the
+// view of all cells. This is an ABC, you will normally use one of the
+// predefined derived classes or derive your own class from it.
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxGridCellRenderer : public wxGridCellWorker
+{
+public:
+ // draw the given cell on the provided DC inside the given rectangle
+ // using the style specified by the attribute and the default or selected
+ // state corresponding to the isSelected value.
+ //
+ // this pure virtual function has a default implementation which will
+ // prepare the DC using the given attribute: it will draw the rectangle
+ // with the bg colour from attr and set the text colour and font
+ 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
+ virtual wxSize GetBestSize(wxGrid& grid,
+ wxGridCellAttr& attr,
+ wxDC& dc,
+ int row, int col) = 0;
+
+ // create a new object which is the copy of this one
+ virtual wxGridCellRenderer *Clone() const = 0;
+};
+
+// ----------------------------------------------------------------------------
+// wxGridCellEditor: This class is responsible for providing and manipulating
+// the in-place edit controls for the grid. Instances of wxGridCellEditor
+// (actually, instances of derived classes since it is an ABC) can be
+// associated with the cell attributes for individual cells, rows, columns, or
+// even for the entire grid.
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxGridCellEditor : public wxGridCellWorker
+{
+public:
+ wxGridCellEditor();
+
+ bool IsCreated() { return m_control != NULL; }
+ wxControl* GetControl() { return m_control; }
+ void SetControl(wxControl* control) { m_control = control; }
+
+ wxGridCellAttr* GetCellAttr() { return m_attr; }
+ void SetCellAttr(wxGridCellAttr* attr) { m_attr = attr; }
+
+ // Creates the actual edit control
+ virtual void Create(wxWindow* parent,
+ wxWindowID id,
+ wxEvtHandler* evtHandler) = 0;
+
+ // Size and position the edit control
+ virtual void SetSize(const wxRect& rect);
+
+ // Show or hide the edit control, use the specified attributes to set
+ // colours/fonts for it
+ virtual void Show(bool show, wxGridCellAttr *attr = NULL);
+
+ // Draws the part of the cell not occupied by the control: the base class
+ // version just fills it with background colour from the attribute
+ virtual void PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr);
+
+
+ // The methods called by wxGrid when a cell is edited: first BeginEdit() is
+ // called, then EndEdit() is and if it returns true and if the change is
+ // not vetoed by a user-defined event handler, finally ApplyEdit() is called
+
+ // Fetch the value from the table and prepare the edit control
+ // to begin editing. Set the focus to the edit control.
+ virtual void BeginEdit(int row, int col, wxGrid* grid) = 0;
+
+ // Returns false if nothing changed, otherwise returns true and return the
+ // new value in its string form in the newval output parameter.
+ //
+ // This should also store the new value in its real type internally so that
+ // it could be used by ApplyEdit() but it must not modify the grid as the
+ // change could still be vetoed.
+ virtual bool EndEdit(int row, int col, const wxGrid *grid,
+ const wxString& oldval, wxString *newval) = 0;
+
+ // Complete the editing of the current cell by storing the value saved by
+ // the previous call to EndEdit() in the grid
+ virtual void ApplyEdit(int row, int col, wxGrid* grid) = 0;
+
+
+ // Reset the value in the control back to its starting value
+ virtual void Reset() = 0;
+
+ // return true to allow the given key to start editing: the base class
+ // version only checks that the event has no modifiers. The derived
+ // classes are supposed to do "if ( base::IsAcceptedKey() && ... )" in
+ // their IsAcceptedKey() implementation, although, of course, it is not a
+ // mandatory requirment.
+ //
+ // NB: if the key is F2 (special), editing will always start and this
+ // method will not be called at all (but StartingKey() will)
+ virtual bool IsAcceptedKey(wxKeyEvent& event);
+
+ // If the editor is enabled by pressing keys on the grid, this will be
+ // called to let the editor do something about that first key if desired
+ virtual void StartingKey(wxKeyEvent& event);
+
+ // if the editor is enabled by clicking on the cell, this method will be
+ // called
+ virtual void StartingClick();
+
+ // Some types of controls on some platforms may need some help
+ // with the Return key.
+ virtual void HandleReturn(wxKeyEvent& event);
+
+ // Final cleanup
+ virtual void Destroy();
+
+ // create a new object which is the copy of this one
+ virtual wxGridCellEditor *Clone() const = 0;
+
+ // added GetValue so we can get the value which is in the control
+ virtual wxString GetValue() const = 0;
+
+protected:
+ // the dtor is private because only DecRef() can delete us
+ virtual ~wxGridCellEditor();
+
+ // the control we show on screen
+ wxControl* m_control;
+
+ // a temporary pointer to the attribute being edited
+ wxGridCellAttr* m_attr;
+
+ // if we change the colours/font of the control from the default ones, we
+ // must restore the default later and we save them here between calls to
+ // Show(true) and Show(false)
+ wxColour m_colFgOld,
+ m_colBgOld;
+ wxFont m_fontOld;
+
+ // suppress the stupid gcc warning about the class having private dtor and
+ // no friends
+ friend class wxGridCellEditorDummyFriend;
+
+ wxDECLARE_NO_COPY_CLASS(wxGridCellEditor);
+};
+
+// ----------------------------------------------------------------------------
+// wxGridHeaderRenderer and company: like wxGridCellRenderer but for headers
+// ----------------------------------------------------------------------------
+
+// Base class for corner window renderer: it is the simplest of all renderers
+// and only has a single function
+class WXDLLIMPEXP_ADV wxGridCornerHeaderRenderer
+{
+public:
+ // Draw the border around the corner window.
+ virtual void DrawBorder(const wxGrid& grid,
+ wxDC& dc,
+ wxRect& rect) const = 0;
+
+ // make the dtor of a class with virtual functions virtual to avoid g++
+ // warnings, even though this class is not supposed to be used
+ // polymorphically
+ virtual ~wxGridCornerHeaderRenderer() { }
+};
+
+
+// Base class for the row/column header cells renderers
+class WXDLLIMPEXP_ADV wxGridHeaderLabelsRenderer
+ : public wxGridCornerHeaderRenderer
+{
+public:
+ // Draw header cell label
+ virtual void DrawLabel(const wxGrid& grid,
+ wxDC& dc,
+ const wxString& value,
+ const wxRect& rect,
+ int horizAlign,
+ int vertAlign,
+ int textOrientation) const;
+};
+
+// Currently the row/column/corner renders don't need any methods other than
+// those already in wxGridHeaderLabelsRenderer but still define separate classes
+// for them for future extensions and also for better type safety (i.e. to
+// avoid inadvertently using a column header renderer for the row headers)
+class WXDLLIMPEXP_ADV wxGridRowHeaderRenderer
+ : public wxGridHeaderLabelsRenderer
+{
+};
+
+class WXDLLIMPEXP_ADV wxGridColumnHeaderRenderer
+ : public wxGridHeaderLabelsRenderer
+{
+};
+
+// Also define the default renderers which are used by wxGridCellAttrProvider
+// by default
+class WXDLLIMPEXP_ADV wxGridRowHeaderRendererDefault
+ : public wxGridRowHeaderRenderer
+{
+public:
+ virtual void DrawBorder(const wxGrid& grid,
+ wxDC& dc,
+ wxRect& rect) const;
+};
+
+// Column header cells renderers
+class WXDLLIMPEXP_ADV wxGridColumnHeaderRendererDefault
+ : public wxGridColumnHeaderRenderer
+{
+public:
+ virtual void DrawBorder(const wxGrid& grid,
+ wxDC& dc,
+ wxRect& rect) const;
+};
+
+// Header corner renderer
+class WXDLLIMPEXP_ADV wxGridCornerHeaderRendererDefault
+ : public wxGridCornerHeaderRenderer
+{
+public:
+ virtual void DrawBorder(const wxGrid& grid,
+ wxDC& dc,
+ wxRect& rect) const;
+};
+