Ticket URL: <
http://trac.wxwidgets.org/ticket/14835#comment:1>
#14835: wxRichToolTipInfo for wxRichToolTip
--------------------------------------------------------+-------------------
Reporter: johnr | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone:
Component: GUI-generic | Version: 2.9-svn
Keywords: wxRichToolTip wxRichToolTipInfo needs-work | Blockedby:
Patch: 1 | Blocking:
--------------------------------------------------------+-------------------
Changes (by vadz):
* keywords: wxRichToolTip wxRichToolTipInfo => wxRichToolTip
wxRichToolTipInfo needs-work
Comment:
Thanks!
I don't have any special comments about the public API changes so the
documentation can be safely written. One problem I do have with this patch
is that it does several things at once, AFAICS it
1. Adds "show delay" timeout.
1. Adds "rect" parameter in `ShowFor()`.
1. Adds `DismissFor()`.
1. Adds `wxRichToolTipInfo`.
It seems like I should be able to commit those changes independently
relatively easily so it's not a big deal but it would still be even easier
to split changes in separate patches from the beginning if possible.
I also have some comments about the non-public changes, mostly minor (and
some very minor):
1. I don't like overloads of virtual functions, this makes it impossible
to override just one of them (because this hides the other ones) and can
lead to code duplication as can be seen in wxMSW implementation here. It
would be better to use the same virtual function with some special values
of parameters (e.g. `-1` for the delay, `NULL` for the rectangle) to
indicate that they're not specified.
1. I don't think `DismissFor()` should be redeclared in the derived impl
classes, what is this for?
1. `m_timedelay` should be called `m_timeDelay` to honour our naming
convention (or maybe just `m_delay` for consistency with `m_timeout`?).
1. There is really no need for "`m_title = wxString();`" in
`wxRichToolTipInfo` ctor. Either just omit this (and the next) line(s) or
initialize them in the initializer list if you really want to. But better
just omit them. On a related note, it would be marginally better to
initialize `m_title` and `m_message` in the initializer list in the non-
default ctor.
1. It would be nice to consistently use "`if ( cond )`" style but right
now patch also has some additions of "`if( cond )`" and "`if (cond)`".
1. Comment "must be done" is not very useful. Presumably it must, yes,
otherwise why is the code there? But why? If it's obvious (it seems to be
so to me, we must store the timeout to use it later...), just omit the
comment. If it isn't, please explain why (e.g. "this is used later in
OnTimer()").
1. What is not obvious to me is why has the timer been changed to be
"multiple" instead of one shot? As we restart it anyhow, it seems
unnecessary. Wouldn't it be better to just store a flag telling us whether
we're preparing to show the tooltip or preparing to hide it? This would
get rid of the strange interval check in `OnTimer()` too and would be much
more clear IMHO.
1. There is some commented out code in `OnTimer()` which should
presumably be just removed.
1. I wonder if `DismissFor()` implementation wouldn't be simpler if we
stored a list of (normally very few) currently shown tooltips indexed by
the associated window?
1. In wxMSW code the new `ShowFor()` overload duplicates the existing
code. This would hopefully change if we have just one `ShowFor()` with
optional `rect`, as mentioned above.
1. It also should presumably check for valid rect and not use the native
implementation in this case as it doesn't support this.
1. AFAICS `DismissFor()` doesn't work with native MSW tooltips currently.
Sorry for so many remarks but, again, most of them are very minor. The
most important one is (1), then perhaps (11) and (12).
TIA!
--
Ticket URL: <
http://trac.wxwidgets.org/ticket/14835#comment:1>