X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9f7aee01986653bfc0fe2e7ebf5a68cb12d7f0b1..84056016e19cc83788bcbfe93f614d413c91a010:/src/generic/grid.cpp diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index f92efb38ba..acfdc88d3f 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -50,7 +50,7 @@ #include "wx/generic/gridsel.h" -const wxChar wxGridNameStr[] = wxT("grid"); +const char wxGridNameStr[] = "grid"; #if defined(__WXMOTIF__) #define WXUNUSED_MOTIF(identifier) WXUNUSED(identifier) @@ -965,32 +965,19 @@ bool wxGridCellEditor::IsAcceptedKey(wxKeyEvent& event) if ((ctrl || alt) && !(ctrl && alt)) return false; - int key = 0; - bool keyOk = true; - -#ifdef __WXGTK20__ - // If it's a F-Key or other special key then it shouldn't start the - // editor. - if (event.GetKeyCode() >= WXK_START) - return false; -#endif #if wxUSE_UNICODE // if the unicode key code is not really a unicode character (it may // be a function key or etc., the platforms appear to always give us a // small value in this case) then fallback to the ASCII key code but // don't do anything for function keys or etc. - key = event.GetUnicodeKey(); - if (key <= 127) - { - key = event.GetKeyCode(); - keyOk = (key <= 127); - } + if ( event.GetUnicodeKey() > 127 && event.GetKeyCode() > 127 ) + return false; #else - key = event.GetKeyCode(); - keyOk = (key <= 255); + if ( event.GetKeyCode() > 255 ) + return false; #endif - return keyOk; + return true; } void wxGridCellEditor::StartingKey(wxKeyEvent& event) @@ -3843,15 +3830,6 @@ void wxGridStringTable::SetValue( int row, int col, const wxString& value ) m_data[row][col] = value; } -bool wxGridStringTable::IsEmptyCell( int row, int col ) -{ - wxCHECK_MSG( (row < GetNumberRows()) && (col < GetNumberCols()), - true, - _T("invalid row or column index in wxGridStringTable") ); - - return (m_data[row][col] == wxEmptyString); -} - void wxGridStringTable::Clear() { int row, col; @@ -4533,6 +4511,9 @@ bool wxGrid::Create(wxWindow *parent, wxWindowID id, wxGrid::~wxGrid() { + if ( m_winCapture ) + m_winCapture->ReleaseMouse(); + // Ensure that the editor control is destroyed before the grid is, // otherwise we crash later when the editor tries to do something with the // half destroyed grid @@ -4903,10 +4884,9 @@ void wxGrid::InitColWidths() m_colWidths.Add( m_defaultColWidth, m_numCols ); - int colRight = 0; for ( int i = 0; i < m_numCols; i++ ) { - colRight = ( GetColPos( i ) + 1 ) * m_defaultColWidth; + int colRight = ( GetColPos( i ) + 1 ) * m_defaultColWidth; m_colRights.Add( colRight ); } } @@ -6182,8 +6162,7 @@ void wxGrid::ChangeCursorMode(CursorMode mode, if ( m_winCapture ) { - if (m_winCapture->HasCapture()) - m_winCapture->ReleaseMouse(); + m_winCapture->ReleaseMouse(); m_winCapture = NULL; } @@ -6410,8 +6389,7 @@ wxGrid::DoGridCellLeftUp(wxMouseEvent& event, const wxGridCellCoords& coords) { if (m_winCapture) { - if (m_winCapture->HasCapture()) - m_winCapture->ReleaseMouse(); + m_winCapture->ReleaseMouse(); m_winCapture = NULL; } @@ -9052,7 +9030,7 @@ bool wxGrid::MovePageUp() bool wxGrid::MovePageDown() { return DoMoveCursorByPage( - wxGridForwardOperations(this, wxGridColumnOperations())); + wxGridForwardOperations(this, wxGridRowOperations())); } // helper of DoMoveCursorByBlock(): advance the cell coordinates using diroper