+protected:
+ bool m_created;
+ bool m_displayed;
+
+ wxGridWindow *m_gridWin;
+ wxGridRowLabelWindow *m_rowLabelWin;
+ wxGridColLabelWindow *m_colLabelWin;
+ wxGridCornerLabelWindow *m_cornerLabelWin;
+
+ wxGridTableBase *m_table;
+ bool m_ownTable;
+
+ int m_left;
+ int m_top;
+ int m_right;
+ int m_bottom;
+
+ int m_numRows;
+ int m_numCols;
+
+ wxGridCellCoords m_currentCellCoords;
+
+ wxGridCellCoords m_selectedTopLeft;
+ wxGridCellCoords m_selectedBottomRight;
+ wxColour m_selectionBackground;
+ wxColour m_selectionForeground;
+
+ int m_defaultRowHeight;
+ wxArrayInt m_rowHeights;
+ wxArrayInt m_rowBottoms;
+
+ int m_defaultColWidth;
+ wxArrayInt m_colWidths;
+ wxArrayInt m_colRights;
+
+ int m_rowLabelWidth;
+ int m_colLabelHeight;
+
+ wxColour m_labelBackgroundColour;
+ wxColour m_labelTextColour;
+ wxFont m_labelFont;
+
+ int m_rowLabelHorizAlign;
+ int m_rowLabelVertAlign;
+ int m_colLabelHorizAlign;
+ int m_colLabelVertAlign;
+
+ bool m_defaultRowLabelValues;
+ bool m_defaultColLabelValues;
+
+ wxColour m_gridLineColour;
+ bool m_gridLinesEnabled;
+
+
+ // do we have some place to store attributes in?
+ bool CanHaveAttributes();
+
+ // returns the attribute we may modify in place: a new one if this cell
+ // doesn't have any yet or the existing one if it does
+ //
+ // DecRef() must be called on the returned pointer, as usual
+ wxGridCellAttr *GetOrCreateCellAttr(int row, int col) const;
+
+ // cell attribute cache (currently we only cache 1, may be will do
+ // more/better later)
+ struct CachedAttr
+ {
+ int row, col;
+ wxGridCellAttr *attr;
+ } m_attrCache;
+
+ // invalidates the attribute cache
+ void ClearAttrCache();
+
+ // adds an attribute to cache
+ void CacheAttr(int row, int col, wxGridCellAttr *attr) const;
+
+ // looks for an attr in cache, returns TRUE if found
+ bool LookupAttr(int row, int col, wxGridCellAttr **attr) const;
+
+ // looks for the attr in cache, if not found asks the table and caches the
+ // result
+ wxGridCellAttr *GetCellAttr(int row, int col) const;
+
+ // the default cell attr object for cells that don't have their own
+ wxGridCellAttr* m_defaultCellAttr;
+
+
+ wxGridCellCoordsArray m_cellsExposed;
+ wxArrayInt m_rowsExposed;
+ wxArrayInt m_colsExposed;
+ wxArrayInt m_rowLabelsExposed;
+ wxArrayInt m_colLabelsExposed;
+
+ bool m_inOnKeyDown;
+ int m_batchCount;
+
+ enum CursorMode
+ {
+ WXGRID_CURSOR_SELECT_CELL,
+ WXGRID_CURSOR_RESIZE_ROW,
+ WXGRID_CURSOR_RESIZE_COL,
+ WXGRID_CURSOR_SELECT_ROW,
+ WXGRID_CURSOR_SELECT_COL
+ };
+
+ // this method not only sets m_cursorMode but also sets the correct cursor
+ // for the given mode and, if captureMouse is not FALSE releases the mouse
+ // if it was captured and captures it if it must be captured
+ //
+ // for this to work, you should always use it and not set m_cursorMode
+ // directly!
+ void ChangeCursorMode(CursorMode mode,
+ wxWindow *win = (wxWindow *)NULL,
+ bool captureMouse = TRUE);
+
+ wxWindow *m_winCapture; // the window which captured the mouse
+ CursorMode m_cursorMode;
+
+ int m_dragLastPos;
+ int m_dragRowOrCol;
+ bool m_isDragging;
+
+ wxTimer *m_editTimer;
+
+ wxGridCellCoords m_selectionStart;
+
+ wxCursor m_rowResizeCursor;
+ wxCursor m_colResizeCursor;
+
+ bool m_editable; // applies to whole grid
+ int m_editCtrlType; // for current cell
+ wxWindow* m_cellEditCtrl;
+ bool m_cellEditCtrlEnabled;
+
+
+ void Create();
+ void Init();
+ void CalcDimensions();
+ void CalcWindowSizes();
+ bool Redimension( wxGridTableMessage& );
+
+
+ bool SendEvent( const wxEventType,
+ int row, int col,
+ wxMouseEvent& );
+
+ bool SendEvent( const wxEventType,
+ int row, int col );
+
+
+ void OnPaint( wxPaintEvent& );
+ void OnSize( wxSizeEvent& );
+ void OnKeyDown( wxKeyEvent& );
+ void OnEraseBackground( wxEraseEvent& );
+
+
+ void SetCurrentCell( const wxGridCellCoords& coords );
+ void SetCurrentCell( int row, int col )
+ { SetCurrentCell( wxGridCellCoords(row, col) ); }
+
+
+ // ------ functions to get/send data (see also public functions)
+ //
+ bool GetModelValues();
+ bool SetModelValues();
+
+
+ DECLARE_DYNAMIC_CLASS( wxGrid )