[ 1494561 ] wxComboCtrl vertical size fix.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39472 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -379,7 +379,6 @@ protected:
|
|||||||
void DestroyPopup();
|
void DestroyPopup();
|
||||||
|
|
||||||
// override the base class virtuals involved in geometry calculations
|
// override the base class virtuals involved in geometry calculations
|
||||||
virtual void DoMoveWindow(int x, int y, int width, int height);
|
|
||||||
virtual wxSize DoGetBestSize() const;
|
virtual wxSize DoGetBestSize() const;
|
||||||
|
|
||||||
// ensures there is atleast the default popup
|
// ensures there is atleast the default popup
|
||||||
|
@@ -716,6 +716,16 @@ bool wxComboCtrlBase::Create(wxWindow *parent,
|
|||||||
OnThemeChange();
|
OnThemeChange();
|
||||||
m_absIndent = GetNativeTextIndent();
|
m_absIndent = GetNativeTextIndent();
|
||||||
|
|
||||||
|
m_iFlags |= wxCC_IFLAG_CREATED;
|
||||||
|
|
||||||
|
// If x and y indicate valid size, wxSizeEvent won't be
|
||||||
|
// emitted automatically, so we need to add artifical one.
|
||||||
|
if ( size.x > 0 && size.y > 0 )
|
||||||
|
{
|
||||||
|
wxSizeEvent evt(size,GetId());
|
||||||
|
GetEventHandler()->AddPendingEvent(evt);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -828,15 +838,31 @@ void wxComboCtrlBase::CalculateAreas( int btnWidth )
|
|||||||
if ( butWidth <= 0 )
|
if ( butWidth <= 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
int butHeight = sz.y - btnBorder*2;
|
||||||
|
|
||||||
// Adjust button width
|
// Adjust button width
|
||||||
if ( m_btnWid < 0 )
|
if ( m_btnWid < 0 )
|
||||||
butWidth += m_btnWid;
|
butWidth += m_btnWid;
|
||||||
else if ( m_btnWid > 0 )
|
else if ( m_btnWid > 0 )
|
||||||
butWidth = m_btnWid;
|
butWidth = m_btnWid;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Adjust button width to match aspect ratio
|
||||||
|
// (but only if control is smaller than best size).
|
||||||
|
int bestHeight = GetBestSize().y;
|
||||||
|
int height = GetSize().y;
|
||||||
|
|
||||||
int butHeight = sz.y;
|
if ( height < bestHeight )
|
||||||
|
{
|
||||||
butHeight -= btnBorder*2;
|
// Make very small buttons square, as it makes
|
||||||
|
// them accommodate arrow image better and still
|
||||||
|
// looks decent.
|
||||||
|
if ( height > 18 )
|
||||||
|
butWidth = (height*butWidth)/bestHeight;
|
||||||
|
else
|
||||||
|
butWidth = butHeight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Adjust button height
|
// Adjust button height
|
||||||
if ( m_btnHei < 0 )
|
if ( m_btnHei < 0 )
|
||||||
@@ -987,14 +1013,6 @@ wxSize wxComboCtrlBase::DoGetBestSize() const
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxComboCtrlBase::DoMoveWindow(int x, int y, int width, int height)
|
|
||||||
{
|
|
||||||
// SetSize is called last in create, so it marks the end of creation
|
|
||||||
m_iFlags |= wxCC_IFLAG_CREATED;
|
|
||||||
|
|
||||||
wxControl::DoMoveWindow(x, y, width, height);
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxComboCtrlBase::OnSizeEvent( wxSizeEvent& event )
|
void wxComboCtrlBase::OnSizeEvent( wxSizeEvent& event )
|
||||||
{
|
{
|
||||||
if ( !IsCreated() )
|
if ( !IsCreated() )
|
||||||
|
Reference in New Issue
Block a user