#ifndef WX_PRECOMP
#include "wx/utils.h"
+ #include "wx/app.h"
#include "wx/log.h"
#include "wx/brush.h"
#include "wx/settings.h"
return msStyle;
}
+#ifndef EP_EDITTEXT
+ #define EP_EDITTEXT 1
+ #define ETS_NORMAL 1
+#endif
+
+wxVisualAttributes
+wxChoice::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
+{
+ // it is important to return valid values for all attributes from here,
+ // GetXXX() below rely on this
+ wxVisualAttributes attrs;
+
+ // FIXME: Use better dummy window?
+ wxWindow* wnd = wxTheApp->GetTopWindow();
+ if (!wnd)
+ return attrs;
+
+ attrs.font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
+
+ // there doesn't seem to be any way to get the text colour using themes
+ // API: TMT_TEXTCOLOR doesn't work neither for EDIT nor COMBOBOX
+ attrs.colFg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
+
+ // NB: use EDIT, not COMBOBOX (the latter works in XP but not Vista)
+ attrs.colBg = wnd->MSWGetThemeColour(L"EDIT",
+ EP_EDITTEXT,
+ ETS_NORMAL,
+ ThemeColourBackground,
+ wxSYS_COLOUR_WINDOW);
+
+ return attrs;
+}
+
wxChoice::~wxChoice()
{
Clear();
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
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