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
control.cpp
Go to the documentation of this file.
1 /*
2  * Vega Strike
3  * Copyright (C) 2003 Mike Byron
4  *
5  * http://vegastrike.sourceforge.net/
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20  */
21 
22 #include "vegastrike.h"
23 
24 #include "control.h"
25 
26 //Line width for control outline.
27 static const float DEFAULT_OUTLINE_LINE_WIDTH = 1.0;
28 
29 //Whether the specified point is inside this control.
30 bool Control::hitTest( const Point &p )
31 {
32  const float maxX = m_rect.origin.x+m_rect.size.width;
33  const float maxY = m_rect.origin.y+m_rect.size.height;
34 
35  return p.x >= m_rect.origin.x && p.x < maxX && p.y >= m_rect.origin.y && p.y < maxY;
36 }
37 
38 //Draw window background.
40 {
41  if ( !isClear( m_color ) )
43  if ( !isClear( m_outlineColor ) )
45 }
46 
47 //CONSTRUCTION
49  m_rect( 0.0, 0.0, 0.0, 0.0 )
50  , m_id()
51  , m_color( GUI_OPAQUE_WHITE() )
52  , m_outlineColor( GUI_CLEAR )
53  , m_textColor( GUI_OPAQUE_BLACK() )
54  , m_font( 0.1 )
55  , m_hidden( false )
56 {}
57