- switch ( m_cursorMode )
- {
- case WXGRID_CURSOR_RESIZE_ROW:
- {
- if ( m_dragLastPos >= 0 )
- {
- // erase the last line and resize the row
- //
- wxClientDC dc( this );
- dc.SetLogicalFunction( wxINVERT );
- dc.DrawLine( m_left, m_dragLastPos,
- m_right, m_dragLastPos );
- HideCellEditControl();
- int top = m_top + m_colLabelHeight;
- if ( m_dragRowOrCol > 0 )
- top = m_rowBottoms[m_dragRowOrCol-1];
- m_rowHeights[m_dragRowOrCol] = wxMax( ev.GetY() - top,
- WXGRID_MIN_ROW_HEIGHT );
- CalcDimensions();
- ShowCellEditControl();
- Refresh();
-
- // Note: we are ending the event *after* doing
- // default processing in this case
- //
- SendEvent( EVT_WXGRID_ROW_SIZE, m_dragRowOrCol, -1, ev );
- }
- }
- break;
-
- case WXGRID_CURSOR_RESIZE_COL:
- {
- if ( m_dragLastPos >= 0 )
- {
- // erase the last line and resize the col
- //
- wxClientDC dc( this );
- dc.SetLogicalFunction( wxINVERT );
- dc.DrawLine( m_left, m_dragLastPos,
- m_right, m_dragLastPos );
- HideCellEditControl();
- int left = m_left + m_rowLabelWidth;
- if ( m_dragRowOrCol > 0 )
- left = m_colRights[m_dragRowOrCol-1];
- m_colWidths[m_dragRowOrCol] = wxMax( ev.GetX() - left,
- WXGRID_MIN_COL_WIDTH );
- CalcDimensions();
- ShowCellEditControl();
- Refresh();
-
- // Note: we are ending the event *after* doing
- // default processing in this case
- //
- SendEvent( EVT_WXGRID_COL_SIZE, -1, m_dragRowOrCol, ev );
- }
- }
- break;
-
- case WXGRID_CURSOR_SELECT_CELL:
- {
- if ( IsSelection() )
- {
- // Note: we are ending the event *after* doing
- // default processing in this case
- //
- SendEvent( EVT_WXGRID_RANGE_SELECT, -1, -1, ev );
- }
- }
- break;
- }
-
- m_dragLastPos = -1;
+ switch ( m_cursorMode )
+ {
+ case WXGRID_CURSOR_RESIZE_ROW:
+ {
+ if ( m_dragLastPos >= 0 )
+ {
+ // erase the last line and resize the row
+ //
+ wxClientDC dc( this );
+ dc.SetLogicalFunction( wxINVERT );
+ dc.DrawLine( m_left, m_dragLastPos,
+ m_right, m_dragLastPos );
+ HideCellEditControl();
+ int top = m_top + m_colLabelHeight;
+ if ( m_dragRowOrCol > 0 )
+ top = m_rowBottoms[m_dragRowOrCol-1];
+
+ m_sumRowHeights -= m_rowHeights[ m_dragRowOrCol ];
+ m_rowHeights[m_dragRowOrCol] = wxMax( ev.GetY() - top,
+ WXGRID_MIN_ROW_HEIGHT );
+ m_sumRowHeights += m_rowHeights[ m_dragRowOrCol ];
+ CalcDimensions();
+ ShowCellEditControl();
+ Refresh();
+
+ // Note: we are ending the event *after* doing
+ // default processing in this case
+ //
+ SendEvent( EVT_GRID_ROW_SIZE, m_dragRowOrCol, -1, ev );
+ }
+ }
+ break;
+
+ case WXGRID_CURSOR_RESIZE_COL:
+ {
+ if ( m_dragLastPos >= 0 )
+ {
+ // erase the last line and resize the col
+ //
+ wxClientDC dc( this );
+ dc.SetLogicalFunction( wxINVERT );
+ dc.DrawLine( m_left, m_dragLastPos,
+ m_right, m_dragLastPos );
+ HideCellEditControl();
+ int left = m_left + m_rowLabelWidth;
+ if ( m_dragRowOrCol > 0 )
+ left = m_colRights[m_dragRowOrCol-1];
+
+ m_sumColWidths -= m_colWidths[m_dragRowOrCol];
+ m_colWidths[m_dragRowOrCol] = wxMax( ev.GetX() - left,
+ WXGRID_MIN_COL_WIDTH );
+ m_sumColWidths += m_colWidths[m_dragRowOrCol];
+
+ CalcDimensions();
+ ShowCellEditControl();
+ Refresh();
+
+ // Note: we are ending the event *after* doing
+ // default processing in this case
+ //
+ SendEvent( EVT_GRID_COL_SIZE, -1, m_dragRowOrCol, ev );
+ }
+ }
+ break;
+
+ case WXGRID_CURSOR_SELECT_CELL:
+ {
+ if ( IsSelection() )
+ {
+ // Note: we are ending the event *after* doing
+ // default processing in this case
+ //
+ SendEvent( EVT_GRID_RANGE_SELECT, -1, -1, ev );
+ }
+ }
+ break;
+ }
+
+ m_dragLastPos = -1;