- added worldmap stuff
[supertux.git] / src / button.h
1 //
2 // C Interface: button
3 //
4 // Description:
5 //
6 //
7 // Author: Tobias Glaesser <tobi.web@gmx.de>, (C) 2004
8 //
9 // Copyright: See COPYING file that comes with this distribution
10 //
11 //
12
13 #ifndef SUPERTUX_BUTTON_H
14 #define SUPERTUX_BUTTON_H
15
16 #include "texture.h"
17
18 enum {
19   BN_CLICKED,
20   BN_PRESSED,
21   BN_HOVER
22 };
23
24 typedef struct button_type
25   {
26     texture_type icon;
27     texture_type* bkgd;
28     char *info;
29     SDLKey shortcut;
30     int x;
31     int y;
32     int w;
33     int h;
34     int show_info;
35     int state;
36     int tag;
37   }
38 button_type;
39
40 void button_load(button_type* pbutton,char* icon_file, char* info, SDLKey shortcut, int x, int y);
41 button_type* button_create(char* icon_file, char* info, SDLKey shortcut, int x, int y);
42 button_type* button_change_icon(button_type* pbutton,char* icon_file);
43 void button_draw(button_type* pbutton);
44 void button_free(button_type* pbutton);
45 void button_event(button_type* pbutton, SDL_Event* event);
46 int button_get_state(button_type* pbutton);
47
48 typedef struct button_panel_type
49   {
50     int num_items;
51     int hidden;
52     int x,y;
53     int w,h;
54     button_type* item;
55   }
56 button_panel_type;
57
58 void button_panel_init(button_panel_type* pbutton_panel, int x, int y, int w, int h);
59 void button_panel_free(button_panel_type* pbutton_panel);
60 void button_panel_draw(button_panel_type* pbutton_panel);
61 void button_panel_additem(button_panel_type* pbutton_panel, button_type* pbutton, int tag);
62 button_type* button_panel_event(button_panel_type* pbutton_panel, SDL_Event* event);
63
64 #endif /*SUPERTUX_BUTTON_H*/