[wxGTK 2.8.7] wxStatusBar text colour

Carsten A. Arnholm arnholm at offline.no
Tue Dec 4 16:20:12 PST 2007


Carsten A. Arnholm wrote:
> Robert Roebling wrote:
>> Well, it is going to be difficult to match KDE system colours to
>> GTK+ and then to wxWidgets without problems, but the current
>> default is that the text foregrund colour of all DCs in wxWidgets
>> is black - always.
>
> I am not sure if I understand how that is consistent with my
> observations, but I am sure you are right :-)
>
>> Obviously, there are places and themes, where
>> this is wrong. This also begs the question if we should fix that
>> for wxStatusBar only or for which other windows/widgets/controls?
>
> Ideally a wxWidgets application should behave as similar as possible
> to a native application also wrt. colours. But a more pragmatic point
> of view is maybe to allow some way for an application to set the
> wxStatusBar text colour, for example using an overload of
> wxWindow::SetForegroundColour ?

Well I found a temporary fix until something more standard is available. I 
defined a class wxStatusBarEx in my project:

On Windows this is just
#define wxStatusBarEx  wxStatusBar

On Linux it is a new class that derives from wxStatusBar and with a new 
OnPaint event handler. This does the same as wxStatusBarGeneric::OnPaint, 
but it also sets the text colour

dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));

The net result is that I get a status bar with ok text colour in wxWidgets 
2.8.7  :-) Presumably, the standard wxStatusBarGeneric::OnPaint handler 
could do the same in a future version.

-- 
Carsten A. Arnholm
http://arnholm.org/
N59.776 E10.457 








More information about the wx-users mailing list