diff options
Diffstat (limited to 'apps/plugins/lib/pluginlib_touchscreen.h')
-rw-r--r-- | apps/plugins/lib/pluginlib_touchscreen.h | 117 |
1 files changed, 117 insertions, 0 deletions
diff --git a/apps/plugins/lib/pluginlib_touchscreen.h b/apps/plugins/lib/pluginlib_touchscreen.h new file mode 100644 index 0000000000..f2787655ee --- /dev/null +++ b/apps/plugins/lib/pluginlib_touchscreen.h | |||
@@ -0,0 +1,117 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 by Maurus Cuelenaere | ||
11 | * Copyright (C) 2009 by Karl Kurbjun | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or | ||
14 | * modify it under the terms of the GNU General Public License | ||
15 | * as published by the Free Software Foundation; either version 2 | ||
16 | * of the License, or (at your option) any later version. | ||
17 | * | ||
18 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
19 | * KIND, either express or implied. | ||
20 | * | ||
21 | ****************************************************************************/ | ||
22 | |||
23 | #ifndef _PLUGIN_LIB_TOUCHSCREEN_H_ | ||
24 | #define _PLUGIN_LIB_TOUCHSCREEN_H_ | ||
25 | |||
26 | #include "plugin.h" | ||
27 | |||
28 | #ifdef HAVE_TOUCHSCREEN | ||
29 | |||
30 | /******************************************************************************* | ||
31 | * Touchbutton | ||
32 | ******************************************************************************/ | ||
33 | struct touchbutton { | ||
34 | /* Each button has it's own viewport to define colors, drawstyle, location*/ | ||
35 | struct viewport vp; | ||
36 | bool repeat; /* requires the area be held for the action */ | ||
37 | int action; /* action this button will return */ | ||
38 | bool invisible; /* Is this an invisible button? */ | ||
39 | char *title; /* Specify a title */ | ||
40 | fb_data *pixmap; /* Currently unused, but will allow for a graphic */ | ||
41 | }; | ||
42 | |||
43 | /* Get: tests for a button press and returns action. */ | ||
44 | int touchbutton_get(struct touchbutton *data, int button, int num_buttons); | ||
45 | /* Draw: Draws all visible buttons */ | ||
46 | void touchbutton_draw(struct touchbutton *data, int num_buttons); | ||
47 | |||
48 | |||
49 | /******************************************************************************* | ||
50 | * Touch mapping | ||
51 | ******************************************************************************/ | ||
52 | struct ts_mapping | ||
53 | { | ||
54 | int tl_x; /* top left */ | ||
55 | int tl_y; | ||
56 | int width; | ||
57 | int height; | ||
58 | }; | ||
59 | |||
60 | struct ts_mappings | ||
61 | { | ||
62 | struct ts_mapping *mappings; | ||
63 | int amount; | ||
64 | }; | ||
65 | |||
66 | unsigned int touchscreen_map(struct ts_mappings *map, int x, int y); | ||
67 | |||
68 | struct ts_raster | ||
69 | { | ||
70 | int tl_x; /* top left */ | ||
71 | int tl_y; | ||
72 | int width; | ||
73 | int height; | ||
74 | int raster_width; | ||
75 | int raster_height; | ||
76 | }; | ||
77 | |||
78 | struct ts_raster_result | ||
79 | { | ||
80 | int x; | ||
81 | int y; | ||
82 | }; | ||
83 | |||
84 | unsigned int touchscreen_map_raster(struct ts_raster *map, int x, int y, struct ts_raster_result *result); | ||
85 | |||
86 | struct ts_raster_button_mapping | ||
87 | { | ||
88 | struct ts_raster *raster; | ||
89 | bool drag_drop_enable; /* ... */ | ||
90 | bool double_click_enable; /* ... */ | ||
91 | bool click_enable; /* ... */ | ||
92 | bool move_progress_enable; /* ... */ | ||
93 | bool two_d_movement_enable; /* ... */ | ||
94 | struct ts_raster_result two_d_from; /* ... */ | ||
95 | int _prev_x; /* Internal: DO NOT MODIFY! */ | ||
96 | int _prev_y; /* Internal: DO NOT MODIFY! */ | ||
97 | int _prev_btn_state; /* Internal: DO NOT MODIFY! */ | ||
98 | }; | ||
99 | |||
100 | struct ts_raster_button_result | ||
101 | { | ||
102 | enum{ | ||
103 | TS_ACTION_NONE, | ||
104 | TS_ACTION_MOVE, | ||
105 | TS_ACTION_CLICK, | ||
106 | TS_ACTION_DOUBLE_CLICK, | ||
107 | TS_ACTION_DRAG_DROP, | ||
108 | TS_ACTION_TWO_D_MOVEMENT | ||
109 | } action; | ||
110 | struct ts_raster_result from; | ||
111 | struct ts_raster_result to; | ||
112 | }; | ||
113 | |||
114 | struct ts_raster_button_result touchscreen_raster_map_button(struct ts_raster_button_mapping *map, int x, int y, int button); | ||
115 | |||
116 | #endif /* HAVE_TOUCHSCREEN */ | ||
117 | #endif /* _PLUGIN_LIB_TOUCHSCREEN_H_ */ | ||