start of the great grid folding: introduce wxGridOperations class and use it to avoid duplicating the same code for rows and columns in a couple of methods

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55652 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-09-16 08:32:12 +00:00
parent d41f34403c
commit bec7026270
3 changed files with 428 additions and 251 deletions

View File

@@ -84,6 +84,10 @@ class WXDLLIMPEXP_FWD_CORE wxTextCtrl;
class WXDLLIMPEXP_FWD_CORE wxSpinCtrl;
#endif
class wxGridOperations;
class wxGridRowOperations;
class wxGridColumnOperations;
// ----------------------------------------------------------------------------
// macros
// ----------------------------------------------------------------------------
@@ -1264,7 +1268,7 @@ public:
// coordinates for mouse events etc.
//
void XYToCell( int x, int y, wxGridCellCoords& ) const;
int YToRow( int y ) const;
int YToRow( int y, bool clipToMinMax = false ) const;
int XToCol( int x, bool clipToMinMax = false ) const;
int YToEdgeOfRow( int y ) const;
@@ -1405,6 +1409,12 @@ public:
bool GetDefaultCellOverflow() const;
bool GetCellOverflow( int row, int col ) const;
void GetCellSize( int row, int col, int *num_rows, int *num_cols ) const;
wxSize GetCellSize(const wxGridCellCoords& coords)
{
wxSize s;
GetCellSize(coords.GetRow(), coords.GetCol(), &s.x, &s.y);
return s;
}
void SetDefaultRowSize( int height, bool resizeExistingRows = false );
void SetRowSize( int row, int height );
@@ -1982,8 +1992,13 @@ protected:
bool m_canDragColMove;
bool m_canDragGridSize;
bool m_canDragCell;
// the last position (horizontal or vertical depending on whether the user
// is resizing a column or a row) where a row or column separator line was
// dragged by the user or -1 of there is no drag operation in progress
int m_dragLastPos;
int m_dragRowOrCol;
bool m_isDragging;
wxPoint m_startDragPos;
@@ -2042,11 +2057,21 @@ protected:
bool SetModelValues();
friend class WXDLLIMPEXP_FWD_ADV wxGridSelection;
friend class wxGridRowOperations;
friend class wxGridColumnOperations;
private:
// implement wxScrolledWindow method to return m_gridWin size
virtual wxSize GetSizeAvailableForScrollTarget(const wxSize& size);
// common implementations of methods defined for both rows and columns
void DeselectLine(int line, const wxGridOperations& oper);
void DoEndDragResizeLine(const wxGridOperations& oper);
int PosToLine(int pos, bool clipToMinMax,
const wxGridOperations& oper) const;
DECLARE_DYNAMIC_CLASS( wxGrid )
DECLARE_EVENT_TABLE()
DECLARE_NO_COPY_CLASS(wxGrid)