2014-05-06 02:40:18 +00:00
|
|
|
/* GTK - The GIMP Toolkit
|
|
|
|
* Copyright (C) 2012, One Laptop Per Child.
|
|
|
|
* Copyright (C) 2014, Red Hat, Inc.
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
* Author(s): Carlos Garnacho <carlosg@gnome.org>
|
|
|
|
*/
|
|
|
|
#ifndef __GTK_EVENT_CONTROLLER_PRIVATE_H__
|
|
|
|
#define __GTK_EVENT_CONTROLLER_PRIVATE_H__
|
|
|
|
|
|
|
|
#include "gtkeventcontroller.h"
|
|
|
|
|
2020-07-30 17:21:28 +00:00
|
|
|
/* GdkCrossingType:
|
|
|
|
* @GTK_CROSSING_FOCUS: Focus moved from one widget to another
|
|
|
|
* @GTK_CROSSING_ACTIVE: The active window changed (the crossing
|
|
|
|
* events in this case leave from the old active window's focus
|
|
|
|
* location to the new active window's one.
|
|
|
|
* @GTK_CROSSING_POINTER: The pointer moved from one widget to another
|
2022-08-05 14:38:56 +00:00
|
|
|
* @GTK_CROSSING_DROP: An active drag moved from one widget to another
|
2020-07-30 17:21:28 +00:00
|
|
|
*
|
|
|
|
* We emit various kinds of crossing events when the target widget
|
|
|
|
* for keyboard or pointer events changes.
|
|
|
|
*/
|
2020-02-20 22:22:03 +00:00
|
|
|
typedef enum {
|
|
|
|
GTK_CROSSING_FOCUS,
|
2020-07-30 17:21:28 +00:00
|
|
|
GTK_CROSSING_ACTIVE,
|
2020-02-19 03:44:41 +00:00
|
|
|
GTK_CROSSING_POINTER,
|
|
|
|
GTK_CROSSING_DROP
|
2020-02-20 22:22:03 +00:00
|
|
|
} GtkCrossingType;
|
|
|
|
|
2020-07-30 17:21:28 +00:00
|
|
|
/*
|
|
|
|
* GdkCrossingirection:
|
|
|
|
* @GTK_CROSSING_IN: the event is on the downward slope, towards the new target
|
|
|
|
* @GTK_CROSSING_OUT: the event is on the upward slope, away from the old target
|
|
|
|
*/
|
2020-02-20 22:22:03 +00:00
|
|
|
typedef enum {
|
|
|
|
GTK_CROSSING_IN,
|
|
|
|
GTK_CROSSING_OUT
|
|
|
|
} GtkCrossingDirection;
|
|
|
|
|
|
|
|
typedef struct _GtkCrossingData GtkCrossingData;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* GtkCrossingData:
|
|
|
|
* @type: the type of crossing event
|
|
|
|
* @direction: whether this is a focus-in or focus-out event
|
|
|
|
* @mode: the crossing mode
|
|
|
|
* @old_target: the old target
|
|
|
|
* @old_descendent: the direct child of the receiving widget that
|
2021-05-18 21:05:26 +00:00
|
|
|
* is an ancestor of @old_target, or %NULL if @old_target is not
|
|
|
|
* a descendent of the receiving widget
|
2020-02-20 22:22:03 +00:00
|
|
|
* @new_target: the new target
|
|
|
|
* @new_descendent: the direct child of the receiving widget that
|
2021-05-18 21:05:26 +00:00
|
|
|
* is an ancestor of @new_target, or %NULL if @new_target is not
|
|
|
|
* a descendent of the receiving widget
|
2021-05-20 13:17:04 +00:00
|
|
|
* @drop: the `GdkDrop` if this is info for a drop operation
|
2020-02-20 22:22:03 +00:00
|
|
|
*
|
|
|
|
* The struct that is passed to gtk_event_controller_handle_crossing().
|
|
|
|
*
|
|
|
|
* The @old_target and @new_target fields are set to the old or new
|
2020-02-19 03:44:41 +00:00
|
|
|
* focus, drop or hover location.
|
2020-02-20 22:22:03 +00:00
|
|
|
*/
|
|
|
|
struct _GtkCrossingData {
|
|
|
|
GtkCrossingType type;
|
|
|
|
GtkCrossingDirection direction;
|
|
|
|
GdkCrossingMode mode;
|
|
|
|
GtkWidget *old_target;
|
|
|
|
GtkWidget *old_descendent;
|
|
|
|
GtkWidget *new_target;
|
|
|
|
GtkWidget *new_descendent;
|
2020-02-19 03:44:41 +00:00
|
|
|
GdkDrop *drop;
|
2020-02-20 22:22:03 +00:00
|
|
|
};
|
|
|
|
|
2014-05-06 02:40:18 +00:00
|
|
|
struct _GtkEventController
|
|
|
|
{
|
|
|
|
GObject parent_instance;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _GtkEventControllerClass
|
|
|
|
{
|
|
|
|
GObjectClass parent_class;
|
|
|
|
|
2018-03-08 02:30:44 +00:00
|
|
|
void (* set_widget) (GtkEventController *controller,
|
|
|
|
GtkWidget *widget);
|
|
|
|
void (* unset_widget) (GtkEventController *controller);
|
2014-05-06 02:40:18 +00:00
|
|
|
gboolean (* handle_event) (GtkEventController *controller,
|
2020-02-16 16:09:02 +00:00
|
|
|
GdkEvent *event,
|
2020-02-13 05:08:49 +00:00
|
|
|
double x,
|
|
|
|
double y);
|
2014-05-06 02:40:18 +00:00
|
|
|
void (* reset) (GtkEventController *controller);
|
|
|
|
|
2020-02-13 01:26:29 +00:00
|
|
|
void (* handle_crossing) (GtkEventController *controller,
|
|
|
|
const GtkCrossingData *crossing,
|
|
|
|
double x,
|
|
|
|
double y);
|
|
|
|
|
2014-05-06 02:40:18 +00:00
|
|
|
/*<private>*/
|
2015-07-09 16:55:32 +00:00
|
|
|
|
2016-08-23 18:31:29 +00:00
|
|
|
/* Tells whether the event is filtered out, %TRUE makes
|
|
|
|
* the event unseen by the handle_event vfunc.
|
|
|
|
*/
|
2015-07-09 16:55:32 +00:00
|
|
|
gboolean (* filter_event) (GtkEventController *controller,
|
2020-02-16 16:09:02 +00:00
|
|
|
GdkEvent *event);
|
2020-02-16 06:48:50 +00:00
|
|
|
|
2014-05-06 02:40:18 +00:00
|
|
|
gpointer padding[10];
|
|
|
|
};
|
|
|
|
|
2020-04-11 16:40:21 +00:00
|
|
|
GtkWidget * gtk_event_controller_get_target (GtkEventController *controller);
|
|
|
|
|
2020-02-16 07:46:05 +00:00
|
|
|
|
2020-02-20 22:22:03 +00:00
|
|
|
gboolean gtk_event_controller_handle_event (GtkEventController *controller,
|
|
|
|
GdkEvent *event,
|
|
|
|
GtkWidget *target,
|
|
|
|
double x,
|
|
|
|
double y);
|
|
|
|
void gtk_event_controller_handle_crossing (GtkEventController *controller,
|
|
|
|
const GtkCrossingData *crossing,
|
|
|
|
double x,
|
|
|
|
double y);
|
|
|
|
|
2014-05-06 02:40:18 +00:00
|
|
|
#endif /* __GTK_EVENT_CONTROLLER_PRIVATE_H__ */
|