zori.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610
  1. #ifndef zori_H_INCLUDED
  2. #define zori_H_INCLUDED
  3. /*
  4. * ZORI is a a GUI subsystem for use with Allegro 5 that handles
  5. * the user interface of Eruta.
  6. *
  7. * ZORI is a classic retained-mode GUI system that has an additional
  8. * pseudo-direct mode API. ZORI uses a handler system where events are handled
  9. * by call back functions which can be installed as specific handlers that are
  10. * activated on certain events. But, in the spirit of direct mode GUI's, all
  11. * widgets also keep state flags and value flags that can be used to see if they
  12. * have been activated and that can be inspected in a direct-mode GUI fashion.
  13. * With ZORI you can have your retained mode GUI pie and also eat it in direct
  14. * mode.
  15. *
  16. * In ZORI, there is only one top-level widget, the root, however, every widget
  17. * can contain any amount of child widgets. One level below the root widget are
  18. * the screen widgets which are intent to handle the GUI on one physical screen
  19. * or display. Every GUI page can have different "pages", but only one page
  20. * should be active per screen. The idea is that a GUI page represents a single
  21. * GUI mode such as the main menu, the settings menu, the in game menu, etc,
  22. * where you definitely want only one to be active at any given time.
  23. *
  24. * The box model used in Zori will be as follows (XXX implement this):
  25. * ......................................
  26. * .margin .
  27. * . +-------------border-----------+ .
  28. * . | padding | .
  29. * . | .......................... | .
  30. * . | . . | .
  31. * . | . contents . | .
  32. * . | . . | .
  33. * . | .......................... | .
  34. * . | padding | .
  35. * . +------------------------------+ .
  36. * .margin .
  37. * ......................................
  38. *
  39. * The padding determines the minimal distance between the border or the
  40. * parent widget and it's contents and/or child widgets.
  41. *
  42. * The border's thickness is only relevant for visual effects.
  43. * It does not change the layout. The border is effectively "inside"
  44. * the padding and/or contents of the widget and is unrelated to the padding.
  45. *
  46. * The margin of a widget determines how closely that widget may be packed
  47. * to it's sibling widgets.
  48. *
  49. * The work in UI is divided between the top-level widgets,
  50. * namely the root and the page, and the other widgets.
  51. * The root and the page handle everything that depends on and/or may influence
  52. * several widgets at once, such as event dispatching but also setting the
  53. * focus, determining which widget is being hovered, or dragged, etc.
  54. * The latter functions change the state of several widgets, so they
  55. * are handled on the level of the container widgets.
  56. * The zori_widget and the other concrete widgets handle the individual
  57. * state and actions of the various widgets individually.
  58. *
  59. *
  60. *
  61. *
  62. */
  63. #include <stdbool.h>
  64. #include "eruta.h"
  65. #include "rebox.h"
  66. #include "miao.h"
  67. #include "str.h"
  68. /* Defines for C11/C99/C89 portability */
  69. #ifndef inline
  70. #define inline inline
  71. #endif
  72. /* Macros for possible later system library portability. */
  73. #define ZORI_EVENT_TYPE_IS_USER(T) ALLEGRO_EVENT_TYPE_IS_USER(T)
  74. #define ZORI_SYSTEM_EVENT_KEY_DOWN ALLEGRO_EVENT_KEY_DOWN
  75. #define ZORI_SYSTEM_EVENT_KEY_UP ALLEGRO_EVENT_KEY_UP
  76. #define ZORI_SYSTEM_EVENT_KEY_CHAR ALLEGRO_EVENT_KEY_CHAR
  77. #define ZORI_SYSTEM_EVENT_MOUSE_AXES ALLEGRO_EVENT_MOUSE_AXES
  78. #define ZORI_SYSTEM_EVENT_MOUSE_AXES ALLEGRO_EVENT_MOUSE_AXES
  79. #define ZORI_SYSTEM_EVENT_MOUSE_BUTTON_DOWN ALLEGRO_EVENT_MOUSE_BUTTON_DOWN
  80. #define ZORI_SYSTEM_EVENT_MOUSE_BUTTON_UP ALLEGRO_EVENT_MOUSE_BUTTON_UP
  81. /* Typedefs for possible later system library portability. */
  82. typedef ALLEGRO_COLOR zori_color;
  83. typedef ALLEGRO_BITMAP zori_bitmap;
  84. typedef ALLEGRO_FONT zori_font;
  85. typedef ALLEGRO_EVENT zori_system_event;
  86. typedef ALLEGRO_EVENT_TYPE zori_event_type;
  87. typedef ALLEGRO_DISPLAY zori_display;
  88. typedef Point zori_point;
  89. typedef Rebox zori_rebox;
  90. typedef Rebox zori_box;
  91. typedef int zori_id;
  92. typedef ALLEGRO_USTR zori_string;
  93. typedef ALLEGRO_USTR zori_text;
  94. /* Macros for possible portability. */
  95. #define zori_font_lineheight(FONT) al_get_font_line_height(FONT)
  96. #define zori_font_drawstr(FONT, COLOR, X, Y, ATTR, TEXT) al_draw_ustr(FONT, COLOR, X, Y, ATTR, TEXT)
  97. /* Default sizes of a widget. */
  98. #define ZORI_WIDGET_DEFAULT_W 640
  99. #define ZORI_WIDGET_DEFAULT_H 480
  100. /* Defaut padding and margin. */
  101. #define ZORI_PADDING_DEFAULT 4
  102. #define ZORI_MARGIN_DEFAULT 0
  103. /* Zori ID's. */
  104. #define ZORI_ID_OK_P(ID) ((ID) > -1)
  105. #define ZORI_ID_OK ((zori_id)(0))
  106. #define ZORI_ID_ERROR ((zori_id)(-1))
  107. #define ZORI_ID_ENOMEM ((zori_id)(-2))
  108. #define ZORI_ID_EINVAL ((zori_id)(-3))
  109. /** Macro for the number of elements of an array .*/
  110. #define ZORI_ARRAY_AMOUNT(A) ((size_t)(sizeof(A))/(sizeof(*A)))
  111. /** Macro that expands to the the array itself, and the amount of elements
  112. * in that array, in that order. Only works on a statically sized array. */
  113. #define ZORI_ARRAY_AND_AMOUNT(A) (A), ZORI_ARRAY_AMOUNT(A)
  114. /* Macro: ZORI_CONTAINER_OF(PTR, TYPE, MEMBER)
  115. This macro returns, for the given pointer, a pointer to a containing struct
  116. of type TYPE, in which PTR is a member named MEMBER.
  117. This enables cool ways of type genericity and extension in plain C.
  118. It should not run afoul of strict aliasing since it passes over a char * pointer
  119. and a pointer of a containing struct or union.
  120. */
  121. #define ZORI_CONTAINER_OF(PTR, TYPE, MEMBER) \
  122. ((PTR) ? ((TYPE *)(((char *)(PTR)) - offsetof(TYPE, MEMBER))) : NULL)
  123. /** Custom event types, used in conjunction with Allegro event types. */
  124. enum zori_custom_event_type {
  125. ZORI_EVENT_CUSTOM = ALLEGRO_GET_EVENT_TYPE('z', 'o', 'r', 'i'),
  126. /** Update event, called at regular intervals to update the state of the UI.*/
  127. ZORI_EVENT_UPDATE,
  128. /** First draw pass. */
  129. ZORI_EVENT_DRAW,
  130. /** Second draw pass for cursors. */
  131. ZORI_EVENT_OVERDRAW,
  132. /** Cleanup event. */
  133. ZORI_EVENT_DONE,
  134. /** Destruction event. */
  135. ZORI_EVENT_FREE,
  136. /** Activation event, such as a button being clicked or a menu being opened. */
  137. ZORI_EVENT_ACTION,
  138. /** Close event, such as a menu being closed. Not for cleanup.*/
  139. ZORI_EVENT_CLOSE,
  140. /** Child added event to ease setup. */
  141. ZORI_EVENT_NEW_CHILD,
  142. };
  143. struct zori_widget;
  144. /* Common fields for an event. */
  145. struct zori_any_event {
  146. /* Type of the event, possibly copied from sysev. */
  147. zori_event_type type;
  148. /* Widget the event is sent to. */
  149. struct zori_widget * widget;
  150. /* Data specified in the handler. */
  151. void * data;
  152. };
  153. /* System event, that is coming from the underlying library used, e.g. Allegro. */
  154. struct zori_sys_event {
  155. struct zori_any_event any;
  156. zori_system_event * ev;
  157. };
  158. /* Update event, when UI has to update (animations, etc). */
  159. struct zori_update_event {
  160. struct zori_any_event any;
  161. double dt;
  162. };
  163. /* Draw event when the UI has to draw itself. */
  164. struct zori_draw_event {
  165. struct zori_any_event any;
  166. };
  167. /* Cleanup event. */
  168. struct zori_done_event {
  169. struct zori_any_event any;
  170. };
  171. /* Cleanup event. */
  172. struct zori_free_event {
  173. struct zori_any_event any;
  174. };
  175. /* Action event. */
  176. struct zori_action_event {
  177. struct zori_any_event any;
  178. };
  179. /* Close event. */
  180. struct zori_close_event {
  181. struct zori_any_event any;
  182. /* The widget that was closed and that sent this message to it's parent. */
  183. struct zori_widget * from;
  184. };
  185. /* New child event. */
  186. struct zori_new_child_event {
  187. struct zori_any_event any;
  188. /* The widget that was added as a child and that sent this message to it's parent. */
  189. struct zori_widget * child;
  190. };
  191. /** An event that ZORI can handle. The union is cunningly overlaid so
  192. * that the type field and the any field can be used in all cases. */
  193. union zori_event {
  194. /* Type of the event, possibly copied from sysev. */
  195. zori_event_type type;
  196. struct zori_any_event any;
  197. struct zori_sys_event sys;
  198. struct zori_draw_event draw;
  199. struct zori_update_event update;
  200. struct zori_done_event done;
  201. struct zori_free_event free;
  202. struct zori_action_event action;
  203. struct zori_close_event close;
  204. struct zori_new_child_event new_child;
  205. };
  206. /* Helper functions to get widget from an event. */
  207. static inline struct zori_widget *
  208. zori_event_widget(union zori_event * event) {
  209. if (!event) return NULL;
  210. return event->any.widget;
  211. }
  212. /* Helper functions to get data from an event. */
  213. static inline void * zori_event_data(union zori_event * event) {
  214. if (!event) return NULL;
  215. return event->any.data;
  216. }
  217. /* Helper function that checks if an event is a sys_event. */
  218. static inline bool zori_event_is_sys_event(union zori_event * event) {
  219. if (!event) return false;
  220. return (!ALLEGRO_EVENT_TYPE_IS_USER(event->type));
  221. }
  222. /* Helper functions to get system event from an event. Type checks the type. */
  223. static inline zori_system_event * zori_event_system_event(union zori_event * event) {
  224. if (!event) return NULL;
  225. if (!zori_event_is_sys_event(event)) return NULL;
  226. return event->sys.ev;
  227. }
  228. /* Helper functions to set widget for an event. */
  229. static inline struct zori_widget *
  230. zori_event_set_widget(union zori_event * event, struct zori_widget * widget) {
  231. if (!event) return NULL;
  232. return event->any.widget = widget;
  233. }
  234. /* Helper functions to set data for an event. */
  235. static inline void * zori_event_set_data(union zori_event * event, void * data) {
  236. if (!event) return NULL;
  237. return event->any.data = data;
  238. }
  239. /* A style part is a color, image, font, and font flags applied to a part of the GUI. */
  240. struct zori_stylepart {
  241. zori_color color;
  242. zori_bitmap * bitmap;
  243. zori_font * font;
  244. int font_flags;
  245. };
  246. /* A style is a set of style parts for different parts of the GUI. */
  247. struct zori_style {
  248. struct zori_stylepart fore;
  249. struct zori_stylepart back;
  250. struct zori_stylepart text;
  251. struct zori_stylepart border;
  252. struct zori_stylepart hover;
  253. struct zori_stylepart mark;
  254. };
  255. struct zori_widget;
  256. /* Event handler results. */
  257. enum zori_handle_result {
  258. ZORI_HANDLE_ERROR = -1, /* An error ocurred, stop propagating to children.*/
  259. ZORI_HANDLE_DONE = 0, /* The event was handled and consumed, no need to propagate to children automatically (widget may re-send event manually to children.)*/
  260. ZORI_HANDLE_IGNORE = 1, /* Event wasn't handled, propagate to children. */
  261. ZORI_HANDLE_PASS = 2, /* Event was handled, but needs to be propagated.*/
  262. };
  263. /* Returns whether or not a event needs to be propagated based on the
  264. * result of a handler. */
  265. static int zori_propagate_event_p(enum zori_handle_result result) {
  266. switch(result) {
  267. case ZORI_HANDLE_ERROR: return 0;
  268. case ZORI_HANDLE_DONE: return 0;
  269. case ZORI_HANDLE_IGNORE: return !0;
  270. case ZORI_HANDLE_PASS: return !0;
  271. default: return !0;
  272. }
  273. }
  274. typedef enum zori_handle_result (zori_handler_func)(union zori_event * event);
  275. /* A single event handler */
  276. struct zori_handler {
  277. zori_event_type type;
  278. zori_handler_func * handler;
  279. void * data;
  280. };
  281. /* A dynamic array of event handlers event handlers. */
  282. struct zori_handlers miao_of_type(struct zori_handler);
  283. /* An entry in a widget registry. */
  284. struct zori_registry_entry {
  285. zori_id id;
  286. struct zori_widget * widget;
  287. };
  288. /* A widget registry as a dynamic array of entries. */
  289. struct zori_registry miao_of_type(struct zori_registry_entry);
  290. /* Generic state flags for several zori structs. */
  291. enum zori_flag {
  292. /* The object is not visible, though it may still be interacted with.*/
  293. ZORI_FLAG_HIDDEN = 1 << 0,
  294. /* The object cannot be interacted with, though it is still visible. */
  295. ZORI_FLAG_DISABLED = 1 << 1,
  296. /* The object is both hidden and disabled. */
  297. ZORI_FLAG_DEACTIVATED = ZORI_FLAG_HIDDEN | ZORI_FLAG_DISABLED,
  298. /* The object is being hovered by the mouse cursor. */
  299. ZORI_FLAG_HOVERED = 1 << 2,
  300. /* The object is "marked" for activation by the keyjoy cursor */
  301. ZORI_FLAG_MARKED = 1 << 3,
  302. };
  303. /* Typedef for the type of a widget.
  304. * Not an enum since every widget may define this itself.
  305. */
  306. typedef uint32_t zori_widget_type;
  307. /* Generic widget types. */
  308. #define ZORI_WIDGET_TYPE_NONE ((zori_widget_type)(0))
  309. /* Macro to help generate widget types. */
  310. #define ZORI_WIDGET_TYPE(A, B, C, D) ((zori_widget_type)((A<<24) | (B<<16) | (C<<8) | D))
  311. /* Mouse or keyboard/joystick cursor. */
  312. struct zori_cursor {
  313. zori_point p;
  314. struct zori_widget * hover;
  315. struct zori_widget * focus;
  316. zori_bitmap * bitmap;
  317. enum zori_flag flags;
  318. };
  319. /* Support multiple cursors... */
  320. struct zori_cursors {
  321. struct zori_cursor mouse;
  322. struct zori_cursor keyjoy;
  323. };
  324. /*
  325. on_enter
  326. on_enter(data = {})
  327. on_event(*args)
  328. on_event(*data)
  329. on_key_down(*args)
  330. on_leave(name=nil)
  331. on_mouse_axes(t, x, y, z, w, dx, dy, dz, dw)
  332. on_mouse_button_down(t, x, y, z, w, b)
  333. on_mouse_button_up(t, x, y, z, w, b)
  334. on_mouse_in(x, y, from)
  335. on_mouse_out(x, y, to)
  336. on_resize
  337. */
  338. struct zori_widget;
  339. struct zori_widget_list miao_of_type(struct zori_widget *);
  340. struct zori_widget {
  341. /* ID of the widget, used in most external API's. */
  342. zori_id id;
  343. /* Root level widget under which this widget is active. */
  344. struct zori_widget * root;
  345. /* Position and size of the widget. */
  346. zori_rebox box;
  347. /* Outer rectangle of the widget, with the margin added. */
  348. zori_rebox outer;
  349. /* Inner rectangle of the widget, with the padding removed. */
  350. zori_rebox inner;
  351. /* Z ordering. */
  352. int z;
  353. /* Style. */
  354. struct zori_style style;
  355. /* Handlers. */
  356. struct zori_handlers handlers;
  357. /* Related widgets. */
  358. struct zori_widget * parent;
  359. struct zori_widget_list children;
  360. /* Flags. */
  361. enum zori_flag flags;
  362. /* Type of the widget. */
  363. zori_widget_type type;
  364. /* Generic "result", of last operation on widget, normally zero. */
  365. int result;
  366. };
  367. /* An array of widget pointers. */
  368. struct zori_widget_array miao_of_type(struct zori_widget *);
  369. /* Forward declarations. */
  370. struct zori_screen;
  371. struct zori_console;
  372. /*
  373. * Root level widget, my spread out over several displays.
  374. * In Zori, there can only be a single root level widget active.
  375. * It's ID is always 0;
  376. */
  377. struct zori_root {
  378. /* A root is a widget. */
  379. struct zori_widget widget;
  380. /* Current active screen widget if any. */
  381. struct zori_screen * active_screen;
  382. /* Current active console if any. */
  383. struct zori_console * console;
  384. };
  385. /* Forward declaration of a page. */
  386. struct zori_page;
  387. struct zori_root * zori_get_root(void);
  388. /* Initializes Zori and creates a top level widget. Returns 0 on success
  389. * or negative on error. The style will be copied and set as default
  390. * if it is not NULL. Otherwise a built-in style will be used.
  391. * Not that ZORI will NOT clean up any images or fonts it uses by itself.
  392. */
  393. zori_id zori_start(struct zori_style * default_style);
  394. /* Shut down Zori and destroys all widgets. Return 0 on succes or
  395. * negative on error.
  396. */
  397. zori_id zori_shutdown();
  398. /* Creates a new screen widget. Normally this should be the first widget
  399. * you create after zori_start. */
  400. /* Activates the page on it's display. All other pages are dectivated and
  401. * hidden. */
  402. zori_id zori_activate_page(zori_id page);
  403. /* Creates a new generic widget on the given screen with the given
  404. * dimensions. */
  405. zori_id zori_new(zori_id screen, zori_rebox * box);
  406. /* Sets the flags of a widget. */
  407. zori_id zori_set_flags(zori_id widget, enum zori_flag flags);
  408. /* Sets the whole style of a widget. */
  409. zori_id zori_set_style(zori_id id, struct zori_style * style);
  410. /* Sets the background color of the widget. */
  411. zori_id zori_set_background_color(zori_id id, zori_color color);
  412. /* Sets the foreground color of the widget. */
  413. zori_id zori_set_foreground_color(zori_id id, zori_color color);
  414. /* Creates a new frame widget. */
  415. zori_id zori_new_frame_widget(zori_id parent, zori_rebox box);
  416. /* Creates a new (vertical) menu widget. */
  417. zori_id zori_new_menu_widget(zori_id parent, zori_rebox box, char * text);
  418. /* Creates a new button widget. */
  419. zori_id zori_new_button_widget(zori_id parent, zori_rebox box, char * text);
  420. /* Creates a new conversation widget. */
  421. zori_id zori_new_conversation_widget(zori_id parent, zori_rebox box, char * text);
  422. /* Draws the whole UI and all visible parts. */
  423. void zori_draw_all(void);
  424. /* Updates the state of the UI. Pass in the time passed since last update. */
  425. void zori_update(double dt);
  426. /* Registers an event handler for a widget. */
  427. zori_id zori_register(zori_id id, zori_event_type type, zori_handler_func handler, void * extra);
  428. int zori_registry_entry_compare(const void *v1, const void *v2);
  429. zori_id zori_registry_init(struct zori_registry *registry);
  430. zori_id zori_registry_add(struct zori_registry *registry, zori_id id, struct zori_widget *widget);
  431. struct zori_registry_entry *zori_registry_lookup_entry(struct zori_registry *registry, zori_id id);
  432. struct zori_widget *zori_registry_lookup(struct zori_registry *registry, zori_id id);
  433. zori_id zori_registry_remove(struct zori_registry *registry, zori_id id);
  434. int zori_handler_compare(const void *v1, const void *v2);
  435. struct zori_handler *zori_handlers_add(struct zori_handlers *me, zori_event_type type, zori_handler_func *handler, void *data);
  436. void zori_handlers_done(struct zori_handlers *me);
  437. void zori_handlers_init(struct zori_handlers *me);
  438. struct zori_handler *zori_handlers_search(struct zori_handlers *me, zori_event_type type);
  439. int zori_handlers_handle(struct zori_handlers *me, union zori_event *event);
  440. int zori_widget_raise_system_event(struct zori_widget *widget, zori_system_event *sysev);
  441. int zori_widget_raise_draw_event(struct zori_widget *widget);
  442. int zori_widget_raise_done_event(struct zori_widget *widget);
  443. int zori_widget_raise_free_event(struct zori_widget *widget);
  444. int zori_widget_raise_update_event(struct zori_widget *widget, double dt);
  445. int zori_widget_raise_action_event(struct zori_widget *widget);
  446. int zori_widget_raise_close_event(struct zori_widget *widget, struct zori_widget * from);
  447. int zori_widget_compare(const void *v1, const void *v2);
  448. struct zori_widget *zori_get_widget(zori_id id);
  449. zori_id zori_get_unused_id(void);
  450. struct zori_handler *zori_widget_add_handler(struct zori_widget *widget, zori_event_type type, zori_handler_func *handler, void *data);
  451. struct zori_handler *zori_widget_add_handlers(struct zori_widget *widget, struct zori_handler *handlers, size_t amount);
  452. zori_id zori_start(struct zori_style *default_style);
  453. struct zori_widget *zori_widget_done(struct zori_widget *widget);
  454. void zori_widget_free(struct zori_widget *widget);
  455. struct zori_widget *zori_widget_add_child(struct zori_widget *parent, struct zori_widget *child);
  456. struct zori_widget *zori_widget_init(struct zori_widget *widget, zori_widget_type type, zori_id id, struct zori_widget *parent, zori_rebox *box, struct zori_style *style);
  457. zori_id zori_shutdown(void);
  458. struct zori_widget *zori_widget_initall(struct zori_widget *widget, zori_widget_type type, zori_id id, struct zori_widget *parent, zori_rebox *box, struct zori_style *style, struct zori_handler *handlers, size_t amount);
  459. void zori_draw_all(void);
  460. int zori_widget_visible(struct zori_widget *widget);
  461. int zori_widget_visible_(struct zori_widget *widget, int set);
  462. int zori_widget_active(struct zori_widget *widget);
  463. int zori_widget_active_(struct zori_widget *widget, int set);
  464. int zori_widget_hover(struct zori_widget *widget);
  465. int zori_widget_hover_(struct zori_widget *widget, int set);
  466. int zori_widget_marked(struct zori_widget *widget);
  467. int zori_widget_marked_(struct zori_widget *widget, int set);
  468. int zori_widget_active_(struct zori_widget *widget, int set);
  469. void zori_update(double dt);
  470. zori_font *zori_widget_font(struct zori_widget *widget);
  471. zori_color zori_widget_forecolor(struct zori_widget *widget);
  472. zori_color zori_widget_backcolor(struct zori_widget *widget);
  473. int zori_widget_h(struct zori_widget *widget);
  474. int zori_widget_w(struct zori_widget *widget);
  475. int zori_widget_x(struct zori_widget *widget);
  476. int zori_widget_y(struct zori_widget *widget);
  477. int zori_xy_inside_widget_p(struct zori_widget * widget, double x, double y);
  478. zori_font * zori_widget_text_font(struct zori_widget * widget);
  479. zori_font * zori_text_font(zori_id id);
  480. void zori_widget_drawroundframe(struct zori_widget *self);
  481. int zori_handle_system_event(zori_system_event * sysev);
  482. int zori_result(int zori_id);
  483. int zori_mark_widget(struct zori_widget * widget);
  484. #endif