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
/*
2
* This file is part of the Colobot: Gold Edition source code
3
* Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
4
* http://epsiteŃ.ch; http://colobot.info; http://github.com/colobot
5
*
6
* This program is free software: you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation, either version 3 of the License, or
9
* (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14
* See the GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program. If not, see http://gnu.org/licenses
18
*/
19
20
// control.h
21
22
#pragma once
23
24
#include <string>
25
26
#include "
common/event.h
"
27
#include "common/misc.h"
28
#include "
common/restext.h
"
29
30
#include "
graphics/core/device.h
"
31
#include "
graphics/engine/engine.h
"
32
#include "
graphics/engine/particle.h
"
33
#include "
graphics/engine/text.h
"
34
35
#include "
object/robotmain.h
"
36
37
#include "
sound/sound.h
"
38
39
40
41
namespace
Ui
{
42
43
enum
ControlState
44
{
45
STATE_ENABLE = (1<<0),
// active
46
STATE_CHECK = (1<<1),
// pressed
47
STATE_HILIGHT = (1<<2),
// overflown by mouse
48
STATE_PRESS = (1<<3),
// pressed by mouse
49
STATE_VISIBLE = (1<<4),
// visible
50
STATE_DEAD = (1<<5),
// inaccessible (x)
51
STATE_DEFAULT = (1<<6),
// actuated by RETURN
52
STATE_OKAY = (1<<7),
// green point at the bottom right
53
STATE_SHADOW = (1<<8),
// shadow
54
STATE_GLINT = (1<<9),
// dynamic reflection
55
STATE_CARD = (1<<10),
// tab
56
STATE_EXTEND = (1<<11),
// extended mode
57
STATE_SIMPLY = (1<<12),
// undecorated
58
STATE_FRAME = (1<<13),
// framework highlighting
59
STATE_WARNING = (1<<14),
// framework hatched yellow / black
60
STATE_VALUE = (1<<15),
// displays the value
61
STATE_RUN = (1<<16)
// running program
62
};
63
64
65
66
class
CControl
67
{
68
public
:
69
CControl
();
70
virtual
~
CControl
();
71
72
virtual
bool
Create(
Math::Point
pos,
Math::Point
dim,
int
icon,
EventType
eventType);
73
74
virtual
bool
EventProcess(
const
Event
&event);
75
76
virtual
void
SetPos(
Math::Point
pos);
77
virtual
Math::Point
GetPos();
78
virtual
void
SetDim(
Math::Point
dim);
79
virtual
Math::Point
GetDim();
80
virtual
bool
SetState(
int
state,
bool
bState);
81
virtual
bool
SetState(
int
state);
82
virtual
bool
ClearState(
int
state);
83
virtual
bool
TestState(
int
state);
84
virtual
int
GetState();
85
virtual
void
SetIcon(
int
icon);
86
virtual
int
GetIcon();
87
virtual
void
SetName(std::string name,
bool
bTooltip=
true
);
88
virtual
std::string GetName();
89
virtual
void
SetTextAlign(
Gfx::TextAlign
mode);
90
virtual
int
GetTextAlign();
91
virtual
void
SetFontSize(
float
size);
92
virtual
float
GetFontSize();
93
virtual
void
SetFontStretch(
float
stretch);
94
virtual
float
GetFontStretch();
95
virtual
void
SetFontType(
Gfx::FontType
font);
96
virtual
Gfx::FontType
GetFontType();
97
virtual
bool
SetTooltip(std::string name);
98
virtual
bool
GetTooltip(
Math::Point
pos, std::string &name);
99
virtual
void
SetFocus(
bool
bFocus);
100
virtual
bool
GetFocus();
101
102
virtual
EventType
GetEventType();
103
104
virtual
void
Draw();
105
106
protected
:
107
void
GlintDelete();
108
void
GlintCreate(
Math::Point
ref,
bool
bLeft=
true
,
bool
bUp=
true
);
109
void
GlintFrame(
const
Event
&event);
110
void
DrawPart(
int
icon,
float
zoom,
float
ex);
111
void
DrawIcon(
Math::Point
pos,
Math::Point
dim,
Math::Point
uv1,
Math::Point
uv2,
float
ex=0.0f);
112
void
DrawIcon(
Math::Point
pos,
Math::Point
dim,
Math::Point
uv1,
Math::Point
uv2,
Math::Point
corner,
float
ex);
113
void
DrawWarning(
Math::Point
pos,
Math::Point
dim);
114
void
DrawShadow(
Math::Point
pos,
Math::Point
dim,
float
deep=1.0f);
115
virtual
bool
Detect(
Math::Point
pos);
116
117
std::string GetResourceName(
EventType
eventType);
118
119
protected
:
120
Gfx::CEngine
* m_engine;
121
Gfx::CParticle
* m_particle;
122
CEventQueue
* m_event;
123
CRobotMain
* m_main;
124
CSoundInterface
* m_sound;
125
126
Math::Point
m_pos;
// corner upper / left
127
Math::Point
m_dim;
// dimensions
128
int
m_icon;
129
EventType
m_eventType;
// message to send when clicking
130
int
m_state;
// states (STATE_ *)
131
float
m_fontSize;
// size of the button name
132
float
m_fontStretch;
// stretch of the font
133
Gfx::FontType
m_fontType;
// type of font
134
Gfx::TextAlign
m_textAlign;
//type of alignment //comes in the place of m_justif
135
std::string m_name;
// name of the button
136
std::string m_tooltip;
// name of tooltip
137
bool
m_bFocus;
138
bool
m_bCapture;
139
140
bool
m_bGlint;
141
Math::Point
m_glintCorner1;
142
Math::Point
m_glintCorner2;
143
float
m_glintProgress;
144
Math::Point
m_glintMouse;
145
};
146
147
}
// namespace Ui
148
sound.h
Sound plugin interface.
engine.h
Main graphics engine - CEngine class.
Ui
Definition:
controller.h:32
text.h
Text rendering - CText class.
robotmain.h
CRobotMain - main class of Colobot game engine.
CEventQueue
Global event queue.
Definition:
event.h:751
CRobotMain
Definition:
robotmain.h:172
Gfx::CParticle
Particle engine.
Definition:
particle.h:268
restext.h
Translation and string resource utilities.
Math::Point
2D point
Definition:
point.h:49
Gfx::CEngine
The graphics engine.
Definition:
engine.h:684
event.h
Event types, structs and event queue.
Gfx::TextAlign
TextAlign
Type of text alignment.
Definition:
text.h:51
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:38
Event
Event sent by system, interface or game.
Definition:
event.h:678
Ui::CControl
Definition:
control.h:66
Gfx::FontType
FontType
Type of font.
Definition:
text.h:69
CSoundInterface
Sound plugin interface.
Definition:
sound.h:151
Generated by
1.8.8