File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,6 +27,11 @@ list_provider::list_provider(utki::shared_ref<ruis::context> context) :
2727 context(std::move(context))
2828{}
2929
30+ utki::shared_ref<widget> list_provider::get_highlighted_widget (size_t index)
31+ {
32+ return this ->get_widget (index);
33+ }
34+
3035void list_provider::notify_model_change ()
3136{
3237 if (!this ->owner ) {
Original file line number Diff line number Diff line change @@ -68,6 +68,14 @@ class list_provider
6868 */
6969 virtual utki::shared_ref<widget> get_widget (size_t index) = 0;
7070
71+ /* *
72+ * @brief Get widget for a highlighted item.
73+ * Default implemetation just falls back to calling get_widget().
74+ * @param index - index of the item to provide widget for.
75+ * @return Widget for requested item.
76+ */
77+ virtual utki::shared_ref<widget> get_highlighted_widget (size_t index);
78+
7179 /* *
7280 * @brief Notify about change of items model.
7381 * The user is supposed to invoke this function when items model change.
Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ void selection_box::handle_model_change()
5353 return ;
5454 }
5555
56- this ->selection_container .push_back (this ->get_provider ().get_widget (this ->get_selection ()));
56+ this ->selection_container .push_back (this ->get_provider ().get_highlighted_widget (this ->get_selection ()));
5757}
5858
5959void selection_box::set_selection (size_t i)
Original file line number Diff line number Diff line change @@ -64,7 +64,30 @@ class theme_selection_provider : public ruis::list_provider
6464
6565 utki::shared_ref<ruis::widget> get_widget (size_t index) override
6666 {
67- return m::text (this ->context , {}, this ->items .at (index));
67+ // clang-format off
68+ return m::text (this ->context ,
69+ {
70+ .color_params {
71+ .color = this ->context .get ().style ().get_color_text_normal ()
72+ }
73+ },
74+ this ->items .at (index)
75+ );
76+ // clang-format on
77+ }
78+
79+ utki::shared_ref<ruis::widget> get_highlighted_widget (size_t index) override
80+ {
81+ // clang-format off
82+ return m::text (this ->context ,
83+ {
84+ .color_params {
85+ .color = this ->context .get ().style ().get_color_highlight ()
86+ }
87+ },
88+ this ->items .at (index)
89+ );
90+ // clang-format on
6891 }
6992};
7093
You can’t perform that action at this time.
0 commit comments