/////////////////////////////////////////////////////////////////////////////
-// Name: msw/tbar95.cpp
+// Name: src/msw/tbar95.cpp
// Purpose: wxToolBar
// Author: Julian Smart
// Modified by:
#pragma hdrstop
#endif
+#if wxUSE_TOOLBAR && wxUSE_TOOLBAR_NATIVE && !defined(__SMARTPHONE__)
+
+#include "wx/toolbar.h"
+
#ifndef WX_PRECOMP
+ #include "wx/dynarray.h"
#include "wx/frame.h"
#include "wx/log.h"
#include "wx/intl.h"
- #include "wx/dynarray.h"
#include "wx/settings.h"
#include "wx/bitmap.h"
#include "wx/dcmemory.h"
#include "wx/control.h"
+ #include "wx/app.h" // for GetComCtl32Version
+ #include "wx/image.h"
#endif
-#if wxUSE_TOOLBAR && wxUSE_TOOLBAR_NATIVE && !defined(__SMARTPHONE__)
-
-#include "wx/toolbar.h"
#include "wx/sysopt.h"
-#include "wx/image.h"
#include "wx/msw/private.h"
// include <commctrl.h> "properly"
#include "wx/msw/wrapcctl.h"
-#include "wx/app.h" // for GetComCtl32Version
-
// this define controls whether the code for button colours remapping (only
// useful for 16 or 256 colour images) is active at all, it's always turned off
// for CE where it doesn't compile (and is probably not needed anyhow) and may
(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) )
{
// as we can't use disabled image list with older versions of comctl32.dll,
// don't even bother creating it
- if ( wxTheApp->GetComCtl32Version() >= 470 )
+ if ( wxApp::GetComCtl32Version() >= 470 )
{
// search for the first disabled button img in the toolbar, if any
for ( wxToolBarToolsList::compatibility_iterator
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
}
// ----------------------------------------------------------------------------
void wxToolBar::UpdateSize()
{
+ wxPoint pos = GetPosition();
::SendMessage(GetHwnd(), TB_AUTOSIZE, 0, 0);
+ if (pos != GetPosition())
+ Move(pos);
// In case Realize is called after the initial display (IOW the programmer
// may have rebuilt the toolbar) give the frame the option of resizing the
#endif // wxREMAP_BUTTON_COLOURS
#endif // wxUSE_TOOLBAR
-