HoverRace
2.0
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
engine
Display
Label.h
Go to the documentation of this file.
1
2
// Label.h
3
//
4
// Copyright (c) 2013-2016 Michael Imamura.
5
//
6
// Licensed under GrokkSoft HoverRace SourceCode License v1.0(the "License");
7
// you may not use this file except in compliance with the License.
8
//
9
// A copy of the license should have been attached to the package from which
10
// you have taken this file. If you can not find the license you can not use
11
// this file.
12
//
13
//
14
// The author makes no representations about the suitability of
15
// this software for any purpose. It is provided "as is" "AS IS",
16
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
17
// implied.
18
//
19
// See the License for the specific language governing permissions
20
// and limitations under the License.
21
22
#pragma once
23
24
#include "
BaseText.h
"
25
26
#if defined(_WIN32) && defined(HR_ENGINE_SHARED)
27
# ifdef MR_ENGINE
28
# define MR_DllDeclare __declspec( dllexport )
29
# else
30
# define MR_DllDeclare __declspec( dllimport )
31
# endif
32
#else
33
# define MR_DllDeclare
34
#endif
35
36
namespace
HoverRace
{
37
namespace
Display {
38
class
Display;
39
}
40
}
41
42
namespace
HoverRace
{
43
namespace
Display {
44
51
class
MR_DllDeclare
Label
:
public
BaseText
52
{
53
using
SUPER
=
BaseText
;
54
55
public
:
56
struct
Props
57
{
58
enum
59
{
60
SCALE = SUPER::Props::NEXT_,
61
WRAP_WIDTH
,
62
NEXT_
,
63
};
64
};
65
66
public
:
67
Label
(
const
std::string &text,
const
UiFont
&font,
const
Color
color,
68
uiLayoutFlags_t
layoutFlags = 0);
69
Label
(
double
wrapWidth,
const
std::string &text,
const
UiFont
&font,
70
const
Color
color,
uiLayoutFlags_t
layoutFlags = 0);
71
virtual
~Label
() { }
72
73
public
:
74
void
AttachView
(
Display
&disp)
override
{ AttachViewDynamic(disp,
this
); }
75
76
public
:
83
bool
IsAutoWidth
()
const
{
return
wrapWidth <= 0; }
84
void
SetAutoWidth();
85
90
double
GetScale
()
const
{
return
scale; }
91
void
SetScale(
const
double
scale);
92
98
double
GetWrapWidth
()
const
{
return
wrapWidth; }
99
void
SetWrapWidth(
double
wrapWidth);
100
101
private
:
102
double
scale
;
103
double
wrapWidth
;
104
};
105
106
}
// namespace Display
107
}
// namespace HoverRace
108
109
#undef MR_DllDeclare
HoverRace::Display::Color
Definition:
Color.h:40
HoverRace::Display::Label::IsAutoWidth
bool IsAutoWidth() const
Check if automatic width sizing is enabled.
Definition:
Label.h:83
HoverRace::Display::Label::GetScale
double GetScale() const
Gets the scaling of this label.
Definition:
Label.h:90
HoverRace::Display::UiFont
Describes a font used for the UI.
Definition:
UiFont.h:44
HoverRace::Display::UiViewModel
Base class for UI (2D) components.
Definition:
UiViewModel.h:56
BaseText.h
HoverRace::Display::Label::Props
Definition:
Label.h:56
HoverRace::Display::Label
A static text label.
Definition:
Label.h:51
HoverRace::Display::uiLayoutFlags_t
MR_UInt32 uiLayoutFlags_t
Definition:
UiLayoutFlags.h:53
HoverRace::Display::Label::wrapWidth
double wrapWidth
Definition:
Label.h:103
HoverRace::Display::Label::AttachView
void AttachView(Display &disp) override
Definition:
Label.h:74
HoverRace::Display::Display
Base class for display managers.
Definition:
Display.h:73
HoverRace::Display::Label::Props::WRAP_WIDTH
Fired when a fixed width is set or auto-width is enabled.
Definition:
Label.h:61
MR_DllDeclare
#define MR_DllDeclare
Definition:
Label.h:33
HoverRace::Display::BaseText
Base class for widgets that display text.
Definition:
BaseText.h:46
HoverRace::Display::Label::Props::NEXT_
First index for subclasses.
Definition:
Label.h:62
HoverRace
Definition:
Announcement.h:24
HoverRace::Display::Label::scale
double scale
Definition:
Label.h:102
HoverRace::Display::Label::~Label
virtual ~Label()
Definition:
Label.h:71
HoverRace::Display::Label::GetWrapWidth
double GetWrapWidth() const
Returns the set width, if a fixed width is set.
Definition:
Label.h:98
1.8.11