|
1 /* |
|
2 * GUI XML parser interface |
|
3 * |
|
4 * Copyright (c) 2009 CodeSourcery |
|
5 * |
|
6 * Permission is hereby granted, free of charge, to any person obtaining a copy |
|
7 * of this software and associated documentation files (the "Software"), to deal |
|
8 * in the Software without restriction, including without limitation the rights |
|
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
10 * copies of the Software, and to permit persons to whom the Software is |
|
11 * furnished to do so, subject to the following conditions: |
|
12 * |
|
13 * The above copyright notice and this permission notice shall be included in |
|
14 * all copies or substantial portions of the Software. |
|
15 * |
|
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
|
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
|
22 * THE SOFTWARE. |
|
23 */ |
|
24 |
|
25 typedef struct images_node_s |
|
26 { |
|
27 struct images_node_s *next; |
|
28 char filename[128]; |
|
29 gui_area_t area; |
|
30 } image_node_t; |
|
31 |
|
32 typedef char devid_t[64]; |
|
33 |
|
34 typedef struct button_node_s |
|
35 { |
|
36 struct button_node_s *next; |
|
37 gui_area_t area; |
|
38 int pressed_img_id; |
|
39 char action[16]; |
|
40 char parameter[32]; |
|
41 } button_node_t; |
|
42 |
|
43 typedef struct displayarea_node_s |
|
44 { |
|
45 struct displayarea_node_s *next; |
|
46 gui_area_t area; |
|
47 devid_t devid; |
|
48 } displayarea_node_t; |
|
49 |
|
50 typedef struct pointerarea_node_s |
|
51 { |
|
52 struct pointerarea_node_s *next; |
|
53 gui_area_t area; |
|
54 devid_t devid; |
|
55 int absolute; |
|
56 int grab_on_click; |
|
57 int show_cursor_while_grabbing; |
|
58 } pointerarea_node_t; |
|
59 |
|
60 typedef struct vt_node_s |
|
61 { |
|
62 struct vt_node_s *next; |
|
63 image_node_t *first_image_node; |
|
64 displayarea_node_t *first_displayarea_node; |
|
65 pointerarea_node_t *first_pointerarea_node; |
|
66 button_node_t *first_button_node; |
|
67 unsigned int n_images; |
|
68 unsigned int n_displayareas; |
|
69 unsigned int n_pointerareas; |
|
70 unsigned int n_buttons; |
|
71 } vt_node_t; |
|
72 |
|
73 |
|
74 typedef struct |
|
75 { |
|
76 vt_node_t *first_vt_node; |
|
77 unsigned int n_vts; |
|
78 } gui_xml_tree_t; |
|
79 |
|
80 typedef enum { |
|
81 PARSE_OK = 0, |
|
82 UNRECOGNIZED_ELEMENT, |
|
83 UNEXPECTED_EOF, |
|
84 FILE_NOT_FOUND, |
|
85 INVALID_ID, |
|
86 OUT_OF_MEMORY, |
|
87 } parse_result_t; |
|
88 |
|
89 parse_result_t parse_gui_xml(const char *xml_file, gui_xml_tree_t *gui_xml_tree); |
|
90 const char* parsing_location_error(void); |
|
91 |
|
92 |