1 /***************************************************************************
2 						guibutton.h    -  description
3 							-------------------
4 	begin                : march 22th, 2004
5 	copyright            : (C) 2004-2008 by Duong Khang NGUYEN
6 	email                : neoneurone @ gmail com
7 
8 	$Id: guibutton.h 375 2008-10-28 14:47:15Z neoneurone $
9  ***************************************************************************/
10 
11 /***************************************************************************
12  *                                                                         *
13  *   This program is free software; you can redistribute it and/or modify  *
14  *   it under the terms of the GNU General Public License as published by  *
15  *   the Free Software Foundation; either version 2 of the License, or     *
16  *   any later version.                                                    *
17  *                                                                         *
18  ***************************************************************************/
19 
20 #ifndef _OPENCITY_GUIBUTTON_H_
21 #define _OPENCITY_GUIBUTTON_H_ 1
22 
23 #include "guimain.h"
24 #include "texture.h"
25 
26 #define GUIBUTTON_POSITION_1		19, 73, 30, 30
27 #define GUIBUTTON_POSITION_2		19, 33, 30, 30
28 #define GUIBUTTON_POSITION_3		55, 13, 30, 30
29 #define GUIBUTTON_POSITION_4		91, 33, 30, 30
30 #define GUIBUTTON_POSITION_5		91, 73, 30, 30
31 #define GUIBUTTON_POSITION_6		55, 93, 30, 30
32 
33 
34 //========================================================================
35 /** One or two states button: onMouseOver and onMouseOut. The default
36 is a two state button
37 */
38 class GUIButton : public GUIMain {
39 public:
40 	GUIButton();
41 	GUIButton(
42 		const int& rciX,
43 		const int& rciY,
44 		const uint& rcuiW,
45 		const uint& rcuiH,
46 		const string& strFile,
47 		uint numberState = 2 );
48 	~GUIButton();
49 
50 
51 	void
52 	SetBackground(
53 		const Color& color );
54 
55 	void
56 	SetForeground(
57 		const Color& color );
58 
59 
60 //========================================================================
61 // Inherited methods from GUIMain
62 //========================================================================
63 	void
64 	Display() const;
65 
66 
67 //========================================================================
68 // Inherited methods from UI
69 //========================================================================
70 	void Keyboard( const SDL_KeyboardEvent& rcEvent );
71 	void MouseMotion( const SDL_MouseMotionEvent& rcEvent );
72 	void MouseButton( const SDL_MouseButtonEvent& rcEvent );
73 	void Expose( const SDL_ExposeEvent& rcEvent );
74 	void Resize( const SDL_ResizeEvent& rcEvent );
75 
76 
77 private:
78 	uint		_uiNumberState;				///< Number of state (default is 2)
79 	Texture		moTextureNormal;			///< Inactive button texture
80 	Texture		moTextureOver;				///< On mouse over button texture
81 
82 	Color		_cForeground;				///< Foreground color
83 	Color		_cBackground;				///< Background color
84 };
85 
86 #endif
87 
88 
89 
90 
91 
92 
93 
94 
95 
96 
97 
98 
99 
100 
101 
102 
103 
104 
105 
106 
107 
108 
109 
110 
111 
112 
113 
114 
115 
116 
117 
118