Only draw valid help lines in resizing.
First try to enable EditCtrl on slow clicking: Doesn't work yet.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5998
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
#include "wx/textctrl.h"
#include "wx/combobox.h"
#include "wx/dynarray.h"
#include "wx/textctrl.h"
#include "wx/combobox.h"
#include "wx/dynarray.h"
// Default parameters for wxGrid
//
// Default parameters for wxGrid
//
+//-----------------------------------------------------------------------------
+// wxGridEditTimer (internal)
+//-----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxGridEditTimer: public wxTimer
+{
+ private:
+ wxGrid *m_owner;
+
+ public:
+ wxGridEditTimer( wxGrid *owner );
+ void Notify();
+};
+
// ----------------------------------------------------------------------------
// wxGrid
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// wxGrid
// ----------------------------------------------------------------------------
int m_dragRowOrCol;
bool m_isDragging;
int m_dragRowOrCol;
bool m_isDragging;
+ wxTimer *m_editTimer;
+
wxGridCellCoords m_selectionStart;
wxCursor m_rowResizeCursor;
wxGridCellCoords m_selectionStart;
wxCursor m_rowResizeCursor;
//////////////////////////////////////////////////////////////////////
IMPLEMENT_DYNAMIC_CLASS( wxGridTextCtrl, wxTextCtrl )
//////////////////////////////////////////////////////////////////////
IMPLEMENT_DYNAMIC_CLASS( wxGridTextCtrl, wxTextCtrl )
{
switch ( event.KeyCode() )
{
{
switch ( event.KeyCode() )
{
case WXK_ESCAPE:
m_grid->SetEditControlValue( startValue );
SetInsertionPointEnd();
break;
case WXK_ESCAPE:
m_grid->SetEditControlValue( startValue );
SetInsertionPointEnd();
break;
+#else
+ case WXK_ESCAPE:
+ m_grid->EnableCellEditControl( FALSE );
+#endif
case WXK_UP:
case WXK_DOWN:
case WXK_LEFT:
case WXK_UP:
case WXK_DOWN:
case WXK_LEFT:
case WXK_HOME:
case WXK_END:
if ( m_isCellControl )
case WXK_HOME:
case WXK_END:
if ( m_isCellControl )
+//-----------------------------------------------------------------------------
+// wxGridEditTimer (internal)
+//-----------------------------------------------------------------------------
+
+wxGridEditTimer::wxGridEditTimer( wxGrid *owner )
+{
+ m_owner = owner;
+}
+
+void wxGridEditTimer::Notify()
+{
+ m_owner->EnableCellEditControl( TRUE );
+}
+
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
if (m_ownTable)
delete m_table;
if (m_ownTable)
delete m_table;
m_dragRowOrCol = -1;
m_isDragging = FALSE;
m_dragRowOrCol = -1;
m_isDragging = FALSE;
+ m_editTimer = new wxGridEditTimer ( this );
+
m_rowResizeCursor = wxCursor( wxCURSOR_SIZENS );
m_colResizeCursor = wxCursor( wxCURSOR_SIZEWE );
m_rowResizeCursor = wxCursor( wxCURSOR_SIZENS );
m_colResizeCursor = wxCursor( wxCURSOR_SIZEWE );
wxClientDC dc( m_gridWin );
PrepareDC( dc );
wxClientDC dc( m_gridWin );
PrepareDC( dc );
+ y = wxMax( y,
+ m_rowBottoms[m_dragRowOrCol] -
+ m_rowHeights[m_dragRowOrCol] +
+ WXGRID_MIN_ROW_HEIGHT );
dc.SetLogicalFunction(wxINVERT);
if ( m_dragLastPos >= 0 )
{
dc.SetLogicalFunction(wxINVERT);
if ( m_dragLastPos >= 0 )
{
wxClientDC dc( m_gridWin );
PrepareDC( dc );
wxClientDC dc( m_gridWin );
PrepareDC( dc );
+ x = wxMax( x,
+ m_colRights[m_dragRowOrCol] -
+ m_colWidths[m_dragRowOrCol] +
+ WXGRID_MIN_COL_WIDTH );
dc.SetLogicalFunction(wxINVERT);
if ( m_dragLastPos >= 0 )
{
dc.SetLogicalFunction(wxINVERT);
if ( m_dragLastPos >= 0 )
{
wxClientDC dc( m_gridWin );
PrepareDC( dc );
wxClientDC dc( m_gridWin );
PrepareDC( dc );
+ y = wxMax( y,
+ m_rowBottoms[m_dragRowOrCol] -
+ m_rowHeights[m_dragRowOrCol] +
+ WXGRID_MIN_ROW_HEIGHT );
dc.SetLogicalFunction(wxINVERT);
if ( m_dragLastPos >= 0 )
{
dc.SetLogicalFunction(wxINVERT);
if ( m_dragLastPos >= 0 )
{
wxClientDC dc( m_gridWin );
PrepareDC( dc );
wxClientDC dc( m_gridWin );
PrepareDC( dc );
+ x = wxMax( x,
+ m_colRights[m_dragRowOrCol] -
+ m_colWidths[m_dragRowOrCol] + WXGRID_MIN_COL_WIDTH );
dc.SetLogicalFunction(wxINVERT);
if ( m_dragLastPos >= 0 )
{
dc.SetLogicalFunction(wxINVERT);
if ( m_dragLastPos >= 0 )
{
//
if ( event.LeftDown() )
{
//
if ( event.LeftDown() )
{
- if ( event.AltDown() )
- {
- MakeCellVisible( coords );
- SetCurrentCell( coords );
- EnableCellEditControl( TRUE );
- }
- else
- {
- EnableCellEditControl( FALSE );
- }
+ EnableCellEditControl( FALSE );
if ( event.ShiftDown() )
{
SelectBlock( m_currentCellCoords, coords );
if ( event.ShiftDown() )
{
SelectBlock( m_currentCellCoords, coords );
else if ( event.LeftDClick() )
{
EnableCellEditControl( FALSE );
else if ( event.LeftDClick() )
{
EnableCellEditControl( FALSE );
if ( XToEdgeOfCol(x) < 0 && YToEdgeOfRow(y) < 0 )
{
SendEvent( EVT_GRID_CELL_LEFT_DCLICK,
if ( XToEdgeOfCol(x) < 0 && YToEdgeOfRow(y) < 0 )
{
SendEvent( EVT_GRID_CELL_LEFT_DCLICK,
// been hidden for drag-shrinking.
if ( IsCellEditControlEnabled() )
ShowCellEditControl();
// been hidden for drag-shrinking.
if ( IsCellEditControlEnabled() )
ShowCellEditControl();
+ if( IsEditable() && coords == m_currentCellCoords )
+ m_editTimer->Start( 100, TRUE );
}
else if ( m_cursorMode == WXGRID_CURSOR_RESIZE_ROW )
{
}
else if ( m_cursorMode == WXGRID_CURSOR_RESIZE_ROW )
{
if ( !IsCellEditControlEnabled() )
EnableCellEditControl( TRUE );
if ( IsCellEditControlEnabled() )
if ( !IsCellEditControlEnabled() )
EnableCellEditControl( TRUE );
if ( IsCellEditControlEnabled() )
- {
- event.SetEventObject( m_cellEditCtrl );
- m_cellEditCtrl->GetEventHandler()->ProcessEvent( event );
- }
- break;
+ {
+ event.SetEventObject( m_cellEditCtrl );
+ m_cellEditCtrl->GetEventHandler()->ProcessEvent( event );
+ }
+ break;
int left, top, right, bottom;
CalcScrolledPosition( rect.GetLeft(), rect.GetTop(), &left, &top );
CalcScrolledPosition( rect.GetRight(), rect.GetBottom(), &right, &bottom );
int left, top, right, bottom;
CalcScrolledPosition( rect.GetLeft(), rect.GetTop(), &left, &top );
CalcScrolledPosition( rect.GetRight(), rect.GetBottom(), &right, &bottom );
+ left--; top--; right--; bottom--; // cell is shifted by one pixel
int cw, ch;
m_gridWin->GetClientSize( &cw, &ch );
int cw, ch;
m_gridWin->GetClientSize( &cw, &ch );