[wx-dev] wxMenuBar::GetLabelTop inconsistency
Julian Smart
julian at anthemion.co.uk
Fri Aug 3 07:42:22 PDT 2007
Hi Vadim,
Yes, I don't like the 'top' name anyway. So I think adding:
wxMenuBar::GetMenuLabel
wxMenuBar::GetMenuText
wxMenu::GetItemLabel
wxMenu::GetItemText
would be the way to go. I'll have a go at adding these to 2.9 and 2.8
(in a compatible way) if no-one objects.
Thanks,
Julian
Vadim Zeitlin wrote:
> On Fri, 03 Aug 2007 10:32:06 +0100 Julian Smart <julian at anthemion.co.uk> wrote:
>
> JS> A wxWidgets user (NCBI) has pointed out that wxMenuBar::GetLabelTop()
> JS> strips the menu codes, whereas wxMenu::GetLabel() doesn't. This is a
> JS> problem for them because they need to merge UI elements and thus require
> JS> the original labels.
>
> The inconsistency is worse than this because there are also wxMenuItem
> methods. So we have:
>
> 1. In wxMenuItem
> a) GetLabel() which does the stripping
> b) GetText() which returns the full text, i.e. doesn't strip anything
>
> 2. wxMenu::GetLabel() which returns the full text (because it uses
> wxMenuItem::GetText(), *not* GetLabel() internally!)
>
> 3. wxMenuBar::GetLabelTop() which does the stripping (at least in wxMSW,
> I'm not sure if it does in all the other ports, it doesn't seem to do
> it in wxUniv for example)
>
> JS> My suggestion is to make GetLabelTop() return the original label in 2.9,
> JS> and in 2.8 have a wxSystemOption to let apps tell wxWidgets that
> JS> GetLabelTop() should return the raw label.
>
> The minimal change which would make the API sensible is to leave
> wxMenuBar::GetLabelTop() as is and add wxMenuBar::GetTextTop() for
> returning the original text and change wxMenu::GetLabel() to use
> wxMenuItem::GetLabel() and add wxMenu::GetText().
>
> If we agree to do this in 2.9, then we should just add GetTextTop() to
> 2.8.5 (it would have to be done for each port separately as we can't add a
> new virtual without breaking ABI). There is still the problem of breaking
> the code which relies on wxMenu::GetLabel() returning the full text but I
> don't see what can we do about it. My only idea is to deprecate it (and
> then wxMenuBar::GetLabelTop() too) and add new wxMenu::GetItemLabel/Text()
> and wxMenuBar::GetMenuLabel/Text() consistent with wxMenuItem. Maybe this
> is actually the best thing to do... As before, the new methods could be
> added to 2.8 provided it is done separately for each port instead of using
> a virtual function in the base class.
>
> In any case, I think that having a system option for something like this
> is not a good idea for all the usual reason (using a global variable to
> make one part of a program work risks well to break another one in
> mysterious ways).
>
> Regards,
> VZ
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wx-dev-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail: wx-dev-help at lists.wxwidgets.org
>
>
>
>
--
Julian Smart, Anthemion Software Ltd.
28/5 Gillespie Crescent, Edinburgh, Midlothian, EH10 4HU
www.anthemion.co.uk | +44 (0)131 229 5306
Tools for writers: www.writerscafe.co.uk
wxWidgets RAD: www.anthemion.co.uk/dialogblocks
More information about the wx-dev
mailing list