Skip to content

Commit

Permalink
use slider
Browse files Browse the repository at this point in the history
  • Loading branch information
igagis committed Apr 17, 2024
1 parent 8609bb8 commit 61c9c73
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
26 changes: 16 additions & 10 deletions src/gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,23 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.

#include <ruis/widgets/container.hpp>
#include <ruis/widgets/label/image.hpp>
#include <ruis/widgets/slider/scroll_bar.hpp>
#include <ruis/widgets/slider/slider.hpp>

#include "car_widget.hpp"
#include "gauge.hpp"

using namespace std::string_literals;

using namespace ruis::length_literals;

using namespace carcockpit;

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

utki::shared_ref<ruis::widget> carcockpit::make_root_layout(utki::shared_ref<ruis::context> c)
utki::shared_ref<ruis::widget> carcockpit::make_root_widgets(utki::shared_ref<ruis::context> c)
{
using ruis::lp;

Expand All @@ -50,15 +52,19 @@ utki::shared_ref<ruis::widget> carcockpit::make_root_layout(utki::shared_ref<rui
}
},
{
// TODO: should be slider, not scroll bar, band is not needed
utki::make_shared<ruis::horizontal_scroll_bar>(
c,
tml::read(R"(
id{gauge_slider}
lp{dx{fill}dy{30pp}}
)")
m::slider(c,
{
.widget_params = {
.id = "gauge_slider"s,
.lp = {
.dims = {lp::fill, 30_pp}
}
},
.oriented_params = {
.vertical = false
}
}
),

m::container(
c,
{
Expand Down
2 changes: 1 addition & 1 deletion src/gui.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.

namespace carcockpit {

utki::shared_ref<ruis::widget> make_root_layout(utki::shared_ref<ruis::context> c);
utki::shared_ref<ruis::widget> make_root_widgets(utki::shared_ref<ruis::context> c);

} // namespace carcockpit
2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class application : public ruisapp::application

this->gui.context.get().loader.mount_res_pack(*this->get_res_file(papki::as_dir(res_path)));

this->gui.set_root(make_root_layout(this->gui.context));
this->gui.set_root(make_root_widgets(this->gui.context));
}
};

Expand Down

0 comments on commit 61c9c73

Please sign in to comment.