// the label of the first column had been set it would have only one
// element and not numCols, so account for it
int numRemaining = m_colLabels.size() - colID;
- m_colLabels.RemoveAt( colID, wxMin(numCols, numRemaining) );
+ if (numRemaining > 0)
+ m_colLabels.RemoveAt( colID, wxMin(numCols, numRemaining) );
}
if ( numCols >= curNumCols )
// grid mouse event processing
// ----------------------------------------------------------------------------
-void
+bool
wxGrid::DoGridCellDrag(wxMouseEvent& event,
const wxGridCellCoords& coords,
bool isFirstDrag)
{
+ bool performDefault = true ;
+
if ( coords == wxGridNoCellCoords )
- return; // we're outside any valid cell
+ return performDefault; // we're outside any valid cell
// Hide the edit control, so it won't interfere with drag-shrinking.
if ( IsCellEditControlShown() )
if ( m_selectedBlockCorner == wxGridNoCellCoords)
m_selectedBlockCorner = coords;
- SendEvent(wxEVT_GRID_CELL_BEGIN_DRAG, coords, event);
- return;
+ // if event is handled by user code, no further processing
+ if ( SendEvent(wxEVT_GRID_CELL_BEGIN_DRAG, coords, event) != 0 )
+ performDefault = false;
+
+ return performDefault;
}
}
// we don't handle the other key modifiers
event.Skip();
}
+
+ return performDefault;
}
void wxGrid::DoGridLineDrag(wxMouseEvent& event, const wxGridOperations& oper)
switch ( m_cursorMode )
{
case WXGRID_CURSOR_SELECT_CELL:
- DoGridCellDrag(event, coords, isFirstDrag);
+ // no further handling if handled by user
+ if ( DoGridCellDrag(event, coords, isFirstDrag) == false )
+ return;
break;
case WXGRID_CURSOR_RESIZE_ROW:
mouseEv.GetY() + GetColLabelSize(),
false,
mouseEv);
+
+ if ( type == wxEVT_GRID_CELL_BEGIN_DRAG )
+ {
+ // by default the dragging is not supported, the user code must
+ // explicitly allow the event for it to take place
+ gridEvt.Veto();
+ }
+
claimed = GetEventHandler()->ProcessEvent(gridEvt);
vetoed = !gridEvt.IsAllowed();
}
}
// See comment in SetColSize
- if ( height < GetRowMinimalAcceptableHeight())
+ if ( height > 0 && height < GetRowMinimalAcceptableHeight())
return;
if ( m_rowHeights.IsEmpty() )
}
if ( !GetBatchCount() )
+ {
CalcDimensions();
+ Refresh();
+ }
}
void wxGrid::SetDefaultColSize( int width, bool resizeExistingCols )