You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
178 lines
4.0 KiB
178 lines
4.0 KiB
/***************************************************************************
|
|
* 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;
|
|
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;
|
|
char **data;
|
|
int vs; // first element to draw
|
|
int selected;
|
|
void (*callback_selectitem) (int nr);
|
|
} typedef GUIList;
|
|
|
|
|
|
struct {
|
|
int x, y;
|
|
char text[GUI_TEXTLEN];
|
|
struct color *textcol;
|
|
} typedef GUILabel;
|
|
|
|
|
|
struct {
|
|
int x, y, w, h;
|
|
char text[GUI_TEXTLEN];
|
|
int curpos;
|
|
int overwrite;
|
|
void (*callback_enter) ();
|
|
void (*callback_changed) ();
|
|
} typedef GUIEntry;
|
|
|
|
|
|
struct {
|
|
int x, y, w, h;
|
|
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];
|
|
GUIItem *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 gui_window_new (GUIWindow *win, int w, int h, char *title);
|
|
extern void gui_window_close (GUIWindow *win);
|
|
|
|
/* button functions */
|
|
extern void gui_button_draw (GUIButton *button);
|
|
extern GUIButton *gui_button_new (char *name, int x, int y, int w, int h);
|
|
|
|
/* label functions */
|
|
extern void gui_label_draw (GUILabel *label);
|
|
extern GUILabel *gui_label_new (char *name, int x, int y);
|
|
|
|
/* entry functions */
|
|
extern void gui_entry_draw (GUIEntry *entry);
|
|
extern void gui_entry_event (GUIEntry *entry, GUIEvent *event);
|
|
extern GUIEntry *gui_entry_new (char *text, int x, int y, int w, int h);
|
|
|
|
/* 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);
|
|
extern GUIList *gui_list_new (int x, int y, int w, int h);
|
|
|
|
/**************************************************************************
|
|
* 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
|