Skip to content

Commit

Permalink
pw menu
Browse files Browse the repository at this point in the history
  • Loading branch information
igagis committed Sep 17, 2024
1 parent 524bcc4 commit 31f67aa
Show file tree
Hide file tree
Showing 4 changed files with 132 additions and 9 deletions.
52 changes: 43 additions & 9 deletions src/bedsidemon/spo2/spo2_parameter_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#include <ruis/widget/group/margins.hpp>
#include <ruis/widget/label/image.hpp>
#include <ruis/widget/label/rectangle.hpp>
#include <ruis/widget/proxy/click_proxy.hpp>

#include "../application.hpp"
#include "../style.hpp"

using namespace std::string_literals;
using namespace std::string_view_literals;

using namespace ruis::length_literals;

Expand Down Expand Up @@ -178,19 +180,38 @@ std::vector<utki::shared_ref<ruis::widget>> make_widgets(utki::shared_ref<ruis::
}
},
{
m::margins(c,
m::pile(c,
{
.layout_params = {
.layout_params{
.dims = {ruis::dim::fill, ruis::dim::min}
},
.container_params = {
.layout = ruis::layout::column
},
.frame_params = {
.borders = {style::pw_padding}
}
},
make_numeric_content(c, title)
{
m::click_proxy(c,
{
.layout_params{
.dims{ruis::dim::fill, ruis::dim::fill}
},
.widget_params{
.id = "click_proxy"s
}
}
),
m::margins(c,
{
.layout_params = {
.dims = {ruis::dim::fill, ruis::dim::min}
},
.container_params = {
.layout = ruis::layout::column
},
.frame_params = {
.borders = {style::pw_padding}
}
},
make_numeric_content(c, title)
)
}
),
m::rectangle(c,
{
Expand Down Expand Up @@ -238,6 +259,19 @@ spo2_parameter_window::spo2_parameter_window(utki::shared_ref<ruis::context> con
}
))
{
{
auto& cp = this->get_widget_as<ruis::click_proxy>("click_proxy"sv);
cp.click_handler = [this](ruis::click_proxy& cp){
if(this->pw_menu){
// menu is already open
return;
}
auto pwm = utki::make_shared<spo2_parameter_window_menu>(this->context);
this->pw_menu = pwm;
application::inst().open_menu(pwm);
};
}

auto& ss = settings_storage::inst();
decltype(settings_storage::settings_changed_signal
)::callback_type settings_change_handler = [&pw = *this](const settings& s) {
Expand Down
3 changes: 3 additions & 0 deletions src/bedsidemon/spo2/spo2_parameter_window.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#include "../settings.hpp"
#include "../waveform.hpp"

#include "spo2_parameter_window_menu.hpp"
#include "spo2_measurement.hpp"

namespace bedsidemon {
Expand All @@ -49,6 +50,8 @@ class spo2_parameter_window :

utki::signal<const settings&>::connection settings_change_signal_connection;

std::shared_ptr<spo2_parameter_window_menu> pw_menu;

public:
spo2_parameter_window(utki::shared_ref<ruis::context> context, std::u32string title = std::u32string(U"SpO2 %"));
~spo2_parameter_window() override;
Expand Down
53 changes: 53 additions & 0 deletions src/bedsidemon/spo2/spo2_parameter_window_menu.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
bedsidemon - Bedside monitor example GUI project
Copyright (C) 2024 Gagistech Oy <[email protected]>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

/* ================ LICENSE END ================ */

#include "spo2_parameter_window_menu.hpp"

using namespace std::string_literals;

using namespace bedsidemon;

namespace{
std::vector<utki::shared_ref<ruis::widget>> make_menu_contents(utki::shared_ref<ruis::context> c){
// clang-format off
return {
// TODO:
};
// clang-format on
}
}

spo2_parameter_window_menu::spo2_parameter_window_menu(utki::shared_ref<ruis::context> context) :
// clang-format off
ruis::widget(
std::move(context),
{
.dims{ruis::dim::fill, ruis::dim::fill}
},
{}
),
menu(
this->context, //
U"SpO2"s,
make_menu_contents(this->context)
)
// clang-format on
{}
33 changes: 33 additions & 0 deletions src/bedsidemon/spo2/spo2_parameter_window_menu.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
bedsidemon - Bedside monitor example GUI project
Copyright (C) 2024 Gagistech Oy <[email protected]>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

/* ================ LICENSE END ================ */

#pragma once

#include "../menu.hpp"

namespace bedsidemon{

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

}

0 comments on commit 31f67aa

Please sign in to comment.