// headers
// ----------------------------------------------------------------------------
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation "tbar95.h"
#endif
#include "wx/control.h"
#endif
-#if wxUSE_TOOLBAR && defined(__WIN95__) && wxUSE_TOOLBAR_NATIVE
+#if wxUSE_TOOLBAR && wxUSE_TOOLBAR_NATIVE && (!defined(_WIN32_WCE) || (_WIN32_WCE >= 400 && !wxUSE_POCKETPC_UI))
#include "wx/toolbar.h"
-#if !defined(__GNUWIN32__) && !defined(__SALFORDC__)
- #include "malloc.h"
-#endif
-
#include "wx/msw/private.h"
// include <commctrl.h> "properly"
if ( !tool )
return FALSE;
+ bool toggled = false; // just to suppress warnings
+
if ( tool->CanBeToggled() )
{
LRESULT state = ::SendMessage(GetHwnd(), TB_GETSTATE, id, 0);
- tool->Toggle((state & TBSTATE_CHECKED) != 0);
- }
+ toggled = (state & TBSTATE_CHECKED) != 0;
- bool toggled = tool->IsToggled();
+ // ignore the event when a radio button is released, as this doesn't seem to
+ // happen at all, and is handled otherwise
+ if ( tool->GetKind() == wxITEM_RADIO && !toggled )
+ return TRUE;
- // avoid sending the event when a radio button is released, this is not
- // interesting
- if ( !tool->CanBeToggled() || tool->GetKind() != wxITEM_RADIO || toggled )
+ tool->Toggle(toggled);
+ UnToggleRadioGroup(tool);
+ }
+
+ // OnLeftClick() can veto the button state change - for buttons which
+ // may be toggled only, of couse
+ if ( !OnLeftClick((int)id, toggled) && tool->CanBeToggled() )
{
- // OnLeftClick() can veto the button state change - for buttons which
- // may be toggled only, of couse
- if ( !OnLeftClick((int)id, toggled) && tool->CanBeToggled() )
- {
- // revert back
- toggled = !toggled;
- tool->SetToggle(toggled);
+ // revert back
+ tool->Toggle(!toggled);
- ::SendMessage(GetHwnd(), TB_CHECKBUTTON, id, MAKELONG(toggled, 0));
- }
+ ::SendMessage(GetHwnd(), TB_CHECKBUTTON, id, MAKELONG(toggled, 0));
}
return TRUE;
{
// TB_GETBUTTONSIZE is supported from version 4.70
#if defined(_WIN32_IE) && (_WIN32_IE >= 0x300 ) \
- && !( defined(__GNUWIN32__) && !wxCHECK_W32API_VERSION( 1, 0 ) )
+ && !( defined(__GNUWIN32__) && !wxCHECK_W32API_VERSION( 1, 0 ) ) \
+ && !defined (__DIGITALMARS__)
if ( wxTheApp->GetComCtl32Version() >= 470 )
{
DWORD dw = ::SendMessage(GetHwnd(), TB_GETBUTTONSIZE, 0, 0);