Correxted myfixed widget to prevent warnings from GTK
Changed listbox dclick emission git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2495 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
0a7723227a
commit
7a30ee8f2c
@ -64,6 +64,53 @@ extern bool g_isIdle;
|
||||
extern bool g_blockEventsOnDrag;
|
||||
extern bool g_blockEventsOnScroll;
|
||||
|
||||
static bool g_hasDoubleClicked = FALSE;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// "button_release_event"
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/* we would normally emit a wxEVT_COMMAND_LISTBOX_DOUBLECLICKED event once
|
||||
a GDK_2BUTTON_PRESS occurs, but this has the particular problem of the
|
||||
listbox keeping the focus until it receives a GDK_BUTTON_RELEASE event.
|
||||
this can lead to race conditions so that we emit the dclick event
|
||||
after the GDK_BUTTON_RELEASE event after the GDK_2BUTTON_PRESS event */
|
||||
|
||||
static gint
|
||||
gtk_listbox_button_release_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxListBox *listbox )
|
||||
{
|
||||
if (g_isIdle) wxapp_install_idle_handler();
|
||||
|
||||
if (g_blockEventsOnDrag) return FALSE;
|
||||
if (g_blockEventsOnScroll) return FALSE;
|
||||
|
||||
if (!listbox->m_hasVMT) return FALSE;
|
||||
|
||||
if (!g_hasDoubleClicked) return FALSE;
|
||||
|
||||
wxCommandEvent event( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, listbox->GetId() );
|
||||
event.SetEventObject( listbox );
|
||||
|
||||
wxArrayInt aSelections;
|
||||
int count = listbox->GetSelections(aSelections);
|
||||
if ( count > 0 )
|
||||
{
|
||||
event.m_commandInt = aSelections[0] ;
|
||||
event.m_clientData = listbox->GetClientData( event.m_commandInt );
|
||||
wxString str(listbox->GetString(event.m_commandInt));
|
||||
if (!str.IsEmpty()) event.m_commandString = str;
|
||||
}
|
||||
else
|
||||
{
|
||||
event.m_commandInt = -1 ;
|
||||
event.m_commandString.Empty();
|
||||
}
|
||||
|
||||
listbox->GetEventHandler()->ProcessEvent( event );
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// "button_press_event"
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -91,30 +138,9 @@ gtk_listbox_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event,
|
||||
event.SetInt( sel );
|
||||
listbox->GetEventHandler()->ProcessEvent( event );
|
||||
}
|
||||
|
||||
if (gdk_event->type == GDK_2BUTTON_PRESS)
|
||||
{
|
||||
wxCommandEvent event( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, listbox->GetId() );
|
||||
event.SetEventObject( listbox );
|
||||
|
||||
wxArrayInt aSelections;
|
||||
int count = listbox->GetSelections(aSelections);
|
||||
if ( count > 0 )
|
||||
{
|
||||
event.m_commandInt = aSelections[0] ;
|
||||
event.m_clientData = listbox->GetClientData( event.m_commandInt );
|
||||
wxString str(listbox->GetString(event.m_commandInt));
|
||||
if (!str.IsEmpty()) event.m_commandString = str;
|
||||
}
|
||||
else
|
||||
{
|
||||
event.m_commandInt = -1 ;
|
||||
event.m_commandString.Empty();
|
||||
}
|
||||
|
||||
listbox->GetEventHandler()->ProcessEvent( event );
|
||||
|
||||
}
|
||||
|
||||
/* emit wxEVT_COMMAND_LISTBOX_DOUBLECLICKED later */
|
||||
g_hasDoubleClicked = (gdk_event->type == GDK_2BUTTON_PRESS);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@ -269,6 +295,11 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
|
||||
(GtkSignalFunc)gtk_listbox_button_press_callback,
|
||||
(gpointer) this );
|
||||
|
||||
gtk_signal_connect_after( GTK_OBJECT(list_item),
|
||||
"button_release_event",
|
||||
(GtkSignalFunc)gtk_listbox_button_release_callback,
|
||||
(gpointer) this );
|
||||
|
||||
if (m_hasCheckBoxes)
|
||||
{
|
||||
gtk_signal_connect( GTK_OBJECT(list_item),
|
||||
|
@ -228,7 +228,7 @@ gtk_myfixed_put (GtkMyFixed *myfixed,
|
||||
if (GTK_WIDGET_REALIZED (myfixed) && !GTK_WIDGET_REALIZED (widget))
|
||||
gtk_widget_realize (widget);
|
||||
|
||||
if (GTK_WIDGET_MAPPED (myfixed) && !GTK_WIDGET_MAPPED (widget))
|
||||
if (GTK_WIDGET_MAPPED (myfixed) && !GTK_WIDGET_MAPPED (widget) && GTK_WIDGET_VISIBLE (widget))
|
||||
gtk_widget_map (widget);
|
||||
|
||||
if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (myfixed))
|
||||
|
@ -64,6 +64,53 @@ extern bool g_isIdle;
|
||||
extern bool g_blockEventsOnDrag;
|
||||
extern bool g_blockEventsOnScroll;
|
||||
|
||||
static bool g_hasDoubleClicked = FALSE;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// "button_release_event"
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/* we would normally emit a wxEVT_COMMAND_LISTBOX_DOUBLECLICKED event once
|
||||
a GDK_2BUTTON_PRESS occurs, but this has the particular problem of the
|
||||
listbox keeping the focus until it receives a GDK_BUTTON_RELEASE event.
|
||||
this can lead to race conditions so that we emit the dclick event
|
||||
after the GDK_BUTTON_RELEASE event after the GDK_2BUTTON_PRESS event */
|
||||
|
||||
static gint
|
||||
gtk_listbox_button_release_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxListBox *listbox )
|
||||
{
|
||||
if (g_isIdle) wxapp_install_idle_handler();
|
||||
|
||||
if (g_blockEventsOnDrag) return FALSE;
|
||||
if (g_blockEventsOnScroll) return FALSE;
|
||||
|
||||
if (!listbox->m_hasVMT) return FALSE;
|
||||
|
||||
if (!g_hasDoubleClicked) return FALSE;
|
||||
|
||||
wxCommandEvent event( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, listbox->GetId() );
|
||||
event.SetEventObject( listbox );
|
||||
|
||||
wxArrayInt aSelections;
|
||||
int count = listbox->GetSelections(aSelections);
|
||||
if ( count > 0 )
|
||||
{
|
||||
event.m_commandInt = aSelections[0] ;
|
||||
event.m_clientData = listbox->GetClientData( event.m_commandInt );
|
||||
wxString str(listbox->GetString(event.m_commandInt));
|
||||
if (!str.IsEmpty()) event.m_commandString = str;
|
||||
}
|
||||
else
|
||||
{
|
||||
event.m_commandInt = -1 ;
|
||||
event.m_commandString.Empty();
|
||||
}
|
||||
|
||||
listbox->GetEventHandler()->ProcessEvent( event );
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// "button_press_event"
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -91,30 +138,9 @@ gtk_listbox_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event,
|
||||
event.SetInt( sel );
|
||||
listbox->GetEventHandler()->ProcessEvent( event );
|
||||
}
|
||||
|
||||
if (gdk_event->type == GDK_2BUTTON_PRESS)
|
||||
{
|
||||
wxCommandEvent event( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, listbox->GetId() );
|
||||
event.SetEventObject( listbox );
|
||||
|
||||
wxArrayInt aSelections;
|
||||
int count = listbox->GetSelections(aSelections);
|
||||
if ( count > 0 )
|
||||
{
|
||||
event.m_commandInt = aSelections[0] ;
|
||||
event.m_clientData = listbox->GetClientData( event.m_commandInt );
|
||||
wxString str(listbox->GetString(event.m_commandInt));
|
||||
if (!str.IsEmpty()) event.m_commandString = str;
|
||||
}
|
||||
else
|
||||
{
|
||||
event.m_commandInt = -1 ;
|
||||
event.m_commandString.Empty();
|
||||
}
|
||||
|
||||
listbox->GetEventHandler()->ProcessEvent( event );
|
||||
|
||||
}
|
||||
|
||||
/* emit wxEVT_COMMAND_LISTBOX_DOUBLECLICKED later */
|
||||
g_hasDoubleClicked = (gdk_event->type == GDK_2BUTTON_PRESS);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@ -269,6 +295,11 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
|
||||
(GtkSignalFunc)gtk_listbox_button_press_callback,
|
||||
(gpointer) this );
|
||||
|
||||
gtk_signal_connect_after( GTK_OBJECT(list_item),
|
||||
"button_release_event",
|
||||
(GtkSignalFunc)gtk_listbox_button_release_callback,
|
||||
(gpointer) this );
|
||||
|
||||
if (m_hasCheckBoxes)
|
||||
{
|
||||
gtk_signal_connect( GTK_OBJECT(list_item),
|
||||
|
@ -228,7 +228,7 @@ gtk_myfixed_put (GtkMyFixed *myfixed,
|
||||
if (GTK_WIDGET_REALIZED (myfixed) && !GTK_WIDGET_REALIZED (widget))
|
||||
gtk_widget_realize (widget);
|
||||
|
||||
if (GTK_WIDGET_MAPPED (myfixed) && !GTK_WIDGET_MAPPED (widget))
|
||||
if (GTK_WIDGET_MAPPED (myfixed) && !GTK_WIDGET_MAPPED (widget) && GTK_WIDGET_VISIBLE (widget))
|
||||
gtk_widget_map (widget);
|
||||
|
||||
if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (myfixed))
|
||||
|
Loading…
Reference in New Issue
Block a user