+ else // no valid bitmap
+ {
+ if ( m_bitmaps[which].IsOk() )
+ {
+ // we don't need to be notified about the button pressed
+ // state changes any more
+ g_signal_handlers_disconnect_by_func
+ (
+ m_widget,
+ (gpointer)wxgtk_button_press_callback,
+ this
+ );
+
+ g_signal_handlers_disconnect_by_func
+ (
+ m_widget,
+ (gpointer)wxgtk_button_released_callback,
+ this
+ );
+
+ // also make sure we don't remain stuck in pressed state
+ if ( m_isPressed )
+ {
+ m_isPressed = false;
+ GTKUpdateBitmap();
+ }
+ }
+ }
+ break;
+
+ case State_Current:
+ // the logic here is the same as above for State_Pressed: we need
+ // to connect the handlers if we must be notified about the changes
+ // in the button current state and we disconnect them when/if we
+ // don't need them any more
+ if ( bitmap.IsOk() )
+ {
+ if ( !m_bitmaps[which].IsOk() )
+ {
+ g_signal_connect
+ (
+ m_widget,
+ "enter",
+ G_CALLBACK(wxgtk_button_enter_callback),
+ this
+ );
+
+ g_signal_connect
+ (
+ m_widget,
+ "leave",
+ G_CALLBACK(wxgtk_button_leave_callback),
+ this
+ );
+ }
+ }
+ else // no valid bitmap
+ {
+ if ( m_bitmaps[which].IsOk() )
+ {
+ g_signal_handlers_disconnect_by_func
+ (
+ m_widget,
+ (gpointer)wxgtk_button_enter_callback,
+ this
+ );
+
+ g_signal_handlers_disconnect_by_func
+ (
+ m_widget,
+ (gpointer)wxgtk_button_leave_callback,
+ this
+ );
+
+ if ( m_isCurrent )
+ {
+ m_isCurrent = false;
+ GTKUpdateBitmap();
+ }
+ }
+ }
+ break;
+
+ case State_Focused:
+ if ( bitmap.IsOk() )
+ {
+ Connect(wxEVT_SET_FOCUS,
+ wxFocusEventHandler(wxButton::GTKOnFocus));
+ Connect(wxEVT_KILL_FOCUS,
+ wxFocusEventHandler(wxButton::GTKOnFocus));
+ }
+ else // no valid focused bitmap
+ {
+ Disconnect(wxEVT_SET_FOCUS,
+ wxFocusEventHandler(wxButton::GTKOnFocus));
+ Disconnect(wxEVT_KILL_FOCUS,
+ wxFocusEventHandler(wxButton::GTKOnFocus));
+ }
+ break;
+
+ default:
+ // no callbacks to connect/disconnect
+ ;