Colobot
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
src
ui
controls
list.h
1
/*
2
* This file is part of the Colobot: Gold Edition source code
3
* Copyright (C) 2001-2016, Daniel Roux, EPSITEC SA & TerranovaTeam
4
* http://epsitec.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
#pragma once
21
22
#include "ui/controls/control.h"
23
24
#include "
common/event.h
"
25
26
#include "
graphics/engine/text.h
"
27
28
#include "ui/controls/button.h"
29
#include "ui/controls/scroll.h"
30
31
#include <array>
32
#include <memory>
33
34
namespace
Ui
35
{
36
37
const
int
LISTMAXDISPLAY = 20;
// maximum number of visible lines
38
39
40
41
class
CList
:
public
CControl
42
{
43
public
:
44
CList
();
45
~
CList
();
46
47
bool
Create(
Math::Point
pos,
Math::Point
dim,
int
icon,
EventType
eventMsg,
float
expand);
48
49
void
SetPos(
Math::Point
pos)
override
;
50
void
SetDim(
Math::Point
dim)
override
;
51
52
bool
SetState(
int
state,
bool
bState)
override
;
53
bool
SetState(
int
state)
override
;
54
bool
ClearState(
int
state)
override
;
55
56
bool
EventProcess(
const
Event
&event)
override
;
57
void
Draw()
override
;
58
59
void
Flush();
60
61
void
SetTotal(
int
i);
62
int
GetTotal();
63
64
void
SetSelect(
int
i);
65
int
GetSelect();
66
67
void
SetSelectCap(
bool
bEnable);
68
bool
GetSelectCap();
69
70
void
SetBlink(
bool
bEnable);
71
bool
GetBlink();
72
73
void
SetItemName(
int
i,
const
std::string& name);
74
const
std::string& GetItemName(
int
i);
75
76
void
SetCheck(
int
i,
bool
bMode);
77
bool
GetCheck(
int
i);
78
79
void
SetEnable(
int
i,
bool
enable);
80
bool
GetEnable(
int
i);
81
82
void
SetTabs(
int
i,
float
pos,
Gfx::TextAlign
justif=Gfx::TEXT_ALIGN_LEFT);
83
float
GetTabs(
int
i);
84
85
void
ShowSelect(
bool
bFixed);
86
87
EventType
GetEventMsgButton(
int
i);
88
EventType
GetEventMsgScroll();
89
90
protected
:
91
bool
MoveAdjust();
92
void
UpdateButton();
93
void
UpdateScroll();
94
void
MoveScroll();
95
void
DrawCase(
const
char
* text,
Math::Point
pos,
float
width,
Gfx::TextAlign
justif);
96
97
private
:
98
// Overridden to avoid warning about hiding the virtual function
99
bool
Create(
Math::Point
pos,
Math::Point
dim,
int
icon,
EventType
eventType)
override
;
100
101
protected
:
102
std::array<std::unique_ptr<CButton>, LISTMAXDISPLAY> m_buttons;
103
std::unique_ptr<CScroll> m_scroll;
104
105
float
m_expand;
106
int
m_totalLine;
// total number of lines
107
int
m_displayLine;
// number of visible lines
108
int
m_selectLine;
// selected line
109
int
m_firstLine;
// first visible line
110
bool
m_bBlink;
111
bool
m_bSelectCap;
112
float
m_blinkTime;
113
float
m_tabs[10];
114
Gfx::TextAlign
m_justifs[10];
115
116
struct
Item
117
{
118
std::string text =
""
;
119
bool
check =
false
;
120
bool
enable =
true
;
121
};
122
std::vector<Item> m_items;
123
};
124
125
126
}
// namespace Ui
Ui
Definition:
robotmain.h:108
text.h
Text rendering - CText class.
Ui::CList
Definition:
list.h:41
Math::Point
2D point
Definition:
point.h:50
Ui::CList::Item
Definition:
list.h:116
event.h
Event types, structs and event queue.
Gfx::TextAlign
TextAlign
Type of text alignment.
Definition:
text.h:54
EventType
EventType
Type of event message.
Definition:
event.h:41
Event
Event sent by system, interface or game.
Definition:
event.h:735
Ui::CControl
Definition:
control.h:65
Generated by
1.8.11