@@ -27,6 +27,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
2727#include < ruis/widget/label/image.hpp>
2828#include < ruis/widget/label/padding.hpp>
2929#include < ruis/widget/label/text.hpp>
30+ #include < ruis/widget/button/touch/tab_button.hpp>
3031
3132#include " list_page.hpp"
3233#include " scroll_area_page.hpp"
@@ -39,97 +40,15 @@ using namespace ruis::length_literals;
3940
4041namespace {
4142
42- class tab_button :
43- public ruis::choice_button, //
44- private ruis::container
45- {
46- public:
47- struct all_parameters {
48- ruis::layout::parameters layout_params;
49- ruis::widget::parameters widget_params;
50- ruis::image::parameters image_params;
51- ruis::string text;
52- };
53-
54- tab_button (
55- utki::shared_ref<ruis::context> context, //
56- all_parameters params
57- ) :
58- widget (
59- std::move (context), //
60- std::move(params.layout_params),
61- std::move(params.widget_params)
62- ),
63- button(
64- this ->context,
65- {
66- }
67- ),
68- toggle_button(this ->context),
69- choice_button(this ->context),
70- // clang-format off
71- ruis::container(
72- this ->context, //
73- {
74- .container_params = {
75- .layout = ruis::layout::pile
76- }
77- },
78- {
79- m::padding (
80- this ->context ,
81- {
82- .layout_params = {
83- .dims = {ruis::dim::fill, ruis::dim::fill}
84- },
85- .container_params = {
86- .layout = ruis::layout::column
87- },
88- .padding_params = {
89- .borders = {10_pp}
90- }
91- },
92- {
93- m::image (this ->context ,
94- {
95- .layout_params = {
96- .dims = {ruis::dim::min, ruis::dim::fill},
97- .weight = 1
98- },
99- .image_params = std::move (params.image_params )
100- }
101- ),
102- m::text (this ->context ,
103- {
104- .layout_params = {
105- .dims = {ruis::dim::min, ruis::dim::min},
106- .align = {ruis::align::center, ruis::align::center}
107- }
108- },
109- std::move (params.text )
110- )
111- }
112- )
113- }
114- )
115- // clang-format on
116- {}
117-
118- ruis::event_status on_mouse_button (const ruis::mouse_button_event& event) override
119- {
120- return this ->choice_button ::on_mouse_button (event);
121- }
122- };
123-
124- utki::shared_ref<ruis::choice_button> make_tab_button (
43+ utki::shared_ref<ruis::touch::tab_button> make_tab_button (
12544 utki::shared_ref<ruis::context> c, //
12645 utki::shared_ref<const ruis::res::image> icon,
12746 ruis::string text
12847)
12948{
13049 // clang-format off
131- return utki::make_shared< tab_button> (std::move (c),
132- tab_button::all_parameters{
50+ return ruis::touch::make:: tab_button (std::move (c),
51+ ruis::touch:: tab_button::all_parameters{
13352 .layout_params = {
13453 .dims = {ruis::dim::fill, 60_pp},
13554 .weight = 1
@@ -138,8 +57,8 @@ utki::shared_ref<ruis::choice_button> make_tab_button(
13857 .img = std::move (icon),
13958 .keep_aspect_ratio = true
14059 },
141- . text = std::move (text)
142- }
60+ },
61+ std::move (text)
14362 );
14463 // clang-format on
14564}
0 commit comments