]> git.saurik.com Git - wxWidgets.git/commitdiff
Added functions to enable/disable drag-resizing of rows and cols.
authorMichael Bedward <mbedward@ozemail.com.au>
Tue, 22 Feb 2000 03:51:43 +0000 (03:51 +0000)
committerMichael Bedward <mbedward@ozemail.com.au>
Tue, 22 Feb 2000 03:51:43 +0000 (03:51 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6198 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/generic/grid.h
src/generic/grid.cpp

index bc92de5093960139f81ee9d40e943310871e58c1..9df770ec8ea56dd2d2b93ad0caf8dd6ef6212bae 100644 (file)
@@ -839,6 +839,13 @@ public:
     void     SetRowLabelValue( int row, const wxString& );
     void     SetColLabelValue( int col, const wxString& );
     void     SetGridLineColour( const wxColour& );
+    
+    void     EnableDragRowSize( bool enable = TRUE );
+    void     DisableDragRowSize() { EnableDragRowSize( FALSE ); }
+    bool     CanDragRowSize() { return m_canDragRowSize; }
+    void     EnableDragColSize( bool enable = TRUE );
+    void     DisableDragColSize() { EnableDragColSize( FALSE ); }
+    bool     CanDragColSize() { return m_canDragColSize; }
 
     // this sets the specified attribute for all cells in this row/col
     void     SetRowAttr(int row, wxGridCellAttr *attr);
@@ -1319,6 +1326,8 @@ protected:
     wxWindow *m_winCapture;     // the window which captured the mouse
     CursorMode m_cursorMode;
 
+    bool    m_canDragRowSize;
+    bool    m_canDragColSize;
     int     m_dragLastPos;
     int     m_dragRowOrCol;
     bool    m_isDragging;
index 664efa84d4a27973967b09250cf3f29612c273c5..7ae17f89a473e7654b6f9847b07e221972e08975 100644 (file)
@@ -2398,6 +2398,8 @@ void wxGrid::Init()
 
     m_cursorMode  = WXGRID_CURSOR_SELECT_CELL;
     m_winCapture = (wxWindow *)NULL;
+    m_canDragRowSize = TRUE;
+    m_canDragColSize = TRUE;
     m_dragLastPos  = -1;
     m_dragRowOrCol = -1;
     m_isDragging = FALSE;
@@ -2974,7 +2976,8 @@ void wxGrid::ProcessRowLabelMouseEvent( wxMouseEvent& event )
         {
             // starting to drag-resize a row
             //
-            ChangeCursorMode(WXGRID_CURSOR_RESIZE_ROW, m_rowLabelWin);
+            if ( CanDragRowSize() )
+                ChangeCursorMode(WXGRID_CURSOR_RESIZE_ROW, m_rowLabelWin);
         }
     }
 
@@ -3044,7 +3047,8 @@ void wxGrid::ProcessRowLabelMouseEvent( wxMouseEvent& event )
             if ( m_cursorMode == WXGRID_CURSOR_SELECT_CELL )
             {
                 // don't capture the mouse yet
-                ChangeCursorMode(WXGRID_CURSOR_RESIZE_ROW, m_rowLabelWin, FALSE);
+                if ( CanDragRowSize() )
+                    ChangeCursorMode(WXGRID_CURSOR_RESIZE_ROW, m_rowLabelWin, FALSE);
             }
         }
         else if ( m_cursorMode != WXGRID_CURSOR_SELECT_CELL )
@@ -3139,7 +3143,8 @@ void wxGrid::ProcessColLabelMouseEvent( wxMouseEvent& event )
         {
             // starting to drag-resize a col
             //
-            ChangeCursorMode(WXGRID_CURSOR_RESIZE_COL, m_colLabelWin);
+            if ( CanDragColSize() )
+                ChangeCursorMode(WXGRID_CURSOR_RESIZE_COL, m_colLabelWin);
         }
     }
 
@@ -3209,7 +3214,8 @@ void wxGrid::ProcessColLabelMouseEvent( wxMouseEvent& event )
             if ( m_cursorMode == WXGRID_CURSOR_SELECT_CELL )
             {
                 // don't capture the cursor yet
-                ChangeCursorMode(WXGRID_CURSOR_RESIZE_COL, m_colLabelWin, FALSE);
+                if ( CanDragColSize() )
+                    ChangeCursorMode(WXGRID_CURSOR_RESIZE_COL, m_colLabelWin, FALSE);
             }
         }
         else if ( m_cursorMode != WXGRID_CURSOR_SELECT_CELL )
@@ -3590,7 +3596,8 @@ void wxGrid::ProcessGridCellMouseEvent( wxMouseEvent& event )
 
                 if ( m_cursorMode == WXGRID_CURSOR_SELECT_CELL )
                 {
-                    ChangeCursorMode(WXGRID_CURSOR_RESIZE_ROW);
+                    if ( CanDragRowSize() )
+                        ChangeCursorMode(WXGRID_CURSOR_RESIZE_ROW);
                 }
 
                 return;
@@ -3602,7 +3609,8 @@ void wxGrid::ProcessGridCellMouseEvent( wxMouseEvent& event )
 
                 if ( m_cursorMode == WXGRID_CURSOR_SELECT_CELL )
                 {
-                    ChangeCursorMode(WXGRID_CURSOR_RESIZE_COL);
+                    if ( CanDragColSize() )
+                        ChangeCursorMode(WXGRID_CURSOR_RESIZE_COL);
                 }
 
                 return;
@@ -6221,6 +6229,18 @@ wxGridCellRenderer* wxGrid::GetDefaultRendererForType(const wxString& typeName)
 // row/col size
 // ----------------------------------------------------------------------------
 
+void wxGrid::EnableDragRowSize( bool enable )
+{
+    m_canDragRowSize = enable;
+}
+
+
+void wxGrid::EnableDragColSize( bool enable )
+{
+    m_canDragColSize = enable;
+}
+
+
 void wxGrid::SetDefaultRowSize( int height, bool resizeExistingRows )
 {
     m_defaultRowHeight = wxMax( height, WXGRID_MIN_ROW_HEIGHT );