X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/11393d2900fdd267f22d653721c6be745d0c4649..565382de29554aceb4bf275e650e3b9ef70826f8:/include/wx/generic/grid.h diff --git a/include/wx/generic/grid.h b/include/wx/generic/grid.h index 98427527e8..6873ca0de5 100644 --- a/include/wx/generic/grid.h +++ b/include/wx/generic/grid.h @@ -1485,8 +1485,10 @@ public: // int GetDefaultRowSize() const; int GetRowSize( int row ) const; + bool IsRowShown(int row) const { return GetRowSize(row) != 0; } int GetDefaultColSize() const; int GetColSize( int col ) const; + bool IsColShown(int col) const { return GetColSize(col) != 0; } wxColour GetDefaultCellBackgroundColour() const; wxColour GetCellBackgroundColour( int row, int col ) const; wxColour GetDefaultCellTextColour() const; @@ -1505,11 +1507,19 @@ public: return s; } + // ------ row and col sizes void SetDefaultRowSize( int height, bool resizeExistingRows = false ); void SetRowSize( int row, int height ); - void SetDefaultColSize( int width, bool resizeExistingCols = false ); + void HideRow(int row) { SetRowSize(row, 0); } + void ShowRow(int row) { SetRowSize(row, -1); } + void SetDefaultColSize( int width, bool resizeExistingCols = false ); void SetColSize( int col, int width ); + void HideCol(int col) { SetColSize(col, 0); } + void ShowCol(int col) { SetColSize(col, -1); } + + + // ------- columns (only, for now) reordering // columns index <-> positions mapping: by default, the position of the // column is the same as its index, but the columns can also be reordered @@ -1551,6 +1561,8 @@ public: return wxNOT_FOUND; } + // reset the columns positions to the default order + void ResetColPos(); // automatically size the column or row to fit to its contents, if @@ -1737,6 +1749,17 @@ public: wxWindow* GetGridColLabelWindow() const { return m_colWindow; } wxWindow* GetGridCornerLabelWindow() const { return (wxWindow*)m_cornerLabelWin; } + // This one can only be called if we are using the native header window + wxHeaderCtrl *GetGridColHeader() const + { + wxASSERT_MSG( m_useNativeHeader, "no column header window" ); + + // static_cast<> doesn't work without the full class declaration in + // view and we prefer to avoid adding more compile-time dependencies + // even at the cost of using reinterpret_cast<> + return reinterpret_cast(m_colWindow); + } + // Allow adjustment of scroll increment. The default is (15, 15). void SetScrollLineX(int x) { m_scrollLineX = x; } void SetScrollLineY(int y) { m_scrollLineY = y; } @@ -1960,16 +1983,6 @@ protected: // wxGridColLabelWindow, use accessors below when the real type matters wxWindow *m_colWindow; - wxHeaderCtrl *GetColHeader() const - { - wxASSERT_MSG( m_useNativeHeader, "no column header window" ); - - // static_cast<> doesn't work without the full class declaration in - // view and we prefer to avoid adding more compile-time dependencies - // even at the cost of using reinterpret_cast<> - return reinterpret_cast(m_colWindow); - } - wxGridColLabelWindow *GetColLabelWindow() const { wxASSERT_MSG( !m_useNativeHeader, "no column label window" ); @@ -2279,6 +2292,10 @@ private: // 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