00001 /* This source file is (c) 2010 - 2012 Volker Schatz 00002 It is licensed under Version 3 or later of the Gnu General Public License 00003 (see http://www.gnu.org/licenses/gpl.html for details) */ 00004 00019 #ifndef ILIAD_APP_H 00020 #define ILIAD_APP_H 00021 00022 #include <X11/Xlib.h> 00023 #include <gtk/gtkstyle.h> 00024 #include <gdk/gdkkeysyms.h> 00025 00026 int app_init(char *prgname); 00027 void app_exit(); 00028 GtkWidget *app_window(); 00029 Display *app_xdisplay(); 00030 Window app_xwindow(); 00031 00032 #define EV_SYS 0 00033 #define EV_KEY 1 00034 #define EV_PEN 2 00035 #define EV_TOOLBAR 3 00036 #define EV_PAGEBAR 4 00037 00038 #define EV_SYS_DELETE 0 00039 #define EV_SYS_EXPOSE 1 00040 00042 struct iliad_event_sys { 00043 unsigned short type; 00044 unsigned short subtype; 00045 }; 00046 00047 #define EV_KEY_ASCEND 0 00048 #define EV_KEY_FORW 1 00049 #define EV_KEY_BACK 2 00050 #define EV_KEY_UP 3 00051 #define EV_KEY_DOT 4 00052 #define EV_KEY_DOWN 5 00053 00055 struct iliad_event_key { 00056 unsigned short type; 00057 unsigned short key; 00058 unsigned short long_press; 00059 }; 00060 00062 struct iliad_event_pen { 00063 unsigned short type; 00065 unsigned short xfrom, yfrom, xto, yto; 00066 }; 00067 00069 struct iliad_event_toolbar { 00070 unsigned short type; 00072 unsigned short icon; 00074 unsigned short state; 00075 }; 00076 00078 struct iliad_event_pagebar { 00079 unsigned short type; 00080 unsigned short page; 00081 }; 00082 00084 typedef union { 00085 unsigned short type; 00086 struct iliad_event_sys sys; 00087 struct iliad_event_key key; 00088 struct iliad_event_pen pen; 00089 struct iliad_event_toolbar toolbar; 00090 struct iliad_event_pagebar pagebar; 00091 } 00092 iliad_event; 00093 00094 int app_events_pending(); 00095 void app_wait_event(iliad_event *ev); 00096 00097 #define SYNC_TOOLBAR 1 00098 #define SYNC_PAGEBAR 2 00099 00100 #define SYNC_OK 0 00101 #define SYNC_ERROR 1 00102 #define SYNC_TIMEOUT 2 00103 00104 int sync_bars(int mask); 00105 00106 FILE *app_debug(); 00107 00108 #endif 00109