1+ /*
2+ ruis - GUI framework
3+
4+ Copyright (C) 2012-2026 Ivan Gagis <igagis@gmail.com>
5+
6+ This program is free software: you can redistribute it and/or modify
7+ it under the terms of the GNU General Public License as published by
8+ the Free Software Foundation, either version 3 of the License, or
9+ (at your option) any later version.
10+
11+ This program is distributed in the hope that it will be useful,
12+ but WITHOUT ANY WARRANTY; without even the implied warranty of
13+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+ GNU General Public License for more details.
15+
16+ You should have received a copy of the GNU General Public License
17+ along with this program. If not, see <http://www.gnu.org/licenses/>.
18+ */
19+
20+ /* ================ LICENSE END ================ */
21+
22+ #include " rectangle_text_input_line.hpp"
23+
24+ #include < utki/debug.hpp>
25+
26+ using namespace ruis ;
27+
28+ rectangle_text_input_line::rectangle_text_input_line (
29+ utki::shared_ref<ruis::context> context, //
30+ all_parameters params,
31+ ruis::string text
32+ ) :
33+ rectangle_text_input_line(
34+ context,
35+ params,
36+ ruis::make::text_input_line (
37+ context, //
38+ {
39+ .layout_params = std::move (params.text_input_line_params .layout_params ),
40+ .widget_params = std::move (params.text_input_line_params .widget_params ),
41+ .text_widget_params = std::move (params.text_input_line_params .text_widget_params ),
42+ .color_params = std::move (params.text_input_line_params .color_params )
43+ },
44+ std::move (text)
45+ )
46+ )
47+ {}
48+
49+ rectangle_text_input_line::rectangle_text_input_line (
50+ utki::shared_ref<ruis::context>& context, //
51+ all_parameters& params,
52+ utki::shared_ref<ruis::text_input_line> text_input_line
53+ ) :
54+ widget(
55+ std::move (context), //
56+ std::move(params.layout_params),
57+ std::move(params.widget_params)
58+ ),
59+ // Initialize rectangle first so it adds the text_input_line as a child
60+ // clang-format off
61+ rectangle(
62+ this ->context,
63+ {
64+ .container_params = std::move (params.container_params ),
65+ .padding_params = std::move (params.padding_params ),
66+ .color_params = std::move (params.color_params ),
67+ .rectangle_params = {
68+ .corner_radii = std::move (params.rectangle_params .corner_radii ),
69+ .stroke_width = std::move (params.rectangle_params .stroke_width ),
70+ // stroke_color = primary color from style
71+ .stroke_color = this ->context .get ().style ().get_color_primary (),
72+ // fill color will be set from color_widget's color (background from style)
73+ }
74+ },
75+ {
76+ text_input_line
77+ }
78+ ),
79+ // clang-format on
80+ decorated_widget<ruis::text_input_line>(
81+ this ->context, //
82+ text_input_line.get()
83+ )
84+ {
85+ // Set fill color to background color from style
86+ this ->set_color (this ->context .get ().style ().get_color_background ());
87+ }
88+
89+ void rectangle_text_input_line::on_focus_change ()
90+ {
91+ this ->decorated_widget <ruis::text_input_line>::get_decorated ().on_focus_change ();
92+ }
93+
94+ utki::shared_ref<ruis::rectangle_text_input_line> ruis::make::rectangle_text_input_line (
95+ utki::shared_ref<ruis::context> context, //
96+ ruis::rectangle_text_input_line::all_parameters params,
97+ ruis::string text
98+ )
99+ {
100+ return utki::make_shared<ruis::rectangle_text_input_line>(
101+ std::move (context), //
102+ std::move (params),
103+ std::move (text)
104+ );
105+ }
0 commit comments