[wx-dev] inheritable colours again

Jamie Gadd jrgadd2 at cs.latrobe.edu.au
Sat Aug 5 15:38:07 PDT 2006


On Sat, 5 Aug 2006, Vadim Zeitlin wrote:

> I thought we fixed this problem already but as the thread starting from
>
> 	http://article.gmane.org/gmane.comp.lib.wxwindows.general/45397
>
> demonstrates, we didn't. Basically the problem is that it seems to be
> currently impossible to make the background colour to apply to the window
> and all of its children -- unlike, for example, foreground colour or font.

It seems this change was done while correcting the notebook themes on XP.

src/msw/notebook.cpp, rev 1.125 (Dec 13 2004) VZ:
"implemented MSWGetBgBrush/ColourForChild() to propagate themed notebook 
background to children"

src/common/wincmn.cpp, rev 1.212 (Dec 19 2004) VZ:
"do not inherit background colour in InheritAttributes() as it totally 
breaks themed backgrounds"

> I see the following solutions:
>
> 1. The one I proposed in the thread above, that is add new SetBgRecursive()
>   method which would work as expected and change SetBackgroundColour() to
>   behave as SetOwnBackgroundColour() currently does:
>
>   + Allows to change the background for the entire panel/dialog at once
>   + Compatible with the current code
>   - SetBackgroundColour() inconsistent with SetForegroundColour()
>   - SetOwnBackgroundColour() becomes useless (same as SetBackgroundColour())

Inconsistency here would be confusing. It is currently documented to work 
the same as SetForegroundColour().

> 2. Remove/deprecate SetOwnBackgroundColour(), document that
>   SetBackgroundColour() doesn't change the children background explaining
>   that it's a bad idea with modern themed GUIs
>
>   + Simplest
>   - SetBackgroundColour() inconsistent with SetForegroundColour()
>   - Doesn't allow to change the background of the entire dialog at once

If we have SetForegroundColour() then we should also have a 
SetBackgroundColour() to match.

> 3. Let SetBackgroundColour() behave as SetForegroundColour(), i.e. change
>   the colour for the window and all its descendants at once.
>
>   + Allows to change the background for the entire panel/dialog at once
>   + All methods behave in consistent way
>   - Incompatible with the current behaviour

+ Compatible with the current documentation.

This could be considered a bug fix.

> What would you prefer? My order is probably 1,3,2. Or is there something
> else/better to do?

3,1,2.

Thanks
Jamie




More information about the wx-dev mailing list