Skip to content

Commit

Permalink
add empty about menu
Browse files Browse the repository at this point in the history
  • Loading branch information
igagis committed Sep 12, 2024
1 parent 7528b14 commit c4d2888
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 3 deletions.
37 changes: 37 additions & 0 deletions src/bedsidemon/about_menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,41 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.

#include "about_menu.hpp"

#include <ruis/widget/label/text.hpp>

using namespace std::string_literals;

using namespace bedsidemon;

namespace m {
using namespace ruis::make;
} // namespace m

namespace {
std::vector<utki::shared_ref<ruis::widget>> make_contents(utki::shared_ref<ruis::context> c)
{
// clang-format off
return {
m::text(c,
{},
U"TODO:"s
)
};
// clang-format on
}
} // namespace

about_menu::about_menu(utki::shared_ref<ruis::context> context) :
ruis::widget(
std::move(context),
{
.dims = {ruis::dim::fill, ruis::dim::fill}
},
{}
),
menu(
this->context, //
U"About"s,
make_contents(this->context)
)
{}
9 changes: 7 additions & 2 deletions src/bedsidemon/about_menu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,14 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.

#pragma once

#include "menu.hpp"

namespace bedsidemon {

class about_menu
{};
class about_menu : public menu
{
public:
about_menu(utki::shared_ref<ruis::context> context);
};

} // namespace bedsidemon
6 changes: 6 additions & 0 deletions src/bedsidemon/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#include "spo2/setocare_st_t130_u01.hpp"
#include "spo2/spo2_parameter_window.hpp"

#include "about_menu.hpp"
#include "gui.hpp"
#include "settings_menu.hpp"

Expand Down Expand Up @@ -121,6 +122,11 @@ application::application(bool window, std::string_view res_path) :
app.open_menu(utki::make_shared<settings_menu>(app.gui.context));
};

c.get().get_widget_as<ruis::push_button>("about_button"sv).click_handler = [](ruis::push_button& b) {
auto& app = bedsidemon::application::inst();
app.open_menu(utki::make_shared<about_menu>(app.gui.context));
};

c.get().get_widget_as<ruis::push_button>("exit_button"sv).click_handler = [](ruis::push_button& b) {
auto& app = bedsidemon::application::inst();
app.quit();
Expand Down
2 changes: 1 addition & 1 deletion src/bedsidemon/menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ menu::menu(
.font_size = style::font_size_menu_title
}
},
U"Settings"s
std::move(title)
),
m::margins(this->context,
{
Expand Down

0 comments on commit c4d2888

Please sign in to comment.