Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
button.h
Go to the documentation of this file.
1 /***************************************************************************
2 * button.h - description
3 * --------------------------
4 * begin : January 10, 2002
5 * copyright : (C) 2002 by David Ranger
6 * email : ussreliant@users.sourceforge.net
7 ***************************************************************************/
8 
9 /***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * any later version. *
15 * *
16 ***************************************************************************/
17 
18 #ifndef GUI_BUTTON_H
19 #define GUI_BUTTON_H
20 
21 //Version: 1.0 - Initial Release (Feb 18, 2002)
22 
23 /* This class is designed to be self sufficient.
24  * The only external functions it requires that aren't provided by system libs are in glut_support.h
25  */
26 
27 #if defined (__APPLE__) || defined (MACOSX)
28  #include <OpenGL/gl.h>
29  #include <GLUT/glut.h>
30 #else
31 #ifdef _WIN32
32  #ifndef NOMINMAX
33  #define NOMINMAX
34  #endif //tells VCC not to generate min/max macros
35  #include <windows.h>
36 #else
37  #include <GL/gl.h>
38 #endif
39  #include <GL/glut.h>
40 #endif
41 
42 #include "glut_support.h"
43 
44 class Button
45 {
46 public: Button( float x, float y, float wid, float hei, const char *name );
47  ~Button( void );
48 
49  void Refresh( void );
50 
51  int MouseClick( int button, int state, float x, float );
52  int MouseMove( float x, float y );
53  int MouseMoveClick( float x, float y );
54  int DoMouse( int type, float x, float y, int button, int state );
55  void ModifyName( const char *newname );
56 private:
57 //Stores the location and label of the button
58  float xcoord;
59  float ycoord;
60  float width;
61  float height;
62  char *label;
63 
64 //Flag that says wether or not to highlight the button
65  int highlight;
66 
67  int Inside( float x, float y );
68 };
69 
70 #endif //GUI_BUTTON_H
71