void ShowCellEditControl();
void HideCellEditControl();
- void SetEditControlValue( const wxString& s = wxEmptyString );
void SaveEditControlValue();
void EnableDragColSize( bool enable = TRUE );
void DisableDragColSize() { EnableDragColSize( FALSE ); }
bool CanDragColSize() { return m_canDragColSize; }
+ void EnableDragGridSize(bool enable = TRUE);
+ void DisableDragGridSize() { EnableDragGridSize(FALSE); }
+ bool CanDragGridSize() { return m_canDragGridSize; }
+
// this sets the specified attribute for all cells in this row/col
void SetRowAttr(int row, wxGridCellAttr *attr);
bool m_canDragRowSize;
bool m_canDragColSize;
+ bool m_canDragGridSize;
int m_dragLastPos;
int m_dragRowOrCol;
bool m_isDragging;
EVT_MENU( ID_TOGGLEEDIT, GridFrame::ToggleEditing )
EVT_MENU( ID_TOGGLEROWSIZING, GridFrame::ToggleRowSizing )
EVT_MENU( ID_TOGGLECOLSIZING, GridFrame::ToggleColSizing )
+ EVT_MENU( ID_TOGGLEGRIDSIZING, GridFrame::ToggleGridSizing )
EVT_MENU( ID_SETLABELCOLOUR, GridFrame::SetLabelColour )
EVT_MENU( ID_SETLABELTEXTCOLOUR, GridFrame::SetLabelTextColour )
EVT_MENU( ID_ROWLABELHORIZALIGN, GridFrame::SetRowLabelHorizAlignment )
viewMenu->Append( ID_TOGGLEEDIT, "&Editable", "", TRUE );
viewMenu->Append( ID_TOGGLEROWSIZING, "Ro&w drag-resize", "", TRUE );
viewMenu->Append( ID_TOGGLECOLSIZING, "C&ol drag-resize", "", TRUE );
+ viewMenu->Append( ID_TOGGLEGRIDSIZING, "&Grid drag-resize", "", TRUE );
wxMenu *rowLabelMenu = new wxMenu;
GetMenuBar()->Check( ID_TOGGLEEDIT, TRUE );
GetMenuBar()->Check( ID_TOGGLEROWSIZING, TRUE );
GetMenuBar()->Check( ID_TOGGLECOLSIZING, TRUE );
+ GetMenuBar()->Check( ID_TOGGLEGRIDSIZING, TRUE );
}
GetMenuBar()->IsChecked( ID_TOGGLECOLSIZING ) );
}
+void GridFrame::ToggleGridSizing( wxCommandEvent& WXUNUSED(ev) )
+{
+ grid->EnableDragGridSize(
+ GetMenuBar()->IsChecked( ID_TOGGLEGRIDSIZING ) );
+}
+
void GridFrame::SetLabelColour( wxCommandEvent& WXUNUSED(ev) )
{
m_winCapture = (wxWindow *)NULL;
m_canDragRowSize = TRUE;
m_canDragColSize = TRUE;
+ m_canDragGridSize = TRUE;
m_dragLastPos = -1;
m_dragRowOrCol = -1;
m_isDragging = FALSE;
m_isDragging = FALSE;
m_startDragPos = wxDefaultPosition;
+// if ( coords == wxGridNoCellCoords && m_cursorMode != WXGRID_CURSOR_SELECT_CELL )
+// {
+// ChangeCursorMode(WXGRID_CURSOR_SELECT_CELL);
+// }
- if ( coords != wxGridNoCellCoords )
- {
+// if ( coords != wxGridNoCellCoords )
+// {
// VZ: if we do this, the mode is reset to WXGRID_CURSOR_SELECT_CELL
// immediately after it becomes WXGRID_CURSOR_RESIZE_ROW/COL under
// wxGTK
// ------------ Left button pressed
//
- if ( event.LeftDown() )
+ if ( event.LeftDown() && coords != wxGridNoCellCoords )
{
DisableCellEditControl();
if ( event.ShiftDown() )
// ------------ Left double click
//
- else if ( event.LeftDClick() )
+ else if ( event.LeftDClick() && coords != wxGridNoCellCoords )
{
DisableCellEditControl();
if ( XToEdgeOfCol(x) < 0 && YToEdgeOfRow(y) < 0 )
// ------------ Right button down
//
- else if ( event.RightDown() )
+ else if ( event.RightDown() && coords != wxGridNoCellCoords )
{
DisableCellEditControl();
if ( !SendEvent( wxEVT_GRID_CELL_RIGHT_CLICK,
// ------------ Right double click
//
- else if ( event.RightDClick() )
+ else if ( event.RightDClick() && coords != wxGridNoCellCoords )
{
DisableCellEditControl();
if ( !SendEvent( wxEVT_GRID_CELL_RIGHT_DCLICK,
if ( m_cursorMode == WXGRID_CURSOR_SELECT_CELL )
{
- if ( CanDragRowSize() )
+ if ( CanDragRowSize() && CanDragGridSize() )
ChangeCursorMode(WXGRID_CURSOR_RESIZE_ROW);
}
if ( m_cursorMode == WXGRID_CURSOR_SELECT_CELL )
{
- if ( CanDragColSize() )
+ if ( CanDragColSize() && CanDragGridSize() )
ChangeCursorMode(WXGRID_CURSOR_RESIZE_COL);
}
ChangeCursorMode(WXGRID_CURSOR_SELECT_CELL);
}
}
- }
}
{
if ( m_table )
{
+ if (IsCellEditControlEnabled())
+ DisableCellEditControl();
+
m_table->Clear();
- SetEditControlValue();
if ( !GetBatchCount() ) m_gridWin->Refresh();
}
}
if ( !GetBatchCount() ) Refresh();
}
- SetEditControlValue();
return ok;
}
else
if ( !GetBatchCount() ) Refresh();
}
- SetEditControlValue();
return ok;
}
else
m_numRows && m_numCols )
{
m_currentCellCoords.Set(0, 0);
- SetEditControlValue();
ShowCellEditControl();
}
m_currentCellCoords != wxGridNoCellCoords )
{
HideCellEditControl();
- // RD: Does disabling this cause any problems? It's called again
- // in DisableCellEditControl...
- // SaveEditControlValue();
DisableCellEditControl();
// Clear the old current cell highlight
m_currentCellCoords = coords;
- SetEditControlValue();
-
if ( m_displayed )
{
wxClientDC dc(m_gridWin);
// do it before ShowCellEditControl()
m_cellEditCtrlEnabled = enable;
- SetEditControlValue();
ShowCellEditControl();
}
else
}
-void wxGrid::SetEditControlValue( const wxString& value )
-{
- // RD: The new Editors get the value from the table themselves now. This
- // method can probably be removed...
-}
-
void wxGrid::SaveEditControlValue()
{
m_canDragColSize = enable;
}
+void wxGrid::EnableDragGridSize( bool enable )
+{
+ m_canDragGridSize = enable;
+}
+
void wxGrid::SetDefaultRowSize( int height, bool resizeExistingRows )
{
DrawCell( dc, wxGridCellCoords(row, col) );
}
-#if 0 // TODO: edit in place
-
if ( m_currentCellCoords.GetRow() == row &&
- m_currentCellCoords.GetCol() == col )
+ m_currentCellCoords.GetCol() == col &&
+ IsCellEditControlEnabled())
{
- SetEditControlValue( s );
+ HideCellEditControl();
+ ShowCellEditControl(); // will reread data from table
}
-#endif
-
}
}