YAPOG
0.0.1
Yet Another Pokemon Online Game
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
PictureBox.cpp
Go to the documentation of this file.
1
#include "
YAPOG/Graphics/Gui/PictureBox.hpp
"
2
#include "
YAPOG/Graphics/IDrawingContext.hpp
"
3
#include "
YAPOG/Graphics/Gui/Padding.hpp
"
4
#include "
YAPOG/Graphics/Gui/WidgetBorder.hpp
"
5
#include "
YAPOG/Graphics/Game/Sprite/ISprite.hpp
"
6
7
namespace
yap
8
{
9
PictureBox::PictureBox
()
10
: picture_ (nullptr)
11
{
12
}
13
14
PictureBox::~PictureBox
()
15
{
16
}
17
18
Vector2
PictureBox::HandleGetSize
()
const
19
{
20
return
Vector2
(
21
padding_
.
left
+
picture_
->
GetSize
().x +
padding_
.
right
,
22
padding_
.
top
+
picture_
->
GetSize
().y +
padding_
.
bottom
)
23
+ ((
border_
!=
nullptr
) ?
border_
->
GetSize
() :
Vector2
());
24
}
25
26
bool
PictureBox::IsFocusable
()
const
27
{
28
return
false
;
29
}
30
31
void
PictureBox::HandleDraw
(
IDrawingContext
& context)
32
{
33
picture_
->
Draw
(context);
34
}
35
36
void
PictureBox::HandleShow
(
bool
isVisible)
37
{
38
}
39
40
void
PictureBox::HandleMove
(
const
Vector2
& offset)
41
{
42
picture_
->
Move
(offset);
43
//picture_->SetPosition (GetPosition() + offset);
44
}
45
46
void
PictureBox::HandleScale
(
const
Vector2
& factor)
47
{
48
Vector2
base =
picture_
->
GetSize
();
49
Vector2
neo (base.x * factor.x, base.y * factor.y);
50
51
picture_
->
SetSize
(neo);
52
}
53
54
void
PictureBox::HandleUpdate
(
const
Time
& dt)
55
{
56
}
57
58
void
PictureBox::HandleChangeColor
(
const
sf::Color& color)
59
{
60
picture_
->
ChangeColor
(color);
61
}
62
63
const
ISprite
&
PictureBox::GetPicture
()
const
64
{
65
return
*
picture_
;
66
}
67
68
void
PictureBox::SetPicture
(
ISprite
* picture)
69
{
70
if
(
picture_
!=
nullptr
)
71
delete
picture_
;
72
73
picture_
= picture;
74
75
picture_
->
SetPosition
(
Vector2
(
GetPosition
().x +
padding_
.
left
,
76
GetPosition
().y +
padding_
.
top
));
77
78
BaseWidget::Refresh
();
79
}
80
}
//namespace yap
YAPOG
src
YAPOG
Graphics
Gui
PictureBox.cpp
Generated on Mon Sep 17 2012 22:24:26 for YAPOG by
1.8.1.1