Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

gui_component.hxx

Go to the documentation of this file.
00001 //  $Id: gui_component.hxx,v 1.11 2003/01/07 15:07:12 grumbel Exp $
00002 // 
00003 //  Construo - A wire-frame construction game
00004 //  Copyright (C) 2002 Ingo Ruhnke <[email protected]>
00005 //
00006 //  This program is free software; you can redistribute it and/or
00007 //  modify it under the terms of the GNU General Public License
00008 //  as published by the Free Software Foundation; either version 2
00009 //  of the License, or (at your option) any later version.
00010 //
00011 //  This program is distributed in the hope that it will be useful,
00012 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 //  GNU General Public License for more details.
00015 // 
00016 //  You should have received a copy of the GNU General Public License
00017 //  along with this program; if not, write to the Free Software
00018 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00019 
00020 #ifndef HEADER_CONSTRUO_GUI_COMPONENT_HXX
00021 #define HEADER_CONSTRUO_GUI_COMPONENT_HXX
00022 
00023 class GraphicContext;
00024 class GUIManager;
00025 
00027 class GUIComponent
00028 {
00029 protected:
00030   int x_pos;
00031   int y_pos;
00032   int width;
00033   int height;
00034   
00035 public:
00036   GUIComponent (int x_, int y_, int width_, int height_)
00037     : x_pos (x_), y_pos (y_), width (width_), height (height_)
00038   {}
00039 
00040   virtual ~GUIComponent () {}
00041 
00042   virtual void draw (GraphicContext* gc) =0;
00043 
00045   virtual bool is_at (int x, int y);
00046 
00047   void set_position (int x, int y) { x_pos = x, y_pos = y; }
00048   void set_width (int w) { width = w; }
00049   void set_height (int h) { height = h; }
00050   int  get_x_pos () { return x_pos; }
00051   int  get_y_pos () { return y_pos; }
00052   int  get_width () { return width; }
00053   int  get_height () { return height; }
00054 
00055   virtual void on_primary_button_press (int x, int y) {}
00056   virtual void on_primary_button_release (int x, int y) {}
00057 
00058   virtual void on_secondary_button_press (int x, int y) {}
00059   virtual void on_secondary_button_release (int x, int y) {}
00060 
00061   virtual void on_tertiary_button_press (int x, int y) {}
00062   virtual void on_tertiary_button_release (int x, int y) {}
00063 
00064   virtual void on_duplicate_press (int x, int y) {}
00065   virtual void on_delete_press (int x, int y) {}
00066   virtual void on_fix_press (int x, int y) {}
00067 
00068   virtual void on_mouse_enter () {}
00069   virtual void on_mouse_leave () {}
00070 
00071   virtual void wheel_up (int x, int y) {}
00072   virtual void wheel_down (int x, int y) {}
00073 
00074   virtual void on_button_press (int button_id, int x, int y) {}
00075 
00076   virtual void scroll_left () {}
00077   virtual void scroll_right () {}
00078   virtual void scroll_up () {}
00079   virtual void scroll_down () {}
00080 
00081   virtual void on_mouse_move (int x, int y, int of_x, int of_y) {}
00082 };
00083 
00084 #endif
00085 
00086 /* EOF */

Generated on Thu Jul 24 10:24:30 2003 for Construo by doxygen1.3-rc3