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