forked from libretro/RetroArch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathui_companion_driver.h
206 lines (168 loc) · 5.52 KB
/
ui_companion_driver.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2017 - Daniel De Matteis
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __UI_COMPANION_DRIVER_H
#define __UI_COMPANION_DRIVER_H
#include <stddef.h>
#include <boolean.h>
#include <retro_common_api.h>
#include <lists/file_list.h>
#ifdef HAVE_CONFIG_H
#include "../config.h"
#endif
#include "../command.h"
RETRO_BEGIN_DECLS
enum ui_msg_window_buttons
{
UI_MSG_WINDOW_OK = 0,
UI_MSG_WINDOW_OKCANCEL,
UI_MSG_WINDOW_YESNO,
UI_MSG_WINDOW_YESNOCANCEL
};
enum ui_msg_window_response
{
UI_MSG_RESPONSE_NA = 0,
UI_MSG_RESPONSE_OK,
UI_MSG_RESPONSE_CANCEL,
UI_MSG_RESPONSE_YES,
UI_MSG_RESPONSE_NO
};
enum ui_msg_window_type
{
UI_MSG_WINDOW_TYPE_ERROR = 0,
UI_MSG_WINDOW_TYPE_INFORMATION,
UI_MSG_WINDOW_TYPE_QUESTION,
UI_MSG_WINDOW_TYPE_WARNING
};
typedef struct ui_msg_window_state
{
enum ui_msg_window_buttons buttons;
char *text;
char *title;
void *window;
} ui_msg_window_state;
typedef struct ui_browser_window_state
{
struct
{
bool can_choose_directories;
bool can_choose_directories_val;
bool can_choose_files;
bool can_choose_files_val;
bool allows_multiple_selection;
bool allows_multiple_selection_val;
bool treat_file_packages_as_directories;
bool treat_file_packages_as_directories_val;
} capabilities;
void *window;
char *filters;
char *filters_title;
char *startdir;
char *path;
char *title;
char *result;
} ui_browser_window_state_t;
typedef struct ui_browser_window
{
bool (*open)(ui_browser_window_state_t *state);
bool (*save)(ui_browser_window_state_t *state);
const char *ident;
} ui_browser_window_t;
typedef struct ui_msg_window
{
enum ui_msg_window_response (*error )(ui_msg_window_state *state);
enum ui_msg_window_response (*information)(ui_msg_window_state *state);
enum ui_msg_window_response (*question )(ui_msg_window_state *state);
enum ui_msg_window_response (*warning )(ui_msg_window_state *state);
const char *ident;
} ui_msg_window_t;
typedef struct ui_application
{
void* (*initialize)(void);
void (*process_events)(void);
void (*quit)(void);
bool exiting;
const char *ident;
} ui_application_t;
typedef struct ui_window
{
void* (*init)(void);
void (*destroy)(void *data);
void (*set_focused)(void *data);
void (*set_visible)(void *data, bool visible);
void (*set_title)(void *data, char *buf);
void (*set_droppable)(void *data, bool droppable);
bool (*focused)(void *data);
const char *ident;
} ui_window_t;
typedef struct ui_companion_driver
{
void *(*init)(void);
void (*deinit)(void *data);
void (*toggle)(void *data, bool force);
void (*event_command)(void *data, enum event_command action);
void (*notify_content_loaded)(void *data);
void (*notify_list_loaded)(void *data, file_list_t *list, file_list_t *menu_list);
void (*notify_refresh)(void *data);
void (*msg_queue_push)(void *data, const char *msg, unsigned priority, unsigned duration, bool flush);
void (*render_messagebox)(const char *msg);
void *(*get_main_window)(void *data);
void (*log_msg)(void *data, const char *msg);
bool (*is_active)(void *data);
ui_browser_window_t *browser_window;
ui_msg_window_t *msg_window;
ui_window_t *window;
ui_application_t *application;
const char *ident;
} ui_companion_driver_t;
typedef struct
{
const ui_companion_driver_t *drv;
void *data;
#ifdef HAVE_QT
void *qt_data;
bool qt_is_inited;
#endif
bool is_on_foreground;
} uico_driver_state_t;
extern ui_companion_driver_t ui_companion_cocoa;
extern ui_companion_driver_t ui_companion_cocoatouch;
extern ui_companion_driver_t ui_companion_qt;
extern ui_companion_driver_t ui_companion_win32;
extern ui_msg_window_t ui_msg_window_win32;
bool ui_companion_is_on_foreground(void);
void ui_companion_set_foreground(unsigned enable);
void ui_companion_event_command(enum event_command action);
void ui_companion_driver_notify_refresh(void);
void ui_companion_driver_notify_list_loaded(file_list_t *list, file_list_t *menu_list);
void ui_companion_driver_notify_content_loaded(void);
const ui_msg_window_t *ui_companion_driver_get_msg_window_ptr(void);
const ui_browser_window_t *ui_companion_driver_get_browser_window_ptr(void);
const ui_window_t *ui_companion_driver_get_window_ptr(void);
void ui_companion_driver_log_msg(const char *msg);
void *ui_companion_driver_get_main_window(void);
const char *ui_companion_driver_get_ident(void);
void ui_companion_driver_init_first(void);
void ui_companion_driver_msg_queue_push(
const char *msg, unsigned priority,
unsigned duration, bool flush);
void ui_companion_driver_deinit(void);
void ui_companion_driver_toggle(
bool desktop_menu_enable,
bool ui_companion_toggle,
bool force);
uico_driver_state_t *uico_state_get_ptr(void);
RETRO_END_DECLS
#endif