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)
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 e61aa6a..774e763 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)
1874 evas_object_size_hint_weight_set(grid, EVAS_HINT_EXPAND, 0.0); 1874 evas_object_size_hint_weight_set(grid, EVAS_HINT_EXPAND, 0.0);
1875 evas_object_size_hint_align_set(grid, EVAS_HINT_FILL, 0.0); 1875 evas_object_size_hint_align_set(grid, EVAS_HINT_FILL, 0.0);
1876 evas_object_show(grid); 1876 evas_object_show(grid);
1877 _elm_code_widget_setup_palette(grid, efl_parent_get(pd->scroller)); 1877 _elm_code_widget_setup_palette(grid, widget);
1878 1878
1879 elm_box_pack_end(pd->gridbox, grid); 1879 elm_box_pack_end(pd->gridbox, grid);
1880 pd->grids = eina_list_append(pd->grids, grid); 1880 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 *
2192 *col = pd->cursor_col; 2192 *col = pd->cursor_col;
2193} 2193}
2194 2194
2195EOLIAN static Efl_Ui_Theme_Apply
2196_elm_code_widget_elm_widget_theme_apply(Eo *obj, Elm_Code_Widget_Data *pd)
2197{
2198 Eo *edje;
2199 int r, g, b, a;
2200 unsigned int i;
2201 Evas_Object *grid, *background;
2202
2203 edje = elm_layout_edje_get(obj);
2204 edje_object_color_class_get(edje, "elm/code/status/default", &r, &g, &b, &a,
2205 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
2206
2207 background = elm_object_part_content_get(pd->scroller, "elm.swallow.background");
2208 evas_object_color_set(background, r, g, b, a);
2209
2210 for (i = 0; i < eina_list_count(pd->grids); i++)
2211 {
2212 grid = eina_list_nth(pd->grids, i);
2213 _elm_code_widget_setup_palette(grid, obj);
2214 }
2215
2216 return EFL_UI_THEME_APPLY_SUCCESS;
2217}
2218
2195EOLIAN static void 2219EOLIAN static void
2196_elm_code_widget_efl_canvas_group_group_add(Eo *obj, Elm_Code_Widget_Data *pd) 2220_elm_code_widget_efl_canvas_group_group_add(Eo *obj, Elm_Code_Widget_Data *pd)
2197{ 2221{
2198 Evas_Object *background, *gridrows, *scroller; 2222 Evas_Object *background, *gridrows, *scroller;
2199 const char *fontname, *fontsize; 2223 const char *fontname, *fontsize;
2200 Eo *edje;
2201 int r, g, b, a;
2202 2224
2203 efl_canvas_group_add(efl_super(obj, ELM_CODE_WIDGET_CLASS)); 2225 efl_canvas_group_add(efl_super(obj, ELM_CODE_WIDGET_CLASS));
2204 elm_object_focus_allow_set(obj, EINA_TRUE); 2226 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)
2214 elm_object_focus_allow_set(scroller, EINA_FALSE); 2236 elm_object_focus_allow_set(scroller, EINA_FALSE);
2215 pd->scroller = scroller; 2237 pd->scroller = scroller;
2216 2238
2217 edje = elm_layout_edje_get(efl_parent_get(pd->scroller));
2218 edje_object_color_class_get(edje, "elm/code/status/default", &r, &g, &b, &a, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
2219
2220 background = elm_bg_add(scroller); 2239 background = elm_bg_add(scroller);
2221 evas_object_color_set(background, r, g, b, a);
2222 evas_object_size_hint_weight_set(background, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 2240 evas_object_size_hint_weight_set(background, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2223 evas_object_size_hint_align_set(background, EVAS_HINT_FILL, EVAS_HINT_FILL); 2241 evas_object_size_hint_align_set(background, EVAS_HINT_FILL, EVAS_HINT_FILL);
2224 evas_object_show(background); 2242 evas_object_show(background);
@@ -2235,6 +2253,8 @@ _elm_code_widget_efl_canvas_group_group_add(Eo *obj, Elm_Code_Widget_Data *pd)
2235 elm_object_content_set(scroller, gridrows); 2253 elm_object_content_set(scroller, gridrows);
2236 pd->gridbox = gridrows; 2254 pd->gridbox = gridrows;
2237 2255
2256 _elm_code_widget_elm_widget_theme_apply(obj, pd);
2257
2238 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _elm_code_widget_resize_cb, obj); 2258 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _elm_code_widget_resize_cb, obj);
2239 evas_object_event_callback_add(obj, EVAS_CALLBACK_KEY_DOWN, _elm_code_widget_key_down_cb, obj); 2259 evas_object_event_callback_add(obj, EVAS_CALLBACK_KEY_DOWN, _elm_code_widget_key_down_cb, obj);
2240 evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE, _elm_code_widget_hidden_cb, obj); 2260 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 b8ed094..c896e4e 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)
302 Efl.Object.constructor; 302 Efl.Object.constructor;
303 Efl.Object.finalize; 303 Efl.Object.finalize;
304 Elm.Widget.widget_event; 304 Elm.Widget.widget_event;
305 Elm.Widget.theme_apply;
305 } 306 }
306 constructors { 307 constructors {
307 .code; 308 .code;