/*************************************************************************** * gui.h * * 2011-03-10 * Copyright 2011 Steffen Pohle * steffen@gulpe.de ****************************************************************************/ /* * This program 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 Foundation; either version 2 of the License, or * (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _GUI_H_ #define _GUI_H_ #include "osmroute.h" #define GUI_TEXTLEN 256 #define GUI_MAX_ITEM 256 enum { EGUI_NONE, EGUI_KEYPRESSED, EGUI_KEYRELEASED, EGUI_MOUSEMOVE, EGUI_MOUSEPRESSED, EGUI_MOUSERELEASED }; enum { GUI_NONE, GUI_BUTTON, GUI_LIST, GUI_ENTRY, GUI_CHECKBOX, GUI_LABEL }; /* * styles for the windows.. */ #define WGUI_S_VCENTER 0x0003 #define WGUI_S_VLEFT 0x0002 #define WGUI_S_VRIGHT 0x0001 #define WGUI_S_HCENTER 0x000C #define WGUI_S_HTOP 0x0004 #define WGUI_S_HBOTTOM 0x0008 #define WGUI_S_NOTITLE 0x0010 // #define WGUI_S_**** 0x0080 #define WGUI_S_MODAL 0x0100 struct _GUIEvent_ { int event; uint32_t keyval; // needed for utf8 (max was 32bit?) iPoint mousepos; int mousebtn; } typedef GUIEvent; struct _GUIButton_ { int x, y, w, h; int id; char caption[GUI_TEXTLEN]; struct color *col; struct color *textcol; void (*callback_clicked) (int x, int y); void (*callback_draw) (struct _GUIButton_ *btn); } typedef GUIButton; struct _GUIList_ { int x, y, w, h; int id; char **data; int vs; // first element to draw int selected; void (*callback_selectitem) (int nr); } typedef GUIList; struct { int x, y; int id; char text[GUI_TEXTLEN]; struct color *textcol; } typedef GUILabel; struct { int x, y, w, h; int id; char text[GUI_TEXTLEN]; int curpos; int overwrite; void (*callback_enter) (); void (*callback_changed) (); } typedef GUIEntry; struct { int x, y, w, h; int id; char text[GUI_TEXTLEN]; int checked; void (*callback_changed) (); } typedef GUICheckbox; struct _GUIItem_ { int type; void *item; } typedef GUIItem; struct _GUIWindow_ { void (*callback_close) (); struct _GUIWindow_ *parent; struct image *screen; int screen_changed; char title[GUI_TEXTLEN]; int x; int y; int w; int h; int style; GUIItem items[GUI_MAX_ITEM]; void *focus; } typedef GUIWindow; extern GUIWindow *currentwin; extern void gui_show (GUIWindow *win); extern void gui_draw (); extern void gui_close (); extern int gui_event (GUIEvent event); extern void guiwindow_new (GUIWindow *win, int w, int h, char *title); extern void guiwindow_close (GUIWindow *win); /* button functions */ extern void gui_button_draw (GUIButton *button); /* label functions */ extern void gui_label_draw (GUILabel *label); /* entry functions */ extern void gui_entry_draw (GUIEntry *entry); extern void gui_entry_event (GUIEntry *entry, GUIEvent *event); /* list functions */ extern void gui_list_draw (GUIList *list); extern void gui_list_event (GUIList *list, GUIEvent *event); extern void gui_list_setselect (GUIList *list); /************************************************************************** * gui windows */ extern void gui_search_show (); extern void gui_fav_show (); extern void gui_mainmenu_show (); extern void gui_buttons_show (); extern void gpswin_show (); #endif