- wxString <-> wxColour conversions in wxColour class (Francesco Montorsi).
- Fixed bug with ignoring blank lines in multiline wxGrid cell labels
- Added wxTextAttr::Merge() (Marcin Simonides)
+- Added wxTB_NO_TOOLTIPS style (Igor Korot)
wxMSW:
\twocolitem{\windowstyle{wxTB\_HORZ\_LAYOUT}}{Shows the text and the icons alongside, not vertically stacked (Windows and GTK
2 only). This style must be used with wxTB\_TEXT.}
\twocolitem{\windowstyle{wxTB\_HORZ\_TEXT}}{Combination of wxTB\_HORZ\_LAYOUT and wxTB\_TEXT.}
+\twocolitem{\windowstyle{wxTB\_NO\_TOOLTIPS}{Don't show the short help tooltips for the tools when the mouse hovers over them.}
\end{twocollist}
See also \helpref{window styles overview}{windowstyles}. Note that the Win32
wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
- long style = 0,
+ long style = wxTB_HORIZONTAL,
const wxString& name = wxToolBarNameStr )
{
Init();
// show the text and the icons alongside, not vertically stacked (Win32/GTK)
wxTB_HORZ_LAYOUT = 0x0800,
- wxTB_HORZ_TEXT = wxTB_HORZ_LAYOUT | wxTB_TEXT
+ wxTB_HORZ_TEXT = wxTB_HORZ_LAYOUT | wxTB_TEXT,
+
+ // don't show the toolbar short help tooltips
+ wxTB_NO_TOOLTIPS = 0x1000
};
#if wxUSE_TOOLBAR
void OnToggleToolbarSize(wxCommandEvent& event);
void OnToggleToolbarOrient(wxCommandEvent& event);
void OnToggleToolbarRows(wxCommandEvent& event);
+ void OnToggleTooltips(wxCommandEvent& event);
void OnToggleCustomDisabled(wxCommandEvent& event);
void OnEnablePrint(wxCommandEvent& WXUNUSED(event)) { DoEnablePrint(); }
bool m_smallToolbar,
m_horzToolbar,
m_horzText,
- m_useCustomDisabled;
+ m_useCustomDisabled,
+ m_showTooltips;
size_t m_rows; // 1 or 2 only
// the number of print buttons we have (they're added/removed dynamically)
IDM_TOOLBAR_TOGGLETOOLBARSIZE = 200,
IDM_TOOLBAR_TOGGLETOOLBARORIENT,
IDM_TOOLBAR_TOGGLETOOLBARROWS,
+ IDM_TOOLBAR_TOGGLETOOLTIPS,
IDM_TOOLBAR_TOGGLECUSTOMDISABLED,
IDM_TOOLBAR_ENABLEPRINT,
IDM_TOOLBAR_DELETEPRINT,
EVT_MENU(IDM_TOOLBAR_TOGGLETOOLBARSIZE, MyFrame::OnToggleToolbarSize)
EVT_MENU(IDM_TOOLBAR_TOGGLETOOLBARORIENT, MyFrame::OnToggleToolbarOrient)
EVT_MENU(IDM_TOOLBAR_TOGGLETOOLBARROWS, MyFrame::OnToggleToolbarRows)
+ EVT_MENU(IDM_TOOLBAR_TOGGLETOOLTIPS, MyFrame::OnToggleTooltips)
EVT_MENU(IDM_TOOLBAR_TOGGLECUSTOMDISABLED, MyFrame::OnToggleCustomDisabled)
EVT_MENU(IDM_TOOLBAR_ENABLEPRINT, MyFrame::OnEnablePrint)
style &= ~(wxTB_HORIZONTAL | wxTB_VERTICAL | wxTB_HORZ_LAYOUT);
style |= m_horzToolbar ? wxTB_HORIZONTAL : wxTB_VERTICAL;
+ if ( m_showTooltips )
+ style &= ~wxTB_NO_TOOLTIPS;
+ else
+ style |= wxTB_NO_TOOLTIPS;
+
if ( style & wxTB_TEXT && !(style & wxTB_NOICONS) && m_horzText )
style |= wxTB_HORZ_LAYOUT;
toolBarBitmaps[n] =
wxBitmap(toolBarBitmaps[n].ConvertToImage().Scale(w, h));
}
-
- toolBar->SetToolBitmapSize(wxSize(w, h));
}
+ toolBar->SetToolBitmapSize(wxSize(w, h));
+
toolBar->AddTool(wxID_NEW, _T("New"), toolBarBitmaps[Tool_new], _T("New file"));
toolBar->AddTool(wxID_OPEN, _T("Open"), toolBarBitmaps[Tool_open], _T("Open file"));
m_horzToolbar = true;
m_horzText = false;
m_useCustomDisabled = false;
+ m_showTooltips = true;
+
m_rows = 1;
m_nPrint = 1;
_T("Toggle number of &rows\tCtrl-R"),
_T("Toggle number of toolbar rows between 1 and 2"));
+ tbarMenu->AppendCheckItem(IDM_TOOLBAR_TOGGLETOOLTIPS,
+ _T("Show &tooltips\tCtrl-L"),
+ _T("Show tooltips for the toolbar tools"));
+
tbarMenu->AppendCheckItem(IDM_TOOLBAR_TOGGLECUSTOMDISABLED,
_T("Use c&ustom disabled images\tCtrl-U"),
_T("Switch between using system-generated and custom disabled images"));
SetMenuBar(menuBar);
menuBar->Check(IDM_TOOLBAR_SHOW_BOTH, true);
+ menuBar->Check(IDM_TOOLBAR_TOGGLETOOLTIPS, true);
// Create the toolbar
RecreateToolbar();
//RecreateToolbar(); -- this is unneeded
}
+void MyFrame::OnToggleTooltips(wxCommandEvent& WXUNUSED(event))
+{
+ m_showTooltips = !m_showTooltips;
+
+ RecreateToolbar();
+}
+
void MyFrame::OnToggleCustomDisabled(wxCommandEvent& WXUNUSED(event))
{
m_useCustomDisabled = !m_useCustomDisabled;
ConnectWidget( m_widget );
gtk_widget_show(GTK_WIDGET(m_toolbar));
}
-
- gtk_toolbar_set_tooltips( GTK_TOOLBAR(m_toolbar), TRUE );
+ gtk_toolbar_set_tooltips( GTK_TOOLBAR(m_toolbar), !(style & wxTB_NO_TOOLTIPS) );
// FIXME: there is no such function for toolbars in 2.0
#if 0
void wxToolBar::SetWindowStyleFlag( long style )
{
wxToolBarBase::SetWindowStyleFlag(style);
-
+ if( style & wxTB_TOOLTIPS )
+ {
+ if( m_toolbar )
+ gtk_toolbar_set_tooltips( GTK_TOOLBAR(m_toolbar), TRUE );
+ }
+ else
+ {
+ if( m_toolbar )
+ gtk_toolbar_set_tooltips( GTK_TOOLBAR(m_toolbar), FALSE );
+ }
if ( m_toolbar )
GtkSetStyle();
}
(style & ~wxBORDER_MASK) | wxBORDER_NONE, exstyle
);
- // always include this one, it never hurts and setting it later
- // only if we do have tooltips wouldn't work
- msStyle |= TBSTYLE_TOOLTIPS;
+ if ( !(style & wxTB_NO_TOOLTIPS) )
+ msStyle |= TBSTYLE_TOOLTIPS;
if ( style & (wxTB_FLAT | wxTB_HORZ_LAYOUT) )
{
WXLPARAM lParam,
WXLPARAM *WXUNUSED(result))
{
+ if( !HasFlag(wxTB_NO_TOOLTIPS) )
+ {
#if wxUSE_TOOLTIPS
- // First check if this applies to us
- NMHDR *hdr = (NMHDR *)lParam;
+ // First check if this applies to us
+ NMHDR *hdr = (NMHDR *)lParam;
- // the tooltips control created by the toolbar is sometimes Unicode, even
- // in an ANSI application - this seems to be a bug in comctl32.dll v5
- UINT code = hdr->code;
- if ( (code != (UINT) TTN_NEEDTEXTA) && (code != (UINT) TTN_NEEDTEXTW) )
- return false;
+ // the tooltips control created by the toolbar is sometimes Unicode, even
+ // in an ANSI application - this seems to be a bug in comctl32.dll v5
+ UINT code = hdr->code;
+ if ( (code != (UINT) TTN_NEEDTEXTA) && (code != (UINT) TTN_NEEDTEXTW) )
+ return false;
- HWND toolTipWnd = (HWND)::SendMessage((HWND)GetHWND(), TB_GETTOOLTIPS, 0, 0);
- if ( toolTipWnd != hdr->hwndFrom )
- return false;
+ HWND toolTipWnd = (HWND)::SendMessage(GetHwnd(), TB_GETTOOLTIPS, 0, 0);
+ if ( toolTipWnd != hdr->hwndFrom )
+ return false;
- LPTOOLTIPTEXT ttText = (LPTOOLTIPTEXT)lParam;
- int id = (int)ttText->hdr.idFrom;
+ LPTOOLTIPTEXT ttText = (LPTOOLTIPTEXT)lParam;
+ int id = (int)ttText->hdr.idFrom;
- wxToolBarToolBase *tool = FindById(id);
- if ( !tool )
- return false;
-
- return HandleTooltipNotify(code, lParam, tool->GetShortHelp());
+ wxToolBarToolBase *tool = FindById(id);
+ if ( tool )
+ return HandleTooltipNotify(code, lParam, tool->GetShortHelp());
#else
- wxUnusedVar(lParam);
+ wxUnusedVar(lParam);
+#endif
+ }
return false;
-#endif
}
// ----------------------------------------------------------------------------