[wx-dev] Re: CanApplyThemeBorder()
Julian Smart
julian at anthemion.co.uk
Tue Jan 1 08:42:53 PST 2008
Vadim Zeitlin wrote:
> On Sun, 30 Dec 2007 22:44:18 +0000 Julian Smart <julian at anthemion.co.uk> wrote:
>
> JS> > But maybe I'm wrong because I still don't really know when should this
> JS> > method return true and when should it return false. What is the rule for
> JS> > it?
> JS> >
> JS> It should return true if (a) an app may wish it to have a themed border
> JS> at some point and (b) the control doesn't internally draw the themed
> JS> border (e.g. wxListBox already does).
>
> I wonder what does (a) mean exactly. If the app uses wxBORDER_THEME
> explicitly, shouldn't the themed border be always used anyhow, whatever
> CanApplyThemeBorder() return?
>
> As for (b), if the control draws its border internally then it means that
> it doesn't need any "generic" border at all by default and hence it must
> override GetDefaultBorder() to return wxBORDER_NONE.
No. We want to be able to tell wxMSW whether to draw the themed border
explicitly or not INDEPENDENTLY of using border styles to fudge it.
Whether a control already draws its theme, or whether the wxMSW
implementation should draw it explicitly, has nothing to do with the
platform-independent border styles in wxWidgets. It's entirely an
implementational detail.
> So if this is the only
> case when CanApplyThemeBorder() should return false, then it seems like we
> don't need it at all and checking GetDefaultBorder() is enough.
>
No, we need it.
> JS> So by returning false you're saying the control either draws the border
> JS> itself, or should never draw a themed border.
>
> When does the latter happen/make sense?
>
A wxListBox returns false because it draws the themed border itself
inside the WIN32 listbox implementation. The application can then use
wxBORDER_THEME to get the border, or wxBORDER_NONE to not have a border,
or wxBORDER_DFAULT to get the themed border. A wxRichTextCtrl, OTOH,
should return true from this function because the themed border should
be drawn by wxMSW. Again, the app can choose to use any of the border
styles. Entirely independently of the CanApplyThemeBorder function.
> JS> Maybe the default value of GetDefaultBorder() != wxBORDER_NONE would be
> JS> appropriate. Border changes have a habit of coming back to haunt us...
>
> Unfortunately I'm still very confused by wxBORDER_THEME. I think things
> were pretty simple before: from the user point of view by default you got
> the appropriate default border and you could force the border style by
> specifying some wxBORDER_XXX explicitly. And from the implementor point of
> view, all you had to do was to override GetDefaultBorder() in your control
> class (if the inherited version was wrong). Now I'm not sure at all about
> how does it work: it seems that even specifying wxBORDER_THEME explicitly
> won't always give you the themed border (if the control overrides
> CanApplyThemeBorder())?
>
Huh? No, you'll get the themed border if you specify wxBORDER_THEME _if_
it makes sense for the control - so, there won't be a border for a
wxStaticText, but there will be for a wxListBox or a wxRichTextCtrl. I
don't think there's a problem here. You're probably confusing an
implementational detail (CanApplyThemeBorder) with the
platform-independent border styles.
Regards,
Julian
More information about the wx-dev
mailing list