X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/fb7e87effa123dc73d7b299ea814d29d4ef7de2e..dc134969ef4efd78faccc19fa616d715ab39c5f8:/src/msw/tbar95.cpp diff --git a/src/msw/tbar95.cpp b/src/msw/tbar95.cpp index 1a18ce01f2..f28404d38b 100644 --- a/src/msw/tbar95.cpp +++ b/src/msw/tbar95.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: msw/tbar95.cpp +// Name: src/msw/tbar95.cpp // Purpose: wxToolBar // Author: Julian Smart // Modified by: @@ -24,20 +24,22 @@ #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 #endif -#if wxUSE_TOOLBAR && wxUSE_TOOLBAR_NATIVE && !defined(__SMARTPHONE__) - -#include "wx/toolbar.h" #include "wx/sysopt.h" #include "wx/image.h" @@ -50,8 +52,6 @@ // include "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 @@ -377,9 +377,8 @@ WXDWORD wxToolBar::MSWGetStyle(long style, WXDWORD *exstyle) const (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) ) { @@ -510,7 +509,7 @@ void wxToolBar::CreateDisabledImageList() // 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 @@ -1119,33 +1118,34 @@ bool wxToolBar::MSWOnNotify(int WXUNUSED(idCtrl), 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 } // ---------------------------------------------------------------------------- @@ -1252,7 +1252,10 @@ wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord x, wxCoord y) const 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 @@ -1656,4 +1659,3 @@ WXHBITMAP wxToolBar::MapBitmap(WXHBITMAP bitmap, int width, int height) #endif // wxREMAP_BUTTON_COLOURS #endif // wxUSE_TOOLBAR -