11 #include "addons/kodi-dev-kit/include/kodi/c-api/gui/window.h" 12 #include "threads/Event.h" 13 #include "windows/GUIMediaWindow.h" 50 static KODI_GUI_WINDOW_HANDLE
create(KODI_HANDLE kodiBase,
51 const char* xml_filename,
52 const char* default_skin,
55 static void destroy(KODI_HANDLE kodiBase, KODI_GUI_WINDOW_HANDLE handle);
56 static void set_callbacks(KODI_HANDLE kodiBase,
57 KODI_GUI_WINDOW_HANDLE handle,
58 KODI_GUI_CLIENT_HANDLE clienthandle,
59 bool (*CBInit)(KODI_GUI_CLIENT_HANDLE),
60 bool (*CBFocus)(KODI_GUI_CLIENT_HANDLE,
int),
61 bool (*CBClick)(KODI_GUI_CLIENT_HANDLE,
int),
62 bool (*CBOnAction)(KODI_GUI_CLIENT_HANDLE,
ADDON_ACTION),
63 void (*CBGetContextButtons)(KODI_GUI_CLIENT_HANDLE,
67 bool (*CBOnContextButton)(KODI_GUI_CLIENT_HANDLE,
int,
unsigned int));
68 static bool show(KODI_HANDLE kodiBase, KODI_GUI_WINDOW_HANDLE handle);
69 static bool close(KODI_HANDLE kodiBase, KODI_GUI_WINDOW_HANDLE handle);
70 static bool do_modal(KODI_HANDLE kodiBase, KODI_GUI_WINDOW_HANDLE handle);
73 static bool set_focus_id(KODI_HANDLE kodiBase, KODI_GUI_WINDOW_HANDLE handle,
int control_id);
74 static int get_focus_id(KODI_HANDLE kodiBase, KODI_GUI_WINDOW_HANDLE handle);
75 static void set_control_label(KODI_HANDLE kodiBase,
76 KODI_GUI_WINDOW_HANDLE handle,
79 static void set_control_visible(KODI_HANDLE kodiBase,
80 KODI_GUI_WINDOW_HANDLE handle,
83 static void set_control_selected(KODI_HANDLE kodiBase,
84 KODI_GUI_WINDOW_HANDLE handle,
90 KODI_GUI_WINDOW_HANDLE handle,
93 static void set_property_int(KODI_HANDLE kodiBase,
94 KODI_GUI_WINDOW_HANDLE handle,
97 static void set_property_bool(KODI_HANDLE kodiBase,
98 KODI_GUI_WINDOW_HANDLE handle,
101 static void set_property_double(KODI_HANDLE kodiBase,
102 KODI_GUI_WINDOW_HANDLE handle,
105 static char* get_property(KODI_HANDLE kodiBase, KODI_GUI_WINDOW_HANDLE handle,
const char* key);
106 static int get_property_int(KODI_HANDLE kodiBase,
107 KODI_GUI_WINDOW_HANDLE handle,
109 static bool get_property_bool(KODI_HANDLE kodiBase,
110 KODI_GUI_WINDOW_HANDLE handle,
112 static double get_property_double(KODI_HANDLE kodiBase,
113 KODI_GUI_WINDOW_HANDLE handle,
115 static void clear_properties(KODI_HANDLE kodiBase, KODI_GUI_WINDOW_HANDLE handle);
116 static void clear_property(KODI_HANDLE kodiBase,
117 KODI_GUI_WINDOW_HANDLE handle,
121 static void clear_item_list(KODI_HANDLE kodiBase, KODI_GUI_WINDOW_HANDLE handle);
122 static void add_list_item(KODI_HANDLE kodiBase,
123 KODI_GUI_WINDOW_HANDLE handle,
124 KODI_GUI_LISTITEM_HANDLE item,
126 static void remove_list_item_from_position(KODI_HANDLE kodiBase,
127 KODI_GUI_WINDOW_HANDLE handle,
129 static void remove_list_item(KODI_HANDLE kodiBase,
130 KODI_GUI_WINDOW_HANDLE handle,
131 KODI_GUI_LISTITEM_HANDLE item);
132 static KODI_GUI_LISTITEM_HANDLE get_list_item(KODI_HANDLE kodiBase,
133 KODI_GUI_WINDOW_HANDLE handle,
135 static void set_current_list_position(KODI_HANDLE kodiBase,
136 KODI_GUI_WINDOW_HANDLE handle,
138 static int get_current_list_position(KODI_HANDLE kodiBase, KODI_GUI_WINDOW_HANDLE handle);
139 static int get_list_size(KODI_HANDLE kodiBase, KODI_GUI_WINDOW_HANDLE handle);
140 static void set_container_property(KODI_HANDLE kodiBase,
141 KODI_GUI_WINDOW_HANDLE handle,
144 static void set_container_content(KODI_HANDLE kodiBase,
145 KODI_GUI_WINDOW_HANDLE handle,
147 static int get_current_container_id(KODI_HANDLE kodiBase, KODI_GUI_WINDOW_HANDLE handle);
150 static void mark_dirty_region(KODI_HANDLE kodiBase, KODI_GUI_WINDOW_HANDLE handle);
154 KODI_GUI_WINDOW_HANDLE handle,
156 static KODI_GUI_CONTROL_HANDLE get_control_edit(KODI_HANDLE kodiBase,
157 KODI_GUI_WINDOW_HANDLE handle,
159 static KODI_GUI_CONTROL_HANDLE get_control_fade_label(KODI_HANDLE kodiBase,
160 KODI_GUI_WINDOW_HANDLE handle,
162 static KODI_GUI_CONTROL_HANDLE get_control_image(KODI_HANDLE kodiBase,
163 KODI_GUI_WINDOW_HANDLE handle,
165 static KODI_GUI_CONTROL_HANDLE get_control_label(KODI_HANDLE kodiBase,
166 KODI_GUI_WINDOW_HANDLE handle,
168 static KODI_GUI_CONTROL_HANDLE get_control_radio_button(KODI_HANDLE kodiBase,
169 KODI_GUI_WINDOW_HANDLE handle,
171 static KODI_GUI_CONTROL_HANDLE get_control_progress(KODI_HANDLE kodiBase,
172 KODI_GUI_WINDOW_HANDLE handle,
174 static KODI_GUI_CONTROL_HANDLE get_control_render_addon(KODI_HANDLE kodiBase,
175 KODI_GUI_WINDOW_HANDLE handle,
177 static KODI_GUI_CONTROL_HANDLE get_control_settings_slider(KODI_HANDLE kodiBase,
178 KODI_GUI_WINDOW_HANDLE handle,
180 static KODI_GUI_CONTROL_HANDLE get_control_slider(KODI_HANDLE kodiBase,
181 KODI_GUI_WINDOW_HANDLE handle,
183 static KODI_GUI_CONTROL_HANDLE get_control_spin(KODI_HANDLE kodiBase,
184 KODI_GUI_WINDOW_HANDLE handle,
186 static KODI_GUI_CONTROL_HANDLE get_control_text_box(KODI_HANDLE kodiBase,
187 KODI_GUI_WINDOW_HANDLE handle,
192 static KODI_GUI_CONTROL_HANDLE GetControl(KODI_HANDLE kodiBase,
193 KODI_GUI_WINDOW_HANDLE handle,
195 const char*
function,
196 CGUIControl::GUICONTROLTYPES type,
197 const std::string& typeName);
198 static int GetNextAvailableWindowId();
210 bool OnAction(
const CAction& action)
override;
211 void AllocResources(
bool forceLoad =
false)
override;
212 void Render()
override;
213 bool IsMediaWindow()
const override {
return m_isMedia; }
216 void PulseActionEvent();
217 void AddItem(CFileItemPtr* fileItem,
int itemPosition);
218 void RemoveItem(
int itemPosition);
219 void RemoveItem(CFileItemPtr* fileItem);
221 CFileItemPtr* GetListItem(
int position);
223 int GetCurrentListPosition();
224 void SetCurrentListPosition(
int item);
225 void SetContainerProperty(
const std::string& key,
const std::string& value);
226 void SetContainerContent(
const std::string& value);
227 int GetCurrentContainerControlId();
229 CGUIControl::GUICONTROLTYPES type,
230 const std::string& typeName);
233 void GetContextButtons(
int itemNumber,
CContextButtons& buttons)
override;
234 bool OnContextButton(
int itemNumber, CONTEXT_BUTTON button)
override;
235 void SetupShares()
override;
238 KODI_GUI_CLIENT_HANDLE m_clientHandle =
nullptr;
239 bool (*CBOnInit)(KODI_GUI_CLIENT_HANDLE cbhdl) =
nullptr;
240 bool (*CBOnFocus)(KODI_GUI_CLIENT_HANDLE cbhdl,
int controlId) =
nullptr;
241 bool (*CBOnClick)(KODI_GUI_CLIENT_HANDLE cbhdl,
int controlId) =
nullptr;
242 bool (*CBOnAction)(KODI_GUI_CLIENT_HANDLE cbhdl,
ADDON_ACTION actionId) =
nullptr;
243 void (*CBGetContextButtons)(KODI_GUI_CLIENT_HANDLE cbhdl,
246 unsigned int* size) =
nullptr;
247 bool (*CBOnContextButton)(KODI_GUI_CLIENT_HANDLE cbhdl,
249 unsigned int button) =
nullptr;
251 const int m_windowId;
252 int m_oldWindowId = 0;
255 void WaitForActionEvent(
unsigned int timeout);
259 std::string m_mediaDir;
268 bool IsDialogRunning()
const override {
return m_bRunning; }
269 bool IsDialog()
const override {
return true; }
270 bool IsModalDialog()
const override {
return true; }
272 void Show(
bool show =
true,
bool modal =
true);
273 void Show_Internal(
bool show =
true);
276 bool m_bRunning =
false;
This is an Event class built from a ConditionVariable.
Definition: Event.h:35
Definition: AddonDll.h:51
static bool set_focus_id(KODI_HANDLE kodiBase, KODI_GUI_WINDOW_HANDLE handle, int control_id)
Definition: Window.cpp:366
ADDON_ACTION
Definition: action_ids.h:18
static void clear_item_list(KODI_HANDLE kodiBase, KODI_GUI_WINDOW_HANDLE handle)
Definition: Window.cpp:745
Base class for controls.
Definition: GUIControl.h:83
Main structure passed from kodi to addon with basic information needed to create add-on.
Definition: addon_base.h:378
Global gui Add-on to Kodi callback functions.
Definition: Window.h:33
Class encapsulating information regarding a particular user action to be sent to windows and controls...
Definition: Action.h:21
static KODI_GUI_CONTROL_HANDLE get_control_button(KODI_HANDLE kodiBase, KODI_GUI_WINDOW_HANDLE handle, int control_id)
Definition: Window.cpp:1026
Definition: GUIMessage.h:365
static KODI_GUI_WINDOW_HANDLE create(KODI_HANDLE kodiBase, const char *xml_filename, const char *default_skin, bool as_dialog, bool is_media)
callback functions from add-on to kodi
Definition: Window.cpp:111
static void mark_dirty_region(KODI_HANDLE kodiBase, KODI_GUI_WINDOW_HANDLE handle)
Definition: Window.cpp:1003
Definition: GUIDialogContextMenu.h:93
static void set_property(KODI_HANDLE kodiBase, KODI_GUI_WINDOW_HANDLE handle, const char *key, const char *value)
Definition: Window.cpp:494