Colobot
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Pages
src
ui
control.h
1
// * This file is part of the COLOBOT source code;
2
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
3
// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
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 3 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, see http://www.gnu.org/licenses/.
17
18
// control.h
19
20
#pragma once
21
22
#include <string>
23
24
#include "
common/event.h
"
25
#include "common/misc.h"
26
#include "
common/restext.h
"
27
28
#include "
graphics/core/device.h
"
29
#include "
graphics/engine/engine.h
"
30
#include "
graphics/engine/particle.h
"
31
#include "
graphics/engine/text.h
"
32
33
#include "
object/robotmain.h
"
34
35
#include "
sound/sound.h
"
36
37
38
39
namespace
Ui {
40
41
enum
ControlState
42
{
43
STATE_ENABLE = (1<<0),
// active
44
STATE_CHECK = (1<<1),
// pressed
45
STATE_HILIGHT = (1<<2),
// overflown by mouse
46
STATE_PRESS = (1<<3),
// pressed by mouse
47
STATE_VISIBLE = (1<<4),
// visible
48
STATE_DEAD = (1<<5),
// inaccessible (x)
49
STATE_DEFAULT = (1<<6),
// actuated by RETURN
50
STATE_OKAY = (1<<7),
// green point at the bottom right
51
STATE_SHADOW = (1<<8),
// shadow
52
STATE_GLINT = (1<<9),
// dynamic reflection
53
STATE_CARD = (1<<10),
// tab
54
STATE_EXTEND = (1<<11),
// extended mode
55
STATE_SIMPLY = (1<<12),
// undecorated
56
STATE_FRAME = (1<<13),
// framework highlighting
57
STATE_WARNING = (1<<14),
// framework hatched yellow / black
58
STATE_VALUE = (1<<15),
// displays the value
59
STATE_RUN = (1<<16)
// running program
60
};
61
62
63
64
class
CControl
65
{
66
public
:
67
CControl
();
68
virtual
~
CControl
();
69
70
virtual
bool
Create(
Math::Point
pos,
Math::Point
dim,
int
icon,
EventType
eventType);
71
72
virtual
bool
EventProcess(
const
Event
&event);
73
74
virtual
void
SetPos(
Math::Point
pos);
75
virtual
Math::Point
GetPos();
76
virtual
void
SetDim(
Math::Point
dim);
77
virtual
Math::Point
GetDim();
78
virtual
bool
SetState(
int
state,
bool
bState);
79
virtual
bool
SetState(
int
state);
80
virtual
bool
ClearState(
int
state);
81
virtual
bool
TestState(
int
state);
82
virtual
int
GetState();
83
virtual
void
SetIcon(
int
icon);
84
virtual
int
GetIcon();
85
virtual
void
SetName(std::string name,
bool
bTooltip=
true
);
86
virtual
std::string GetName();
87
virtual
void
SetTextAlign(
Gfx::TextAlign
mode);
88
virtual
int
GetTextAlign();
89
virtual
void
SetFontSize(
float
size);
90
virtual
float
GetFontSize();
91
virtual
void
SetFontStretch(
float
stretch);
92
virtual
float
GetFontStretch();
93
virtual
void
SetFontType(
Gfx::FontType
font);
94
virtual
Gfx::FontType
GetFontType();
95
virtual
bool
SetTooltip(std::string name);
96
virtual
bool
GetTooltip(
Math::Point
pos, std::string &name);
97
virtual
void
SetFocus(
bool
bFocus);
98
virtual
bool
GetFocus();
99
100
virtual
EventType
GetEventType();
101
102
virtual
void
Draw();
103
104
protected
:
105
void
GlintDelete();
106
void
GlintCreate(
Math::Point
ref,
bool
bLeft=
true
,
bool
bUp=
true
);
107
void
GlintFrame(
const
Event
&event);
108
void
DrawPart(
int
icon,
float
zoom,
float
ex);
109
void
DrawIcon(
Math::Point
pos,
Math::Point
dim,
Math::Point
uv1,
Math::Point
uv2,
float
ex=0.0f);
110
void
DrawIcon(
Math::Point
pos,
Math::Point
dim,
Math::Point
uv1,
Math::Point
uv2,
Math::Point
corner,
float
ex);
111
void
DrawWarning(
Math::Point
pos,
Math::Point
dim);
112
void
DrawShadow(
Math::Point
pos,
Math::Point
dim,
float
deep=1.0f);
113
virtual
bool
Detect(
Math::Point
pos);
114
115
protected
:
116
Gfx::CEngine
* m_engine;
117
Gfx::CParticle
* m_particle;
118
CEventQueue
* m_event;
119
CRobotMain
* m_main;
120
CSoundInterface
* m_sound;
121
122
Math::Point
m_pos;
// corner upper / left
123
Math::Point
m_dim;
// dimensions
124
int
m_icon;
125
EventType
m_eventType;
// message to send when clicking
126
int
m_state;
// states (STATE_ *)
127
float
m_fontSize;
// size of the button name
128
float
m_fontStretch;
// stretch of the font
129
Gfx::FontType
m_fontType;
// type of font
130
Gfx::TextAlign
m_textAlign;
//type of alignment //comes in the place of m_justif
131
std::string m_name;
// name of the button
132
std::string m_tooltip;
// name of tooltip
133
bool
m_bFocus;
134
bool
m_bCapture;
135
136
bool
m_bGlint;
137
Math::Point
m_glintCorner1;
138
Math::Point
m_glintCorner2;
139
float
m_glintProgress;
140
Math::Point
m_glintMouse;
141
};
142
143
}
// namespace Ui
144
sound.h
Sound plugin interface.
engine.h
Main graphics engine - CEngine class.
text.h
Text rendering - CText class.
robotmain.h
CRobotMain - main class of Colobot game engine.
CEventQueue
Global event queue.
Definition:
event.h:765
CRobotMain
Definition:
robotmain.h:191
Gfx::CParticle
Particle engine.
Definition:
particle.h:266
restext.h
Translation and string resource utilities.
Math::Point
2D point
Definition:
point.h:46
Gfx::CEngine
The graphics engine.
Definition:
engine.h:681
event.h
Event types, structs and event queue.
Gfx::TextAlign
TextAlign
Type of text alignment.
Definition:
text.h:49
particle.h
Particle rendering - CParticle class (aka particle)
device.h
Abstract graphics device - CDevice class and related structs/enums.
EventType
EventType
Type of event message.
Definition:
event.h:35
Event
Event sent by system, interface or game.
Definition:
event.h:687
Ui::CControl
Definition:
control.h:64
Gfx::FontType
FontType
Type of font.
Definition:
text.h:67
CSoundInterface
Sound plugin interface.
Definition:
sound.h:149
Generated on Thu Jan 2 2014 13:30:51 for Colobot by
1.8.5