// be the correct colour and themed brush. Instead we'll use
// wxSYS_COLOUR_WINDOW in the EVT_PAINT handler as needed.
#ifndef __WXMAC__
- SetOwnBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
+ if ( !m_hasBgCol )
+ {
+ wxColour bgCol = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
+ SetOwnBackgroundColour(bgCol);
+ m_hasBgCol = false;
+ }
#endif
}
selRect.width -= wcp + (focusSpacingX*2);
wxColour bgCol;
+ wxColour fgCol;
+
bool doDrawSelRect = true;
+ // Determine foreground colour
+ if ( isEnabled )
+ {
+ if ( doDrawFocusRect )
+ {
+ fgCol = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT);
+ }
+ else if ( m_hasFgCol )
+ {
+ // Honour the custom foreground colour
+ fgCol = GetForegroundColour();
+ }
+ else
+ {
+ fgCol = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
+ }
+ }
+ else
+ {
+ fgCol = wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT);
+ }
+
+ // Determine background colour
if ( isEnabled )
{
- // If popup is hidden and this control is focused,
- // then draw the focus-indicator (selbgcolor background etc.).
if ( doDrawFocusRect )
{
- dc.SetTextForeground( wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT) );
bgCol = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT);
}
+ else if ( m_hasBgCol )
+ {
+ // Honour the custom background colour
+ bgCol = GetBackgroundColour();
+ }
else
{
- dc.SetTextForeground( wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT) );
#ifndef __WXMAC__ // see note in OnThemeChange
doDrawSelRect = false;
bgCol = GetBackgroundColour();
}
else
{
- dc.SetTextForeground( wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT) );
#ifndef __WXMAC__ // see note in OnThemeChange
bgCol = GetBackgroundColour();
#else
#endif
}
+ dc.SetTextForeground( fgCol );
dc.SetBrush( bgCol );
if ( doDrawSelRect )
{
{
// 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
- SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
+ if ( !m_hasFgCol )
+ {
+ wxColour fgCol = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
+ SetForegroundColour(fgCol);
+ m_hasFgCol = false;
+ }
+
+ wxColour bgCol = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
#if wxUSE_UXTHEME
wxUxThemeEngine * const theme = wxUxThemeEngine::GetIfActive();
);
if ( SUCCEEDED(hr) )
{
- SetBackgroundColour(wxRGBToColour(col));
-
- // skip the call below
- return;
+ bgCol = wxRGBToColour(col);
+ }
+ else
+ {
+ wxLogApiError("GetThemeColor(EDIT, ETS_NORMAL, TMT_FILLCOLOR)",
+ hr);
}
-
- wxLogApiError(wxT("GetThemeColor(EDIT, ETS_NORMAL, TMT_FILLCOLOR)"), hr);
}
#endif
- SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
+ if ( !m_hasBgCol )
+ {
+ SetBackgroundColour(bgCol);
+ m_hasBgCol = false;
+ }
}
void wxComboCtrl::OnResize()
//if ( hTheme )
// theme = wxUxThemeEngine::GetIfActive();
+ wxColour fgCol;
wxColour bgCol;
bool doDrawDottedEdge = false;
bool doDrawSelRect = true;
if ( (m_iFlags & wxCC_FULL_BUTTON) && !(flags & wxCONTROL_ISSUBMENU) )
{
// Vista style read-only combo
+ fgCol = GetForegroundColour();
+ bgCol = GetBackgroundColour();
doDrawSelRect = false;
doDrawDottedEdge = true;
}
else
{
- dc.SetTextForeground( wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT) );
+ fgCol = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT);
bgCol = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT);
}
}
else
{
- dc.SetTextForeground( wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT) );
+ fgCol = GetForegroundColour();
bgCol = GetBackgroundColour();
doDrawSelRect = false;
}
}
else
{
- dc.SetTextForeground( wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT) );
+ fgCol = wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT);
bgCol = wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE);
}
+ dc.SetTextForeground(fgCol);
dc.SetBrush(bgCol);
if ( doDrawSelRect )
{