newSize.x = bestSize.x;
if (newSize.y == -1)
newSize.y = bestSize.y;
- if (newSize.y > 30)
- newSize.y = 30;
+ if (newSize.y > 22)
+ newSize.y = 22;
if (!PreCreation( parent, pos, newSize ) ||
!CreateBase( parent, id, pos, size, style, validator, name ))
wxSize wxComboBox::DoGetBestSize() const
{
// totally bogus - should measure the strings in the combo!
- return wxSize(100, 26);
+ return wxSize(100, 22);
}
#endif
wxSize wxControl::DoGetBestSize() const
{
+ // Do not return any arbitrary default value...
+ wxASSERT_MSG( m_widget, wxT("DoGetBestSize called before creation") );
+
GtkRequisition req;
(* GTK_WIDGET_CLASS( GTK_OBJECT(m_widget)->klass )->size_request )
(m_widget, &req );
m_needParent = TRUE;
m_acceptsFocus = TRUE;
- wxSize new_size = size,
- sizeBest = DoGetBestSize();
- if (new_size.x == -1)
- new_size.x = sizeBest.x;
- if (new_size.y == -1)
- new_size.y = sizeBest.y;
-
- if (!PreCreation( parent, pos, new_size ) ||
- !CreateBase( parent, id, pos, new_size, style, wxDefaultValidator, name ))
+ if (!PreCreation( parent, pos, size ) ||
+ !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
{
wxFAIL_MSG( wxT("wxSpinCtrl creation failed") );
return FALSE;
m_adjust = (GtkAdjustment*) gtk_adjustment_new( initial, min, max, 1.0, 5.0, 0.0);
m_widget = gtk_spin_button_new( m_adjust, 1, 0 );
+
+ wxSize new_size = size,
+ sizeBest = DoGetBestSize();
+ if (new_size.x == -1)
+ new_size.x = sizeBest.x;
+ if (new_size.y == -1)
+ new_size.y = sizeBest.y;
+
+ if ((new_size.x != size.x) || (new_size.y != size.y))
+ SetSize( new_size.x, new_size.y );
gtk_spin_button_set_wrap( GTK_SPIN_BUTTON(m_widget),
(int)(m_windowStyle & wxSP_WRAP) );
wxSize wxSpinCtrl::DoGetBestSize() const
{
- return wxSize(95, 26);
+ wxSize ret( wxControl::DoGetBestSize() );
+ return wxSize(95, ret.y);
}
#endif
m_text = gtk_entry_new();
}
- SetSizeOrDefault( size );
+ wxSize new_size = size,
+ sizeBest = DoGetBestSize();
+ if (new_size.x == -1)
+ new_size.x = sizeBest.x;
+ if (new_size.y == -1)
+ new_size.y = sizeBest.y;
+
+ if ((new_size.x != size.x) || (new_size.y != size.y))
+ SetSize( new_size.x, new_size.y );
m_parent->DoAddChild( this );
wxSize wxTextCtrl::DoGetBestSize() const
{
// FIXME should be different for multi-line controls...
- return wxSize(80, 26);
+ wxSize ret( wxControl::DoGetBestSize() );
+ return wxSize(80, ret.y);
}
newSize.x = bestSize.x;
if (newSize.y == -1)
newSize.y = bestSize.y;
- if (newSize.y > 30)
- newSize.y = 30;
+ if (newSize.y > 22)
+ newSize.y = 22;
if (!PreCreation( parent, pos, newSize ) ||
!CreateBase( parent, id, pos, size, style, validator, name ))
wxSize wxComboBox::DoGetBestSize() const
{
// totally bogus - should measure the strings in the combo!
- return wxSize(100, 26);
+ return wxSize(100, 22);
}
#endif
wxSize wxControl::DoGetBestSize() const
{
+ // Do not return any arbitrary default value...
+ wxASSERT_MSG( m_widget, wxT("DoGetBestSize called before creation") );
+
GtkRequisition req;
(* GTK_WIDGET_CLASS( GTK_OBJECT(m_widget)->klass )->size_request )
(m_widget, &req );
m_needParent = TRUE;
m_acceptsFocus = TRUE;
- wxSize new_size = size,
- sizeBest = DoGetBestSize();
- if (new_size.x == -1)
- new_size.x = sizeBest.x;
- if (new_size.y == -1)
- new_size.y = sizeBest.y;
-
- if (!PreCreation( parent, pos, new_size ) ||
- !CreateBase( parent, id, pos, new_size, style, wxDefaultValidator, name ))
+ if (!PreCreation( parent, pos, size ) ||
+ !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
{
wxFAIL_MSG( wxT("wxSpinCtrl creation failed") );
return FALSE;
m_adjust = (GtkAdjustment*) gtk_adjustment_new( initial, min, max, 1.0, 5.0, 0.0);
m_widget = gtk_spin_button_new( m_adjust, 1, 0 );
+
+ wxSize new_size = size,
+ sizeBest = DoGetBestSize();
+ if (new_size.x == -1)
+ new_size.x = sizeBest.x;
+ if (new_size.y == -1)
+ new_size.y = sizeBest.y;
+
+ if ((new_size.x != size.x) || (new_size.y != size.y))
+ SetSize( new_size.x, new_size.y );
gtk_spin_button_set_wrap( GTK_SPIN_BUTTON(m_widget),
(int)(m_windowStyle & wxSP_WRAP) );
wxSize wxSpinCtrl::DoGetBestSize() const
{
- return wxSize(95, 26);
+ wxSize ret( wxControl::DoGetBestSize() );
+ return wxSize(95, ret.y);
}
#endif
m_text = gtk_entry_new();
}
- SetSizeOrDefault( size );
+ wxSize new_size = size,
+ sizeBest = DoGetBestSize();
+ if (new_size.x == -1)
+ new_size.x = sizeBest.x;
+ if (new_size.y == -1)
+ new_size.y = sizeBest.y;
+
+ if ((new_size.x != size.x) || (new_size.y != size.y))
+ SetSize( new_size.x, new_size.y );
m_parent->DoAddChild( this );
wxSize wxTextCtrl::DoGetBestSize() const
{
// FIXME should be different for multi-line controls...
- return wxSize(80, 26);
+ wxSize ret( wxControl::DoGetBestSize() );
+ return wxSize(80, ret.y);
}