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; }
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_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;
{
m_needParent = TRUE;
m_acceptsFocus = TRUE;
+ m_isListBox = TRUE;
m_prevSelection = 0; // or -1 ??
if (!PreCreation( parent, pos, size ) ||
// "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 (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() );
void wxRadioBox::Init()
{
- m_alreadySent = FALSE;
m_needParent = TRUE;
m_acceptsFocus = TRUE;
!CreateBase( parent, id, pos, size, style, validator, name ))
{
wxFAIL_MSG( wxT("wxRadioBox creation failed") );
- return FALSE;
+ return FALSE;
}
m_widget = gtk_frame_new( title.mbc_str() );
GtkDisableEvents();
- gtk_toggle_button_set_state( button, 1 );
+ gtk_toggle_button_set_active( button, 1 );
GtkEnableEvents();
}
// Author: Robert Roebling
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
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_blockEventsOnDrag) return;
+ if (!button->active) return;
+
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") );
- return FALSE;
+ return FALSE;
}
if (HasFlag(wxRB_GROUP))
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();
}
- if (chief)
- {
+ if (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;
- }
+ }
}
m_widget = gtk_radio_button_new_with_label( m_radioButtonGroup, label.mbc_str() );
if (val)
{
- gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_widget), TRUE );
+ gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(m_widget), TRUE );
}
else
{
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() );
}
UpdateWindowUI();
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),
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.
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.
m_isStaticBox = FALSE;
m_isRadioButton = FALSE;
+ m_isListBox = FALSE;
m_isFrame = FALSE;
m_acceptsFocus = FALSE;
{
m_needParent = TRUE;
m_acceptsFocus = TRUE;
+ m_isListBox = TRUE;
m_prevSelection = 0; // or -1 ??
if (!PreCreation( parent, pos, size ) ||
// "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 (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() );
void wxRadioBox::Init()
{
- m_alreadySent = FALSE;
m_needParent = TRUE;
m_acceptsFocus = TRUE;
!CreateBase( parent, id, pos, size, style, validator, name ))
{
wxFAIL_MSG( wxT("wxRadioBox creation failed") );
- return FALSE;
+ return FALSE;
}
m_widget = gtk_frame_new( title.mbc_str() );
GtkDisableEvents();
- gtk_toggle_button_set_state( button, 1 );
+ gtk_toggle_button_set_active( button, 1 );
GtkEnableEvents();
}
// Author: Robert Roebling
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
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_blockEventsOnDrag) return;
+ if (!button->active) return;
+
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") );
- return FALSE;
+ return FALSE;
}
if (HasFlag(wxRB_GROUP))
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();
}
- if (chief)
- {
+ if (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;
- }
+ }
}
m_widget = gtk_radio_button_new_with_label( m_radioButtonGroup, label.mbc_str() );
if (val)
{
- gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_widget), TRUE );
+ gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(m_widget), TRUE );
}
else
{
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() );
}
UpdateWindowUI();
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),
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.
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.
m_isStaticBox = FALSE;
m_isRadioButton = FALSE;
+ m_isListBox = FALSE;
m_isFrame = FALSE;
m_acceptsFocus = FALSE;