#ifndef PAGE_H #define PAGE_H #include "../include/osw-x.h" typedef struct _xsw_imglabel_struct xsw_imglabel_struct; #define XSW_IMGLABEL_STRUCT ((xsw_imglabel_struct *)(p)) typedef struct _page_struct page_struct; #define PAGE(p) ((page_struct *)(p)) typedef struct _page_label_struct page_label_struct; #define PAGE_LABEL(p) ((page_label_struct *)(p)) /* * Page Label States */ #define XSW_PAGE_LABEL_STATES 3 /* * Draw Amounts: */ #define PAGE_DRAW_AMOUNT_COMPLETE 0 /* * Background Image Draw Rules: */ #define PAGE_BKG_DRAW_TOFIT 0 #define PAGE_BKG_DRAW_TILED 1 /* * Label states: * * Highest must be one less than PAGE_LABELS_PER_LABEL. */ #define PAGE_LABEL_STATE_UNARMED 0 #define PAGE_LABEL_STATE_ARMED 1 #define PAGE_LABEL_STATE_HIGHLIGHTED 2 /* * XSW Image Label Type: */ struct _xsw_imglabel_struct { char *filename; bool_t pos_by_percent; /* If true, coordinates are calculated * by percent */ bool_t size_by_percent;/* If true, size is calculated by * percent */ int x, y; /* If pos_by_percent is true, this is * in percent */ image_t *image; }; /* * Page: */ struct _page_label_struct { bool_t map_state; bool_t allow_transparency; int op_code; /* One of XSW_ACTION_* */ xsw_imglabel_struct imglabel[XSW_PAGE_LABEL_STATES]; char *hint_mesg; }; struct _page_struct { bool_t map_state, has_focus; int x, y; unsigned int width, height; /* Background image */ char *bg_filename; image_t *bg_image; int bg_image_draw_code; /* One of PAGE_BKG_DRAW_* */ /* Selected label information */ int sel_label; /* -1 for none */ int sel_label_state; /* One of PAGE_LABEL_STATE_* */ /* Labels */ page_label_struct **label; int total_labels; }; /* page.cpp */ extern "C" int PageIsLabelAllocated(page_struct *p, int n); extern "C" int PageCreateLabel(page_struct *p); extern "C" int PageInit( page_struct *p, win_t w, shared_image_t *image ); extern "C" void PageResize( page_struct *p, win_t w, shared_image_t *image ); extern "C" void PageDrawLabel( page_struct *p, win_t w, shared_image_t *image, int mm_label_num, bool_t put_to_window ); extern "C" void PageDraw( page_struct *p, win_t w, shared_image_t *image, int amount, bool_t put_to_window ); extern "C" int PageManage( page_struct *p, win_t w, shared_image_t *image, event_t *event, const time_t cur_ms, const time_t cur_sec, const float tc ); extern "C" void PageMap( page_struct *p, win_t w, shared_image_t *image ); extern "C" void PageUnmap( page_struct *p, win_t w, shared_image_t *image ); extern "C" void PageDestroy( page_struct *p, win_t w, shared_image_t *image ); extern "C" void PageDoAction( page_struct *p, win_t w, shared_image_t *image, const int action ); /* pagefile.cpp */ extern "C" int PageFileOpen( page_struct *p, win_t w, shared_image_t *image, const char *filename ); #endif /* PAGE_H */