1 /* 2 * binding: A keyboard or pointer binding 3 * 4 * Copyright 2012-2020 Stephan Haller <nomad@froevel.de> 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 2 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, write to the Free Software 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 19 * MA 02110-1301, USA. 20 * 21 * 22 */ 23 24 #ifndef __LIBXFDASHBOARD_BINDING__ 25 #define __LIBXFDASHBOARD_BINDING__ 26 27 #if !defined(__LIBXFDASHBOARD_H_INSIDE__) && !defined(LIBXFDASHBOARD_COMPILATION) 28 #error "Only <libxfdashboard/libxfdashboard.h> can be included directly." 29 #endif 30 31 #include <clutter/clutter.h> 32 33 G_BEGIN_DECLS 34 35 #define XFDASHBOARD_TYPE_BINDING (xfdashboard_binding_get_type()) 36 #define XFDASHBOARD_BINDING(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), XFDASHBOARD_TYPE_BINDING, XfdashboardBinding)) 37 #define XFDASHBOARD_IS_BINDING(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), XFDASHBOARD_TYPE_BINDING)) 38 #define XFDASHBOARD_BINDING_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), XFDASHBOARD_TYPE_BINDING, XfdashboardBindingClass)) 39 #define XFDASHBOARD_IS_BINDING_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), XFDASHBOARD_TYPE_BINDING)) 40 #define XFDASHBOARD_BINDING_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), XFDASHBOARD_TYPE_BINDING, XfdashboardBindingClass)) 41 42 typedef struct _XfdashboardBinding XfdashboardBinding; 43 typedef struct _XfdashboardBindingClass XfdashboardBindingClass; 44 typedef struct _XfdashboardBindingPrivate XfdashboardBindingPrivate; 45 46 struct _XfdashboardBinding 47 { 48 /*< private >*/ 49 /* Parent instance */ 50 GObject parent_instance; 51 52 /* Private structure */ 53 XfdashboardBindingPrivate *priv; 54 }; 55 56 struct _XfdashboardBindingClass 57 { 58 /*< private >*/ 59 /* Parent class */ 60 GObjectClass parent_class; 61 }; 62 63 /* Public API */ 64 #define XFDASHBOARD_BINDING_MODIFIERS_MASK (CLUTTER_SHIFT_MASK | \ 65 CLUTTER_CONTROL_MASK | \ 66 CLUTTER_MOD1_MASK | \ 67 CLUTTER_MOD2_MASK | \ 68 CLUTTER_MOD3_MASK | \ 69 CLUTTER_MOD4_MASK | \ 70 CLUTTER_MOD5_MASK | \ 71 CLUTTER_SUPER_MASK | \ 72 CLUTTER_HYPER_MASK | \ 73 CLUTTER_META_MASK) 74 75 typedef enum /*< flags,prefix=XFDASHBOARD_BINDING_FLAGS >*/ 76 { 77 XFDASHBOARD_BINDING_FLAGS_NONE=0, 78 XFDASHBOARD_BINDING_FLAGS_ALLOW_UNFOCUSABLE_TARGET=1 << 0, 79 } XfdashboardBindingFlags; 80 81 GType xfdashboard_binding_get_type(void) G_GNUC_CONST; 82 83 XfdashboardBinding* xfdashboard_binding_new(void); 84 XfdashboardBinding* xfdashboard_binding_new_for_event(const ClutterEvent *inEvent); 85 86 guint xfdashboard_binding_hash(gconstpointer inValue); 87 gboolean xfdashboard_binding_compare(gconstpointer inLeft, gconstpointer inRight); 88 89 ClutterEventType xfdashboard_binding_get_event_type(const XfdashboardBinding *self); 90 void xfdashboard_binding_set_event_type(XfdashboardBinding *self, ClutterEventType inType); 91 92 const gchar* xfdashboard_binding_get_class_name(const XfdashboardBinding *self); 93 void xfdashboard_binding_set_class_name(XfdashboardBinding *self, const gchar *inClassName); 94 95 guint xfdashboard_binding_get_key(const XfdashboardBinding *self); 96 void xfdashboard_binding_set_key(XfdashboardBinding *self, guint inKey); 97 98 ClutterModifierType xfdashboard_binding_get_modifiers(const XfdashboardBinding *self); 99 void xfdashboard_binding_set_modifiers(XfdashboardBinding *self, ClutterModifierType inModifiers); 100 101 const gchar* xfdashboard_binding_get_target(const XfdashboardBinding *self); 102 void xfdashboard_binding_set_target(XfdashboardBinding *self, const gchar *inTarget); 103 104 const gchar* xfdashboard_binding_get_action(const XfdashboardBinding *self); 105 void xfdashboard_binding_set_action(XfdashboardBinding *self, const gchar *inAction); 106 107 XfdashboardBindingFlags xfdashboard_binding_get_flags(const XfdashboardBinding *self); 108 void xfdashboard_binding_set_flags(XfdashboardBinding *self, XfdashboardBindingFlags inFlags); 109 110 G_END_DECLS 111 112 #endif /* __LIBXFDASHBOARD_BINDING__ */ 113