summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Williams <andy@andywilliams.me>2017-11-27 21:23:11 +0000
committerAndy Williams <andy@andywilliams.me>2017-11-27 21:23:55 +0000
commitd43fe6c16fd763215e2741b37baa8df913f151c0 (patch)
treef43798fe44b281310e3942b2e179c241ce13c6ac
parent49fefaf1bc370fd3c6f760c79231d65f6596e9c9 (diff)
downloadefl-d43fe6c16fd763215e2741b37baa8df913f151c0.tar.gz
elm_code: Reload grid colours on theme change
-rw-r--r--src/lib/elementary/elm_code_widget.c34
-rw-r--r--src/lib/elementary/elm_code_widget.eo1
2 files changed, 28 insertions, 7 deletions
diff --git a/src/lib/elementary/elm_code_widget.c b/src/lib/elementary/elm_code_widget.c
index e61aa6afea..774e763c78 100644
--- a/src/lib/elementary/elm_code_widget.c
+++ b/src/lib/elementary/elm_code_widget.c
@@ -1874,7 +1874,7 @@ _elm_code_widget_ensure_n_grid_rows(Elm_Code_Widget *widget, int rows)
evas_object_size_hint_weight_set(grid, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(grid, EVAS_HINT_FILL, 0.0);
evas_object_show(grid);
- _elm_code_widget_setup_palette(grid, efl_parent_get(pd->scroller));
+ _elm_code_widget_setup_palette(grid, widget);
elm_box_pack_end(pd->gridbox, grid);
pd->grids = eina_list_append(pd->grids, grid);
@@ -2192,13 +2192,35 @@ _elm_code_widget_cursor_position_get(Eo *obj EINA_UNUSED, Elm_Code_Widget_Data *
*col = pd->cursor_col;
}
+EOLIAN static Efl_Ui_Theme_Apply
+_elm_code_widget_elm_widget_theme_apply(Eo *obj, Elm_Code_Widget_Data *pd)
+{
+ Eo *edje;
+ int r, g, b, a;
+ unsigned int i;
+ Evas_Object *grid, *background;
+
+ edje = elm_layout_edje_get(obj);
+ edje_object_color_class_get(edje, "elm/code/status/default", &r, &g, &b, &a,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+
+ background = elm_object_part_content_get(pd->scroller, "elm.swallow.background");
+ evas_object_color_set(background, r, g, b, a);
+
+ for (i = 0; i < eina_list_count(pd->grids); i++)
+ {
+ grid = eina_list_nth(pd->grids, i);
+ _elm_code_widget_setup_palette(grid, obj);
+ }
+
+ return EFL_UI_THEME_APPLY_SUCCESS;
+}
+
EOLIAN static void
_elm_code_widget_efl_canvas_group_group_add(Eo *obj, Elm_Code_Widget_Data *pd)
{
Evas_Object *background, *gridrows, *scroller;
const char *fontname, *fontsize;
- Eo *edje;
- int r, g, b, a;
efl_canvas_group_add(efl_super(obj, ELM_CODE_WIDGET_CLASS));
elm_object_focus_allow_set(obj, EINA_TRUE);
@@ -2214,11 +2236,7 @@ _elm_code_widget_efl_canvas_group_group_add(Eo *obj, Elm_Code_Widget_Data *pd)
elm_object_focus_allow_set(scroller, EINA_FALSE);
pd->scroller = scroller;
- edje = elm_layout_edje_get(efl_parent_get(pd->scroller));
- edje_object_color_class_get(edje, "elm/code/status/default", &r, &g, &b, &a, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
-
background = elm_bg_add(scroller);
- evas_object_color_set(background, r, g, b, a);
evas_object_size_hint_weight_set(background, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(background, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(background);
@@ -2235,6 +2253,8 @@ _elm_code_widget_efl_canvas_group_group_add(Eo *obj, Elm_Code_Widget_Data *pd)
elm_object_content_set(scroller, gridrows);
pd->gridbox = gridrows;
+ _elm_code_widget_elm_widget_theme_apply(obj, pd);
+
evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _elm_code_widget_resize_cb, obj);
evas_object_event_callback_add(obj, EVAS_CALLBACK_KEY_DOWN, _elm_code_widget_key_down_cb, obj);
evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE, _elm_code_widget_hidden_cb, obj);
diff --git a/src/lib/elementary/elm_code_widget.eo b/src/lib/elementary/elm_code_widget.eo
index b8ed0948c6..c896e4e3ef 100644
--- a/src/lib/elementary/elm_code_widget.eo
+++ b/src/lib/elementary/elm_code_widget.eo
@@ -302,6 +302,7 @@ class Elm.Code_Widget (Efl.Ui.Layout, Efl.Access.Text)
Efl.Object.constructor;
Efl.Object.finalize;
Elm.Widget.widget_event;
+ Elm.Widget.theme_apply;
}
constructors {
.code;