8 sizes_[
"left"] = 200.f;
9 sizes_[
"right"] = 280.f;
11 sizes_[
"bottom"] = 24.f;
15 if (region !=
"left" && region !=
"right" && region !=
"top" && region !=
"bottom") {
16 throw Exception(
"EditorDock::setRegionSize: expected left|right|top|bottom");
18 if (
pixels < 0.f)
throw Exception(
"EditorDock::setRegionSize: size must be >= 0");
24float EditorDock::sizeOf(
const std::string ®ion)
const {
25 auto it = sizes_.find(region);
26 return it == sizes_.end() ? 0.f : it->second;
30 if (screenW <= 0.f || screenH <= 0.f) {
31 throw Exception(
"EditorDock::layout: screen size must be > 0");
33 float left = sizeOf(
"left");
34 float right = sizeOf(
"right");
35 float top = sizeOf(
"top");
36 float bottom = sizeOf(
"bottom");
49 rects_[
"top"] = {0.f, 0.f, screenW,
top};
50 rects_[
"bottom"] = {0.f, screenH -
bottom, screenW,
bottom};
56const EditorDock::Rect *EditorDock::rectOf(
const std::string ®ion)
const {
57 auto it = rects_.find(region);
58 return it == rects_.end() ? nullptr : &it->second;
62 const Rect *
r = rectOf(region);
63 if (!
r)
throw Exception(
"EditorDock::getRegionX: call layout() first / unknown region");
67 const Rect *
r = rectOf(region);
68 if (!
r)
throw Exception(
"EditorDock::getRegionY: call layout() first / unknown region");
72 const Rect *
r = rectOf(region);
73 if (!
r)
throw Exception(
"EditorDock::getRegionW: call layout() first / unknown region");
77 const Rect *
r = rectOf(region);
78 if (!
r)
throw Exception(
"EditorDock::getRegionH: call layout() first / unknown region");
EVENGINE_API_FOUNDATION public API.
float getRegionX(const std::string ®ion) const
Returns the region x.
void setRegionSize(const std::string ®ion, float pixels)
Sets the region size.
float getRegionY(const std::string ®ion) const
Returns the region y.
void layout(float screenW, float screenH)
Layout.
float getRegionW(const std::string ®ion) const
Returns the region w.
float getRegionH(const std::string ®ion) const
Returns the region h.
float getRegionSize(const std::string ®ion) const
Returns the region size.