summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
194323c)
Replace m_blockEvent with g_signal_handlers_block().
Remove wxRadioButton::DoGetBestSize(), it just calls the base.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51427
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
virtual void SetLabel(const wxString& label);
virtual void SetValue(bool val);
virtual bool GetValue() const;
virtual void SetLabel(const wxString& label);
virtual void SetValue(bool val);
virtual bool GetValue() const;
- virtual bool Enable( bool enable = TRUE );
+ virtual bool Enable( bool enable = true );
static wxVisualAttributes
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
static wxVisualAttributes
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
- // implementation
-
- virtual bool IsRadioButton() const { return TRUE; }
-
- bool m_blockEvent;
-
protected:
virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
protected:
virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
- virtual wxSize DoGetBestSize() const;
virtual void DoApplyWidgetStyle(GtkRcStyle *style);
virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
virtual void DoApplyWidgetStyle(GtkRcStyle *style);
virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
DECLARE_DYNAMIC_CLASS(wxRadioButton)
};
DECLARE_DYNAMIC_CLASS(wxRadioButton)
};
// is this window transparent for the mouse events (as wxStaticBox is)?
virtual bool IsTransparentForMouse() const { return false; }
// is this window transparent for the mouse events (as wxStaticBox is)?
virtual bool IsTransparentForMouse() const { return false; }
- // is this a radiobutton (used by radiobutton code itself only)?
- virtual bool IsRadioButton() const { return false; }
-
// Common scroll event handling code for wxWindow and wxScrollBar
wxEventType GetScrollEventType(GtkRange* range);
// Common scroll event handling code for wxWindow and wxScrollBar
wxEventType GetScrollEventType(GtkRange* range);
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
if (!button->active) return;
if (!button->active) return;
- if (rb->m_blockEvent) return;
-
wxCommandEvent event( wxEVT_COMMAND_RADIOBUTTON_SELECTED, rb->GetId());
event.SetInt( rb->GetValue() );
event.SetEventObject( rb );
wxCommandEvent event( wxEVT_COMMAND_RADIOBUTTON_SELECTED, rb->GetId());
event.SetInt( rb->GetValue() );
event.SetEventObject( rb );
const wxValidator& validator,
const wxString& name )
{
const wxValidator& validator,
const wxString& name )
{
- m_blockEvent = false;
-
if (!PreCreation( parent, pos, size ) ||
!CreateBase( parent, id, pos, size, style, validator, name ))
{
if (!PreCreation( parent, pos, size ) ||
!CreateBase( parent, id, pos, size, style, validator, name ))
{
if (!HasFlag(wxRB_GROUP))
{
// search backward for last group start
if (!HasFlag(wxRB_GROUP))
{
// search backward for last group start
- wxRadioButton *chief = (wxRadioButton*) NULL;
wxWindowList::compatibility_iterator node = parent->GetChildren().GetLast();
wxWindowList::compatibility_iterator node = parent->GetChildren().GetLast();
+ for (; node; node = node->GetPrevious())
{
wxWindow *child = node->GetData();
{
wxWindow *child = node->GetData();
- if (child->IsRadioButton())
+ if (child->HasFlag(wxRB_GROUP) && wxIsKindOf(child, wxRadioButton))
- chief = (wxRadioButton*) child;
- if (child->HasFlag(wxRB_GROUP))
- break;
+ radioButtonGroup = gtk_radio_button_get_group(
+ GTK_RADIO_BUTTON(child->m_widget));
+ break;
- node = node->GetPrevious();
- }
- if (chief)
- {
- // we are part of the group started by chief
- radioButtonGroup = gtk_radio_button_get_group( GTK_RADIO_BUTTON(chief->m_widget) );
}
void wxRadioButton::SetLabel( const wxString& label )
}
void wxRadioButton::SetLabel( const wxString& label )
if (val == GetValue())
return;
if (val == GetValue())
return;
+ g_signal_handlers_block_by_func(
+ m_widget, (void*)gtk_radiobutton_clicked_callback, this);
// as FALSE. Failing silently is probably TRTTD here.
}
// as FALSE. Failing silently is probably TRTTD here.
}
+ g_signal_handlers_unblock_by_func(
+ m_widget, (void*)gtk_radiobutton_clicked_callback, this);
}
bool wxRadioButton::GetValue() const
{
}
bool wxRadioButton::GetValue() const
{
- wxCHECK_MSG( m_widget != NULL, FALSE, wxT("invalid radiobutton") );
+ wxCHECK_MSG( m_widget != NULL, false, wxT("invalid radiobutton") );
return GTK_TOGGLE_BUTTON(m_widget)->active;
}
return GTK_TOGGLE_BUTTON(m_widget)->active;
}
bool wxRadioButton::Enable( bool enable )
{
if ( !wxControl::Enable( enable ) )
bool wxRadioButton::Enable( bool enable )
{
if ( !wxControl::Enable( enable ) )
gtk_widget_set_sensitive(GTK_BIN(m_widget)->child, enable);
gtk_widget_set_sensitive(GTK_BIN(m_widget)->child, enable);
}
void wxRadioButton::DoApplyWidgetStyle(GtkRcStyle *style)
}
void wxRadioButton::DoApplyWidgetStyle(GtkRcStyle *style)
return GTK_BUTTON(m_widget)->event_window;
}
return GTK_BUTTON(m_widget)->event_window;
}
-wxSize wxRadioButton::DoGetBestSize() const
-{
- return wxControl::DoGetBestSize();
-}
-
// static
wxVisualAttributes
wxRadioButton::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
// static
wxVisualAttributes
wxRadioButton::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))