From f1fa920d9b3c88455f0bf91f62eecf34a908fe0d Mon Sep 17 00:00:00 2001 From: Ivan Gagis Date: Sat, 19 Sep 2026 00:54:20 +0300 Subject: [PATCH 01/13] stuff --- src/ruis/widget/button/touch/tab_button.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/ruis/widget/button/touch/tab_button.cpp b/src/ruis/widget/button/touch/tab_button.cpp index 195ec8735..13d3b7a89 100644 --- a/src/ruis/widget/button/touch/tab_button.cpp +++ b/src/ruis/widget/button/touch/tab_button.cpp @@ -75,7 +75,13 @@ tab_button::tab_button( .dims = {ruis::dim::min, ruis::dim::fill}, .weight = 1 }, - .params = std::move(params.params.image) + .params = [&]() { + auto& p = params.params.image; + if (auto& c = p.color.normal; c.get().is_undefined()) { + c = context.get().style().get_color_text(); + } + return std::move(p); + }() } ), ruis::make::gap(context, From 4a80a0ecdf73e2ba3663b1f44fdd093da67a432c Mon Sep 17 00:00:00 2001 From: Ivan Gagis Date: Sat, 19 Sep 2026 01:13:32 +0300 Subject: [PATCH 02/13] add dialog to touch test app --- res/ruis_res/themes/dark/style.tml | 4 +- res/ruis_res/themes/light/style.tml | 2 +- tests/touch/src/scroll_area_page.cpp | 61 ++++++++++++++++++++++++++-- 3 files changed, 61 insertions(+), 6 deletions(-) diff --git a/res/ruis_res/themes/dark/style.tml b/res/ruis_res/themes/dark/style.tml index 3ab75d468..389d0a325 100644 --- a/res/ruis_res/themes/dark/style.tml +++ b/res/ruis_res/themes/dark/style.tml @@ -3,9 +3,9 @@ ruis{ color_background{0xff101010} color_panel{0xff424242} color_special{0xffff8080} - color_primary{0xff505050} + color_primary{0xff686868} color_secondary{0xff303030} - color_highlight{0xffad9869} + color_highlight{0xffcdb889} color_dimmed{0xb0000000} diff --git a/res/ruis_res/themes/light/style.tml b/res/ruis_res/themes/light/style.tml index 96d68754a..2559b66da 100644 --- a/res/ruis_res/themes/light/style.tml +++ b/res/ruis_res/themes/light/style.tml @@ -1,7 +1,7 @@ version{1} // TODO: support include? ruis{ - color_background{0xffffffff} + color_background{0xffe0e0e0} color_panel{0xffa0a0a0} color_special{0xff1976d2} color_primary{0xffc0c0c0} diff --git a/tests/touch/src/scroll_area_page.cpp b/tests/touch/src/scroll_area_page.cpp index faf18a9ec..2227bd4c3 100644 --- a/tests/touch/src/scroll_area_page.cpp +++ b/tests/touch/src/scroll_area_page.cpp @@ -25,6 +25,8 @@ along with this program. If not, see . #include #include #include +#include +#include #include #include #include @@ -97,6 +99,56 @@ class theme_selection_provider : public ruis::list_provider } }; +utki::shared_ref make_dialog(const utki::shared_ref& c) +{ + // clang-format off + auto close_button = m::push_button( + c, + { + .layout_params{ + .dims = {ruis::dim::fill, ruis::dim::min} + } + }, + { + m::text(c, {}, U"Close"s) + } + ); + // clang-format on + + // clang-format off + auto dialog = ruis::touch::make::dialog( + c, + { + .layout_params{ + .dims = {ruis::dim::fill, ruis::dim::fill} + } + }, + { + m::text(c, {}, U"Dialog"s), + m::gap(c, + { + .layout_params{ + .dims = {ruis::dim::fill, c.get().style().get_len_gap().get()} + } + } + ), + std::move(close_button) + } + ); + // clang-format on + + // use a weak reference to avoid a reference cycle + // (dialog -> content container -> close_button -> click_handler -> dialog) + auto dialog_weak = utki::make_weak_from(dialog.get()); + close_button.get().click_handler = [dialog_weak](ruis::push_button&) { + if (auto dlg = dialog_weak.lock()) { + dlg->close(); + } + }; + + return dialog; +} + ruis::widget_list make_scroll_area_page_contents(const utki::shared_ref& c) { // clang-format off @@ -140,9 +192,12 @@ ruis::widget_list make_scroll_area_page_contents(const utki::shared_ref(); + b.context.get().post_to_ui_thread([olay = utki::make_shared_from(olay), dialog]() { + olay.get().push_back(dialog); }); }; From 43feafa174ec465b29c6faecc552fbe63b38d710 Mon Sep 17 00:00:00 2001 From: Ivan Gagis Date: Sat, 19 Sep 2026 01:31:37 +0300 Subject: [PATCH 03/13] make default dialog layout column --- src/ruis/widget/base/touch/flickable.cpp | 3 ++- src/ruis/widget/group/touch/dialog.cpp | 5 ++-- src/ruis/widget/group/touch/dialog.hpp | 2 +- tests/touch/src/scroll_area_page.cpp | 31 ++++++++++++++++++++++++ 4 files changed, 37 insertions(+), 4 deletions(-) diff --git a/src/ruis/widget/base/touch/flickable.cpp b/src/ruis/widget/base/touch/flickable.cpp index 9394a29c3..55788734c 100644 --- a/src/ruis/widget/base/touch/flickable.cpp +++ b/src/ruis/widget/base/touch/flickable.cpp @@ -95,7 +95,8 @@ ruis::event_status flickable::on_mouse_button(const mouse_button_event& event) // After reaching the last touch point, it still can remain touched for some time without moving, // so when the touch is released we need to update the timestamp of the last touch point to the current time, // so that the velocity calculation would be correct. - utki::assert(!this->touch_history.empty()); + utki::assert(!this->touch_history.empty() + ); // TODO: once I got this assertion triggered, just need to click fast and move the mouse a little this->touch_history.back().timestamp_ms = utki::get_ticks_ms(); this->velocity_px_per_ms = this->calculate_touch_velocity_px_per_ms(); diff --git a/src/ruis/widget/group/touch/dialog.cpp b/src/ruis/widget/group/touch/dialog.cpp index 309070f13..5406520fc 100644 --- a/src/ruis/widget/group/touch/dialog.cpp +++ b/src/ruis/widget/group/touch/dialog.cpp @@ -128,6 +128,7 @@ widget_list make_chrome( } }, { + // TODO: the rectangle is already a containing widget, need to return its content container instead of creating a new one std::move(content_container) } ); @@ -240,8 +241,8 @@ dialog::dialog( .dims = {ruis::dim::fill, ruis::dim::fill} }, .params = [&](){ - if(!params.params.layout){ - params.params.layout = ruis::layout::pile; + if(auto& l = params.params.layout; !l){ + l = ruis::layout::column; } return std::move(params.params); }() diff --git a/src/ruis/widget/group/touch/dialog.hpp b/src/ruis/widget/group/touch/dialog.hpp index 7ad770de4..4a05604bb 100644 --- a/src/ruis/widget/group/touch/dialog.hpp +++ b/src/ruis/widget/group/touch/dialog.hpp @@ -116,7 +116,7 @@ class dialog : namespace make { /** * @brief Construct 'dialog' widget. - * Default content layout is pile. + * Default content layout is column. * @param context - ruis context. * @param params - 'dialog' widget parameters. * @param children - contents of the constructed 'dialog' widget. diff --git a/tests/touch/src/scroll_area_page.cpp b/tests/touch/src/scroll_area_page.cpp index 2227bd4c3..bdae6829b 100644 --- a/tests/touch/src/scroll_area_page.cpp +++ b/tests/touch/src/scroll_area_page.cpp @@ -28,6 +28,7 @@ along with this program. If not, see . #include #include #include +#include #include #include #include @@ -101,6 +102,28 @@ class theme_selection_provider : public ruis::list_provider utki::shared_ref make_dialog(const utki::shared_ref& c) { + // clang-format off + auto text_field = m::labeled_text_field( + c, + { + .layout_params{ + .dims = {ruis::dim::fill, ruis::dim::min} + }, + .params{ + .label{ + .string = U"Name"s + }, + .text_input{ + .specific{ + .hint = U"Enter your name"s + } + } + } + }, + ruis::string() + ); + // clang-format on + // clang-format off auto close_button = m::push_button( c, @@ -132,6 +155,14 @@ utki::shared_ref make_dialog(const utki::shared_ref Date: Sat, 19 Sep 2026 02:15:56 +0300 Subject: [PATCH 04/13] refactor dialog params --- src/ruis/widget/group/touch/dialog.cpp | 50 +++++++++++--------------- src/ruis/widget/group/touch/dialog.hpp | 24 ++++++------- 2 files changed, 30 insertions(+), 44 deletions(-) diff --git a/src/ruis/widget/group/touch/dialog.cpp b/src/ruis/widget/group/touch/dialog.cpp index 5406520fc..0aaa3ca8a 100644 --- a/src/ruis/widget/group/touch/dialog.cpp +++ b/src/ruis/widget/group/touch/dialog.cpp @@ -99,33 +99,26 @@ widget_list make_chrome( .layout_params{ .dims = {ruis::dim::fill, ruis::dim::fill} }, - .params{ - .padding{ - .specific{ - .borders = [&](){ - for(auto& b : params.padding_params.borders){ - if(b.get().is_undefined()){ - b = style.get_len_dialog_padding(); - } - } - return std::move(params.padding_params.borders); - }() - } - }, - .specific = [&](){ - for(auto& r : params.rectangle_params.corner_radii){ - if(r.get().is_undefined()){ - r = style.get_len_dialog_padding(); - } + .params = [&](){ + auto& rect_params = params.params.rectangle; + for(auto& cr : rect_params.specific.corner_radii){ + if(cr.get().is_undefined()){ + cr = style.get_len_dialog_padding(); } + } - if(params.rectangle_params.fill_color.get().is_undefined()){ - params.rectangle_params.fill_color = style.get_color_panel(); + if(auto& c = rect_params.specific.fill_color; c.get().is_undefined()){ + c = style.get_color_panel(); + } + + for(auto& b : rect_params.padding.specific.borders){ + if(b.get().is_undefined()){ + b = style.get_len_dialog_padding(); } + } - return std::move(params.rectangle_params); - }() - } + return std::move(rect_params); + }() }, { // TODO: the rectangle is already a containing widget, need to return its content container instead of creating a new one @@ -144,7 +137,7 @@ widget_list make_chrome( .params{ .specific{ .borders = [&](){ - auto borders = params.dialog_params.margin_params.borders; + auto borders = params.params.specific.margin_params.borders; for(auto& b : borders){ if(b.get().is_undefined()){ b = style.get_len_dialog_margin(); @@ -240,12 +233,9 @@ dialog::dialog( // (e.g. scrollable lists) can take the whole available area of the panel .dims = {ruis::dim::fill, ruis::dim::fill} }, - .params = [&](){ - if(auto& l = params.params.layout; !l){ - l = ruis::layout::column; - } - return std::move(params.params); - }() + .params = { + .layout = ruis::layout::column + } }, // clang-format on std::move(children) diff --git a/src/ruis/widget/group/touch/dialog.hpp b/src/ruis/widget/group/touch/dialog.hpp index 4a05604bb..9f53cd879 100644 --- a/src/ruis/widget/group/touch/dialog.hpp +++ b/src/ruis/widget/group/touch/dialog.hpp @@ -49,7 +49,7 @@ class dialog : public containing_widget { public: - struct parameters { + struct specific_parameters { /** * @brief Margin between the dialog panel and the edge of the dialog area. * Defaults to the 'len_dialog_margin' style value if undefined. @@ -57,31 +57,27 @@ class dialog : ruis::padding::specific_parameters margin_params; }; - struct all_parameters { - ruis::layout_parameters layout_params; - ruis::widget::parameters widget; - container::parameters params; - + struct parameters{ /** * @brief Color of the dialog panel background. * Defaults to the 'color_panel' style value if undefined. */ color_widget::parameters color; - /** - * @brief Padding between the dialog panel background and the dialog content. - * Defaults to the 'len_dialog_padding' style value if undefined. - */ - ruis::padding::specific_parameters padding_params; - /** * @brief Dialog panel background rectangle parameters. * - corner_radii defaults to the 'len_dialog_padding' style value if undefined. * - stroke_width defaults to 0 (filled rectangle) if undefined. */ - rectangle::specific_parameters rectangle_params; + ruis::rectangle::parameters rectangle; + + specific_parameters specific; + }; - parameters dialog_params; + struct all_parameters { + ruis::layout_parameters layout_params; + ruis::widget::parameters widget; + parameters params; }; private: From 5d066e032c6c4ebc695bbeeb955d519c7bacadf2 Mon Sep 17 00:00:00 2001 From: Ivan Gagis Date: Sat, 19 Sep 2026 02:24:19 +0300 Subject: [PATCH 05/13] fix touch selection_box, fix lint --- src/ruis/widget/button/touch/selection_box.cpp | 3 ++- tests/touch/src/scroll_area_page.cpp | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ruis/widget/button/touch/selection_box.cpp b/src/ruis/widget/button/touch/selection_box.cpp index cfab337d8..0afae69ca 100644 --- a/src/ruis/widget/button/touch/selection_box.cpp +++ b/src/ruis/widget/button/touch/selection_box.cpp @@ -246,7 +246,8 @@ void selection_box::show_selection_menu() ruis::touch::make::list(c, { .layout_params{ - .dims = {ruis::dim::fill, ruis::dim::fill} + .dims = {ruis::dim::fill, ruis::dim::fill}, + .weight = 1 }, .list_params{ .provider = utki::make_shared(utki::make_shared_from(*this)) diff --git a/tests/touch/src/scroll_area_page.cpp b/tests/touch/src/scroll_area_page.cpp index bdae6829b..702c21b78 100644 --- a/tests/touch/src/scroll_area_page.cpp +++ b/tests/touch/src/scroll_area_page.cpp @@ -138,6 +138,8 @@ utki::shared_ref make_dialog(const utki::shared_ref make_dialog(const utki::shared_ref content container -> close_button -> click_handler -> dialog) auto dialog_weak = utki::make_weak_from(dialog.get()); - close_button.get().click_handler = [dialog_weak](ruis::push_button&) { + close_button_ref.click_handler = [dialog_weak](ruis::push_button&) { if (auto dlg = dialog_weak.lock()) { dlg->close(); } From 32658b1c9bcced0106a8dd72ae2a3ca30ad3cbfc Mon Sep 17 00:00:00 2001 From: Ivan Gagis Date: Sun, 20 Sep 2026 01:32:58 +0300 Subject: [PATCH 06/13] increase default font size --- res/ruis_res/themes/dark/style.tml | 2 +- res/ruis_res/themes/light/style.tml | 2 +- src/ruis/style/style_sheet.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/res/ruis_res/themes/dark/style.tml b/res/ruis_res/themes/dark/style.tml index 389d0a325..eb4e642d5 100644 --- a/res/ruis_res/themes/dark/style.tml +++ b/res/ruis_res/themes/dark/style.tml @@ -19,7 +19,7 @@ ruis{ len_dialog_margin{30pp} len_dialog_padding{20pp} - font_size_text{12pp} + font_size_text{14pp} font_size_title{22pp} font_face_text{ruis_fnt_normal} } diff --git a/res/ruis_res/themes/light/style.tml b/res/ruis_res/themes/light/style.tml index 2559b66da..b4dacbd8a 100644 --- a/res/ruis_res/themes/light/style.tml +++ b/res/ruis_res/themes/light/style.tml @@ -20,7 +20,7 @@ ruis{ len_dialog_margin{30pp} len_dialog_padding{20pp} - font_size_text{12pp} + font_size_text{14pp} font_size_title{22pp} font_face_text{ruis_fnt_normal} } diff --git a/src/ruis/style/style_sheet.cpp b/src/ruis/style/style_sheet.cpp index 7a96db443..61bab0ead 100644 --- a/src/ruis/style/style_sheet.cpp +++ b/src/ruis/style/style_sheet.cpp @@ -143,7 +143,7 @@ const utki::enum_array& default_style_forests() d[style::len_button_padding] = tml::read("5pp"); d[style::len_dialog_margin] = tml::read("30pp"); d[style::len_dialog_padding] = tml::read("20pp"); - d[style::font_size_text] = tml::read("12pp"); + d[style::font_size_text] = tml::read("14pp"); d[style::font_size_title] = tml::read("22pp"); d[style::font_face_text] = tml::read("ruis_fnt_normal"); return d; From 47c1d5560edc9141de5dfaf9831c3a7d504287cc Mon Sep 17 00:00:00 2001 From: Ivan Gagis Date: Sun, 20 Sep 2026 01:54:41 +0300 Subject: [PATCH 07/13] stuff --- res/ruis_res/themes/dark/style.tml | 4 +++- res/ruis_res/themes/light/style.tml | 4 +++- src/ruis/style/style_provider.cpp | 10 ++++++++ src/ruis/style/style_provider.hpp | 2 ++ src/ruis/style/style_sheet.cpp | 8 ++++++- src/ruis/style/style_sheet.hpp | 2 ++ src/ruis/widget/button/touch/tab_button.cpp | 2 +- src/ruis/widget/button/touch/tab_group.cpp | 2 +- .../input/impl/nine_patch_text_field.cpp | 2 +- tests/app2/src/rectangles_window.cpp | 2 +- tests/touch/src/scroll_area_page.cpp | 12 +++++----- tests/unit/src/style.cpp | 24 +++++++++++++++---- 12 files changed, 57 insertions(+), 17 deletions(-) diff --git a/res/ruis_res/themes/dark/style.tml b/res/ruis_res/themes/dark/style.tml index eb4e642d5..aad445d1e 100644 --- a/res/ruis_res/themes/dark/style.tml +++ b/res/ruis_res/themes/dark/style.tml @@ -13,7 +13,9 @@ ruis{ color_text_secondary{0xffa0a0a0} len_indent{17pp} - len_gap{4pp} + len_gap_small{4pp} + len_gap{8pp} + len_gap_big{16pp} len_border{1pp} len_button_padding{5pp} len_dialog_margin{30pp} diff --git a/res/ruis_res/themes/light/style.tml b/res/ruis_res/themes/light/style.tml index b4dacbd8a..2b2fbe55f 100644 --- a/res/ruis_res/themes/light/style.tml +++ b/res/ruis_res/themes/light/style.tml @@ -14,7 +14,9 @@ ruis{ color_text_secondary{0xff616161} len_indent{17pp} - len_gap{4pp} + len_gap_small{4pp} + len_gap{8pp} + len_gap_big{16pp} len_border{1pp} len_button_padding{5pp} len_dialog_margin{30pp} diff --git a/src/ruis/style/style_provider.cpp b/src/ruis/style/style_provider.cpp index 30c6f390a..a95d62a2b 100644 --- a/src/ruis/style/style_provider.cpp +++ b/src/ruis/style/style_provider.cpp @@ -185,11 +185,21 @@ styled style_provider::get_len_indent() const return this->get(style::len_indent); } +styled style_provider::get_len_gap_small() const +{ + return this->get(style::len_gap_small); +} + styled style_provider::get_len_gap() const { return this->get(style::len_gap); } +styled style_provider::get_len_gap_big() const +{ + return this->get(style::len_gap_big); +} + styled style_provider::get_len_border() const { return this->get(style::len_border); diff --git a/src/ruis/style/style_provider.hpp b/src/ruis/style/style_provider.hpp index c4f10de65..f90ada178 100644 --- a/src/ruis/style/style_provider.hpp +++ b/src/ruis/style/style_provider.hpp @@ -140,7 +140,9 @@ class style_provider styled get_color_highlight() const; styled get_len_indent() const; + styled get_len_gap_small() const; styled get_len_gap() const; + styled get_len_gap_big() const; styled get_len_border() const; styled get_len_button_padding() const; diff --git a/src/ruis/style/style_sheet.cpp b/src/ruis/style/style_sheet.cpp index 61bab0ead..542a39ed3 100644 --- a/src/ruis/style/style_sheet.cpp +++ b/src/ruis/style/style_sheet.cpp @@ -46,8 +46,12 @@ style style_sheet::name_to_style(std::string_view name) return style::color_special; } else if (name == "len_indent"sv) { return style::len_indent; + } else if (name == "len_gap_small"sv) { + return style::len_gap_small; } else if (name == "len_gap"sv) { return style::len_gap; + } else if (name == "len_gap_big"sv) { + return style::len_gap_big; } else if (name == "len_border"sv) { return style::len_border; } else if (name == "len_button_padding"sv) { @@ -138,7 +142,9 @@ const utki::enum_array& default_style_forests() d[style::color_text] = tml::read("0xffffffff"); d[style::color_text_secondary] = tml::read("0xffa0a0a0"); d[style::len_indent] = tml::read("17pp"); - d[style::len_gap] = tml::read("4pp"); + d[style::len_gap_small] = tml::read("4pp"); + d[style::len_gap] = tml::read("8pp"); + d[style::len_gap_big] = tml::read("16pp"); d[style::len_border] = tml::read("1pp"); d[style::len_button_padding] = tml::read("5pp"); d[style::len_dialog_margin] = tml::read("30pp"); diff --git a/src/ruis/style/style_sheet.hpp b/src/ruis/style/style_sheet.hpp index 3f3e09c9e..7a08d13d4 100644 --- a/src/ruis/style/style_sheet.hpp +++ b/src/ruis/style/style_sheet.hpp @@ -44,7 +44,9 @@ enum class style { color_text_secondary, len_indent, + len_gap_small, len_gap, + len_gap_big, len_border, len_button_padding, len_dialog_margin, diff --git a/src/ruis/widget/button/touch/tab_button.cpp b/src/ruis/widget/button/touch/tab_button.cpp index 13d3b7a89..b46566856 100644 --- a/src/ruis/widget/button/touch/tab_button.cpp +++ b/src/ruis/widget/button/touch/tab_button.cpp @@ -87,7 +87,7 @@ tab_button::tab_button( ruis::make::gap(context, { .layout_params{ - .dims = {ruis::dim::min, context.get().style().get_len_gap()} + .dims = {ruis::dim::min, context.get().style().get_len_gap_small()} } } ), diff --git a/src/ruis/widget/button/touch/tab_group.cpp b/src/ruis/widget/button/touch/tab_group.cpp index f687a41f2..356d84dd0 100644 --- a/src/ruis/widget/button/touch/tab_group.cpp +++ b/src/ruis/widget/button/touch/tab_group.cpp @@ -60,7 +60,7 @@ tab_group::tab_group( }(), .params{ .specific{ - .borders = {context.get().style().get_len_gap() + .borders = {context.get().style().get_len_gap_small() } // TODO: get from params, should be same as selector_gap } } diff --git a/src/ruis/widget/input/impl/nine_patch_text_field.cpp b/src/ruis/widget/input/impl/nine_patch_text_field.cpp index 163f6df26..3d8774140 100644 --- a/src/ruis/widget/input/impl/nine_patch_text_field.cpp +++ b/src/ruis/widget/input/impl/nine_patch_text_field.cpp @@ -72,7 +72,7 @@ nine_patch_text_field::nine_patch_text_field( for(auto& b : params.params.nine_patch.padding.specific.borders){ if(b.get().is_undefined()){ - b = context.get().style().get_len_gap(); + b = context.get().style().get_len_gap_small(); } } diff --git a/tests/app2/src/rectangles_window.cpp b/tests/app2/src/rectangles_window.cpp index 76bc526e9..4376c9410 100644 --- a/tests/app2/src/rectangles_window.cpp +++ b/tests/app2/src/rectangles_window.cpp @@ -146,7 +146,7 @@ utki::shared_ref make_rectangles_window( .params{ .padding{ .specific{ - .borders = {c.get().style().get_len_gap()} + .borders = {c.get().style().get_len_gap_small()} } }, .color{ diff --git a/tests/touch/src/scroll_area_page.cpp b/tests/touch/src/scroll_area_page.cpp index 702c21b78..059500de2 100644 --- a/tests/touch/src/scroll_area_page.cpp +++ b/tests/touch/src/scroll_area_page.cpp @@ -153,7 +153,7 @@ utki::shared_ref make_dialog(const utki::shared_ref make_dialog(const utki::shared_ref Date: Sun, 20 Sep 2026 02:00:28 +0300 Subject: [PATCH 08/13] st uff --- res/ruis_res/themes/dark/style.tml | 1 - res/ruis_res/themes/light/style.tml | 1 - src/ruis/style/style_provider.cpp | 5 ----- src/ruis/style/style_provider.hpp | 1 - src/ruis/style/style_sheet.cpp | 3 --- src/ruis/style/style_sheet.hpp | 1 - src/ruis/widget/button/base/ellipse_button.cpp | 2 +- src/ruis/widget/button/base/rectangle_button.cpp | 4 ++-- src/ruis/widget/button/touch/tab_button.cpp | 2 +- src/ruis/widget/input/impl/rectangle_text_field.cpp | 2 +- tests/unit/src/style.cpp | 3 --- 11 files changed, 5 insertions(+), 20 deletions(-) diff --git a/res/ruis_res/themes/dark/style.tml b/res/ruis_res/themes/dark/style.tml index aad445d1e..3d84fe221 100644 --- a/res/ruis_res/themes/dark/style.tml +++ b/res/ruis_res/themes/dark/style.tml @@ -17,7 +17,6 @@ ruis{ len_gap{8pp} len_gap_big{16pp} len_border{1pp} - len_button_padding{5pp} len_dialog_margin{30pp} len_dialog_padding{20pp} diff --git a/res/ruis_res/themes/light/style.tml b/res/ruis_res/themes/light/style.tml index 2b2fbe55f..b45193df3 100644 --- a/res/ruis_res/themes/light/style.tml +++ b/res/ruis_res/themes/light/style.tml @@ -18,7 +18,6 @@ ruis{ len_gap{8pp} len_gap_big{16pp} len_border{1pp} - len_button_padding{5pp} len_dialog_margin{30pp} len_dialog_padding{20pp} diff --git a/src/ruis/style/style_provider.cpp b/src/ruis/style/style_provider.cpp index a95d62a2b..36110e6d6 100644 --- a/src/ruis/style/style_provider.cpp +++ b/src/ruis/style/style_provider.cpp @@ -205,11 +205,6 @@ styled style_provider::get_len_border() const return this->get(style::len_border); } -styled style_provider::get_len_button_padding() const -{ - return this->get(style::len_button_padding); -} - styled style_provider::get_len_dialog_margin() const { return this->get(style::len_dialog_margin); diff --git a/src/ruis/style/style_provider.hpp b/src/ruis/style/style_provider.hpp index f90ada178..c70e21740 100644 --- a/src/ruis/style/style_provider.hpp +++ b/src/ruis/style/style_provider.hpp @@ -145,7 +145,6 @@ class style_provider styled get_len_gap_big() const; styled get_len_border() const; - styled get_len_button_padding() const; styled get_len_dialog_margin() const; styled get_len_dialog_padding() const; diff --git a/src/ruis/style/style_sheet.cpp b/src/ruis/style/style_sheet.cpp index 542a39ed3..f05c8e21d 100644 --- a/src/ruis/style/style_sheet.cpp +++ b/src/ruis/style/style_sheet.cpp @@ -54,8 +54,6 @@ style style_sheet::name_to_style(std::string_view name) return style::len_gap_big; } else if (name == "len_border"sv) { return style::len_border; - } else if (name == "len_button_padding"sv) { - return style::len_button_padding; } else if (name == "len_dialog_margin"sv) { return style::len_dialog_margin; } else if (name == "len_dialog_padding"sv) { @@ -146,7 +144,6 @@ const utki::enum_array& default_style_forests() d[style::len_gap] = tml::read("8pp"); d[style::len_gap_big] = tml::read("16pp"); d[style::len_border] = tml::read("1pp"); - d[style::len_button_padding] = tml::read("5pp"); d[style::len_dialog_margin] = tml::read("30pp"); d[style::len_dialog_padding] = tml::read("20pp"); d[style::font_size_text] = tml::read("14pp"); diff --git a/src/ruis/style/style_sheet.hpp b/src/ruis/style/style_sheet.hpp index 7a08d13d4..74f7de1db 100644 --- a/src/ruis/style/style_sheet.hpp +++ b/src/ruis/style/style_sheet.hpp @@ -48,7 +48,6 @@ enum class style { len_gap, len_gap_big, len_border, - len_button_padding, len_dialog_margin, len_dialog_padding, diff --git a/src/ruis/widget/button/base/ellipse_button.cpp b/src/ruis/widget/button/base/ellipse_button.cpp index 361165d5e..0e73ec243 100644 --- a/src/ruis/widget/button/base/ellipse_button.cpp +++ b/src/ruis/widget/button/base/ellipse_button.cpp @@ -57,7 +57,7 @@ ellipse_button::ellipse_button( .params = [&](){ for(auto& b : params.ellipse.padding.specific.borders){ if(b.get().is_undefined()){ - b = context.get().style().get_len_button_padding(); + b = context.get().style().get_len_gap(); } } diff --git a/src/ruis/widget/button/base/rectangle_button.cpp b/src/ruis/widget/button/base/rectangle_button.cpp index ef84508c6..71d8cb250 100644 --- a/src/ruis/widget/button/base/rectangle_button.cpp +++ b/src/ruis/widget/button/base/rectangle_button.cpp @@ -59,12 +59,12 @@ rectangle_button::rectangle_button( // .params = [&](){ for(auto& b : params.rectangle.padding.specific.borders){ if(b.get().is_undefined()){ - b = context.get().style().get_len_button_padding(); + b = context.get().style().get_len_gap(); } } for(auto& r : params.rectangle.specific.corner_radii){ if(r.get().is_undefined()){ - r = context.get().style().get_len_button_padding(); + r = context.get().style().get_len_gap(); } } return std::move(params.rectangle); diff --git a/src/ruis/widget/button/touch/tab_button.cpp b/src/ruis/widget/button/touch/tab_button.cpp index b46566856..6c4f51907 100644 --- a/src/ruis/widget/button/touch/tab_button.cpp +++ b/src/ruis/widget/button/touch/tab_button.cpp @@ -64,7 +64,7 @@ tab_button::tab_button( .layout = ruis::layout::column }, .specific{ - .borders = {context.get().style().get_len_button_padding()} + .borders = {context.get().style().get_len_gap()} } } }, diff --git a/src/ruis/widget/input/impl/rectangle_text_field.cpp b/src/ruis/widget/input/impl/rectangle_text_field.cpp index 5994c2b2a..8f74e7188 100644 --- a/src/ruis/widget/input/impl/rectangle_text_field.cpp +++ b/src/ruis/widget/input/impl/rectangle_text_field.cpp @@ -87,7 +87,7 @@ rectangle_text_field::rectangle_text_field( } for(auto& r : params.params.rectangle.specific.corner_radii){ if(r.get().is_undefined()){ - r = context.get().style().get_len_button_padding(); + r = context.get().style().get_len_gap(); } } diff --git a/tests/unit/src/style.cpp b/tests/unit/src/style.cpp index a4d95b924..c2f1e0ae7 100644 --- a/tests/unit/src/style.cpp +++ b/tests/unit/src/style.cpp @@ -274,7 +274,6 @@ const tst::set set("style", [](tst::suite& suite){ tst::check_eq(tml::to_string(ss.get(ruis::style::len_gap)), "8pp"s, SL); tst::check_eq(tml::to_string(ss.get(ruis::style::len_gap_big)), "16pp"s, SL); tst::check_eq(tml::to_string(ss.get(ruis::style::len_border)), "1pp"s, SL); - tst::check_eq(tml::to_string(ss.get(ruis::style::len_button_padding)), "5pp"s, SL); tst::check_eq(tml::to_string(ss.get(ruis::style::len_dialog_margin)), "30pp"s, SL); tst::check_eq(tml::to_string(ss.get(ruis::style::len_dialog_padding)), "20pp"s, SL); tst::check_eq(tml::to_string(ss.get(ruis::style::font_size_text)), "14pp"s, SL); @@ -301,7 +300,6 @@ const tst::set set("style", [](tst::suite& suite){ len_gap{12pp} len_gap_big{30pp} len_border{2pp} - len_button_padding{7pp} len_dialog_margin{40pp} len_dialog_padding{30pp} font_size_text{14pp} @@ -327,7 +325,6 @@ const tst::set set("style", [](tst::suite& suite){ tst::check_eq(tml::to_string(ss.get(ruis::style::len_gap)), "12pp"s, SL); tst::check_eq(tml::to_string(ss.get(ruis::style::len_gap_big)), "30pp"s, SL); tst::check_eq(tml::to_string(ss.get(ruis::style::len_border)), "2pp"s, SL); - tst::check_eq(tml::to_string(ss.get(ruis::style::len_button_padding)), "7pp"s, SL); tst::check_eq(tml::to_string(ss.get(ruis::style::len_dialog_margin)), "40pp"s, SL); tst::check_eq(tml::to_string(ss.get(ruis::style::len_dialog_padding)), "30pp"s, SL); tst::check_eq(tml::to_string(ss.get(ruis::style::font_size_text)), "14pp"s, SL); From b209fb9f9d8750120186373b51c997fd1be79939 Mon Sep 17 00:00:00 2001 From: Ivan Gagis Date: Sun, 20 Sep 2026 02:11:41 +0300 Subject: [PATCH 09/13] stuff --- res/ruis_res/themes/dark/style.tml | 6 ++---- res/ruis_res/themes/light/style.tml | 6 ++---- src/ruis/style/style_provider.cpp | 10 ---------- src/ruis/style/style_provider.hpp | 3 --- src/ruis/style/style_sheet.cpp | 6 ------ src/ruis/style/style_sheet.hpp | 2 -- src/ruis/widget/group/touch/dialog.cpp | 6 +++--- src/ruis/widget/group/touch/dialog.hpp | 4 ++-- tests/unit/src/style.cpp | 6 ------ 9 files changed, 9 insertions(+), 40 deletions(-) diff --git a/res/ruis_res/themes/dark/style.tml b/res/ruis_res/themes/dark/style.tml index 3d84fe221..625c9377d 100644 --- a/res/ruis_res/themes/dark/style.tml +++ b/res/ruis_res/themes/dark/style.tml @@ -14,11 +14,9 @@ ruis{ len_indent{17pp} len_gap_small{4pp} - len_gap{8pp} - len_gap_big{16pp} + len_gap{10pp} + len_gap_big{25pp} len_border{1pp} - len_dialog_margin{30pp} - len_dialog_padding{20pp} font_size_text{14pp} font_size_title{22pp} diff --git a/res/ruis_res/themes/light/style.tml b/res/ruis_res/themes/light/style.tml index b45193df3..8c5743cfb 100644 --- a/res/ruis_res/themes/light/style.tml +++ b/res/ruis_res/themes/light/style.tml @@ -15,11 +15,9 @@ ruis{ len_indent{17pp} len_gap_small{4pp} - len_gap{8pp} - len_gap_big{16pp} + len_gap{10pp} + len_gap_big{25pp} len_border{1pp} - len_dialog_margin{30pp} - len_dialog_padding{20pp} font_size_text{14pp} font_size_title{22pp} diff --git a/src/ruis/style/style_provider.cpp b/src/ruis/style/style_provider.cpp index 36110e6d6..bbabb9ca5 100644 --- a/src/ruis/style/style_provider.cpp +++ b/src/ruis/style/style_provider.cpp @@ -205,16 +205,6 @@ styled style_provider::get_len_border() const return this->get(style::len_border); } -styled style_provider::get_len_dialog_margin() const -{ - return this->get(style::len_dialog_margin); -} - -styled style_provider::get_len_dialog_padding() const -{ - return this->get(style::len_dialog_padding); -} - styled style_provider::get_font_size_normal() const { return this->get(style::font_size_text); diff --git a/src/ruis/style/style_provider.hpp b/src/ruis/style/style_provider.hpp index c70e21740..ff5304b62 100644 --- a/src/ruis/style/style_provider.hpp +++ b/src/ruis/style/style_provider.hpp @@ -145,9 +145,6 @@ class style_provider styled get_len_gap_big() const; styled get_len_border() const; - styled get_len_dialog_margin() const; - styled get_len_dialog_padding() const; - styled get_font_size_normal() const; styled get_font_size_title() const; styled get_font_face_normal() const; diff --git a/src/ruis/style/style_sheet.cpp b/src/ruis/style/style_sheet.cpp index f05c8e21d..e2f5a434d 100644 --- a/src/ruis/style/style_sheet.cpp +++ b/src/ruis/style/style_sheet.cpp @@ -54,10 +54,6 @@ style style_sheet::name_to_style(std::string_view name) return style::len_gap_big; } else if (name == "len_border"sv) { return style::len_border; - } else if (name == "len_dialog_margin"sv) { - return style::len_dialog_margin; - } else if (name == "len_dialog_padding"sv) { - return style::len_dialog_padding; } else if (name == "font_size_text"sv) { return style::font_size_text; } else if (name == "font_size_title"sv) { @@ -144,8 +140,6 @@ const utki::enum_array& default_style_forests() d[style::len_gap] = tml::read("8pp"); d[style::len_gap_big] = tml::read("16pp"); d[style::len_border] = tml::read("1pp"); - d[style::len_dialog_margin] = tml::read("30pp"); - d[style::len_dialog_padding] = tml::read("20pp"); d[style::font_size_text] = tml::read("14pp"); d[style::font_size_title] = tml::read("22pp"); d[style::font_face_text] = tml::read("ruis_fnt_normal"); diff --git a/src/ruis/style/style_sheet.hpp b/src/ruis/style/style_sheet.hpp index 74f7de1db..cd1949ca6 100644 --- a/src/ruis/style/style_sheet.hpp +++ b/src/ruis/style/style_sheet.hpp @@ -48,8 +48,6 @@ enum class style { len_gap, len_gap_big, len_border, - len_dialog_margin, - len_dialog_padding, font_size_text, font_size_title, diff --git a/src/ruis/widget/group/touch/dialog.cpp b/src/ruis/widget/group/touch/dialog.cpp index 0aaa3ca8a..9f7f4c20a 100644 --- a/src/ruis/widget/group/touch/dialog.cpp +++ b/src/ruis/widget/group/touch/dialog.cpp @@ -103,7 +103,7 @@ widget_list make_chrome( auto& rect_params = params.params.rectangle; for(auto& cr : rect_params.specific.corner_radii){ if(cr.get().is_undefined()){ - cr = style.get_len_dialog_padding(); + cr = style.get_len_gap_big(); } } @@ -113,7 +113,7 @@ widget_list make_chrome( for(auto& b : rect_params.padding.specific.borders){ if(b.get().is_undefined()){ - b = style.get_len_dialog_padding(); + b = style.get_len_gap_big(); } } @@ -140,7 +140,7 @@ widget_list make_chrome( auto borders = params.params.specific.margin_params.borders; for(auto& b : borders){ if(b.get().is_undefined()){ - b = style.get_len_dialog_margin(); + b = style.get_len_gap_big(); } } return borders; diff --git a/src/ruis/widget/group/touch/dialog.hpp b/src/ruis/widget/group/touch/dialog.hpp index 9f53cd879..190134b52 100644 --- a/src/ruis/widget/group/touch/dialog.hpp +++ b/src/ruis/widget/group/touch/dialog.hpp @@ -52,7 +52,7 @@ class dialog : struct specific_parameters { /** * @brief Margin between the dialog panel and the edge of the dialog area. - * Defaults to the 'len_dialog_margin' style value if undefined. + * Defaults to the 'len_gap_big' style value if undefined. */ ruis::padding::specific_parameters margin_params; }; @@ -66,7 +66,7 @@ class dialog : /** * @brief Dialog panel background rectangle parameters. - * - corner_radii defaults to the 'len_dialog_padding' style value if undefined. + * - corner_radii defaults to the 'len_gap_big' style value if undefined. * - stroke_width defaults to 0 (filled rectangle) if undefined. */ ruis::rectangle::parameters rectangle; diff --git a/tests/unit/src/style.cpp b/tests/unit/src/style.cpp index c2f1e0ae7..d6c49553b 100644 --- a/tests/unit/src/style.cpp +++ b/tests/unit/src/style.cpp @@ -274,8 +274,6 @@ const tst::set set("style", [](tst::suite& suite){ tst::check_eq(tml::to_string(ss.get(ruis::style::len_gap)), "8pp"s, SL); tst::check_eq(tml::to_string(ss.get(ruis::style::len_gap_big)), "16pp"s, SL); tst::check_eq(tml::to_string(ss.get(ruis::style::len_border)), "1pp"s, SL); - tst::check_eq(tml::to_string(ss.get(ruis::style::len_dialog_margin)), "30pp"s, SL); - tst::check_eq(tml::to_string(ss.get(ruis::style::len_dialog_padding)), "20pp"s, SL); tst::check_eq(tml::to_string(ss.get(ruis::style::font_size_text)), "14pp"s, SL); tst::check_eq(tml::to_string(ss.get(ruis::style::font_size_title)), "22pp"s, SL); tst::check_eq(tml::to_string(ss.get(ruis::style::font_face_text)), "ruis_fnt_normal"s, SL); @@ -300,8 +298,6 @@ const tst::set set("style", [](tst::suite& suite){ len_gap{12pp} len_gap_big{30pp} len_border{2pp} - len_dialog_margin{40pp} - len_dialog_padding{30pp} font_size_text{14pp} font_size_title{26pp} font_face_text{custom_font} @@ -325,8 +321,6 @@ const tst::set set("style", [](tst::suite& suite){ tst::check_eq(tml::to_string(ss.get(ruis::style::len_gap)), "12pp"s, SL); tst::check_eq(tml::to_string(ss.get(ruis::style::len_gap_big)), "30pp"s, SL); tst::check_eq(tml::to_string(ss.get(ruis::style::len_border)), "2pp"s, SL); - tst::check_eq(tml::to_string(ss.get(ruis::style::len_dialog_margin)), "40pp"s, SL); - tst::check_eq(tml::to_string(ss.get(ruis::style::len_dialog_padding)), "30pp"s, SL); tst::check_eq(tml::to_string(ss.get(ruis::style::font_size_text)), "14pp"s, SL); tst::check_eq(tml::to_string(ss.get(ruis::style::font_size_title)), "26pp"s, SL); tst::check_eq(tml::to_string(ss.get(ruis::style::font_face_text)), "custom_font"s, SL); From c42da19a1c99bc840baef6c65acd50307a704d3b Mon Sep 17 00:00:00 2001 From: Ivan Gagis Date: Sun, 20 Sep 2026 02:23:58 +0300 Subject: [PATCH 10/13] stuff --- res/ruis_res/themes/dark/style.tml | 5 +- res/ruis_res/themes/light/style.tml | 5 +- src/ruis/style/style_provider.cpp | 13 +- src/ruis/style/style_provider.hpp | 5 +- src/ruis/style/style_sheet.cpp | 15 ++- src/ruis/style/style_sheet.hpp | 5 +- src/ruis/widget/base/font_widget.cpp | 4 +- src/ruis/widget/button/touch/tab_button.cpp | 125 +++++++++++--------- tests/unit/src/style.cpp | 15 ++- 9 files changed, 107 insertions(+), 85 deletions(-) diff --git a/res/ruis_res/themes/dark/style.tml b/res/ruis_res/themes/dark/style.tml index 625c9377d..9742042ec 100644 --- a/res/ruis_res/themes/dark/style.tml +++ b/res/ruis_res/themes/dark/style.tml @@ -18,8 +18,9 @@ ruis{ len_gap_big{25pp} len_border{1pp} - font_size_text{14pp} + font_size_primary{14pp} + font_size_secondary{12pp} font_size_title{22pp} - font_face_text{ruis_fnt_normal} + font_face_primary{ruis_fnt_normal} } user{} diff --git a/res/ruis_res/themes/light/style.tml b/res/ruis_res/themes/light/style.tml index 8c5743cfb..e7d4b2645 100644 --- a/res/ruis_res/themes/light/style.tml +++ b/res/ruis_res/themes/light/style.tml @@ -19,8 +19,9 @@ ruis{ len_gap_big{25pp} len_border{1pp} - font_size_text{14pp} + font_size_primary{14pp} + font_size_secondary{12pp} font_size_title{22pp} - font_face_text{ruis_fnt_normal} + font_face_primary{ruis_fnt_normal} } user{} diff --git a/src/ruis/style/style_provider.cpp b/src/ruis/style/style_provider.cpp index bbabb9ca5..9ad468d37 100644 --- a/src/ruis/style/style_provider.cpp +++ b/src/ruis/style/style_provider.cpp @@ -205,9 +205,14 @@ styled style_provider::get_len_border() const return this->get(style::len_border); } -styled style_provider::get_font_size_normal() const +styled style_provider::get_font_size_primary() const { - return this->get(style::font_size_text); + return this->get(style::font_size_primary); +} + +styled style_provider::get_font_size_secondary() const +{ + return this->get(style::font_size_secondary); } styled style_provider::get_font_size_title() const @@ -215,7 +220,7 @@ styled style_provider::get_font_size_title() const return this->get(style::font_size_title); } -styled style_provider::get_font_face_normal() const +styled style_provider::get_font_face_primary() const { - return this->get(style::font_face_text); + return this->get(style::font_face_primary); } diff --git a/src/ruis/style/style_provider.hpp b/src/ruis/style/style_provider.hpp index ff5304b62..8c3e70c5a 100644 --- a/src/ruis/style/style_provider.hpp +++ b/src/ruis/style/style_provider.hpp @@ -145,9 +145,10 @@ class style_provider styled get_len_gap_big() const; styled get_len_border() const; - styled get_font_size_normal() const; + styled get_font_size_primary() const; + styled get_font_size_secondary() const; styled get_font_size_title() const; - styled get_font_face_normal() const; + styled get_font_face_primary() const; }; } // namespace ruis diff --git a/src/ruis/style/style_sheet.cpp b/src/ruis/style/style_sheet.cpp index e2f5a434d..0197abb31 100644 --- a/src/ruis/style/style_sheet.cpp +++ b/src/ruis/style/style_sheet.cpp @@ -54,12 +54,14 @@ style style_sheet::name_to_style(std::string_view name) return style::len_gap_big; } else if (name == "len_border"sv) { return style::len_border; - } else if (name == "font_size_text"sv) { - return style::font_size_text; + } else if (name == "font_size_primary"sv) { + return style::font_size_primary; + } else if (name == "font_size_secondary"sv) { + return style::font_size_secondary; } else if (name == "font_size_title"sv) { return style::font_size_title; - } else if (name == "font_face_text"sv) { - return style::font_face_text; + } else if (name == "font_face_primary"sv) { + return style::font_face_primary; } throw std::invalid_argument(utki::cat("style_sheet::name_to_style(name): unknown style name: ", name)); @@ -140,9 +142,10 @@ const utki::enum_array& default_style_forests() d[style::len_gap] = tml::read("8pp"); d[style::len_gap_big] = tml::read("16pp"); d[style::len_border] = tml::read("1pp"); - d[style::font_size_text] = tml::read("14pp"); + d[style::font_size_primary] = tml::read("14pp"); + d[style::font_size_secondary] = tml::read("12pp"); d[style::font_size_title] = tml::read("22pp"); - d[style::font_face_text] = tml::read("ruis_fnt_normal"); + d[style::font_face_primary] = tml::read("ruis_fnt_normal"); return d; }(); return defaults; diff --git a/src/ruis/style/style_sheet.hpp b/src/ruis/style/style_sheet.hpp index cd1949ca6..1ce80073b 100644 --- a/src/ruis/style/style_sheet.hpp +++ b/src/ruis/style/style_sheet.hpp @@ -49,10 +49,11 @@ enum class style { len_gap_big, len_border, - font_size_text, + font_size_primary, + font_size_secondary, font_size_title, - font_face_text, + font_face_primary, enum_size }; diff --git a/src/ruis/widget/base/font_widget.cpp b/src/ruis/widget/base/font_widget.cpp index ecde6aa01..84e82245f 100644 --- a/src/ruis/widget/base/font_widget.cpp +++ b/src/ruis/widget/base/font_widget.cpp @@ -30,10 +30,10 @@ font_widget::font_widget( widget(context, {}, {}), params([&]() { if (auto& f = params.face; !f.get()) { - f = context.get().style().get_font_face_normal(); + f = context.get().style().get_font_face_primary(); } if (auto& s = params.size; s.get().is_undefined()) { - s = context.get().style().get_font_size_normal(); + s = context.get().style().get_font_size_primary(); } return std::move(params); }()) diff --git a/src/ruis/widget/button/touch/tab_button.cpp b/src/ruis/widget/button/touch/tab_button.cpp index 6c4f51907..9401dff56 100644 --- a/src/ruis/widget/button/touch/tab_button.cpp +++ b/src/ruis/widget/button/touch/tab_button.cpp @@ -45,65 +45,72 @@ tab_button::tab_button( ), choice_button(context), // clang-format off - ruis::container( - context, // - { - .params = { - .layout = ruis::layout::pile - } - }, - { - ruis::make::padding( - context, - { - .layout_params{ - .dims = {ruis::dim::fill, ruis::dim::fill} - }, - .params{ - .container{ - .layout = ruis::layout::column - }, - .specific{ - .borders = {context.get().style().get_len_gap()} - } - } - }, - { - ruis::make::image(context, - { - .layout_params{ - .dims = {ruis::dim::min, ruis::dim::fill}, - .weight = 1 - }, - .params = [&]() { - auto& p = params.params.image; - if (auto& c = p.color.normal; c.get().is_undefined()) { - c = context.get().style().get_color_text(); - } - return std::move(p); - }() - } - ), - ruis::make::gap(context, - { - .layout_params{ - .dims = {ruis::dim::min, context.get().style().get_len_gap_small()} - } - } - ), - ruis::make::text(context, - { - .layout_params{ - .dims = {ruis::dim::min, ruis::dim::min}, - .align = {ruis::align::center, ruis::align::center} - } - }, - std::move(text) - ) - } - ) - } - ) + ruis::container( + context, // + { + .params = { + .layout = ruis::layout::pile + } + }, + { + ruis::make::padding( + context, + { + .layout_params{ + .dims = {ruis::dim::fill, ruis::dim::fill} + }, + .params{ + .container{ + .layout = ruis::layout::column + }, + .specific{ + .borders = {context.get().style().get_len_gap_small()} + } + } + }, + { + ruis::make::image(context, + { + .layout_params{ + .dims = {ruis::dim::min, ruis::dim::fill}, + .weight = 1 + }, + .params = [&]() { + auto& p = params.params.image; + if (auto& c = p.color.normal; c.get().is_undefined()) { + c = context.get().style().get_color_text(); + } + return std::move(p); + }() + } + ), + ruis::make::gap(context, + { + .layout_params{ + .dims = {ruis::dim::min, context.get().style().get_len_gap_small()} + } + } + ), + ruis::make::text(context, + { + .layout_params{ + .dims = {ruis::dim::min, ruis::dim::min}, + .align = {ruis::align::center, ruis::align::center} + }, + .params = [&](){ + if(auto& l = params.params.text.font.size; l.get().is_undefined()){ + l = context.get().style().get_font_size_secondary(); + } + + return std::move(params.params.text); + }() + }, + std::move(text) + ) + } + ) + } + ) // clang-format on {} diff --git a/tests/unit/src/style.cpp b/tests/unit/src/style.cpp index d6c49553b..e4f2e8bd2 100644 --- a/tests/unit/src/style.cpp +++ b/tests/unit/src/style.cpp @@ -274,9 +274,10 @@ const tst::set set("style", [](tst::suite& suite){ tst::check_eq(tml::to_string(ss.get(ruis::style::len_gap)), "8pp"s, SL); tst::check_eq(tml::to_string(ss.get(ruis::style::len_gap_big)), "16pp"s, SL); tst::check_eq(tml::to_string(ss.get(ruis::style::len_border)), "1pp"s, SL); - tst::check_eq(tml::to_string(ss.get(ruis::style::font_size_text)), "14pp"s, SL); + tst::check_eq(tml::to_string(ss.get(ruis::style::font_size_primary)), "14pp"s, SL); + tst::check_eq(tml::to_string(ss.get(ruis::style::font_size_secondary)), "12pp"s, SL); tst::check_eq(tml::to_string(ss.get(ruis::style::font_size_title)), "22pp"s, SL); - tst::check_eq(tml::to_string(ss.get(ruis::style::font_face_text)), "ruis_fnt_normal"s, SL); + tst::check_eq(tml::to_string(ss.get(ruis::style::font_face_primary)), "ruis_fnt_normal"s, SL); }); // test that when a style value is present in the style sheet, the sheet value is returned (not the default) @@ -298,9 +299,10 @@ const tst::set set("style", [](tst::suite& suite){ len_gap{12pp} len_gap_big{30pp} len_border{2pp} - font_size_text{14pp} + font_size_primary{14pp} + font_size_secondary{10pp} font_size_title{26pp} - font_face_text{custom_font} + font_face_primary{custom_font} } user{} )qwertyuiop"s); @@ -321,9 +323,10 @@ const tst::set set("style", [](tst::suite& suite){ tst::check_eq(tml::to_string(ss.get(ruis::style::len_gap)), "12pp"s, SL); tst::check_eq(tml::to_string(ss.get(ruis::style::len_gap_big)), "30pp"s, SL); tst::check_eq(tml::to_string(ss.get(ruis::style::len_border)), "2pp"s, SL); - tst::check_eq(tml::to_string(ss.get(ruis::style::font_size_text)), "14pp"s, SL); + tst::check_eq(tml::to_string(ss.get(ruis::style::font_size_primary)), "14pp"s, SL); + tst::check_eq(tml::to_string(ss.get(ruis::style::font_size_secondary)), "10pp"s, SL); tst::check_eq(tml::to_string(ss.get(ruis::style::font_size_title)), "26pp"s, SL); - tst::check_eq(tml::to_string(ss.get(ruis::style::font_face_text)), "custom_font"s, SL); + tst::check_eq(tml::to_string(ss.get(ruis::style::font_face_primary)), "custom_font"s, SL); }); // test that parsing fails when a style value name is present but its value is empty From fa8d04a9adebe72a135ba65053fc6d261c386209 Mon Sep 17 00:00:00 2001 From: Ivan Gagis Date: Sun, 20 Sep 2026 02:27:42 +0300 Subject: [PATCH 11/13] format --- src/ruis/widget/group/touch/dialog.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ruis/widget/group/touch/dialog.hpp b/src/ruis/widget/group/touch/dialog.hpp index 190134b52..28780ad85 100644 --- a/src/ruis/widget/group/touch/dialog.hpp +++ b/src/ruis/widget/group/touch/dialog.hpp @@ -57,7 +57,7 @@ class dialog : ruis::padding::specific_parameters margin_params; }; - struct parameters{ + struct parameters { /** * @brief Color of the dialog panel background. * Defaults to the 'color_panel' style value if undefined. From c96d17d057897eefc883c2b80aa8e362915bbf5b Mon Sep 17 00:00:00 2001 From: Ivan Gagis Date: Sun, 20 Sep 2026 23:50:10 +0300 Subject: [PATCH 12/13] stuff --- src/ruis/widget/button/base/rectangle_button.cpp | 2 +- src/ruis/widget/input/impl/rectangle_text_field.cpp | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/ruis/widget/button/base/rectangle_button.cpp b/src/ruis/widget/button/base/rectangle_button.cpp index 71d8cb250..ff8096a22 100644 --- a/src/ruis/widget/button/base/rectangle_button.cpp +++ b/src/ruis/widget/button/base/rectangle_button.cpp @@ -64,7 +64,7 @@ rectangle_button::rectangle_button( // } for(auto& r : params.rectangle.specific.corner_radii){ if(r.get().is_undefined()){ - r = context.get().style().get_len_gap(); + r = context.get().style().get_len_gap_small(); } } return std::move(params.rectangle); diff --git a/src/ruis/widget/input/impl/rectangle_text_field.cpp b/src/ruis/widget/input/impl/rectangle_text_field.cpp index 8f74e7188..695e17ba8 100644 --- a/src/ruis/widget/input/impl/rectangle_text_field.cpp +++ b/src/ruis/widget/input/impl/rectangle_text_field.cpp @@ -76,6 +76,12 @@ rectangle_text_field::rectangle_text_field( } } + for(auto& r : params.params.rectangle.specific.corner_radii){ + if(r.get().is_undefined()){ + r = context.get().style().get_len_gap_small(); + } + } + if(auto& c = params.params.rectangle.specific.fill_color; c.get().is_undefined()){ c = context.get().style().get_color_background(); } @@ -85,11 +91,6 @@ rectangle_text_field::rectangle_text_field( if(auto& l = params.params.rectangle.specific.stroke_width; l.get().is_undefined()){ l = context.get().style().get_len_border(); } - for(auto& r : params.params.rectangle.specific.corner_radii){ - if(r.get().is_undefined()){ - r = context.get().style().get_len_gap(); - } - } return std::move(params.params.rectangle); }() From 8170e25fcaaa37b12fd0ba8165d27cc81435b764 Mon Sep 17 00:00:00 2001 From: Ivan Gagis Date: Mon, 21 Sep 2026 00:04:41 +0300 Subject: [PATCH 13/13] stuff --- tests/touch/src/style.cpp | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/tests/touch/src/style.cpp b/tests/touch/src/style.cpp index 3035274ad..7016dcc60 100644 --- a/tests/touch/src/style.cpp +++ b/tests/touch/src/style.cpp @@ -36,22 +36,7 @@ utki::shared_ref m::push_button( context, { .layout_params = std::move(params.layout_params), - .widget = std::move(params.widget), - .params{ - .rectangle_button{ - .rectangle{ - .padding{ - .container = std::move(params.params), - .specific{ - .borders = {5_pp} - } - }, - .specific{ - .corner_radii = {5_pp} - } - } - } - } + .widget = std::move(params.widget) }, std::move(contents) );