- if (g_isIdle)
- wxapp_install_idle_handler();
-
- if (!cb->m_hasVMT || g_blockEventsOnDrag)
- return;
-
- if (cb->m_blockEvent) return;
-
- // Generate a wx event.
- wxCommandEvent event(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, cb->GetId());
- event.SetInt(cb->GetValue());
- event.SetEventObject(cb);
- cb->GetEventHandler()->ProcessEvent(event);
+ if (g_blockEventsOnDrag)
+ return;
+
+ // Generate a wx event.
+ wxCommandEvent event(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, cb->GetId());
+ event.SetInt(cb->GetValue());
+ event.SetEventObject(cb);
+ cb->HandleWindowEvent(event);
+}
+}
+
+wxDEFINE_EVENT( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEvent );
+
+// ------------------------------------------------------------------------
+// wxBitmapToggleButton
+// ------------------------------------------------------------------------
+
+IMPLEMENT_DYNAMIC_CLASS(wxBitmapToggleButton, wxToggleButton)
+
+bool wxBitmapToggleButton::Create(wxWindow *parent, wxWindowID id,
+ const wxBitmap &bitmap, const wxPoint &pos,
+ const wxSize &size, long style,
+ const wxValidator& validator,
+ const wxString &name)
+{
+ if ( !wxToggleButton::Create(parent, id, wxEmptyString, pos, size, style | wxBU_NOTEXT | wxBU_EXACTFIT,
+ validator, name) )
+ return false;
+
+ if ( bitmap.IsOk() )
+ {
+ SetBitmapLabel(bitmap);
+
+ // we need to adjust the size after setting the bitmap as it may be too
+ // big for the default button size
+ SetInitialSize(size);
+ }
+
+ return true;