to the whole list box.
wxRadioButton doesn't emit any event when unpressed.
Similar correction to wxRadioBox and wxToggleButton.
Upported change to wxMenuEvent so that the id is
set in the constructor. Otherwise the EVT_MENU
macro is pretty useless. Already in 2.2.8.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12358
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
13 files changed:
public:
wxMenuEvent(wxEventType type = wxEVT_NULL, int id = 0)
public:
wxMenuEvent(wxEventType type = wxEVT_NULL, int id = 0)
- { m_eventType = type; m_menuId = id; }
+ { m_eventType = type; m_menuId = id; m_id = id; }
int GetMenuId() const { return m_menuId; }
int GetMenuId() const { return m_menuId; }
bool m_resizing:1;
bool m_isStaticBox:1; // faster than IS_KIND_OF
bool m_isRadioButton:1; // faster than IS_KIND_OF
bool m_resizing:1;
bool m_isStaticBox:1; // faster than IS_KIND_OF
bool m_isRadioButton:1; // faster than IS_KIND_OF
+ bool m_isListBox:1; // faster than IS_KIND_OF
bool m_isFrame:1; // faster than IS_KIND_OF
bool m_acceptsFocus:1; // not wxStaticBox, not wxStaticBitmap etc.
bool m_isScrolling;
bool m_isFrame:1; // faster than IS_KIND_OF
bool m_acceptsFocus:1; // not wxStaticBox, not wxStaticBitmap etc.
bool m_isScrolling;
bool m_resizing:1;
bool m_isStaticBox:1; // faster than IS_KIND_OF
bool m_isRadioButton:1; // faster than IS_KIND_OF
bool m_resizing:1;
bool m_isStaticBox:1; // faster than IS_KIND_OF
bool m_isRadioButton:1; // faster than IS_KIND_OF
+ bool m_isListBox:1; // faster than IS_KIND_OF
bool m_isFrame:1; // faster than IS_KIND_OF
bool m_acceptsFocus:1; // not wxStaticBox, not wxStaticBitmap etc.
bool m_isScrolling;
bool m_isFrame:1; // faster than IS_KIND_OF
bool m_acceptsFocus:1; // not wxStaticBox, not wxStaticBitmap etc.
bool m_isScrolling;
{
m_needParent = TRUE;
m_acceptsFocus = TRUE;
{
m_needParent = TRUE;
m_acceptsFocus = TRUE;
m_prevSelection = 0; // or -1 ??
if (!PreCreation( parent, pos, size ) ||
m_prevSelection = 0; // or -1 ??
if (!PreCreation( parent, pos, size ) ||
// "clicked"
//-----------------------------------------------------------------------------
// "clicked"
//-----------------------------------------------------------------------------
-static void gtk_radiobutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxRadioBox *rb )
+static void gtk_radiobutton_clicked_callback( GtkToggleButton *button, wxRadioBox *rb )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!rb->m_hasVMT) return;
if (g_blockEventsOnDrag) return;
{
if (g_isIdle) wxapp_install_idle_handler();
if (!rb->m_hasVMT) return;
if (g_blockEventsOnDrag) return;
- if (rb->m_alreadySent)
- {
- rb->m_alreadySent = FALSE;
- return;
- }
-
- rb->m_alreadySent = TRUE;
+ if (!button->active) return;
wxCommandEvent event( wxEVT_COMMAND_RADIOBOX_SELECTED, rb->GetId() );
event.SetInt( rb->GetSelection() );
wxCommandEvent event( wxEVT_COMMAND_RADIOBOX_SELECTED, rb->GetId() );
event.SetInt( rb->GetSelection() );
void wxRadioBox::Init()
{
void wxRadioBox::Init()
{
m_needParent = TRUE;
m_acceptsFocus = TRUE;
m_needParent = TRUE;
m_acceptsFocus = TRUE;
!CreateBase( parent, id, pos, size, style, validator, name ))
{
wxFAIL_MSG( wxT("wxRadioBox creation failed") );
!CreateBase( parent, id, pos, size, style, validator, name ))
{
wxFAIL_MSG( wxT("wxRadioBox creation failed") );
}
m_widget = gtk_frame_new( title.mbc_str() );
}
m_widget = gtk_frame_new( title.mbc_str() );
- gtk_toggle_button_set_state( button, 1 );
+ gtk_toggle_button_set_active( button, 1 );
// Author: Robert Roebling
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
// Author: Robert Roebling
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
static
//-----------------------------------------------------------------------------
static
-void gtk_radiobutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxRadioButton *rb )
+void gtk_radiobutton_clicked_callback( GtkToggleButton *button, wxRadioButton *rb )
{
if (g_isIdle) wxapp_install_idle_handler();
{
if (g_isIdle) wxapp_install_idle_handler();
if (g_blockEventsOnDrag) return;
if (g_blockEventsOnDrag) return;
+ if (!button->active) 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 );
!CreateBase( parent, id, pos, size, style, validator, name ))
{
wxFAIL_MSG( wxT("wxRadioButton creation failed") );
!CreateBase( parent, id, pos, size, style, validator, name ))
{
wxFAIL_MSG( wxT("wxRadioButton creation failed") );
}
if (HasFlag(wxRB_GROUP))
}
if (HasFlag(wxRB_GROUP))
wxRadioButton *chief = (wxRadioButton*) NULL;
wxWindowList::Node *node = parent->GetChildren().GetLast();
while (node)
wxRadioButton *chief = (wxRadioButton*) NULL;
wxWindowList::Node *node = parent->GetChildren().GetLast();
while (node)
- {
- wxWindow *child = node->GetData();
- if (child->m_isRadioButton)
- {
- chief = (wxRadioButton*) child;
- if (child->HasFlag(wxRB_GROUP)) break;
- }
- node = node->GetPrevious();
+ {
+ wxWindow *child = node->GetData();
+ if (child->m_isRadioButton)
+ {
+ chief = (wxRadioButton*) child;
+ if (child->HasFlag(wxRB_GROUP)) break;
+ }
+ node = node->GetPrevious();
/* we are part of the group started by chief */
/* we are part of the group started by chief */
- m_radioButtonGroup = gtk_radio_button_group( GTK_RADIO_BUTTON(chief->m_widget) );
- }
- else
- {
+ m_radioButtonGroup = gtk_radio_button_group( GTK_RADIO_BUTTON(chief->m_widget) );
+ }
+ else
+ {
/* start a new group */
m_radioButtonGroup = (GSList*) NULL;
/* start a new group */
m_radioButtonGroup = (GSList*) NULL;
}
m_widget = gtk_radio_button_new_with_label( m_radioButtonGroup, label.mbc_str() );
}
m_widget = gtk_radio_button_new_with_label( m_radioButtonGroup, label.mbc_str() );
- gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_widget), TRUE );
+ gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(m_widget), TRUE );
if (GTK_TOGGLE_BUTTON(m_widget)->event_window && cursor.Ok())
{
/* I now set the cursor the anew in every OnInternalIdle call
if (GTK_TOGGLE_BUTTON(m_widget)->event_window && cursor.Ok())
{
/* I now set the cursor the anew in every OnInternalIdle call
- as setting the cursor in a parent window also effects the
- windows above so that checking for the current cursor is
- not possible. */
-
- gdk_window_set_cursor( GTK_TOGGLE_BUTTON(m_widget)->event_window, cursor.GetCursor() );
+ as setting the cursor in a parent window also effects the
+ windows above so that checking for the current cursor is
+ not possible. */
+
+ gdk_window_set_cursor( GTK_TOGGLE_BUTTON(m_widget)->event_window, cursor.GetCursor() );
GTK_SIGNAL_FUNC(gtk_togglebutton_clicked_callback),
(gpointer *)this);
GTK_SIGNAL_FUNC(gtk_togglebutton_clicked_callback),
(gpointer *)this);
- gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(m_widget), state);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_widget), state);
gtk_signal_connect(GTK_OBJECT(m_widget), "clicked",
GTK_SIGNAL_FUNC(gtk_togglebutton_clicked_callback),
gtk_signal_connect(GTK_OBJECT(m_widget), "clicked",
GTK_SIGNAL_FUNC(gtk_togglebutton_clicked_callback),
event.m_y = (wxCoord)gdk_event->y;
AdjustEventButtonState(event);
event.m_y = (wxCoord)gdk_event->y;
AdjustEventButtonState(event);
+
+ // wxListBox actually get mouse events from the item
+
+ if (win->m_isListBox)
+ {
+ event.m_x += widget->allocation.x;
+ event.m_y += widget->allocation.y;
+ }
// Some control don't have their own X window and thus cannot get
// any events.
// Some control don't have their own X window and thus cannot get
// any events.
AdjustEventButtonState(event);
AdjustEventButtonState(event);
+ // wxListBox actually get mouse events from the item
+
+ if (win->m_isListBox)
+ {
+ event.m_x += widget->allocation.x;
+ event.m_y += widget->allocation.y;
+ }
+
// Some control don't have their own X window and thus cannot get
// any events.
// Some control don't have their own X window and thus cannot get
// any events.
m_isStaticBox = FALSE;
m_isRadioButton = FALSE;
m_isStaticBox = FALSE;
m_isRadioButton = FALSE;
m_isFrame = FALSE;
m_acceptsFocus = FALSE;
m_isFrame = FALSE;
m_acceptsFocus = FALSE;
{
m_needParent = TRUE;
m_acceptsFocus = TRUE;
{
m_needParent = TRUE;
m_acceptsFocus = TRUE;
m_prevSelection = 0; // or -1 ??
if (!PreCreation( parent, pos, size ) ||
m_prevSelection = 0; // or -1 ??
if (!PreCreation( parent, pos, size ) ||
// "clicked"
//-----------------------------------------------------------------------------
// "clicked"
//-----------------------------------------------------------------------------
-static void gtk_radiobutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxRadioBox *rb )
+static void gtk_radiobutton_clicked_callback( GtkToggleButton *button, wxRadioBox *rb )
{
if (g_isIdle) wxapp_install_idle_handler();
if (!rb->m_hasVMT) return;
if (g_blockEventsOnDrag) return;
{
if (g_isIdle) wxapp_install_idle_handler();
if (!rb->m_hasVMT) return;
if (g_blockEventsOnDrag) return;
- if (rb->m_alreadySent)
- {
- rb->m_alreadySent = FALSE;
- return;
- }
-
- rb->m_alreadySent = TRUE;
+ if (!button->active) return;
wxCommandEvent event( wxEVT_COMMAND_RADIOBOX_SELECTED, rb->GetId() );
event.SetInt( rb->GetSelection() );
wxCommandEvent event( wxEVT_COMMAND_RADIOBOX_SELECTED, rb->GetId() );
event.SetInt( rb->GetSelection() );
void wxRadioBox::Init()
{
void wxRadioBox::Init()
{
m_needParent = TRUE;
m_acceptsFocus = TRUE;
m_needParent = TRUE;
m_acceptsFocus = TRUE;
!CreateBase( parent, id, pos, size, style, validator, name ))
{
wxFAIL_MSG( wxT("wxRadioBox creation failed") );
!CreateBase( parent, id, pos, size, style, validator, name ))
{
wxFAIL_MSG( wxT("wxRadioBox creation failed") );
}
m_widget = gtk_frame_new( title.mbc_str() );
}
m_widget = gtk_frame_new( title.mbc_str() );
- gtk_toggle_button_set_state( button, 1 );
+ gtk_toggle_button_set_active( button, 1 );
// Author: Robert Roebling
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
// Author: Robert Roebling
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
static
//-----------------------------------------------------------------------------
static
-void gtk_radiobutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxRadioButton *rb )
+void gtk_radiobutton_clicked_callback( GtkToggleButton *button, wxRadioButton *rb )
{
if (g_isIdle) wxapp_install_idle_handler();
{
if (g_isIdle) wxapp_install_idle_handler();
if (g_blockEventsOnDrag) return;
if (g_blockEventsOnDrag) return;
+ if (!button->active) 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 );
!CreateBase( parent, id, pos, size, style, validator, name ))
{
wxFAIL_MSG( wxT("wxRadioButton creation failed") );
!CreateBase( parent, id, pos, size, style, validator, name ))
{
wxFAIL_MSG( wxT("wxRadioButton creation failed") );
}
if (HasFlag(wxRB_GROUP))
}
if (HasFlag(wxRB_GROUP))
wxRadioButton *chief = (wxRadioButton*) NULL;
wxWindowList::Node *node = parent->GetChildren().GetLast();
while (node)
wxRadioButton *chief = (wxRadioButton*) NULL;
wxWindowList::Node *node = parent->GetChildren().GetLast();
while (node)
- {
- wxWindow *child = node->GetData();
- if (child->m_isRadioButton)
- {
- chief = (wxRadioButton*) child;
- if (child->HasFlag(wxRB_GROUP)) break;
- }
- node = node->GetPrevious();
+ {
+ wxWindow *child = node->GetData();
+ if (child->m_isRadioButton)
+ {
+ chief = (wxRadioButton*) child;
+ if (child->HasFlag(wxRB_GROUP)) break;
+ }
+ node = node->GetPrevious();
/* we are part of the group started by chief */
/* we are part of the group started by chief */
- m_radioButtonGroup = gtk_radio_button_group( GTK_RADIO_BUTTON(chief->m_widget) );
- }
- else
- {
+ m_radioButtonGroup = gtk_radio_button_group( GTK_RADIO_BUTTON(chief->m_widget) );
+ }
+ else
+ {
/* start a new group */
m_radioButtonGroup = (GSList*) NULL;
/* start a new group */
m_radioButtonGroup = (GSList*) NULL;
}
m_widget = gtk_radio_button_new_with_label( m_radioButtonGroup, label.mbc_str() );
}
m_widget = gtk_radio_button_new_with_label( m_radioButtonGroup, label.mbc_str() );
- gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_widget), TRUE );
+ gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(m_widget), TRUE );
if (GTK_TOGGLE_BUTTON(m_widget)->event_window && cursor.Ok())
{
/* I now set the cursor the anew in every OnInternalIdle call
if (GTK_TOGGLE_BUTTON(m_widget)->event_window && cursor.Ok())
{
/* I now set the cursor the anew in every OnInternalIdle call
- as setting the cursor in a parent window also effects the
- windows above so that checking for the current cursor is
- not possible. */
-
- gdk_window_set_cursor( GTK_TOGGLE_BUTTON(m_widget)->event_window, cursor.GetCursor() );
+ as setting the cursor in a parent window also effects the
+ windows above so that checking for the current cursor is
+ not possible. */
+
+ gdk_window_set_cursor( GTK_TOGGLE_BUTTON(m_widget)->event_window, cursor.GetCursor() );
GTK_SIGNAL_FUNC(gtk_togglebutton_clicked_callback),
(gpointer *)this);
GTK_SIGNAL_FUNC(gtk_togglebutton_clicked_callback),
(gpointer *)this);
- gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(m_widget), state);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_widget), state);
gtk_signal_connect(GTK_OBJECT(m_widget), "clicked",
GTK_SIGNAL_FUNC(gtk_togglebutton_clicked_callback),
gtk_signal_connect(GTK_OBJECT(m_widget), "clicked",
GTK_SIGNAL_FUNC(gtk_togglebutton_clicked_callback),
event.m_y = (wxCoord)gdk_event->y;
AdjustEventButtonState(event);
event.m_y = (wxCoord)gdk_event->y;
AdjustEventButtonState(event);
+
+ // wxListBox actually get mouse events from the item
+
+ if (win->m_isListBox)
+ {
+ event.m_x += widget->allocation.x;
+ event.m_y += widget->allocation.y;
+ }
// Some control don't have their own X window and thus cannot get
// any events.
// Some control don't have their own X window and thus cannot get
// any events.
AdjustEventButtonState(event);
AdjustEventButtonState(event);
+ // wxListBox actually get mouse events from the item
+
+ if (win->m_isListBox)
+ {
+ event.m_x += widget->allocation.x;
+ event.m_y += widget->allocation.y;
+ }
+
// Some control don't have their own X window and thus cannot get
// any events.
// Some control don't have their own X window and thus cannot get
// any events.
m_isStaticBox = FALSE;
m_isRadioButton = FALSE;
m_isStaticBox = FALSE;
m_isRadioButton = FALSE;
m_isFrame = FALSE;
m_acceptsFocus = FALSE;
m_isFrame = FALSE;
m_acceptsFocus = FALSE;