[wx-dev] wxMSW: Themed borders?
Robin Dunn
robin at alldunn.com
Fri Aug 10 10:48:54 PDT 2007
Julian Smart wrote:
> I've committed two slightly different approaches, based on Robin's
> wxBORDER_THEME patch.
>
> Trying to determine whether to paint the themed border on the basis of
> styles alone proved impossible. Sometimes the native control will do it
> itself, sometimes not. And GetDefaultBorder() didn't provide enough
> information for specific controls to determine theme drawing. Depending
> on platform and presence of theme support, wxBORDER_SIMPLE would
> sometimes require WS_BORDER, and sometimes not, so overloading this
> border style would be difficult.
>
> In both ports, wxBORDER_THEME is a new style replacing wxBORDER_DOUBLE
> and currently only relevant on Windows.
>
> On 2.8, you have to use wxBORDER_THEME explicitly, because
> GetDefaultBorder() doesn't have the information to determine it. So for
> the generic wxSearchCtrl, there's Windows-specific code to test for
> whether we can use wxBORDER_THEME.
Julian, it looks like something has gone wrong with wxTextCtrl with a
rich style, at least in 2.8 on XP but I expect that this will happen in
2.9 too. The theme border is drawn along the side with the scrollbar,
but not the rest of the control. Instead it is drawn with no border at
all. It looks like the client size is not being adjusted for the
border, or something like that...
Okay, after a little more investigation I found that the problem is
because the WM_NCCALCSIZE message is not being caught in window.cpp if
the size is given to the constructor. If instead the size is set after
the control is created (such as when it sets itself to its best size)
then the WM_NCCALCSIZE message is handled and the theme border is drawn
correctly. My guess is that there is actually a WM_NCCALCSIZE sent
during creation of the control, but since our SubclassWin hasn't been
called yet we don't get a chance to catch it.
Does anybody know if there is a way to tickle the system into asking for
the NC size again without actually needing to change the size?
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
More information about the wx-dev
mailing list