Space also hits menus.
[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     char *info;
28     SDLKey shortcut;
29     int x;
30     int y;
31     int w;
32     int h;
33     int show_info;
34     int state;
35   }
36 button_type;
37
38 void button_load(button_type* pbutton,char* icon_file, char* info, SDLKey shortcut, int x, int y);
39 button_type* button_create(char* icon_file, char* info, SDLKey shortcut, int x, int y);
40 void button_draw(button_type* pbutton);
41 void button_free(button_type* pbutton);
42 void button_event(button_type* pbutton, SDL_Event* event);
43 int button_get_state(button_type* pbutton);
44
45 typedef struct button_panel_type
46   {
47     int num_items;
48     int x,y;
49     int w,h;
50     button_type* item;
51   }
52 button_panel_type;
53
54 void button_panel_init(button_panel_type* pbutton_panel, int x, int y, int w, int h);
55 void button_panel_free(button_panel_type* pbutton_panel);
56 void button_panel_draw(button_panel_type* pbutton_panel);
57 void button_panel_additem(button_panel_type* pbutton_panel, button_type* pbutton);
58
59 #endif /*SUPERTUX_BUTTON_H*/