|
@@ -32,13 +32,17 @@ typedef ALLEGRO_DISPLAY zori_display;
|
|
|
|
|
|
typedef Point zori_point;
|
|
|
typedef Rebox zori_rebox;
|
|
|
-typedef int zori_id;
|
|
|
+typedef int zori_id;
|
|
|
+typedef ALLEGRO_USTR zori_string;
|
|
|
|
|
|
/* Macros for possible portability. */
|
|
|
#define zori_font_lineheight(FONT) al_get_font_line_height(FONT)
|
|
|
#define zori_font_drawstr(FONT, COLOR, X, Y, ATTR, TEXT) al_draw_ustr(FONT, COLOR, X, Y, ATTR, TEXT)
|
|
|
|
|
|
|
|
|
+/* Default sizes of a widget. */
|
|
|
+#define ZORI_WIDGET_DEFAULT_W 640
|
|
|
+#define ZORI_WIDGET_DEFAULT_H 480
|
|
|
|
|
|
/* Zori ID's. */
|
|
|
#define ZORI_ID_OK_P(ID) ((ID) > -1)
|
|
@@ -67,6 +71,7 @@ enum zori_custom_event_type {
|
|
|
ZORI_EVENT_DRAW,
|
|
|
ZORI_EVENT_DONE,
|
|
|
ZORI_EVENT_FREE,
|
|
|
+ ZORI_EVENT_ACTION,
|
|
|
};
|
|
|
|
|
|
|
|
@@ -85,7 +90,7 @@ struct zori_any_event {
|
|
|
/* System event, that is coming from the underlying library used, e.g. Allegro. */
|
|
|
struct zori_sys_event {
|
|
|
struct zori_any_event any;
|
|
|
- zori_system_event * sysev;
|
|
|
+ zori_system_event * ev;
|
|
|
};
|
|
|
|
|
|
/* Update event, when UI has to update (animations, etc). */
|
|
@@ -109,6 +114,11 @@ struct zori_free_event {
|
|
|
struct zori_any_event any;
|
|
|
};
|
|
|
|
|
|
+/* Action event. */
|
|
|
+struct zori_action_event {
|
|
|
+ struct zori_any_event any;
|
|
|
+};
|
|
|
+
|
|
|
|
|
|
/** An event that ZORI can handle. The union is cunningly overlaid so
|
|
|
* that the type field and the any field can be used in all cases. */
|
|
@@ -121,6 +131,7 @@ union zori_event {
|
|
|
struct zori_update_event update;
|
|
|
struct zori_done_event done;
|
|
|
struct zori_free_event free;
|
|
|
+ struct zori_action_event action;
|
|
|
};
|
|
|
|
|
|
|
|
@@ -149,7 +160,7 @@ static inline bool zori_event_is_sys_event(union zori_event * event) {
|
|
|
static inline zori_system_event * zori_event_system_event(union zori_event * event) {
|
|
|
if (!event) return NULL;
|
|
|
if (!zori_event_is_sys_event(event)) return NULL;
|
|
|
- return event->sys.sysev;
|
|
|
+ return event->sys.ev;
|
|
|
}
|
|
|
|
|
|
/* Helper functions to set widget for an event. */
|
|
@@ -309,17 +320,6 @@ struct zori_root {
|
|
|
/* Forward declaration of a page. */
|
|
|
struct zori_page;
|
|
|
|
|
|
-
|
|
|
-/* In Zori, the GUI is paginated. This means that on any
|
|
|
- * screen, only a single GUI page can be active. The intent is to
|
|
|
- * support different GUI modes such as startup screen, status view,
|
|
|
- * settings, HUD, and so on between which can be switched easily. */
|
|
|
-struct zori_page {
|
|
|
- /* A page is a widget. */
|
|
|
- struct zori_widget widget;
|
|
|
-};
|
|
|
-
|
|
|
-
|
|
|
struct zori_root * zori_get_root(void);
|
|
|
|
|
|
/* Initializes Zori and creates a top level widget. Returns 0 on success
|
|
@@ -337,10 +337,6 @@ zori_id zori_shutdown();
|
|
|
/* Creates a new screen widget. Normally this should be the first widget
|
|
|
* you create after zori_start. */
|
|
|
|
|
|
-/* Creates a new page widget on the given screen. The page is not
|
|
|
- * made the active page, unless if it is the first one created. */
|
|
|
-zori_id zori_new_page(zori_id screen);
|
|
|
-
|
|
|
/* Activates the page on it's display. All other pages are dectivated and
|
|
|
* hidden. */
|
|
|
zori_id zori_activate_page(zori_id page);
|
|
@@ -401,6 +397,7 @@ int zori_widget_raise_draw_event(struct zori_widget *widget);
|
|
|
int zori_widget_raise_done_event(struct zori_widget *widget);
|
|
|
int zori_widget_raise_free_event(struct zori_widget *widget);
|
|
|
int zori_widget_raise_update_event(struct zori_widget *widget, double dt);
|
|
|
+int zori_widget_raise_action_event(struct zori_widget *widget);
|
|
|
int zori_widget_compare(const void *v1, const void *v2);
|
|
|
struct zori_widget *zori_get_widget(zori_id id);
|
|
|
zori_id zori_get_unused_id(void);
|