X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2ec335db7806c058a02d022d2f75b4144ce69d2a..f0ccd2cbfa0b4ac110b81626da5a184b650b1080:/src/msw/choice.cpp diff --git a/src/msw/choice.cpp b/src/msw/choice.cpp index 85eb015339..5b7f131e0b 100644 --- a/src/msw/choice.cpp +++ b/src/msw/choice.cpp @@ -235,6 +235,8 @@ wxChoice::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant)) // FIXME: Use better dummy window? wxWindow* wnd = wxTheApp->GetTopWindow(); + if (!wnd) + return attrs; attrs.font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); @@ -244,7 +246,7 @@ wxChoice::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant)) // NB: use EDIT, not COMBOBOX (the latter works in XP but not Vista) attrs.colBg = wnd->MSWGetThemeColour(L"EDIT", - EP_EDITTEXT, + EP_EDITTEXT, ETS_NORMAL, ThemeColourBackground, wxSYS_COLOUR_WINDOW); @@ -551,8 +553,21 @@ void wxChoice::DoSetSize(int x, int y, int width, int height, int sizeFlags) { + const int heightBest = GetBestSize().y; + // we need the real height below so get the current one if it's not given - if ( height != wxDefaultCoord && height != GetBestSize().y ) + if ( height == wxDefaultCoord ) + { + // height not specified, use the same as before + DoGetSize(NULL, &height); + } + else if ( height == heightBest ) + { + // we don't need to manually manage our height, let the system use the + // default one + m_heightOwn = wxDefaultCoord; + } + else // non-default height specified { // set our new own height but be careful not to make it too big: the // native control apparently stores it as a single byte and so setting @@ -566,10 +581,6 @@ void wxChoice::DoSetSize(int x, int y, else if ( m_heightOwn < COMBO_HEIGHT_ADJ ) m_heightOwn = COMBO_HEIGHT_ADJ; } - else // height not specified - { - DoGetSize(NULL, &height); - } // the height which we must pass to Windows should be the total height of