1 // $Id: gui_buttons.hxx,v 1.7 2003/01/10 20:44:09 grumbel Exp $
3 // Construo - A wire-frame construction game
4 // Copyright (C) 2002 Ingo Ruhnke <grumbel@gmx.de>
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 #ifndef HEADER_CONSTRUO_GUI_BUTTONS_HXX
21 #define HEADER_CONSTRUO_GUI_BUTTONS_HXX
24 #include "gui_component.hxx"
27 class GUIButton
: public GUIComponent
36 GUIButton (const std::string
& title
, int x_pos_
, int y_pos_
, int width_
, int height_
);
38 void draw_border_hover(GraphicContext
*);
39 void draw_border_pressed(GraphicContext
*);
40 void draw_border_normal(GraphicContext
*);
42 void on_mouse_enter ();
43 void on_mouse_leave ();
45 void on_primary_button_press (int x
, int y
);
46 void on_primary_button_release (int x
, int y
);
48 void draw (GraphicContext
*);
50 virtual void draw_content (GraphicContext
*);
51 virtual void on_click ();
54 class GUIRunButton
: public GUIButton
58 void draw_content (GraphicContext
*);
62 class GUISlowMoButton
: public GUIButton
66 void draw_content (GraphicContext
*);
70 class GUIZoomInButton
: public GUIButton
77 class GUIZoomOutButton
: public GUIButton
85 class GUIQuitButton
: public GUIButton
92 class GUILoadButton
: public GUIButton
99 inline bool always_false()
104 class GUIGenericButton
: public GUIButton
107 typedef void (*Func
)();
108 typedef bool (*HighlightFunc
)();
112 GUIGenericButton (const std::string
& title
, int x
, int y
, int width
, int height
,
113 Func f
, HighlightFunc h
= always_false
)
114 : GUIButton (title
, x
, y
, width
, height
),
125 void draw_content (GraphicContext
* gc
)
128 gc
->draw_fill_rect (x_pos
, y_pos
,
129 x_pos
+ width
, y_pos
+ height
, Colors::button_bg_active
);
131 GUIButton::draw_content (gc
);