]> git.saurik.com Git - wxWidgets.git/commitdiff
added wxGridCellEditor::StartingClick(), used by BoolEditor
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 17 Feb 2000 20:03:01 +0000 (20:03 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 17 Feb 2000 20:03:01 +0000 (20:03 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6124 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/generic/grid.h
src/generic/grid.cpp

index 45c4400ae38fbb6dd04ca9a5f76f6e11a3151d85..9932513d4d9e80ebec886614af00d5a35db4127a 100644 (file)
@@ -167,6 +167,10 @@ public:
     // that first key if desired.
     virtual void StartingKey(wxKeyEvent& event);
 
+    // if the editor is enabled by clicking on the cell, this method will be
+    // called
+    virtual void StartingClick();
+
     // Some types of controls on some platforms may need some help
     // with the Return key.
     virtual void HandleReturn(wxKeyEvent& event);
@@ -227,7 +231,7 @@ public:
     virtual bool EndEdit(int row, int col,  bool saveValue, wxGrid* grid);
 
     virtual void Reset();
-    virtual void StartingKey(wxKeyEvent& event);
+    virtual void StartingClick();
 
 protected:
     wxCheckBox *CBox() const { return (wxCheckBox *)m_control; }
index f4aefc8ac384997485069df5e088ccd979ee1f4e..e99d25cea70dd6f394164ac883f5aa7e1c08c31d 100644 (file)
@@ -392,11 +392,11 @@ void wxGridCellEditor::HandleReturn(wxKeyEvent& event)
 
 void wxGridCellEditor::StartingKey(wxKeyEvent& event)
 {
-    wxASSERT_MSG(m_control,
-                 wxT("The wxGridCellEditor must be Created first!"));
+    event.Skip();
+}
 
-    // pass the event to the control
-    m_control->GetEventHandler()->ProcessEvent(event);
+void wxGridCellEditor::StartingClick()
+{
 }
 
 // ----------------------------------------------------------------------------
@@ -590,9 +590,9 @@ void wxGridCellBoolEditor::Reset()
     CBox()->SetValue(m_startValue);
 }
 
-void wxGridCellBoolEditor::StartingKey(wxKeyEvent& event)
+void wxGridCellBoolEditor::StartingClick()
 {
-    event.Skip();
+    CBox()->SetValue(!CBox()->GetValue());
 }
 
 // ----------------------------------------------------------------------------
@@ -3179,6 +3179,11 @@ void wxGrid::ProcessGridCellMouseEvent( wxMouseEvent& event )
                          CanEnableCellControl())
                     {
                         EnableCellEditControl();
+
+                        wxGridCellAttr* attr = GetCellAttr(m_currentCellCoords);
+                        attr->GetEditor()->StartingClick();
+                        attr->DecRef();
+
                         m_waitForSlowClick = FALSE;
                     }
                     else