add a possibility to disable individual grid rows/columns resizing

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60408 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2009-04-26 17:02:53 +00:00
parent fa531da023
commit 82edfbe7d9
7 changed files with 189 additions and 91 deletions

View File

@@ -16,6 +16,8 @@
#if wxUSE_GRID
#include "wx/hashmap.h"
#include "wx/scrolwin.h"
// ----------------------------------------------------------------------------
@@ -85,6 +87,8 @@ class WXDLLIMPEXP_FWD_CORE wxTextCtrl;
class WXDLLIMPEXP_FWD_CORE wxSpinCtrl;
#endif
class wxGridFixedIndicesSet;
class wxGridOperations;
class wxGridRowOperations;
class wxGridColumnOperations;
@@ -771,7 +775,7 @@ private:
// their non default size for those which don't have the default size.
// ----------------------------------------------------------------------------
// Hashmap to store postions as the keys and sizes as the values
// hash map to store positions as the keys and sizes as the values
WX_DECLARE_HASH_MAP_WITH_DECL( unsigned, int, wxIntegerHash, wxIntegerEqual,
wxUnsignedToIntHashMap, class WXDLLIMPEXP_ADV );
@@ -1101,19 +1105,42 @@ public:
void SetCellHighlightPenWidth(int width);
void SetCellHighlightROPenWidth(int width);
// interactive grid mouse operations control
// -----------------------------------------
// functions globally enabling row/column interactive resizing (enabled by
// default)
void EnableDragRowSize( bool enable = true );
void DisableDragRowSize() { EnableDragRowSize( false ); }
bool CanDragRowSize() const { return m_canDragRowSize; }
void EnableDragColSize( bool enable = true );
void DisableDragColSize() { EnableDragColSize( false ); }
bool CanDragColSize() const { return m_canDragColSize; }
// if interactive resizing is enabled, some rows/columns can still have
// fixed size
void DisableRowResize(int row) { DoDisableLineResize(row, m_setFixedRows); }
void DisableColResize(int col) { DoDisableLineResize(col, m_setFixedCols); }
// these functions return whether the given row/column can be
// effectively resized: for this interactive resizing must be enabled
// and this index must not have been passed to DisableRow/ColResize()
bool CanDragRowSize(int row) const
{ return m_canDragRowSize && DoCanResizeLine(row, m_setFixedRows); }
bool CanDragColSize(int col) const
{ return m_canDragColSize && DoCanResizeLine(col, m_setFixedCols); }
// interactive column reordering (disabled by default)
void EnableDragColMove( bool enable = true );
void DisableDragColMove() { EnableDragColMove( false ); }
bool CanDragColMove() const { return m_canDragColMove; }
// interactive resizing of grid cells (enabled by default)
void EnableDragGridSize(bool enable = true);
void DisableDragGridSize() { EnableDragGridSize(false); }
bool CanDragGridSize() const { return m_canDragGridSize; }
// interactive dragging of cells (disabled by default)
void EnableDragCell( bool enable = true );
void DisableDragCell() { EnableDragCell( false ); }
bool CanDragCell() const { return m_canDragCell; }
@@ -1659,6 +1686,9 @@ public:
wxGRID_CHECKBOX,
wxGRID_CHOICE,
wxGRID_COMBOBOX };
wxDEPRECATED_INLINE(bool CanDragRowSize() const, return m_canDragRowSize; )
wxDEPRECATED_INLINE(bool CanDragColSize() const, return m_canDragColSize; )
#endif // WXWIN_COMPATIBILITY_2_8
@@ -2083,10 +2113,22 @@ private:
bool DoAppendLines(bool (wxGridTableBase::*funcAppend)(size_t),
int num, bool updateLabels);
// Common part of Set{Col,Row}Sizes
// 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;
// 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;
DECLARE_DYNAMIC_CLASS( wxGrid )
DECLARE_EVENT_TABLE()
wxDECLARE_NO_COPY_CLASS(wxGrid);