+ friend class WXDLLIMPEXP_FWD_ADV wxGridSelection;
+ friend class wxGridRowOperations;
+ friend class wxGridColumnOperations;
+
+ // they call our private Process{{Corner,Col,Row}Label,GridCell}MouseEvent()
+ friend class wxGridCornerLabelWindow;
+ friend class wxGridColLabelWindow;
+ friend class wxGridRowLabelWindow;
+ friend class wxGridWindow;
+ friend class wxGridHeaderRenderer;
+
+ friend class wxGridHeaderCtrl;
+
+private:
+
+ // implement wxScrolledWindow method to return m_gridWin size
+ virtual wxSize GetSizeAvailableForScrollTarget(const wxSize& size);
+
+ // redraw the grid lines, should be called after changing their attributes
+ void RedrawGridLines();
+
+ // draw all grid lines in the given cell region (unlike the public
+ // DrawAllGridLines() which just draws all of them)
+ void DrawRangeGridLines(wxDC& dc, const wxRegion& reg,
+ const wxGridCellCoords& topLeft,
+ const wxGridCellCoords& bottomRight);
+
+ // draw all lines from top to bottom row and left to right column in the
+ // rectangle determined by (top, left)-(bottom, right) -- but notice that
+ // the caller must have set up the clipping correctly, this rectangle is
+ // only used here for optimization
+ void DoDrawGridLines(wxDC& dc,
+ int top, int left,
+ int bottom, int right,
+ int topRow, int leftCol,
+ int bottomRight, int rightCol);
+
+ // common part of Clip{Horz,Vert}GridLines
+ void DoClipGridLines(bool& var, bool clip);
+
+ // update the sorting indicator shown in the specified column (whose index
+ // must be valid)
+ //
+ // this will use GetSortingColumn() and IsSortOrderAscending() to determine
+ // the sorting indicator to effectively show
+ void UpdateColumnSortingIndicator(int col);
+
+ // update the grid after changing the columns order (common part of
+ // SetColPos() and ResetColPos())
+ void RefreshAfterColPosChange();
+
+
+ // return the position (not index) of the column at the given logical pixel
+ // position
+ //
+ // this always returns a valid position, even if the coordinate is out of
+ // bounds (in which case first/last column is returned)
+ int XToPos(int x) const;
+
+
+ // event handlers and their helpers
+ // --------------------------------
+
+ // process mouse drag event in WXGRID_CURSOR_SELECT_CELL mode
+ bool DoGridCellDrag(wxMouseEvent& event,
+ const wxGridCellCoords& coords,
+ bool isFirstDrag);
+
+ // process row/column resizing drag event
+ void DoGridLineDrag(wxMouseEvent& event, const wxGridOperations& oper);
+
+ // process mouse drag event in the grid window
+ void DoGridDragEvent(wxMouseEvent& event, const wxGridCellCoords& coords);
+
+ // process different clicks on grid cells
+ void DoGridCellLeftDown(wxMouseEvent& event,
+ const wxGridCellCoords& coords,
+ const wxPoint& pos);
+ void DoGridCellLeftDClick(wxMouseEvent& event,
+ const wxGridCellCoords& coords,
+ const wxPoint& pos);
+ void DoGridCellLeftUp(wxMouseEvent& event, const wxGridCellCoords& coords);
+
+ // process movement (but not dragging) event in the grid cell area
+ void DoGridMouseMoveEvent(wxMouseEvent& event,
+ const wxGridCellCoords& coords,
+ const wxPoint& pos);
+
+ // process mouse events in the grid window
+ void ProcessGridCellMouseEvent(wxMouseEvent& event);
+
+ // process mouse events in the row/column labels/corner windows
+ void ProcessRowLabelMouseEvent(wxMouseEvent& event);
+ void ProcessColLabelMouseEvent(wxMouseEvent& event);
+ void ProcessCornerLabelMouseEvent(wxMouseEvent& event);
+
+ void DoColHeaderClick(int col);
+
+ void DoStartResizeCol(int col);
+ void DoUpdateResizeCol(int x);
+ void DoUpdateResizeColWidth(int w);
+ void DoStartMoveCol(int col);
+
+ void DoEndDragResizeRow(const wxMouseEvent& event);
+ void DoEndDragResizeCol(const wxMouseEvent& event);
+ void DoEndMoveCol(int pos);
+
+
+ // common implementations of methods defined for both rows and columns
+ void DeselectLine(int line, const wxGridOperations& oper);
+ bool DoEndDragResizeLine(const wxGridOperations& oper);
+ int PosToLinePos(int pos, bool clipToMinMax,
+ const wxGridOperations& oper) const;
+ int PosToLine(int pos, bool clipToMinMax,
+ const wxGridOperations& oper) const;
+ int PosToEdgeOfLine(int pos, const wxGridOperations& oper) const;
+
+ bool DoMoveCursor(bool expandSelection,
+ const wxGridDirectionOperations& diroper);
+ bool DoMoveCursorByPage(const wxGridDirectionOperations& diroper);
+ bool DoMoveCursorByBlock(bool expandSelection,
+ const wxGridDirectionOperations& diroper);
+ void AdvanceToNextNonEmpty(wxGridCellCoords& coords,
+ const wxGridDirectionOperations& diroper);
+
+ // common part of {Insert,Delete}{Rows,Cols}
+ bool DoModifyLines(bool (wxGridTableBase::*funcModify)(size_t, size_t),
+ int pos, int num, bool updateLabels);
+ // Append{Rows,Cols} is a bit different because of one less parameter
+ bool DoAppendLines(bool (wxGridTableBase::*funcAppend)(size_t),
+ int num, bool updateLabels);
+
+ // common part of Set{Col,Row}Sizes
+ void DoSetSizes(const wxGridSizesInfo& sizeInfo,
+ const wxGridOperations& oper);
+
+ // common part of Disable{Row,Col}Resize and CanDrag{Row,Col}Size
+ void DoDisableLineResize(int line, wxGridFixedIndicesSet *& setFixed);
+ bool DoCanResizeLine(int line, const wxGridFixedIndicesSet *setFixed) const;
+
+ // Helper of Render(): get grid size, origin offset and fill cell arrays
+ void GetRenderSizes( const wxGridCellCoords& topLeft,
+ const wxGridCellCoords& bottomRight,
+ wxPoint& pointOffSet, wxSize& sizeGrid,
+ wxGridCellCoordsArray& renderCells,
+ wxArrayInt& arrayCols, wxArrayInt& arrayRows );
+
+ // Helper of Render(): set the scale to draw the cells at the right size.
+ void SetRenderScale( wxDC& dc, const wxPoint& pos, const wxSize& size,
+ const wxSize& sizeGrid );
+
+ // Helper of Render(): get render start position from passed parameter
+ wxPoint GetRenderPosition( wxDC& dc, const wxPoint& position );
+
+ // Helper of Render(): draws a box around the rendered area
+ void DoRenderBox( wxDC& dc, const int& style,
+ const wxPoint& pointOffSet,
+ const wxSize& sizeCellArea,
+ const wxGridCellCoords& topLeft,
+ const wxGridCellCoords& bottomRight );
+
+ // Implementation of public Set{Row,Col}Size() and {Hide,Show}{Row,Col}().
+ // They interpret their height or width parameter slightly different from
+ // the public methods where -1 in it means "auto fit to the label" for the
+ // compatibility reasons. Here it means "show a previously hidden row or
+ // column" while 0 means "hide it" just as in the public methods. And any
+ // positive values are handled naturally, i.e. they just specify the size.
+ void DoSetRowSize( int row, int height );
+ void DoSetColSize( int col, int width );
+
+
+ // these sets contain the indices of fixed, i.e. non-resizable
+ // interactively, grid rows or columns and are NULL if there are no fixed
+ // elements (which is the default)
+ wxGridFixedIndicesSet *m_setFixedRows,
+ *m_setFixedCols;