1 /*
2  * Button.h
3  * Copyright (C) 2007 by Bryan Duff <duff0097@gmail.com>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
18  * USA
19  */
20 #ifndef _GUI_BUTTON_H_
21 #define _GUI_BUTTON_H_
22 
23 #include <string>
24 #include <GL/gl.h>
25 #include <GL/glu.h>
26 
27 #include "Quaternions.h"
28 #include "Window.h"
29 
30 /* Currently this is only a logical button (it doesn't display anything)
31  * it consists only of state information.
32  * TODO: DrawButton() would consist of drawing a child text and image window.
33  */
34 
35 class Button : public Window {
36 public:
37   Button();
38   Button(float xpos, float ypos, float xwidth, float yheight);
~Button()39   ~Button() {};
40   void setButton(float xpos, float ypos, float xwidth, float yheight);
41   bool isMouseOver(bool recalc, float _xpos=0, float _ypos=0);
setPressed(bool _pressed)42   void setPressed(bool _pressed) { pressed = _pressed; }
isPressed()43   bool isPressed() { return pressed; }
44 
45 private:
46   GLfloat xpos, ypos;
47   GLfloat xwidth, yheight;
48   bool mouseover;
49   bool pressed;
50 };
51 
52 #endif
53