]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/datavcmn.cpp
resolve the DLL linking problems with MSVC due to use of static variables of template...
[wxWidgets.git] / src / common / datavcmn.cpp
index 5edb1147bd3d748e180d94ca9321d9ca4669632b..cbc0840fa920356dc58231b915d1d26fe59f866d 100644 (file)
@@ -41,7 +41,7 @@ bool operator == (const wxDataViewItem &left, const wxDataViewItem &right)
 #ifdef __WXDEBUG__
 void wxDataViewItem::Print(const wxString& text) const
 {
-    wxPrintf(wxT("item %s: %l\n"), text.GetData(), (long)m_id);
+    wxPrintf(wxT("item %s: %lu\n"), text.GetData(), wxPtrToUInt(m_id));
 }
 #endif
 
@@ -720,6 +720,8 @@ bool wxDataViewRendererBase::StartEditing( const wxDataViewItem &item, wxRect la
 
 void wxDataViewRendererBase::CancelEditing()
 {
+    if (!m_editorCtrl) return;
+    
     GetOwner()->GetOwner()->GetMainWindow()->SetFocus();
 
     m_editorCtrl->Hide();
@@ -728,6 +730,8 @@ void wxDataViewRendererBase::CancelEditing()
 
 bool wxDataViewRendererBase::FinishEditing()
 {
+    if (!m_editorCtrl) return true;
+
     wxVariant value;
     GetValueFromEditorCtrl( m_editorCtrl, value );
 
@@ -761,6 +765,7 @@ BEGIN_EVENT_TABLE(wxDataViewEditorCtrlEvtHandler, wxEvtHandler)
     EVT_CHAR           (wxDataViewEditorCtrlEvtHandler::OnChar)
     EVT_KILL_FOCUS     (wxDataViewEditorCtrlEvtHandler::OnKillFocus)
     EVT_IDLE           (wxDataViewEditorCtrlEvtHandler::OnIdle)
+    EVT_TEXT_ENTER     (-1, wxDataViewEditorCtrlEvtHandler::OnTextEnter)
 END_EVENT_TABLE()
 
 wxDataViewEditorCtrlEvtHandler::wxDataViewEditorCtrlEvtHandler(
@@ -785,6 +790,12 @@ void wxDataViewEditorCtrlEvtHandler::OnIdle( wxIdleEvent &event )
     event.Skip();
 }
 
+void wxDataViewEditorCtrlEvtHandler::OnTextEnter( wxCommandEvent &WXUNUSED(event) )
+{
+    m_finished = true;
+    m_owner->FinishEditing();
+}
+
 void wxDataViewEditorCtrlEvtHandler::OnChar( wxKeyEvent &event )
 {
     switch ( event.m_keyCode )
@@ -795,10 +806,11 @@ void wxDataViewEditorCtrlEvtHandler::OnChar( wxKeyEvent &event )
             break;
 
         case WXK_ESCAPE:
+        {
             m_finished = true;
             m_owner->CancelEditing();
             break;
-
+        }
         default:
             event.Skip();
     }
@@ -1261,7 +1273,7 @@ wxControl* wxDataViewSpinRenderer::CreateEditorCtrl( wxWindow *parent, wxRect la
     wxString str;
     str.Printf( wxT("%d"), (int) l );
     wxSpinCtrl *sc = new wxSpinCtrl( parent, wxID_ANY, str,
-               labelRect.GetTopLeft(), size, wxSP_ARROW_KEYS, m_min, m_max, l );
+               labelRect.GetTopLeft(), size, wxSP_ARROW_KEYS|wxTE_PROCESS_ENTER, m_min, m_max, l );
 #ifdef __WXMAC__
     size = sc->GetSize();
     wxPoint pt = sc->GetPosition();