1 /* GIMP - The GNU Image Manipulation Program 2 * Copyright (C) 1995 Spencer Kimball and Peter Mattis 3 * 4 * gimpmotionbuffer.h 5 * 6 * This program is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 3 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program. If not, see <https://www.gnu.org/licenses/>. 18 */ 19 20 #ifndef __GIMP_MOTION_BUFFER_H__ 21 #define __GIMP_MOTION_BUFFER_H__ 22 23 24 #include "core/gimpobject.h" 25 26 27 #define GIMP_TYPE_MOTION_BUFFER (gimp_motion_buffer_get_type ()) 28 #define GIMP_MOTION_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_MOTION_BUFFER, GimpMotionBuffer)) 29 #define GIMP_MOTION_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_MOTION_BUFFER, GimpMotionBufferClass)) 30 #define GIMP_IS_MOTION_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_MOTION_BUFFER)) 31 #define GIMP_IS_MOTION_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_MOTION_BUFFER)) 32 #define GIMP_MOTION_BUFFER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_MOTION_BUFFER, GimpMotionBufferClass)) 33 34 35 typedef struct _GimpMotionBufferClass GimpMotionBufferClass; 36 37 struct _GimpMotionBuffer 38 { 39 GimpObject parent_instance; 40 41 guint32 last_read_motion_time; 42 43 guint32 last_motion_time; /* previous time of a forwarded motion event */ 44 gdouble last_motion_delta_time; 45 gdouble last_motion_delta_x; 46 gdouble last_motion_delta_y; 47 gdouble last_motion_distance; 48 49 GimpCoords last_coords; /* last motion event */ 50 51 GArray *event_history; 52 GArray *event_queue; 53 gboolean event_delay; /* TRUE if there's an unsent event in 54 * the history buffer 55 */ 56 57 gint event_delay_timeout; 58 GdkModifierType last_active_state; 59 }; 60 61 struct _GimpMotionBufferClass 62 { 63 GimpObjectClass parent_class; 64 65 void (* stroke) (GimpMotionBuffer *buffer, 66 const GimpCoords *coords, 67 guint32 time, 68 GdkModifierType state); 69 void (* hover) (GimpMotionBuffer *buffer, 70 const GimpCoords *coords, 71 GdkModifierType state, 72 gboolean proximity); 73 }; 74 75 76 GType gimp_motion_buffer_get_type (void) G_GNUC_CONST; 77 78 GimpMotionBuffer * gimp_motion_buffer_new (void); 79 80 void gimp_motion_buffer_begin_stroke (GimpMotionBuffer *buffer, 81 guint32 time, 82 GimpCoords *last_motion); 83 void gimp_motion_buffer_end_stroke (GimpMotionBuffer *buffer); 84 85 gboolean gimp_motion_buffer_motion_event (GimpMotionBuffer *buffer, 86 GimpCoords *coords, 87 guint32 time, 88 gboolean event_fill); 89 guint32 gimp_motion_buffer_get_last_motion_time (GimpMotionBuffer *buffer); 90 91 void gimp_motion_buffer_request_stroke (GimpMotionBuffer *buffer, 92 GdkModifierType state, 93 guint32 time); 94 void gimp_motion_buffer_request_hover (GimpMotionBuffer *buffer, 95 GdkModifierType state, 96 gboolean proximity); 97 98 99 #endif /* __GIMP_MOTION_BUFFER_H__ */ 100