~ubuntu-branches/ubuntu/trusty/unity-control-center/trusty

« back to all changes in this revision

Viewing changes to panels/wacom/gsd-wacom-device.h

  • Committer: Package Import Robot
  • Author(s): Robert Ancell
  • Date: 2014-01-08 16:29:18 UTC
  • Revision ID: package-import@ubuntu.com-20140108162918-g29dd08tr913y2qh
Tags: upstream-14.04.0
ImportĀ upstreamĀ versionĀ 14.04.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2011 Red Hat, Inc.
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or modify
 
5
 * it under the terms of the GNU General Public License as published by
 
6
 * the Free Software Foundation; either version 2 of the License, or
 
7
 * (at your option) any later version.
 
8
 *
 
9
 * This program 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
 
12
 * GNU General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU General Public License
 
15
 * along with this program; if not, write to the Free Software
 
16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
17
 *
 
18
 * Author: Bastien Nocera <hadess@hadess.net>
 
19
 *
 
20
 */
 
21
 
 
22
#ifndef __GSD_WACOM_DEVICE_MANAGER_H
 
23
#define __GSD_WACOM_DEVICE_MANAGER_H
 
24
 
 
25
#include <glib-object.h>
 
26
#include "gsd-enums.h"
 
27
 
 
28
G_BEGIN_DECLS
 
29
 
 
30
#define NUM_ELEMS_MATRIX 9
 
31
 
 
32
#define GSD_TYPE_WACOM_DEVICE         (gsd_wacom_device_get_type ())
 
33
#define GSD_WACOM_DEVICE(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_WACOM_DEVICE, GsdWacomDevice))
 
34
#define GSD_WACOM_DEVICE_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_WACOM_DEVICE, GsdWacomDeviceClass))
 
35
#define GSD_IS_WACOM_DEVICE(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_WACOM_DEVICE))
 
36
#define GSD_IS_WACOM_DEVICE_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_WACOM_DEVICE))
 
37
#define GSD_WACOM_DEVICE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_WACOM_DEVICE, GsdWacomDeviceClass))
 
38
 
 
39
typedef struct GsdWacomDevicePrivate GsdWacomDevicePrivate;
 
40
 
 
41
typedef struct
 
42
{
 
43
        GObject                parent;
 
44
        GsdWacomDevicePrivate *priv;
 
45
} GsdWacomDevice;
 
46
 
 
47
typedef struct
 
48
{
 
49
        GObjectClass   parent_class;
 
50
} GsdWacomDeviceClass;
 
51
 
 
52
#define GSD_TYPE_WACOM_STYLUS         (gsd_wacom_stylus_get_type ())
 
53
#define GSD_WACOM_STYLUS(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_WACOM_STYLUS, GsdWacomStylus))
 
54
#define GSD_WACOM_STYLUS_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_WACOM_STYLUS, GsdWacomStylusClass))
 
55
#define GSD_IS_WACOM_STYLUS(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_WACOM_STYLUS))
 
56
#define GSD_IS_WACOM_STYLUS_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_WACOM_STYLUS))
 
57
#define GSD_WACOM_STYLUS_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_WACOM_STYLUS, GsdWacomStylusClass))
 
58
 
 
59
typedef struct GsdWacomStylusPrivate GsdWacomStylusPrivate;
 
60
 
 
61
typedef struct
 
62
{
 
63
        GObject                parent;
 
64
        GsdWacomStylusPrivate *priv;
 
65
} GsdWacomStylus;
 
66
 
 
67
typedef struct
 
68
{
 
69
        GObjectClass   parent_class;
 
70
} GsdWacomStylusClass;
 
71
 
 
72
typedef enum {
 
73
        WACOM_STYLUS_TYPE_UNKNOWN,
 
74
        WACOM_STYLUS_TYPE_GENERAL,
 
75
        WACOM_STYLUS_TYPE_INKING,
 
76
        WACOM_STYLUS_TYPE_AIRBRUSH,
 
77
        WACOM_STYLUS_TYPE_CLASSIC,
 
78
        WACOM_STYLUS_TYPE_MARKER,
 
79
        WACOM_STYLUS_TYPE_STROKE,
 
80
        WACOM_STYLUS_TYPE_PUCK
 
81
} GsdWacomStylusType;
 
82
 
 
83
GType            gsd_wacom_stylus_get_type       (void);
 
84
GSettings      * gsd_wacom_stylus_get_settings   (GsdWacomStylus *stylus);
 
85
const char     * gsd_wacom_stylus_get_name       (GsdWacomStylus *stylus);
 
86
const char     * gsd_wacom_stylus_get_icon_name  (GsdWacomStylus *stylus);
 
87
GsdWacomDevice * gsd_wacom_stylus_get_device     (GsdWacomStylus *stylus);
 
88
gboolean         gsd_wacom_stylus_get_has_eraser (GsdWacomStylus *stylus);
 
89
guint            gsd_wacom_stylus_get_num_buttons(GsdWacomStylus *stylus);
 
90
int              gsd_wacom_stylus_get_id         (GsdWacomStylus *stylus);
 
91
GsdWacomStylusType gsd_wacom_stylus_get_stylus_type (GsdWacomStylus *stylus);
 
92
 
 
93
/* Tablet Buttons */
 
94
typedef enum {
 
95
        WACOM_TABLET_BUTTON_TYPE_NORMAL,
 
96
        WACOM_TABLET_BUTTON_TYPE_ELEVATOR,
 
97
        WACOM_TABLET_BUTTON_TYPE_HARDCODED
 
98
} GsdWacomTabletButtonType;
 
99
 
 
100
#define MAX_GROUP_ID 4
 
101
 
 
102
typedef struct
 
103
{
 
104
        char                     *name;
 
105
        char                     *id;
 
106
        GSettings                *settings;
 
107
        GsdWacomTabletButtonType  type;
 
108
        int                       group_id, idx;
 
109
} GsdWacomTabletButton;
 
110
 
 
111
void                  gsd_wacom_tablet_button_free (GsdWacomTabletButton *button);
 
112
GsdWacomTabletButton *gsd_wacom_tablet_button_copy (GsdWacomTabletButton *button);
 
113
 
 
114
/* Device types to apply a setting to */
 
115
typedef enum {
 
116
        WACOM_TYPE_INVALID =     0,
 
117
        WACOM_TYPE_STYLUS  =     (1 << 1),
 
118
        WACOM_TYPE_ERASER  =     (1 << 2),
 
119
        WACOM_TYPE_CURSOR  =     (1 << 3),
 
120
        WACOM_TYPE_PAD     =     (1 << 4),
 
121
        WACOM_TYPE_TOUCH   =     (1 << 5),
 
122
        WACOM_TYPE_ALL     =     WACOM_TYPE_STYLUS | WACOM_TYPE_ERASER | WACOM_TYPE_CURSOR | WACOM_TYPE_PAD | WACOM_TYPE_TOUCH
 
123
} GsdWacomDeviceType;
 
124
 
 
125
/* We use -1 for entire screen when setting/getting monitor value */
 
126
#define GSD_WACOM_SET_ALL_MONITORS -1
 
127
 
 
128
GType gsd_wacom_device_get_type     (void);
 
129
 
 
130
void     gsd_wacom_device_set_display         (GsdWacomDevice    *device,
 
131
                                               int                monitor);
 
132
gint     gsd_wacom_device_get_display_monitor (GsdWacomDevice *device);
 
133
gboolean gsd_wacom_device_get_display_matrix  (GsdWacomDevice *device,
 
134
                                               float           matrix[NUM_ELEMS_MATRIX]);
 
135
GsdWacomRotation gsd_wacom_device_get_display_rotation (GsdWacomDevice *device);
 
136
 
 
137
GsdWacomDevice * gsd_wacom_device_new              (GdkDevice *device);
 
138
GList          * gsd_wacom_device_list_styli       (GsdWacomDevice *device);
 
139
const char     * gsd_wacom_device_get_name         (GsdWacomDevice *device);
 
140
const char     * gsd_wacom_device_get_path         (GsdWacomDevice *device);
 
141
const char     * gsd_wacom_device_get_icon_name    (GsdWacomDevice *device);
 
142
const char     * gsd_wacom_device_get_tool_name    (GsdWacomDevice *device);
 
143
gboolean         gsd_wacom_device_reversible       (GsdWacomDevice *device);
 
144
gboolean         gsd_wacom_device_is_screen_tablet (GsdWacomDevice *device);
 
145
gboolean         gsd_wacom_device_is_fallback      (GsdWacomDevice *device);
 
146
gint             gsd_wacom_device_get_num_strips   (GsdWacomDevice *device);
 
147
gint             gsd_wacom_device_get_num_rings    (GsdWacomDevice *device);
 
148
GSettings      * gsd_wacom_device_get_settings     (GsdWacomDevice *device);
 
149
void             gsd_wacom_device_set_current_stylus (GsdWacomDevice *device,
 
150
                                                      int             stylus_id);
 
151
GsdWacomStylus * gsd_wacom_device_get_stylus_for_type (GsdWacomDevice     *device,
 
152
                                                       GsdWacomStylusType  type);
 
153
 
 
154
GsdWacomDeviceType gsd_wacom_device_get_device_type (GsdWacomDevice *device);
 
155
gint           * gsd_wacom_device_get_area          (GsdWacomDevice *device);
 
156
const char     * gsd_wacom_device_type_to_string    (GsdWacomDeviceType type);
 
157
GList          * gsd_wacom_device_get_buttons       (GsdWacomDevice *device);
 
158
GsdWacomTabletButton *gsd_wacom_device_get_button   (GsdWacomDevice   *device,
 
159
                                                     int               button,
 
160
                                                     GtkDirectionType *dir);
 
161
int gsd_wacom_device_set_next_mode                  (GsdWacomDevice *device,
 
162
                                                     int             group_id);
 
163
GsdWacomRotation gsd_wacom_device_rotation_name_to_type (const char *rotation);
 
164
const char     * gsd_wacom_device_rotation_type_to_name (GsdWacomRotation type);
 
165
 
 
166
 
 
167
/* Helper and debug functions */
 
168
GsdWacomDevice * gsd_wacom_device_create_fake (GsdWacomDeviceType  type,
 
169
                                               const char         *name,
 
170
                                               const char         *tool_name);
 
171
 
 
172
GList * gsd_wacom_device_create_fake_cintiq   (void);
 
173
GList * gsd_wacom_device_create_fake_bt       (void);
 
174
GList * gsd_wacom_device_create_fake_x201     (void);
 
175
GList * gsd_wacom_device_create_fake_intuos4  (void);
 
176
 
 
177
G_END_DECLS
 
178
 
 
179
#endif /* __GSD_WACOM_DEVICE_MANAGER_H */