1 | /* GTK - The GIMP Toolkit |
2 | * Copyright (C) 2016, Red Hat, Inc. |
3 | * |
4 | * This library is free software; you can redistribute it and/or |
5 | * modify it under the terms of the GNU Lesser General Public |
6 | * License as published by the Free Software Foundation; either |
7 | * version 2 of the License, or (at your option) any later version. |
8 | * |
9 | * This library is distributed in the hope that it will be useful, |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | * Lesser General Public License for more details. |
13 | * |
14 | * You should have received a copy of the GNU Lesser General Public |
15 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. |
16 | * |
17 | * Author(s): Carlos Garnacho <carlosg@gnome.org> |
18 | */ |
19 | |
20 | #ifndef __GTK_PAD_CONTROLLER_H__ |
21 | #define __GTK_PAD_CONTROLLER_H__ |
22 | |
23 | #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION) |
24 | #error "Only <gtk/gtk.h> can be included directly." |
25 | #endif |
26 | |
27 | #include <gdk/gdk.h> |
28 | #include <gtk/gtkeventcontroller.h> |
29 | |
30 | G_BEGIN_DECLS |
31 | |
32 | #define GTK_TYPE_PAD_CONTROLLER (gtk_pad_controller_get_type ()) |
33 | #define GTK_PAD_CONTROLLER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GTK_TYPE_PAD_CONTROLLER, GtkPadController)) |
34 | #define GTK_PAD_CONTROLLER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GTK_TYPE_PAD_CONTROLLER, GtkPadControllerClass)) |
35 | #define GTK_IS_PAD_CONTROLLER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GTK_TYPE_PAD_CONTROLLER)) |
36 | #define GTK_IS_PAD_CONTROLLER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GTK_TYPE_PAD_CONTROLLER)) |
37 | #define GTK_PAD_CONTROLLER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GTK_TYPE_PAD_CONTROLLER, GtkPadControllerClass)) |
38 | |
39 | typedef struct _GtkPadController GtkPadController; |
40 | typedef struct _GtkPadControllerClass GtkPadControllerClass; |
41 | typedef struct _GtkPadActionEntry GtkPadActionEntry; |
42 | |
43 | /** |
44 | * GtkPadActionType: |
45 | * @GTK_PAD_ACTION_BUTTON: Action is triggered by a pad button |
46 | * @GTK_PAD_ACTION_RING: Action is triggered by a pad ring |
47 | * @GTK_PAD_ACTION_STRIP: Action is triggered by a pad strip |
48 | * |
49 | * The type of a pad action. |
50 | */ |
51 | typedef enum { |
52 | GTK_PAD_ACTION_BUTTON, |
53 | GTK_PAD_ACTION_RING, |
54 | GTK_PAD_ACTION_STRIP |
55 | } GtkPadActionType; |
56 | |
57 | /** |
58 | * GtkPadActionEntry: |
59 | * @type: the type of pad feature that will trigger this action entry. |
60 | * @index: the 0-indexed button/ring/strip number that will trigger this action |
61 | * entry. |
62 | * @mode: the mode that will trigger this action entry, or -1 for all modes. |
63 | * @label: Human readable description of this action entry, this string should |
64 | * be deemed user-visible. |
65 | * @action_name: action name that will be activated in the #GActionGroup. |
66 | * |
67 | * Struct defining a pad action entry. |
68 | */ |
69 | struct _GtkPadActionEntry { |
70 | GtkPadActionType type; |
71 | gint index; |
72 | gint mode; |
73 | gchar *label; |
74 | gchar *action_name; |
75 | }; |
76 | |
77 | GDK_AVAILABLE_IN_3_22 |
78 | GType gtk_pad_controller_get_type (void) G_GNUC_CONST; |
79 | |
80 | GDK_AVAILABLE_IN_3_22 |
81 | GtkPadController *gtk_pad_controller_new (GtkWindow *window, |
82 | GActionGroup *group, |
83 | GdkDevice *pad); |
84 | |
85 | GDK_AVAILABLE_IN_3_22 |
86 | void gtk_pad_controller_set_action_entries (GtkPadController *controller, |
87 | const GtkPadActionEntry *entries, |
88 | gint n_entries); |
89 | GDK_AVAILABLE_IN_3_22 |
90 | void gtk_pad_controller_set_action (GtkPadController *controller, |
91 | GtkPadActionType type, |
92 | gint index, |
93 | gint mode, |
94 | const gchar *label, |
95 | const gchar *action_name); |
96 | |
97 | G_END_DECLS |
98 | |
99 | #endif /* __GTK_PAD_CONTROLLER_H__ */ |
100 | |