[ wxwindows-Patches-1629946 ] [2.9] wxST_MARKUP and wxST_ELLIPSIZE_*
style support
SourceForge.net
noreply at sourceforge.net
Sun Apr 1 07:12:38 PDT 2007
Patches item #1629946, was opened at 2007-01-07 16:56
Message generated for change (Comment added) made by vadz
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=309863&aid=1629946&group_id=9863
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Common
Group: new feature
>Status: Closed
>Resolution: Accepted
Priority: 7
Private: No
Submitted By: Francesco Montorsi (frm)
Assigned to: Vadim Zeitlin (vadz)
Summary: [2.9] wxST_MARKUP and wxST_ELLIPSIZE_* style support
Initial Comment:
This patch:
1) adds SetLabelWithMarkup() function to wxStaticText and implements it natively (in wxControl however) for GTK+ 2
2) adds a stattextcmn.cpp file for common wxStaticText functions and puts the wxTextWrapper helper class used by wxDialog functions and by wxLabel in a private/stattext.h header
3) modifies WIDGETS sample to show the new feature
4) documents the new feature
NOTE1: the patch does not add to build/bakefiles/files.bkl the new private header. this should be ok I think.
NOTE2: the wxStaticText default constructor is untouched (i.e. the wxStaticText constructor still takes undecorated labels) but to make it easier to use the markup maybe we should:
a) change the constructor to call SetLabelWithMarkup() instead of just SetLabel()
b) add another constructor overload which uses SetLabelWithMarkup()
being able to set the markup directly from the constructor is very useful as when building the GUI the programmers typically do:
mysizer->Add(new wxStaticText(...));
i.e. don't save a pointer to the just-created static text (as this is not usually needed).
----------------------------------------------------------------------
>Comment By: Vadim Zeitlin (vadz)
Date: 2007-04-01 16:12
Message:
Logged In: YES
user_id=71618
Originator: NO
I've finally applied the patch with more (mostly cosmetic) changes, please
review my changes in the cvs and let me know if I got anything wrong.
Except for several compilation fixes and renaming, I've also removed many
wxControl::SetLabel() calls from wxGTK controls and added it to
GTKSetLabelForLabel() instead.
There are a couple of problems which I saw during tesing:
1. Bad things happen if you pass a label with incorrect markup to wxGTK:
the label changes internally but not on the screen. This is probably
trivial to fix but I didn't have time to look at it today, I just wanted to
apply this patch before the sources changed even more.
2. Ellipsization in the middle and from end doesn't work correctly in
wxUniv: just "..." is shown in the widgets sample
Thanks!
----------------------------------------------------------------------
Comment By: Francesco Montorsi (frm)
Date: 2007-02-16 18:38
Message:
Logged In: YES
user_id=591038
Originator: YES
the changes looks right to me - even if most of them are "just" re-wording
or my bad english ;)
Thanks!
----------------------------------------------------------------------
Comment By: Vadim Zeitlin (vadz)
Date: 2007-02-16 16:05
Message:
Logged In: YES
user_id=71618
Originator: NO
I started looking at this patch a few days ago but unfortunately didn't
have time to finish, there are still quite a few things I'm unsure about.
But just so that the changes I already did don't get lost, I attach the
current version of the patch (Francesco, please ask me if you have any
questions about the differences between it and your original patch).
File Added: statictext_vz.patch
----------------------------------------------------------------------
Comment By: Francesco Montorsi (frm)
Date: 2007-02-12 14:06
Message:
Logged In: YES
user_id=591038
Originator: YES
>I'm looking at this
Thanks!
>is setlabelwithmarkup.patch still relevant?
sorry - it isn't; I left it just for historical purposes: it was the
approach of adding SetLabelWithMarkup() function which I later abandoned in
favour of the wxST_MARKUP style.
----------------------------------------------------------------------
Comment By: Vadim Zeitlin (vadz)
Date: 2007-02-12 14:02
Message:
Logged In: YES
user_id=71618
Originator: NO
I'm looking at this but I'm confused by the 2 patches: is
setlabelwithmarkup.patch still relevant?
----------------------------------------------------------------------
Comment By: Francesco Montorsi (frm)
Date: 2007-01-14 12:12
Message:
Logged In: YES
user_id=591038
Originator: YES
Attached the updated patch with the fix of the previous comment.
File Added: statictext.patch
----------------------------------------------------------------------
Comment By: Francesco Montorsi (frm)
Date: 2007-01-13 19:39
Message:
Logged In: YES
user_id=591038
Originator: YES
NOTE: I've found that the MSWCreateControl modification introduces an
unwanted effect: for wxTextCtrl a wxEVT_COMMAND_TEXT_UPDATED event is sent
also on creation, and this may be undesiderate!
The solution is to just set the label when creating the control (i.e.
discard the msw\control.cpp patch portion) and then immediately do:
m_strOriginalLabel = label;
----------------------------------------------------------------------
Comment By: Francesco Montorsi (frm)
Date: 2007-01-12 15:36
Message:
Logged In: YES
user_id=591038
Originator: YES
Now tested also on wxMSW.
Please note that apart from wxGTK and wxMSW very probably it will require
some additional work to get it to work under other platforms.
File Added: statictext.patch
----------------------------------------------------------------------
Comment By: Francesco Montorsi (frm)
Date: 2007-01-11 19:36
Message:
Logged In: YES
user_id=591038
Originator: YES
Attached a new version of the patch which does a lot of things:
1) fixes all "notes to myself" of previous comments
2) adds support for wxST_ELLIPSIZE_START/MIDDLE/END, wxST_MARKUP to wxGTK,
wxMSW, wxUniv, wxCarbon, wxMotif, wxOS2 ports.
3) patches the WIDGETS sample to be able to test all new features of the
wxStaticText class.
Tested on wxGTK 2 only for now.
File Added: statictext.patch
----------------------------------------------------------------------
Comment By: Francesco Montorsi (frm)
Date: 2007-01-08 09:58
Message:
Logged In: YES
user_id=591038
Originator: YES
Two other notes (to myself):
1) we need also a g_markup_escape-like public function to be used when the
programmer needs to set into a wxStaticText a string with markup taken e.g.
from user input. I'd say a static wxStaticText::EscapeLabelWithMarkup()
should do.
2) the const arrays of strings can be taken out of SetLabelWithMarkup()
since stepping with the debugger seems that they need to be initialized all
the times.
----------------------------------------------------------------------
Comment By: Francesco Montorsi (frm)
Date: 2007-01-07 20:55
Message:
Logged In: YES
user_id=591038
Originator: YES
NOTE to myself: things I've just thought about this patch:
1) the comment in stattext.h referring to dlgcmn.cpp can be removed
2) this patch need more testing for some things like double ampersand &&
(specially when placed at the end of the string)
3) we could entirely change the logic: make private the
SetLabelWithMarkup() function and create a wxST_WITH_MARKUP style which
could be used to create wxStaticText objects whose SetLabel() takes a
string with decorated markup.
This approach would be more extendable with e.g. ellipsize-able static
texts which I plan to contribute in future (if we create a
wxST_ELLIPSIZEABLE style).
----------------------------------------------------------------------
Comment By: Francesco Montorsi (frm)
Date: 2007-01-07 17:35
Message:
Logged In: YES
user_id=591038
Originator: YES
File Added: setlabelwithmarkup.patch
----------------------------------------------------------------------
Comment By: Francesco Montorsi (frm)
Date: 2007-01-07 17:33
Message:
Logged In: YES
user_id=591038
Originator: YES
tested also under wxMSW where the mnemonics chars however seems not to be
interpreted as mnemonics; they're just removed (under wxGTK they make the
next char underlined as any mnemonic). This should be ok however (I
think).
File Added: setlabelwithmarkup.patch
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=309863&aid=1629946&group_id=9863
More information about the wx-dev
mailing list