Fixed includes and bugs so that it compiles
[construo.git] / gui_component.hxx
blob1195aa920e8337963e2206828dd16af20e231866
1 // $Id: gui_component.hxx,v 1.14 2003/07/28 22:46:48 grumbel Exp $
2 //
3 // Construo - A wire-frame construction game
4 // Copyright (C) 2002 Ingo Ruhnke <grumbel@gmx.de>
5 //
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.
15 //
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_COMPONENT_HXX
21 #define HEADER_CONSTRUO_GUI_COMPONENT_HXX
23 class GraphicContext;
24 class GUIManager;
26 /** A thing that is under the controll of the GUIManager */
27 class GUIComponent
29 protected:
30 int x_pos;
31 int y_pos;
32 int width;
33 int height;
35 public:
36 GUIComponent (int x_, int y_, int width_, int height_)
37 : x_pos (x_), y_pos (y_), width (width_), height (height_)
40 virtual ~GUIComponent () {}
42 virtual void draw (GraphicContext* gc) =0;
44 /** @return true if the component is present at the given location */
45 virtual bool is_at (int x, int y);
47 void set_position (int x, int y) { x_pos = x, y_pos = y; }
48 void set_width (int w) { width = w; }
49 void set_height (int h) { height = h; }
50 int get_x_pos () { return x_pos; }
51 int get_y_pos () { return y_pos; }
52 int get_width () { return width; }
53 int get_height () { return height; }
55 virtual void on_primary_button_press (int x, int y) {}
56 virtual void on_primary_button_release (int x, int y) {}
58 virtual void on_secondary_button_press (int x, int y) {}
59 virtual void on_secondary_button_release (int x, int y) {}
61 virtual void on_tertiary_button_press (int x, int y) {}
62 virtual void on_tertiary_button_release (int x, int y) {}
64 // FIXME: Join these under some generic event handling, like:
65 // void on_button_press(int button_id, int x, int y);
66 virtual void on_scale_press(int x, int y) {}
67 virtual void on_grid_press(int x, int y) {}
68 virtual void on_duplicate_press (int x, int y) {}
69 virtual void on_delete_press (int x, int y) {}
70 virtual void on_fix_press (int x, int y) {}
71 virtual void on_join_press (int x, int y) {}
73 virtual void on_mouse_enter () {}
74 virtual void on_mouse_leave () {}
76 virtual void wheel_up (int x, int y) {}
77 virtual void wheel_down (int x, int y) {}
79 virtual void on_button_press (int button_id, int x, int y) {}
81 virtual void scroll_left () {}
82 virtual void scroll_right () {}
83 virtual void scroll_up () {}
84 virtual void scroll_down () {}
86 virtual void on_mouse_move (int x, int y, int of_x, int of_y) {}
89 #endif
91 /* EOF */