]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/grid.cpp
ignore clicks on a toolbar but outside any button
[wxWidgets.git] / src / generic / grid.cpp
index fe5b45ebedb619593238e8b56aed792ba7044207..b6afb0c214aab8b69b1c46d0e6910a1694913d85 100644 (file)
@@ -185,7 +185,7 @@ private:
     DECLARE_EVENT_TABLE()
 };
 
     DECLARE_EVENT_TABLE()
 };
 
-class WXDLLEXPORT wxGridWindow : public wxPanel
+class WXDLLEXPORT wxGridWindow : public wxWindow
 {
 public:
     wxGridWindow()
 {
 public:
     wxGridWindow()
@@ -3486,9 +3486,9 @@ void wxGridCornerLabelWindow::OnKeyUp( wxKeyEvent& event )
 
 //////////////////////////////////////////////////////////////////////
 
 
 //////////////////////////////////////////////////////////////////////
 
-IMPLEMENT_DYNAMIC_CLASS( wxGridWindow, wxPanel )
+IMPLEMENT_DYNAMIC_CLASS( wxGridWindow, wxWindow )
 
 
-BEGIN_EVENT_TABLE( wxGridWindow, wxPanel )
+BEGIN_EVENT_TABLE( wxGridWindow, wxWindow )
     EVT_PAINT( wxGridWindow::OnPaint )
     EVT_MOUSEWHEEL( wxGridWindow::OnMouseWheel)
     EVT_MOUSE_EVENTS( wxGridWindow::OnMouseEvent )
     EVT_PAINT( wxGridWindow::OnPaint )
     EVT_MOUSEWHEEL( wxGridWindow::OnMouseWheel)
     EVT_MOUSE_EVENTS( wxGridWindow::OnMouseEvent )
@@ -3501,7 +3501,7 @@ wxGridWindow::wxGridWindow( wxGrid *parent,
                             wxGridRowLabelWindow *rowLblWin,
                             wxGridColLabelWindow *colLblWin,
                             wxWindowID id, const wxPoint &pos, const wxSize &size )
                             wxGridRowLabelWindow *rowLblWin,
                             wxGridColLabelWindow *colLblWin,
                             wxWindowID id, const wxPoint &pos, const wxSize &size )
-        : wxPanel( parent, id, pos, size, wxWANTS_CHARS, "grid window" )
+        : wxWindow( parent, id, pos, size, wxWANTS_CHARS, "grid window" )
 {
     m_owner = parent;
     m_rowLabelWin = rowLblWin;
 {
     m_owner = parent;
     m_rowLabelWin = rowLblWin;
@@ -3532,7 +3532,7 @@ void wxGridWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
 
 void wxGridWindow::ScrollWindow( int dx, int dy, const wxRect *rect )
 {
 
 void wxGridWindow::ScrollWindow( int dx, int dy, const wxRect *rect )
 {
-    wxPanel::ScrollWindow( dx, dy, rect );
+    wxWindow::ScrollWindow( dx, dy, rect );
     m_rowLabelWin->ScrollWindow( 0, dy, rect );
     m_colLabelWin->ScrollWindow( dx, 0, rect );
 }
     m_rowLabelWin->ScrollWindow( 0, dy, rect );
     m_colLabelWin->ScrollWindow( dx, 0, rect );
 }
@@ -3629,9 +3629,10 @@ void wxGrid::Create()
 
     m_cellEditCtrlEnabled = FALSE;
 
 
     m_cellEditCtrlEnabled = FALSE;
 
-    m_defaultCellAttr = new wxGridCellAttr(m_defaultCellAttr);
+    m_defaultCellAttr = new wxGridCellAttr();
 
     // Set default cell attributes
 
     // Set default cell attributes
+    m_defaultCellAttr->SetDefAttr(m_defaultCellAttr);
     m_defaultCellAttr->SetKind(wxGridCellAttr::Default);
     m_defaultCellAttr->SetFont(GetFont());
     m_defaultCellAttr->SetAlignment(wxALIGN_LEFT, wxALIGN_TOP);
     m_defaultCellAttr->SetKind(wxGridCellAttr::Default);
     m_defaultCellAttr->SetFont(GetFont());
     m_defaultCellAttr->SetAlignment(wxALIGN_LEFT, wxALIGN_TOP);
@@ -5831,7 +5832,14 @@ void wxGrid::OnKeyDown( wxKeyEvent& event )
                          || editor->IsAcceptedKey(event) )
                     {
                         EnableCellEditControl();
                          || editor->IsAcceptedKey(event) )
                     {
                         EnableCellEditControl();
-                        editor->StartingKey(event);
+
+                        // the editor could be not shown for a variety of
+                        // reasons (i.e. blocked by the app or whatever), so
+                        // check if it really was created
+                        if ( m_cellEditCtrlEnabled )
+                        {
+                            editor->StartingKey(event);
+                        }
                     }
                     else
                     {
                     }
                     else
                     {