Debian Codegraph @

src/guilabel.h

raw symbols SCIP
1 /***************************************************************************
2 guilabel.h - description
3 -------------------
4 begin : december, 10th 2006
5 copyright : (C) 2006 by Duong Khang NGUYEN
6 email : neoneurone @ gmail com
7
8 $Id: guilabel.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_GUILABEL_H_
21 #define _OPENCITY_GUILABEL_H_ 1
22
23 #include "guimain.h"
24
25
26 //========================================================================
27 /** A label GUI control is used to display a static text in 2D
28 */
29 class GUILabel : public GUIMain {
30 public:
31 enum OPENCITY_TEXT_ALIGN {
32 OC_ALIGN_LEFT,
33 OC_ALIGN_RIGHT,
34 OC_ALIGN_CENTER
35 };
36
37
38 //========================================================================
39 /** Create a new label control. The default alignment is from the left
40 and it can not be changed.
41 \param ciX,ciY The 2D coordinates of the control
42 \param rcsText The text of the control
43 */
44 GUILabel(
45 const int ciX,
46 const int ciY,
47 const string& rcsText );
48
49
50 //========================================================================
51 GUILabel(
52 const int ciX,
53 const int ciY,
54 const uint cuiW,
55 const uint cuiH,
56 const string& rcsText );
57
58
59 ~GUILabel();
60
61
62 //========================================================================
63 void
64 SetAlign( const OPENCITY_TEXT_ALIGN align );
65
66 OPENCITY_TEXT_ALIGN
67 GetAlign() const;
68
69 void
70 SetText( const string& rcsText );
71
72 string
73 GetText() const;
74
75 void
76 SetForeground( const Color& color );
77
78
79 //========================================================================
80 // Inherited methods from GUIMain
81 //========================================================================
82 void
83 Display() const;
84
85
86 //========================================================================
87 // Inherited methods from UI
88 //========================================================================
89 void Keyboard( const SDL_KeyboardEvent& rcEvent );
90 void MouseMotion( const SDL_MouseMotionEvent& rcEvent );
91 void MouseButton( const SDL_MouseButtonEvent& rcEvent );
92 void Expose( const SDL_ExposeEvent& rcEvent );
93 void Resize( const SDL_ResizeEvent& rcEvent );
94
95
96 private:
97 OPENCITY_TEXT_ALIGN _eAlign; ///< The text alignment attribute
98 string _sText; ///< The text of the label
99 Color _cForeground; ///< The color of the label
100
101 static uint _uiLabelNumber;
102 static GLuint _uiFontBase;
103
104
105 //========================================================================
106 // Private methods
107 //========================================================================
108 void _CreateFont();
109 void _DeleteFont();
110 };
111
112 #endif
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144