git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40818
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
virtual GtkWidget* GetConnectWidget();
void ConnectWidget( GtkWidget *widget );
virtual GtkWidget* GetConnectWidget();
void ConnectWidget( GtkWidget *widget );
- // Called from several event handlers
- bool GTKCallbackCommonPrologue(struct _GdkEventAny *event) const;
+ // Called from several event handlers, if it returns true or false, the
+ // same value should be immediately returned by the handler without doing
+ // anything else. If it returns -1, the handler should continue as usual
+ int GTKCallbackCommonPrologue(struct _GdkEventAny *event) const;
protected:
// Override GTKWidgetNeedsMnemonic and return true if your
protected:
// Override GTKWidgetNeedsMnemonic and return true if your
// common event handlers helpers
// ----------------------------------------------------------------------------
// common event handlers helpers
// ----------------------------------------------------------------------------
-bool wxWindowGTK::GTKCallbackCommonPrologue(GdkEventAny *event) const
+int wxWindowGTK::GTKCallbackCommonPrologue(GdkEventAny *event) const
wxapp_install_idle_handler();
if (!m_hasVMT)
wxapp_install_idle_handler();
if (!m_hasVMT)
if (g_blockEventsOnScroll)
if (g_blockEventsOnScroll)
if (!GTKIsOwnWindow(event->window))
if (!GTKIsOwnWindow(event->window))
}
// overloads for all GDK event types we use here: we need to have this as
// GdkEventXXX can't be implicitly cast to GdkEventAny even if it, in fact,
// derives from it in the sense that the structs have the same layout
#define wxDEFINE_COMMON_PROLOGUE_OVERLOAD(T) \
}
// overloads for all GDK event types we use here: we need to have this as
// GdkEventXXX can't be implicitly cast to GdkEventAny even if it, in fact,
// derives from it in the sense that the structs have the same layout
#define wxDEFINE_COMMON_PROLOGUE_OVERLOAD(T) \
- static bool wxGtkCallbackCommonPrologue(T *event, wxWindowGTK *win) \
+ static int wxGtkCallbackCommonPrologue(T *event, wxWindowGTK *win) \
{ \
return win->GTKCallbackCommonPrologue((GdkEventAny *)event); \
}
{ \
return win->GTKCallbackCommonPrologue((GdkEventAny *)event); \
}
#undef wxDEFINE_COMMON_PROLOGUE_OVERLOAD
#undef wxDEFINE_COMMON_PROLOGUE_OVERLOAD
+#define wxCOMMON_CALLBACK_PROLOGUE(event, win) \
+ const int rc = wxGtkCallbackCommonPrologue(event, win); \
+ if ( rc != -1 ) \
+ return rc
+
// send the wxChildFocusEvent and wxFocusEvent, common code of
// gtk_window_focus_in_callback() and SetFocus()
static bool DoSendFocusEvents(wxWindow *win)
// send the wxChildFocusEvent and wxFocusEvent, common code of
// gtk_window_focus_in_callback() and SetFocus()
static bool DoSendFocusEvents(wxWindow *win)
GdkEventButton *gdk_event,
wxWindowGTK *win )
{
GdkEventButton *gdk_event,
wxWindowGTK *win )
{
- if ( !wxGtkCallbackCommonPrologue(gdk_event, win) )
- return FALSE;
+ wxCOMMON_CALLBACK_PROLOGUE(gdk_event, win);
if (win->m_wxwindow && (g_focusWindow != win) && win->AcceptsFocus())
{
if (win->m_wxwindow && (g_focusWindow != win) && win->AcceptsFocus())
{
GdkEventButton *gdk_event,
wxWindowGTK *win )
{
GdkEventButton *gdk_event,
wxWindowGTK *win )
{
- if ( !wxGtkCallbackCommonPrologue(gdk_event, win) )
- return FALSE;
+ wxCOMMON_CALLBACK_PROLOGUE(gdk_event, win);
wxEventType event_type = wxEVT_NULL;
wxEventType event_type = wxEVT_NULL;
GdkEventMotion *gdk_event,
wxWindowGTK *win )
{
GdkEventMotion *gdk_event,
wxWindowGTK *win )
{
- if ( !wxGtkCallbackCommonPrologue(gdk_event, win) )
- return FALSE;
+ wxCOMMON_CALLBACK_PROLOGUE(gdk_event, win);
if (gdk_event->is_hint)
{
if (gdk_event->is_hint)
{
GdkEventCrossing *gdk_event,
wxWindowGTK *win )
{
GdkEventCrossing *gdk_event,
wxWindowGTK *win )
{
- if ( !wxGtkCallbackCommonPrologue(gdk_event, win) )
- return FALSE;
+ wxCOMMON_CALLBACK_PROLOGUE(gdk_event, win);
// Event was emitted after a grab
if (gdk_event->mode != GDK_CROSSING_NORMAL) return FALSE;
// Event was emitted after a grab
if (gdk_event->mode != GDK_CROSSING_NORMAL) return FALSE;
GdkEventCrossing *gdk_event,
wxWindowGTK *win )
{
GdkEventCrossing *gdk_event,
wxWindowGTK *win )
{
- if ( !wxGtkCallbackCommonPrologue(gdk_event, win) )
- return FALSE;
+ wxCOMMON_CALLBACK_PROLOGUE(gdk_event, win);
// Event was emitted after an ungrab
if (gdk_event->mode != GDK_CROSSING_NORMAL) return FALSE;
// Event was emitted after an ungrab
if (gdk_event->mode != GDK_CROSSING_NORMAL) return FALSE;