]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/spinctrl.cpp
Remove duplicate definition caused by last commit.
[wxWidgets.git] / src / gtk1 / spinctrl.cpp
index b1d33df2312f25376136e69f798b394b54559cdb..45cc31f6b839d06390cb7045648872305158a872 100644 (file)
@@ -126,24 +126,10 @@ bool wxSpinCtrl::Create(wxWindow *parent, wxWindowID id,
     
     m_parent->DoAddChild( this );
 
-    PostCreation();
-    InheritAttributes();
-
-    wxSize size_best( DoGetBestSize() );
-    wxSize new_size( size );
-    if (new_size.x == -1)
-        new_size.x = size_best.x;
-    if (new_size.y == -1)
-        new_size.y = size_best.y;
-    if (new_size.y > size_best.y)
-        new_size.y = size_best.y;
-    if ((new_size.x != size.x) || (new_size.y != size.y))
-        SetSize( new_size.x, new_size.y );
+    PostCreation(size);
 
     SetValue( value );
 
-    Show( TRUE );
-
     return TRUE;
 }
 
@@ -290,6 +276,16 @@ void wxSpinCtrl::OnChar( wxKeyEvent &event )
         }
     }
 
+    if ((event.GetKeyCode() == WXK_RETURN) && (m_windowStyle & wxPROCESS_ENTER))
+    {
+        wxCommandEvent evt( wxEVT_COMMAND_TEXT_ENTER, m_windowId );
+        evt.SetEventObject(this);
+        GtkSpinButton *gsb = GTK_SPIN_BUTTON(m_widget);
+        wxString val = wxGTK_CONV_BACK( gtk_entry_get_text( &gsb->entry ) );
+        evt.SetString( val );
+        if (GetEventHandler()->ProcessEvent(evt)) return;
+    }
+
     event.Skip();
 }
 
@@ -314,5 +310,14 @@ wxSize wxSpinCtrl::DoGetBestSize() const
     return wxSize(95, ret.y);
 }
 
+// static
+wxVisualAttributes
+wxSpinCtrl::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
+{
+    // TODO: overload to accept functions like gtk_spin_button_new?
+    // Until then use a similar type
+    return GetDefaultAttributesFromGTKWidget(gtk_entry_new, true);
+}
+
 #endif
    // wxUSE_SPINCTRL