Kodi Development  19.0
for Binary and Script based Add-Ons
window.h
1 /*
2  * Copyright (C) 2005-2020 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 #ifndef C_API_GUI_WINDOW_H
12 #define C_API_GUI_WINDOW_H
13 
14 #include "definitions.h"
15 #include "input/action_ids.h"
16 
17 #include <stddef.h>
18 
19 #define ADDON_MAX_CONTEXT_ENTRIES 20
20 #define ADDON_MAX_CONTEXT_ENTRY_NAME_LENGTH 80
21 
22 #ifdef __cplusplus
23 extern "C"
24 {
25 #endif /* __cplusplus */
26 
27  typedef struct gui_context_menu_pair
28  {
29  unsigned int id;
30  char name[ADDON_MAX_CONTEXT_ENTRY_NAME_LENGTH];
32 
34  {
35  /* Window creation functions */
36  KODI_GUI_WINDOW_HANDLE(*create)
37  (KODI_HANDLE kodiBase,
38  const char* xml_filename,
39  const char* default_skin,
40  bool as_dialog,
41  bool is_media);
42  void (*destroy)(KODI_HANDLE kodiBase, KODI_GUI_WINDOW_HANDLE handle);
43 
44  void (*set_callbacks)(KODI_HANDLE kodiBase,
45  KODI_GUI_WINDOW_HANDLE handle,
46  KODI_GUI_CLIENT_HANDLE clienthandle,
47  bool (*CBInit)(KODI_GUI_CLIENT_HANDLE),
48  bool (*CBFocus)(KODI_GUI_CLIENT_HANDLE, int),
49  bool (*CBClick)(KODI_GUI_CLIENT_HANDLE, int),
50  bool (*CBOnAction)(KODI_GUI_CLIENT_HANDLE, enum ADDON_ACTION),
51  void (*CBGetContextButtons)(
52  KODI_GUI_CLIENT_HANDLE, int, gui_context_menu_pair*, unsigned int*),
53  bool (*CBOnContextButton)(KODI_GUI_CLIENT_HANDLE, int, unsigned int));
54  bool (*show)(KODI_HANDLE kodiBase, KODI_GUI_WINDOW_HANDLE handle);
55  bool (*close)(KODI_HANDLE kodiBase, KODI_GUI_WINDOW_HANDLE handle);
56  bool (*do_modal)(KODI_HANDLE kodiBase, KODI_GUI_WINDOW_HANDLE handle);
57 
58  /* Window control functions */
59  bool (*set_focus_id)(KODI_HANDLE kodiBase, KODI_GUI_WINDOW_HANDLE handle, int control_id);
60  int (*get_focus_id)(KODI_HANDLE kodiBase, KODI_GUI_WINDOW_HANDLE handle);
61  void (*set_control_label)(KODI_HANDLE kodiBase,
62  KODI_GUI_WINDOW_HANDLE handle,
63  int control_id,
64  const char* label);
65  void (*set_control_visible)(KODI_HANDLE kodiBase,
66  KODI_GUI_WINDOW_HANDLE handle,
67  int control_id,
68  bool visible);
69  void (*set_control_selected)(KODI_HANDLE kodiBase,
70  KODI_GUI_WINDOW_HANDLE handle,
71  int control_id,
72  bool selected);
73 
74  /* Window property functions */
75  void (*set_property)(KODI_HANDLE kodiBase,
76  KODI_GUI_WINDOW_HANDLE handle,
77  const char* key,
78  const char* value);
79  void (*set_property_int)(KODI_HANDLE kodiBase,
80  KODI_GUI_WINDOW_HANDLE handle,
81  const char* key,
82  int value);
83  void (*set_property_bool)(KODI_HANDLE kodiBase,
84  KODI_GUI_WINDOW_HANDLE handle,
85  const char* key,
86  bool value);
87  void (*set_property_double)(KODI_HANDLE kodiBase,
88  KODI_GUI_WINDOW_HANDLE handle,
89  const char* key,
90  double value);
91  char* (*get_property)(KODI_HANDLE kodiBase, KODI_GUI_WINDOW_HANDLE handle, const char* key);
92  int (*get_property_int)(KODI_HANDLE kodiBase, KODI_GUI_WINDOW_HANDLE handle, const char* key);
93  bool (*get_property_bool)(KODI_HANDLE kodiBase, KODI_GUI_WINDOW_HANDLE handle, const char* key);
94  double (*get_property_double)(KODI_HANDLE kodiBase,
95  KODI_GUI_WINDOW_HANDLE handle,
96  const char* key);
97  void (*clear_properties)(KODI_HANDLE kodiBase, KODI_GUI_WINDOW_HANDLE handle);
98  void (*clear_property)(KODI_HANDLE kodiBase, KODI_GUI_WINDOW_HANDLE handle, const char* key);
99 
100  /* List item functions */
101  void (*clear_item_list)(KODI_HANDLE kodiBase, KODI_GUI_WINDOW_HANDLE handle);
102  void (*add_list_item)(KODI_HANDLE kodiBase,
103  KODI_GUI_WINDOW_HANDLE handle,
104  KODI_GUI_LISTITEM_HANDLE item,
105  int list_position);
106  void (*remove_list_item_from_position)(KODI_HANDLE kodiBase,
107  KODI_GUI_WINDOW_HANDLE handle,
108  int list_position);
109  void (*remove_list_item)(KODI_HANDLE kodiBase,
110  KODI_GUI_WINDOW_HANDLE handle,
111  KODI_GUI_LISTITEM_HANDLE item);
112  KODI_GUI_LISTITEM_HANDLE(*get_list_item)
113  (KODI_HANDLE kodiBase, KODI_GUI_WINDOW_HANDLE handle, int list_position);
114  void (*set_current_list_position)(KODI_HANDLE kodiBase,
115  KODI_GUI_WINDOW_HANDLE handle,
116  int list_position);
117  int (*get_current_list_position)(KODI_HANDLE kodiBase, KODI_GUI_WINDOW_HANDLE handle);
118  int (*get_list_size)(KODI_HANDLE kodiBase, KODI_GUI_WINDOW_HANDLE handle);
119  void (*set_container_property)(KODI_HANDLE kodiBase,
120  KODI_GUI_WINDOW_HANDLE handle,
121  const char* key,
122  const char* value);
123  void (*set_container_content)(KODI_HANDLE kodiBase,
124  KODI_GUI_WINDOW_HANDLE handle,
125  const char* value);
126  int (*get_current_container_id)(KODI_HANDLE kodiBase, KODI_GUI_WINDOW_HANDLE handle);
127 
128  /* Various functions */
129  void (*mark_dirty_region)(KODI_HANDLE kodiBase, KODI_GUI_WINDOW_HANDLE handle);
130 
131  /* GUI control access functions */
132  KODI_GUI_CONTROL_HANDLE(*get_control_button)
133  (KODI_HANDLE kodiBase, KODI_GUI_WINDOW_HANDLE handle, int control_id);
134  KODI_GUI_CONTROL_HANDLE(*get_control_edit)
135  (KODI_HANDLE kodiBase, KODI_GUI_WINDOW_HANDLE handle, int control_id);
136  KODI_GUI_CONTROL_HANDLE(*get_control_fade_label)
137  (KODI_HANDLE kodiBase, KODI_GUI_WINDOW_HANDLE handle, int control_id);
138  KODI_GUI_CONTROL_HANDLE(*get_control_image)
139  (KODI_HANDLE kodiBase, KODI_GUI_WINDOW_HANDLE handle, int control_id);
140  KODI_GUI_CONTROL_HANDLE(*get_control_label)
141  (KODI_HANDLE kodiBase, KODI_GUI_WINDOW_HANDLE handle, int control_id);
142  KODI_GUI_CONTROL_HANDLE(*get_control_progress)
143  (KODI_HANDLE kodiBase, KODI_GUI_WINDOW_HANDLE handle, int control_id);
144  KODI_GUI_CONTROL_HANDLE(*get_control_radio_button)
145  (KODI_HANDLE kodiBase, KODI_GUI_WINDOW_HANDLE handle, int control_id);
146  KODI_GUI_CONTROL_HANDLE(*get_control_render_addon)
147  (KODI_HANDLE kodiBase, KODI_GUI_WINDOW_HANDLE handle, int control_id);
148  KODI_GUI_CONTROL_HANDLE(*get_control_settings_slider)
149  (KODI_HANDLE kodiBase, KODI_GUI_WINDOW_HANDLE handle, int control_id);
150  KODI_GUI_CONTROL_HANDLE(*get_control_slider)
151  (KODI_HANDLE kodiBase, KODI_GUI_WINDOW_HANDLE handle, int control_id);
152  KODI_GUI_CONTROL_HANDLE(*get_control_spin)
153  (KODI_HANDLE kodiBase, KODI_GUI_WINDOW_HANDLE handle, int control_id);
154  KODI_GUI_CONTROL_HANDLE(*get_control_text_box)
155  (KODI_HANDLE kodiBase, KODI_GUI_WINDOW_HANDLE handle, int control_id);
156  KODI_GUI_CONTROL_HANDLE(*get_control_dummy1)
157  (KODI_HANDLE kodiBase, KODI_GUI_WINDOW_HANDLE handle, int control_id);
158  KODI_GUI_CONTROL_HANDLE(*get_control_dummy2)
159  (KODI_HANDLE kodiBase, KODI_GUI_WINDOW_HANDLE handle, int control_id);
160  KODI_GUI_CONTROL_HANDLE(*get_control_dummy3)
161  (KODI_HANDLE kodiBase, KODI_GUI_WINDOW_HANDLE handle, int control_id);
162  KODI_GUI_CONTROL_HANDLE(*get_control_dummy4)
163  (KODI_HANDLE kodiBase, KODI_GUI_WINDOW_HANDLE handle, int control_id);
164  KODI_GUI_CONTROL_HANDLE(*get_control_dummy5)
165  (KODI_HANDLE kodiBase, KODI_GUI_WINDOW_HANDLE handle, int control_id);
166  KODI_GUI_CONTROL_HANDLE(*get_control_dummy6)
167  (KODI_HANDLE kodiBase, KODI_GUI_WINDOW_HANDLE handle, int control_id);
168  KODI_GUI_CONTROL_HANDLE(*get_control_dummy7)
169  (KODI_HANDLE kodiBase, KODI_GUI_WINDOW_HANDLE handle, int control_id);
170  KODI_GUI_CONTROL_HANDLE(*get_control_dummy8)
171  (KODI_HANDLE kodiBase, KODI_GUI_WINDOW_HANDLE handle, int control_id);
172  KODI_GUI_CONTROL_HANDLE(*get_control_dummy9)
173  (KODI_HANDLE kodiBase, KODI_GUI_WINDOW_HANDLE handle, int control_id);
174  KODI_GUI_CONTROL_HANDLE(*get_control_dummy10)
175  (KODI_HANDLE kodiBase, KODI_GUI_WINDOW_HANDLE handle, int control_id);
176  /* This above used to add new get_control_* functions */
178 
179 #ifdef __cplusplus
180 } /* extern "C" */
181 #endif /* __cplusplus */
182 
183 #endif /* !C_API_GUI_WINDOW_H */
AddonToKodiFuncTable_kodi_gui_window
Definition: window.h:34
gui_context_menu_pair
Definition: window.h:28
ADDON_ACTION
ADDON_ACTION
Definition: action_ids.h:21