summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAl Poole <netstar@gmail.com>2017-12-05 16:41:30 +0000
committerAl Poole <netstar@gmail.com>2017-12-05 16:41:30 +0000
commite0b33d1172a3d3e90a5fb91168a20fb0c20a6aac (patch)
treeec512a2428bcfa0e5d8e1b7c1551ebf6a525c62b
parent78afa2fb84dbbfaf0fabf4064a8caf3a43152d15 (diff)
elm_code: add method to set alpha.devs/netstar/elm_code_alpha
-rw-r--r--src/lib/elementary/elm_code_widget.c87
-rw-r--r--src/lib/elementary/elm_code_widget_legacy.h1
-rw-r--r--src/lib/elementary/elm_code_widget_private.h1
3 files changed, 53 insertions, 36 deletions
diff --git a/src/lib/elementary/elm_code_widget.c b/src/lib/elementary/elm_code_widget.c
index eb4a83800e..c6019eb34a 100644
--- a/src/lib/elementary/elm_code_widget.c
+++ b/src/lib/elementary/elm_code_widget.c
@@ -72,6 +72,8 @@ _elm_code_widget_efl_object_constructor(Eo *obj, Elm_Code_Widget_Data *pd)
72{ 72{
73 obj = efl_constructor(efl_super(obj, ELM_CODE_WIDGET_CLASS)); 73 obj = efl_constructor(efl_super(obj, ELM_CODE_WIDGET_CLASS));
74 74
75 pd->alpha = 255;
76
75 pd->cursor_line = 1; 77 pd->cursor_line = 1;
76 pd->cursor_col = 1; 78 pd->cursor_col = 1;
77 79
@@ -1786,62 +1788,67 @@ _elm_code_widget_elm_widget_widget_event(Eo *obj EINA_UNUSED, Elm_Code_Widget_Da
1786 1788
1787// load a named colour class from the theme and apply it to the grid's specified palette 1789// load a named colour class from the theme and apply it to the grid's specified palette
1788static void 1790static void
1789_elm_code_widget_setup_palette_item(Evas_Object *grid, int type, const char *name, Evas_Object *edje) 1791_elm_code_widget_setup_palette_item(Elm_Code_Widget *widget, Evas_Object *grid, int type, const char *name, Evas_Object *edje)
1790{ 1792{
1793 Elm_Code_Widget_Data *pd;
1791 int r, g, b, a; 1794 int r, g, b, a;
1792 1795
1793 if (!edje_object_color_class_get(edje, name, &r, &g, &b, &a, 1796 if (!edje_object_color_class_get(edje, name, &r, &g, &b, &a,
1794 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)) 1797 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL))
1795 return; 1798 return;
1796 1799
1800 pd = efl_data_scope_get(widget, ELM_CODE_WIDGET_CLASS);
1801 if (pd)
1802 a = pd->alpha;
1803
1797 evas_object_textgrid_palette_set(grid, EVAS_TEXTGRID_PALETTE_STANDARD, type, r, g, b, a); 1804 evas_object_textgrid_palette_set(grid, EVAS_TEXTGRID_PALETTE_STANDARD, type, r, g, b, a);
1798} 1805}
1799 1806
1800static void 1807static void
1801_elm_code_widget_setup_palette(Evas_Object *o, Evas_Object *layout) 1808_elm_code_widget_setup_palette(Evas_Object *o, Elm_Code_Widget *widget)
1802{ 1809{
1803 Evas_Object *edje; 1810 Evas_Object *edje;
1804 1811
1805 edje = elm_layout_edje_get(layout); 1812 edje = elm_layout_edje_get(widget);
1806 1813
1807 // setup status colors 1814 // setup status colors
1808 _elm_code_widget_setup_palette_item(o, ELM_CODE_STATUS_TYPE_DEFAULT, "elm/code/status/default", edje); 1815 _elm_code_widget_setup_palette_item(widget, o, ELM_CODE_STATUS_TYPE_DEFAULT, "elm/code/status/default", edje);
1809 _elm_code_widget_setup_palette_item(o, ELM_CODE_STATUS_TYPE_CURRENT, "elm/code/status/current", edje); 1816 _elm_code_widget_setup_palette_item(widget, o, ELM_CODE_STATUS_TYPE_CURRENT, "elm/code/status/current", edje);
1810 _elm_code_widget_setup_palette_item(o, ELM_CODE_STATUS_TYPE_IGNORED, "elm/code/status/ignored", edje); 1817 _elm_code_widget_setup_palette_item(widget, o, ELM_CODE_STATUS_TYPE_IGNORED, "elm/code/status/ignored", edje);
1811 _elm_code_widget_setup_palette_item(o, ELM_CODE_STATUS_TYPE_NOTE, "elm/code/status/note", edje); 1818 _elm_code_widget_setup_palette_item(widget, o, ELM_CODE_STATUS_TYPE_NOTE, "elm/code/status/note", edje);
1812 _elm_code_widget_setup_palette_item(o, ELM_CODE_STATUS_TYPE_WARNING, "elm/code/status/warning", edje); 1819 _elm_code_widget_setup_palette_item(widget, o, ELM_CODE_STATUS_TYPE_WARNING, "elm/code/status/warning", edje);
1813 _elm_code_widget_setup_palette_item(o, ELM_CODE_STATUS_TYPE_ERROR, "elm/code/status/error", edje); 1820 _elm_code_widget_setup_palette_item(widget, o, ELM_CODE_STATUS_TYPE_ERROR, "elm/code/status/error", edje);
1814 _elm_code_widget_setup_palette_item(o, ELM_CODE_STATUS_TYPE_FATAL, "elm/code/status/fatal", edje); 1821 _elm_code_widget_setup_palette_item(widget, o, ELM_CODE_STATUS_TYPE_FATAL, "elm/code/status/fatal", edje);
1815 _elm_code_widget_setup_palette_item(o, ELM_CODE_STATUS_TYPE_ADDED, "elm/code/status/added", edje); 1822 _elm_code_widget_setup_palette_item(widget, o, ELM_CODE_STATUS_TYPE_ADDED, "elm/code/status/added", edje);
1816 _elm_code_widget_setup_palette_item(o, ELM_CODE_STATUS_TYPE_REMOVED, "elm/code/status/removed", edje); 1823 _elm_code_widget_setup_palette_item(widget, o, ELM_CODE_STATUS_TYPE_REMOVED, "elm/code/status/removed", edje);
1817 _elm_code_widget_setup_palette_item(o, ELM_CODE_STATUS_TYPE_CHANGED, "elm/code/status/changed", edje); 1824 _elm_code_widget_setup_palette_item(widget, o, ELM_CODE_STATUS_TYPE_CHANGED, "elm/code/status/changed", edje);
1818 _elm_code_widget_setup_palette_item(o, ELM_CODE_STATUS_TYPE_PASSED, "elm/code/status/passed", edje); 1825 _elm_code_widget_setup_palette_item(widget, o, ELM_CODE_STATUS_TYPE_PASSED, "elm/code/status/passed", edje);
1819 _elm_code_widget_setup_palette_item(o, ELM_CODE_STATUS_TYPE_FAILED, "elm/code/status/failed", edje); 1826 _elm_code_widget_setup_palette_item(widget, o, ELM_CODE_STATUS_TYPE_FAILED, "elm/code/status/failed", edje);
1820 _elm_code_widget_setup_palette_item(o, ELM_CODE_STATUS_TYPE_TODO, "elm/code/status/todo", edje); 1827 _elm_code_widget_setup_palette_item(widget, o, ELM_CODE_STATUS_TYPE_TODO, "elm/code/status/todo", edje);
1821 1828
1822 // setup token colors 1829 // setup token colors
1823 _elm_code_widget_setup_palette_item(o, ELM_CODE_TOKEN_TYPE_DEFAULT, "elm/code/token/default", edje); 1830 _elm_code_widget_setup_palette_item(widget, o, ELM_CODE_TOKEN_TYPE_DEFAULT, "elm/code/token/default", edje);
1824 _elm_code_widget_setup_palette_item(o, ELM_CODE_TOKEN_TYPE_COMMENT, "elm/code/token/comment", edje); 1831 _elm_code_widget_setup_palette_item(widget, o, ELM_CODE_TOKEN_TYPE_COMMENT, "elm/code/token/comment", edje);
1825 _elm_code_widget_setup_palette_item(o, ELM_CODE_TOKEN_TYPE_STRING, "elm/code/token/string", edje); 1832 _elm_code_widget_setup_palette_item(widget, o, ELM_CODE_TOKEN_TYPE_STRING, "elm/code/token/string", edje);
1826 _elm_code_widget_setup_palette_item(o, ELM_CODE_TOKEN_TYPE_NUMBER, "elm/code/token/number", edje); 1833 _elm_code_widget_setup_palette_item(widget, o, ELM_CODE_TOKEN_TYPE_NUMBER, "elm/code/token/number", edje);
1827 _elm_code_widget_setup_palette_item(o, ELM_CODE_TOKEN_TYPE_BRACE, "elm/code/token/brace", edje); 1834 _elm_code_widget_setup_palette_item(widget, o, ELM_CODE_TOKEN_TYPE_BRACE, "elm/code/token/brace", edje);
1828 _elm_code_widget_setup_palette_item(o, ELM_CODE_TOKEN_TYPE_TYPE, "elm/code/token/type", edje); 1835 _elm_code_widget_setup_palette_item(widget, o, ELM_CODE_TOKEN_TYPE_TYPE, "elm/code/token/type", edje);
1829 _elm_code_widget_setup_palette_item(o, ELM_CODE_TOKEN_TYPE_CLASS, "elm/code/token/class", edje); 1836 _elm_code_widget_setup_palette_item(widget, o, ELM_CODE_TOKEN_TYPE_CLASS, "elm/code/token/class", edje);
1830 _elm_code_widget_setup_palette_item(o, ELM_CODE_TOKEN_TYPE_FUNCTION, "elm/code/token/function", edje); 1837 _elm_code_widget_setup_palette_item(widget, o, ELM_CODE_TOKEN_TYPE_FUNCTION, "elm/code/token/function", edje);
1831 _elm_code_widget_setup_palette_item(o, ELM_CODE_TOKEN_TYPE_PARAM, "elm/code/token/param", edje); 1838 _elm_code_widget_setup_palette_item(widget, o, ELM_CODE_TOKEN_TYPE_PARAM, "elm/code/token/param", edje);
1832 _elm_code_widget_setup_palette_item(o, ELM_CODE_TOKEN_TYPE_KEYWORD, "elm/code/token/keyword", edje); 1839 _elm_code_widget_setup_palette_item(widget, o, ELM_CODE_TOKEN_TYPE_KEYWORD, "elm/code/token/keyword", edje);
1833 _elm_code_widget_setup_palette_item(o, ELM_CODE_TOKEN_TYPE_PREPROCESSOR, "elm/code/token/preprocessor", edje); 1840 _elm_code_widget_setup_palette_item(widget, o, ELM_CODE_TOKEN_TYPE_PREPROCESSOR, "elm/code/token/preprocessor", edje);
1834 _elm_code_widget_setup_palette_item(o, ELM_CODE_TOKEN_TYPE_ADDED, "elm/code/token/added", edje); 1841 _elm_code_widget_setup_palette_item(widget, o, ELM_CODE_TOKEN_TYPE_ADDED, "elm/code/token/added", edje);
1835 _elm_code_widget_setup_palette_item(o, ELM_CODE_TOKEN_TYPE_REMOVED, "elm/code/token/removed", edje); 1842 _elm_code_widget_setup_palette_item(widget, o, ELM_CODE_TOKEN_TYPE_REMOVED, "elm/code/token/removed", edje);
1836 _elm_code_widget_setup_palette_item(o, ELM_CODE_TOKEN_TYPE_CHANGED, "elm/code/token/changed", edje); 1843 _elm_code_widget_setup_palette_item(widget, o, ELM_CODE_TOKEN_TYPE_CHANGED, "elm/code/token/changed", edje);
1837 _elm_code_widget_setup_palette_item(o, ELM_CODE_TOKEN_TYPE_MATCH, "elm/code/token/match", edje); 1844 _elm_code_widget_setup_palette_item(widget, o, ELM_CODE_TOKEN_TYPE_MATCH, "elm/code/token/match", edje);
1838 1845
1839 // other styles that the widget uses 1846 // other styles that the widget uses
1840 _elm_code_widget_setup_palette_item(o, ELM_CODE_WIDGET_COLOR_SELECTION, "elm/code/widget/color/selection", edje); 1847 _elm_code_widget_setup_palette_item(widget, o, ELM_CODE_WIDGET_COLOR_SELECTION, "elm/code/widget/color/selection", edje);
1841 _elm_code_widget_setup_palette_item(o, ELM_CODE_WIDGET_COLOR_GUTTER_BG, "elm/code/widget/color/gutter/bg", edje); 1848 _elm_code_widget_setup_palette_item(widget, o, ELM_CODE_WIDGET_COLOR_GUTTER_BG, "elm/code/widget/color/gutter/bg", edje);
1842 _elm_code_widget_setup_palette_item(o, ELM_CODE_WIDGET_COLOR_GUTTER_FG, "elm/code/widget/color/gutter/fg", edje); 1849 _elm_code_widget_setup_palette_item(widget, o, ELM_CODE_WIDGET_COLOR_GUTTER_FG, "elm/code/widget/color/gutter/fg", edje);
1843 _elm_code_widget_setup_palette_item(o, ELM_CODE_WIDGET_COLOR_GUTTER_SCOPE_BG, "elm/code/widget/color/scope/bg", edje); 1850 _elm_code_widget_setup_palette_item(widget, o, ELM_CODE_WIDGET_COLOR_GUTTER_SCOPE_BG, "elm/code/widget/color/scope/bg", edje);
1844 _elm_code_widget_setup_palette_item(o, ELM_CODE_WIDGET_COLOR_WHITESPACE, "elm/code/widget/color/whitespace", edje); 1851 _elm_code_widget_setup_palette_item(widget, o, ELM_CODE_WIDGET_COLOR_WHITESPACE, "elm/code/widget/color/whitespace", edje);
1845} 1852}
1846 1853
1847static void 1854static void
@@ -2019,6 +2026,14 @@ _elm_code_widget_font_set(Eo *obj EINA_UNUSED, Elm_Code_Widget_Data *pd,
2019 pd->font_size = size; 2026 pd->font_size = size;
2020} 2027}
2021 2028
2029EAPI void
2030elm_code_widget_alpha_set(Elm_Code_Widget *widget, int alpha)
2031{
2032 Elm_Code_Widget_Data *pd = efl_data_scope_get(widget, ELM_CODE_WIDGET_CLASS);
2033
2034 pd->alpha = alpha;
2035}
2036
2022EOLIAN static void 2037EOLIAN static void
2023_elm_code_widget_font_get(Eo *obj EINA_UNUSED, Elm_Code_Widget_Data *pd, 2038_elm_code_widget_font_get(Eo *obj EINA_UNUSED, Elm_Code_Widget_Data *pd,
2024 const char **name, Evas_Font_Size *size) 2039 const char **name, Evas_Font_Size *size)
diff --git a/src/lib/elementary/elm_code_widget_legacy.h b/src/lib/elementary/elm_code_widget_legacy.h
index 5110e301e2..4e58c2018b 100644
--- a/src/lib/elementary/elm_code_widget_legacy.h
+++ b/src/lib/elementary/elm_code_widget_legacy.h
@@ -9,5 +9,6 @@
9 * @ingroup Data 9 * @ingroup Data
10 */ 10 */
11EAPI Evas_Object *elm_code_widget_add(Evas_Object *parent, Elm_Code *code); 11EAPI Evas_Object *elm_code_widget_add(Evas_Object *parent, Elm_Code *code);
12EAPI void elm_code_widget_alpha_set(Elm_Code_Widget *widget, int alpha);
12 13
13#include "elm_code_widget.eo.legacy.h" 14#include "elm_code_widget.eo.legacy.h"
diff --git a/src/lib/elementary/elm_code_widget_private.h b/src/lib/elementary/elm_code_widget_private.h
index 4e050a799b..1aa9ef68a1 100644
--- a/src/lib/elementary/elm_code_widget_private.h
+++ b/src/lib/elementary/elm_code_widget_private.h
@@ -20,6 +20,7 @@ typedef struct
20 const char *font_name; 20 const char *font_name;
21 Evas_Font_Size font_size; 21 Evas_Font_Size font_size;
22 double gravity_x, gravity_y; 22 double gravity_x, gravity_y;
23 int alpha;
23 24
24 unsigned int cursor_line, cursor_col; 25 unsigned int cursor_line, cursor_col;
25 Evas_Object *cursor_rect; 26 Evas_Object *cursor_rect;