-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPanel.cpp
More file actions
56 lines (48 loc) · 1.08 KB
/
Copy pathPanel.cpp
File metadata and controls
56 lines (48 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include "Panel.h"
namespace FD2D
{
Panel::Panel()
: Wnd()
{
}
Panel::Panel(const std::wstring& name)
: Wnd(name)
{
}
void Panel::SetSpacing(float spacing)
{
m_spacing = spacing;
}
float Panel::Spacing() const
{
return m_spacing;
}
Size Panel::Measure(Size available)
{
// Base Panel defers to children Measure pass; default desired is max of children.
Size maxSize {};
for (auto& child : ChildrenInOrder())
{
if (child)
{
Size s = child->Measure(available);
maxSize.w = (std::max)(maxSize.w, s.w);
maxSize.h = (std::max)(maxSize.h, s.h);
}
}
m_desired = maxSize;
return m_desired;
}
void Panel::Arrange(Rect finalRect)
{
m_bounds = finalRect;
m_layoutRect = ToD2D(finalRect);
for (auto& child : ChildrenInOrder())
{
if (child)
{
child->Arrange(finalRect);
}
}
}
}