JR> Before I do any more on this, is this an acceptable api?
JR>
JR> {{{
JR> virtual void SetToolRichTipParams( wxRibbonToolBarToolBase* toolBase,
JR> const wxString& tipTitle,
JR> const wxString& tipMessage,
JR> int wxiconId = wxICON_INFORMATION );
JR>
JR> virtual void SetToolRichTipParams( int tool_id,
JR> const wxString& tipTitle,
JR> const wxString& tipMessage,
JR> int wxiconId = wxICON_INFORMATION );
JR>
JR> virtual void SetToolRichTipIcon( wxRibbonToolBarToolBase* toolBase,
JR> const wxIcon& icon );
JR>
JR> virtual void SetToolRichTipIcon( int tool_id,
JR> const wxIcon& icon );
JR> }}}
Do we really need to distinguish between "params" and "icon"? I.e. why not
have a single overloaded method:
void SetToolTip(wxRibbonToolBarToolBase* tool,
const wxString& title,
const wxString& message,
int icon = wxICON_INFORMATION);
void SetToolTip(wxRibbonToolBarToolBase* tool,
const wxString& title,
const wxString& message,
const wxIcon& icon);
? Notice that I removed "Rich" from the names as I don't think it adds
anything.
I also think that perhaps I was wrong to not introduce a separate
wxRichToolTipInfo struct, as I initially planned to. If we had such struct
containing all of the information about the tool tip (similar to
wxAboutDialogInfo one), then we could simply have a single
void SetToolTip(wxRibbonToolBarToolBase* tool,
const wxRichToolTipInfo& tipInfo);
and use it like this:
wxRichToolTipInfo tipInfo("Title", "Message");
tipInfo.SetIcon(whatever);
tipInfo.SetBackgroundColour(*wxWHITE, *wxBLACK);
...
ribbonBar->SetToolTip(tool, tipInfo);
Regards,
VZ
Do we really need to distinguish between "params" and "icon"? I.e. why not
have a single overloaded method:
? Notice that I removed "Rich" from the names as I don't think it adds
anything.
I also think that perhaps I was wrong to not introduce a separate
wxRichToolTipInfo struct, as I initially planned to. If we had such struct
containing all of the information about the tool tip (similar to
wxAboutDialogInfo one), then we could simply have a single
void SetToolTip(wxRibbonToolBarToolBase* tool,
const wxRichToolTipInfo& tipInfo);
Regards,
VZ
All points are good. The latter can be added later if not done now.
Regards, John
If we had such struct containing all of the information about the tool tip
(similar to wxAboutDialogInfo one...
Regards,
VZ
The more I thought about this the more attractive it became. It could hold
all the fruit for an easier uniform app customisation and save revisiting
code if done now.
It would also replace wxRichToolTip members with a single info member?
I have done a quick copy/paste version below and added a few things
excluding getters of which there are none in wxRichToolTip but will be
necessary here.
One problem is that the tip point is set to the centre of the supplied
window/rect. I guess it is easier to position above and below the rect that
way. However, using 'wxTipKind_None' the tip window covers half the parent
rect unless I fudge when using ShowFor. This is also a problem for Hybrid 2
part buttons where the bottom (or top) part becomes covered.
Regards, John
class WXDLLIMPEXP_ADV wxRichToolTipInfo
{
public:
wxRichToolTipInfo();
wxRichToolTipInfo( wxRichToolTipInfo& info );
wxRichToolTipInfo( const wxString& title,
const wxString& message,
int icon = wxICON_INFORMATION );
void SetBackgroundColour( const wxColour &col, const wxColour
&colEnd=wxColour() );
void SetTimes( unsigned millisecondsDelay, unsigned
millisecondsTimeout );
void SetTipKind( wxTipKind tipKind );
void SetTitleFont( const wxFont &font );
void ShowFor( wxWindow *win );
void SetIcon( int icon=wxICON_INFORMATION );
void SetIcon( const wxIcon &icon);
private:
void Init();
wxString m_title,
m_message;
unsigned m_iconId,
m_timeDelay,
m_timeOut
wxIcon m_icon;
wxColour m_backcolourStart,
m_forecolourEnd;
wxFont m_font;
wxTipKind m_tipKind;
};
JR> -----Original Message-----
JR> From: Vadim Zeitlin
JR> Sent: Tuesday, February 07, 2012 10:29 PM
JR> To: wx-...@googlegroups.com
JR> Subject: Re: [wx-dev] wxRibbon richtooltips
JR>
JR> If we had such struct containing all of the information about the tool tip
JR> (similar to wxAboutDialogInfo one...
JR>
JR> Regards,
JR> VZ
JR>
JR> The more I thought about this the more attractive it became. It could hold
JR> all the fruit for an easier uniform app customisation and save revisiting
JR> code if done now.
JR> It would also replace wxRichToolTip members with a single info member?
Yes, it could be used in wxRichToolTipGenericImpl too.
JR> class WXDLLIMPEXP_ADV wxRichToolTipInfo
JR> {
JR> public:
JR> wxRichToolTipInfo();
I don't think we should have a default ctor, the title and the message
must always be specified.
JR> wxRichToolTipInfo( wxRichToolTipInfo& info );
The copy ctor doesn't seem to be necessary, the default one should be just
fine AFAICS.
Regards,
VZ
On Wed, 8 Feb 2012 15:39:26 +0800 John Roberts <jo...@iinet.net.au> wrote:JR> -----Original Message-----
JR> From: Vadim Zeitlin
JR> Sent: Tuesday, February 07, 2012 10:29 PM
JR> To: wx-...@googlegroups.com
JR> Subject: Re: [wx-dev] wxRibbon richtooltips
JR> class WXDLLIMPEXP_ADV wxRichToolTipInfo
JR> {
JR> public:
JR> wxRichToolTipInfo();
I don't think we should have a default ctor, the title and the message
must always be specified.