-#include "wx/grid.h"
-
-// ----------------------------------------------------------------------------
-// array classes
-// ----------------------------------------------------------------------------
-
-WX_DEFINE_ARRAY(wxGridCellAttr *, wxArrayAttrs);
-
-struct wxGridCellWithAttr
-{
- wxGridCellWithAttr(int row, int col, wxGridCellAttr *attr_)
- : coords(row, col), attr(attr_)
- {
- }
-
- ~wxGridCellWithAttr()
- {
- attr->DecRef();
- }
-
- wxGridCellCoords coords;
- wxGridCellAttr *attr;
-};
-
-WX_DECLARE_OBJARRAY(wxGridCellWithAttr, wxGridCellWithAttrArray);
-
-#include "wx/arrimpl.cpp"
-
-WX_DEFINE_OBJARRAY(wxGridCellCoordsArray)
-WX_DEFINE_OBJARRAY(wxGridCellWithAttrArray)
-
-// ----------------------------------------------------------------------------
-// private classes
-// ----------------------------------------------------------------------------
-
-class WXDLLEXPORT wxGridRowLabelWindow : public wxWindow
-{
-public:
- wxGridRowLabelWindow() { m_owner = (wxGrid *)NULL; }
- wxGridRowLabelWindow( wxGrid *parent, wxWindowID id,
- const wxPoint &pos, const wxSize &size );
-
-private:
- wxGrid *m_owner;
-
- void OnPaint( wxPaintEvent& event );
- void OnMouseEvent( wxMouseEvent& event );
- void OnKeyDown( wxKeyEvent& event );
-
- DECLARE_DYNAMIC_CLASS(wxGridRowLabelWindow)
- DECLARE_EVENT_TABLE()
-};
-
-
-class WXDLLEXPORT wxGridColLabelWindow : public wxWindow
-{
-public:
- wxGridColLabelWindow() { m_owner = (wxGrid *)NULL; }
- wxGridColLabelWindow( wxGrid *parent, wxWindowID id,
- const wxPoint &pos, const wxSize &size );
-
-private:
- wxGrid *m_owner;
-
- void OnPaint( wxPaintEvent &event );
- void OnMouseEvent( wxMouseEvent& event );
- void OnKeyDown( wxKeyEvent& event );
-
- DECLARE_DYNAMIC_CLASS(wxGridColLabelWindow)
- DECLARE_EVENT_TABLE()
-};
-
-
-class WXDLLEXPORT wxGridCornerLabelWindow : public wxWindow
-{
-public:
- wxGridCornerLabelWindow() { m_owner = (wxGrid *)NULL; }
- wxGridCornerLabelWindow( wxGrid *parent, wxWindowID id,
- const wxPoint &pos, const wxSize &size );
-
-private:
- wxGrid *m_owner;
-
- void OnMouseEvent( wxMouseEvent& event );
- void OnKeyDown( wxKeyEvent& event );
- void OnPaint( wxPaintEvent& event );
-
- DECLARE_DYNAMIC_CLASS(wxGridCornerLabelWindow)
- DECLARE_EVENT_TABLE()
-};
-
-class WXDLLEXPORT wxGridWindow : public wxPanel
-{
-public:
- wxGridWindow()
- {
- m_owner = (wxGrid *)NULL;
- m_rowLabelWin = (wxGridRowLabelWindow *)NULL;
- m_colLabelWin = (wxGridColLabelWindow *)NULL;
- }
-
- wxGridWindow( wxGrid *parent,
- wxGridRowLabelWindow *rowLblWin,
- wxGridColLabelWindow *colLblWin,
- wxWindowID id, const wxPoint &pos, const wxSize &size );
- ~wxGridWindow();
-
- void ScrollWindow( int dx, int dy, const wxRect *rect );
-
-private:
- wxGrid *m_owner;
- wxGridRowLabelWindow *m_rowLabelWin;
- wxGridColLabelWindow *m_colLabelWin;
-
- void OnPaint( wxPaintEvent &event );
- void OnMouseEvent( wxMouseEvent& event );
- void OnKeyDown( wxKeyEvent& );
- void OnEraseBackground( wxEraseEvent& );
-
-
- DECLARE_DYNAMIC_CLASS(wxGridWindow)
- DECLARE_EVENT_TABLE()
-};
-
-
-
-class wxGridCellEditorEvtHandler : public wxEvtHandler
-{
-public:
- wxGridCellEditorEvtHandler()
- : m_grid(0), m_editor(0)
- { }
- wxGridCellEditorEvtHandler(wxGrid* grid, wxGridCellEditor* editor)
- : m_grid(grid), m_editor(editor)
- { }
-
- void OnKeyDown(wxKeyEvent& event);
- void OnChar(wxKeyEvent& event);
-
-private:
- wxGrid* m_grid;
- wxGridCellEditor* m_editor;
- DECLARE_DYNAMIC_CLASS(wxGridCellEditorEvtHandler)
- DECLARE_EVENT_TABLE()
-};
-
-
-IMPLEMENT_DYNAMIC_CLASS( wxGridCellEditorEvtHandler, wxEvtHandler )
-BEGIN_EVENT_TABLE( wxGridCellEditorEvtHandler, wxEvtHandler )
- EVT_KEY_DOWN( wxGridCellEditorEvtHandler::OnKeyDown )
- EVT_CHAR( wxGridCellEditorEvtHandler::OnChar )
-END_EVENT_TABLE()
-
-
-
-// ----------------------------------------------------------------------------
-// the internal data representation used by wxGridCellAttrProvider
-// ----------------------------------------------------------------------------
-
-// this class stores attributes set for cells
-class WXDLLEXPORT wxGridCellAttrData
-{
-public:
- void SetAttr(wxGridCellAttr *attr, int row, int col);
- wxGridCellAttr *GetAttr(int row, int col) const;
- void UpdateAttrRows( size_t pos, int numRows );
- void UpdateAttrCols( size_t pos, int numCols );
-
-private:
- // searches for the attr for given cell, returns wxNOT_FOUND if not found
- int FindIndex(int row, int col) const;
-
- wxGridCellWithAttrArray m_attrs;
-};
-
-// this class stores attributes set for rows or columns
-class WXDLLEXPORT wxGridRowOrColAttrData
-{
-public:
- // empty ctor to suppress warnings
- wxGridRowOrColAttrData() { }
- ~wxGridRowOrColAttrData();
-
- void SetAttr(wxGridCellAttr *attr, int rowOrCol);
- wxGridCellAttr *GetAttr(int rowOrCol) const;
- void UpdateAttrRowsOrCols( size_t pos, int numRowsOrCols );
-
-private:
- wxArrayInt m_rowsOrCols;
- wxArrayAttrs m_attrs;
-};
-
-// NB: this is just a wrapper around 3 objects: one which stores cell
-// attributes, and 2 others for row/col ones
-class WXDLLEXPORT wxGridCellAttrProviderData
-{
-public:
- wxGridCellAttrData m_cellAttrs;
- wxGridRowOrColAttrData m_rowAttrs,
- m_colAttrs;
-};
-
-
-// ----------------------------------------------------------------------------
-// data structures used for the data type registry
-// ----------------------------------------------------------------------------
-
-struct wxGridDataTypeInfo
-{
- wxGridDataTypeInfo(const wxString& typeName,
- wxGridCellRenderer* renderer,
- wxGridCellEditor* editor)
- : m_typeName(typeName), m_renderer(renderer), m_editor(editor)
- { }
-
- ~wxGridDataTypeInfo() { delete m_renderer; delete m_editor; }
-
- wxString m_typeName;
- wxGridCellRenderer* m_renderer;
- wxGridCellEditor* m_editor;
-};
-