aboutsummaryrefslogtreecommitdiff
path: root/src/gui/Subsection.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-11-13 22:18:30 +0100
committerdec05eba <dec05eba@protonmail.com>2024-11-13 22:36:55 +0100
commit4ba1e814b748d57631f6b7afb7eaa63e8435c24e (patch)
treeaa49caab6f299fb42f404ace5907025616aad553 /src/gui/Subsection.cpp
parent590428425e8d35c96fffca666a50755a65c1cdba (diff)
Add application audio option
Diffstat (limited to 'src/gui/Subsection.cpp')
-rw-r--r--src/gui/Subsection.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/gui/Subsection.cpp b/src/gui/Subsection.cpp
index 16d6828..15eac04 100644
--- a/src/gui/Subsection.cpp
+++ b/src/gui/Subsection.cpp
@@ -36,8 +36,11 @@ namespace gsr {
window.draw(background);
draw_pos += mgl::vec2f(margin_left_scale, margin_top_scale) * mgl::vec2f(get_theme().window_height, get_theme().window_height);
- label.draw(window, draw_pos);
- draw_pos.y += label.get_size().y + title_spacing_scale * get_theme().window_height;
+
+ if(!label.get_text().empty()) {
+ label.draw(window, draw_pos);
+ draw_pos.y += label.get_size().y + title_spacing_scale * get_theme().window_height;
+ }
inner_widget->set_position(draw_pos);
inner_widget->draw(window, mgl::vec2f(0.0f, 0.0f));
@@ -48,7 +51,8 @@ namespace gsr {
return {0.0f, 0.0f};
const mgl::vec2f margin_size = mgl::vec2f(margin_left_scale + margin_right_scale, margin_top_scale + margin_bottom_scale) * mgl::vec2f(get_theme().window_height, get_theme().window_height);
- mgl::vec2f widgets_size = mgl::vec2f(0.0f, label.get_size().y + title_spacing_scale * get_theme().window_height) + inner_widget->get_size() + margin_size;
+ const float title_height = !label.get_text().empty() ? (label.get_size().y + title_spacing_scale * get_theme().window_height) : 0.0f;
+ mgl::vec2f widgets_size = mgl::vec2f(0.0f, title_height) + inner_widget->get_size() + margin_size;
if(std::abs(size.x) > 0.001f)
widgets_size.x = size.x;
@@ -57,4 +61,12 @@ namespace gsr {
return widgets_size;
}
+
+ mgl::vec2f Subsection::get_inner_size() {
+ if(!visible)
+ return {0.0f, 0.0f};
+
+ const mgl::vec2f margin_size = mgl::vec2f(margin_left_scale + margin_right_scale, margin_top_scale + margin_bottom_scale) * mgl::vec2f(get_theme().window_height, get_theme().window_height);
+ return get_size() - margin_size;
+ }
} \ No newline at end of file