From 3fb3564d05e120cec056ce4160a578bebb996d1f Mon Sep 17 00:00:00 2001 From: Andy Williams Date: Fri, 23 Jan 2015 22:55:13 +0000 Subject: [PATCH] Experimental eo commit - structure in place and it's resizing but won't render --- configure.ac | 10 ++++ elm_code/bin/elm_code_test_main.c | 11 ++++ elm_code/lib/Makefile.am | 3 ++ elm_code/lib/elm_code_widget2.c | 82 ++++++++++++++++++++++++++++++ elm_code/lib/elm_code_widget2.eo | 30 +++++++++++ elm_code/lib/elm_code_widget2.eo.c | 53 +++++++++++++++++++ elm_code/lib/elm_code_widget2.eo.h | 50 ++++++++++++++++++ elm_code/lib/regen.sh | 7 +++ 8 files changed, 246 insertions(+) create mode 100644 elm_code/lib/elm_code_widget2.c create mode 100644 elm_code/lib/elm_code_widget2.eo create mode 100644 elm_code/lib/elm_code_widget2.eo.c create mode 100644 elm_code/lib/elm_code_widget2.eo.h create mode 100755 elm_code/lib/regen.sh diff --git a/configure.ac b/configure.ac index c9b3a42..45e7eb7 100644 --- a/configure.ac +++ b/configure.ac @@ -84,6 +84,14 @@ EFL_CHECK_DOXYGEN([build_doc="yes"], [build_doc="no"]) # Check edje_cc EFL_WITH_BIN([edje], [edje-cc], [edje_cc]) +EFL_WITH_BIN([eolian], [eolian-gen], [eolian_gen]) +# Force the helper to try external eolian generators +AM_CONDITIONAL([HAVE_EOLIAN_GEN], [true]) + +# Needs to be moved into a macro, and also, needs a way to automatically fetch +# from all the dependencies using the Requires. +DEPS_EOLIAN_FLAGS=`${PKG_CONFIG} --variable=eolian_flags eo evas edje ecore efl` +AC_SUBST([DEPS_EOLIAN_FLAGS]) # Checks for library functions. AC_CHECK_FUNCS([setlocale]) @@ -127,6 +135,8 @@ echo " CFLAGS.................: $CFLAGS" echo " edje_cc................: ${edje_cc}" echo " highlighting (libclang): ${build_clang}" echo +echo "eolian_gen...............: ${eolian_gen}" +echo echo "Building documentation...: ${build_doc}" echo "Building tests...........: ${have_tests}" echo "Generate coverage .......: ${have_lcov}" diff --git a/elm_code/bin/elm_code_test_main.c b/elm_code/bin/elm_code_test_main.c index c422c7d..b462ef0 100644 --- a/elm_code/bin/elm_code_test_main.c +++ b/elm_code/bin/elm_code_test_main.c @@ -12,6 +12,7 @@ #include "gettext.h" #include +#include "elm_code_widget2.eo.h" #include "elm_code_test_private.h" @@ -50,6 +51,16 @@ _elm_code_test_welcome_setup(Evas_Object *parent) Evas_Object *widget; code = elm_code_create(); + + Elm_Code_Widget2 *obj = eo_add(ELM_CODE_WIDGET2_CLASS, parent); + eo_do(obj, + elm_code_widget2_font_size_set(14)); + + evas_object_size_hint_weight_set(obj, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(obj, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(obj); +return obj; +// TODO - add all this good stuff into the eo api widget = elm_code_widget_add(parent, code); elm_code_widget_font_size_set(widget, 14); elm_code_widget_editable_set(widget, EINA_TRUE); diff --git a/elm_code/lib/Makefile.am b/elm_code/lib/Makefile.am index 9510cad..193b9e4 100644 --- a/elm_code/lib/Makefile.am +++ b/elm_code/lib/Makefile.am @@ -3,6 +3,7 @@ MAINTAINERCLEANFILES = Makefile.in AM_CPPFLAGS = \ -I$(top_srcdir)/elm_code/lib \ -DEFL_BETA_API_SUPPORT \ +-DEFL_EO_API_SUPPORT \ @EFL_CFLAGS@ \ -DEFL_ELM_CODE_BUILD @@ -20,8 +21,10 @@ libelm_code_la_SOURCES = \ elm_code_file.c \ elm_code_parse.c \ elm_code_widget.c \ +elm_code_widget2.c \ elm_code_diff_widget.c \ elm_code.c \ elm_code_private.h + libelm_code_la_LIBADD = @EFL_LIBS@ -lm libelm_code_la_LDFLAGS = -no-undefined @EFL_LTLIBRARY_FLAGS@ diff --git a/elm_code/lib/elm_code_widget2.c b/elm_code/lib/elm_code_widget2.c new file mode 100644 index 0000000..24dc8df --- /dev/null +++ b/elm_code/lib/elm_code_widget2.c @@ -0,0 +1,82 @@ +#ifdef HAVE_CONFIG +# include "config.h" +#endif + +#include +#include +#include +#include +#include "elm_code_widget2.eo.h" + +typedef struct +{ + Elm_Code *code; + + Evas_Font_Size font_size; + unsigned int cursor_line, cursor_col; + Eina_Bool editable; + +} Elm_Code_Widget2_Data; + +EOLIAN static void +_elm_code_widget2_eo_base_constructor(Eo *obj, Elm_Code_Widget2_Data *pd) +{ + eo_do_super(obj, ELM_CODE_WIDGET2_CLASS, eo_constructor()); +printf("constr\n"); +} + +EOLIAN static void +_elm_code_widget2_evas_object_smart_resize(Eo *obj, Elm_Code_Widget2_Data *pd, Evas_Coord w, Evas_Coord h) +{ +printf("size %d, %d\n", w, h); +} + +EOLIAN static void +_elm_code_widget2_class_constructor(Eo_Class *klass) +{ + +} + +EOLIAN static void +_elm_code_widget2_elm_interface_scrollable_content_pos_set(Eo *obj, Elm_Code_Widget2_Data *pd, Evas_Coord x, Evas_Coord y, Eina_Bool sig) +{ + +} + +EOLIAN static void +_elm_code_widget2_evas_object_smart_add(Eo *obj, Elm_Code_Widget2_Data *pd) +{ + Evas_Object *text; + +printf("add\n"); + eo_do_super(obj, ELM_CODE_WIDGET2_CLASS, evas_obj_smart_add()); + elm_widget_sub_object_parent_add(obj); +// elm_widget_can_focus_set(obj, EINA_TRUE); + + text = elm_label_add(obj); + elm_object_text_set(text, "HELLO"); + elm_widget_sub_object_add(obj, text); + + evas_object_size_hint_weight_set(text, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(text, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(text); + + eo_do(obj, elm_obj_widget_theme_apply()); + + elm_layout_sizing_eval(obj); +} + +EOLIAN static void +_elm_code_widget2_font_size_set(Eo *obj, Elm_Code_Widget2_Data *pd, Evas_Font_Size font_size) +{ + printf("set\n"); + pd->font_size = font_size; +} + +EOLIAN static Evas_Font_Size +_elm_code_widget2_font_size_get(Eo *obj, Elm_Code_Widget2_Data *pd) +{ + return pd->font_size; +} + +#include "elm_code_widget2.eo.c" diff --git a/elm_code/lib/elm_code_widget2.eo b/elm_code/lib/elm_code_widget2.eo new file mode 100644 index 0000000..9104233 --- /dev/null +++ b/elm_code/lib/elm_code_widget2.eo @@ -0,0 +1,30 @@ +class Elm_Code_Widget2 (Elm_Layout, Elm_Interface_Scrollable, + Elm_Interface_Atspi_Text) +{ + eo_prefix: elm_code_widget2; + properties { + font_size { + set { + } + get { + } + values { + Evas_Font_Size font_size; + } + } + } + methods { + } + implements { + class.constructor; + Eo.Base.constructor; + Evas.Object_Smart.add; + Evas.Object_Smart.resize; + Elm_Interface_Scrollable.content_pos_set; + } + events { + focused; + unfocused; + } + +} diff --git a/elm_code/lib/elm_code_widget2.eo.c b/elm_code/lib/elm_code_widget2.eo.c new file mode 100644 index 0000000..2b3a597 --- /dev/null +++ b/elm_code/lib/elm_code_widget2.eo.c @@ -0,0 +1,53 @@ +EOAPI const Eo_Event_Description _ELM_CODE_WIDGET2_EVENT_FOCUSED = + EO_EVENT_DESCRIPTION("focused", ""); +EOAPI const Eo_Event_Description _ELM_CODE_WIDGET2_EVENT_UNFOCUSED = + EO_EVENT_DESCRIPTION("unfocused", ""); + +void _elm_code_widget2_font_size_set(Eo *obj, Elm_Code_Widget2_Data *pd, Evas_Font_Size font_size); + +EOAPI EO_VOID_FUNC_BODYV(elm_code_widget2_font_size_set, EO_FUNC_CALL(font_size), Evas_Font_Size font_size); + +Evas_Font_Size _elm_code_widget2_font_size_get(Eo *obj, Elm_Code_Widget2_Data *pd); + +EOAPI EO_FUNC_BODY(elm_code_widget2_font_size_get, Evas_Font_Size, 0); + +void _elm_code_widget2_eo_base_constructor(Eo *obj, Elm_Code_Widget2_Data *pd); + + +void _elm_code_widget2_evas_object_smart_add(Eo *obj, Elm_Code_Widget2_Data *pd); + + +void _elm_code_widget2_evas_object_smart_resize(Eo *obj, Elm_Code_Widget2_Data *pd, Evas_Coord w, Evas_Coord h); + + +void _elm_code_widget2_elm_interface_scrollable_content_pos_set(Eo *obj, Elm_Code_Widget2_Data *pd, Evas_Coord x, Evas_Coord y, Eina_Bool sig); + + +static Eo_Op_Description _elm_code_widget2_op_desc[] = { + EO_OP_FUNC_OVERRIDE(eo_constructor, _elm_code_widget2_eo_base_constructor), + EO_OP_FUNC_OVERRIDE(evas_obj_smart_add, _elm_code_widget2_evas_object_smart_add), + EO_OP_FUNC_OVERRIDE(evas_obj_smart_resize, _elm_code_widget2_evas_object_smart_resize), + EO_OP_FUNC_OVERRIDE(elm_interface_scrollable_content_pos_set, _elm_code_widget2_elm_interface_scrollable_content_pos_set), + EO_OP_FUNC(elm_code_widget2_font_size_set, _elm_code_widget2_font_size_set, ""), + EO_OP_FUNC(elm_code_widget2_font_size_get, _elm_code_widget2_font_size_get, ""), + EO_OP_SENTINEL +}; + +static const Eo_Event_Description *_elm_code_widget2_event_desc[] = { + ELM_CODE_WIDGET2_EVENT_FOCUSED, + ELM_CODE_WIDGET2_EVENT_UNFOCUSED, + NULL +}; + +static const Eo_Class_Description _elm_code_widget2_class_desc = { + EO_VERSION, + "Elm_Code_Widget2", + EO_CLASS_TYPE_REGULAR, + EO_CLASS_DESCRIPTION_OPS(_elm_code_widget2_op_desc), + _elm_code_widget2_event_desc, + sizeof(Elm_Code_Widget2_Data), + _elm_code_widget2_class_constructor, + NULL +}; + +EO_DEFINE_CLASS(elm_code_widget2_class_get, &_elm_code_widget2_class_desc, ELM_LAYOUT_CLASS, ELM_INTERFACE_SCROLLABLE_MIXIN, ELM_INTERFACE_ATSPI_TEXT_INTERFACE, NULL); \ No newline at end of file diff --git a/elm_code/lib/elm_code_widget2.eo.h b/elm_code/lib/elm_code_widget2.eo.h new file mode 100644 index 0000000..75d1b4d --- /dev/null +++ b/elm_code/lib/elm_code_widget2.eo.h @@ -0,0 +1,50 @@ +#ifndef _ELM_CODE_WIDGET2_EO_H_ +#define _ELM_CODE_WIDGET2_EO_H_ + +#ifndef _ELM_CODE_WIDGET2_EO_CLASS_TYPE +#define _ELM_CODE_WIDGET2_EO_CLASS_TYPE + +typedef Eo Elm_Code_Widget2; + +#endif + +#ifndef _ELM_CODE_WIDGET2_EO_TYPES +#define _ELM_CODE_WIDGET2_EO_TYPES + + +#endif +#define ELM_CODE_WIDGET2_CLASS elm_code_widget2_class_get() + +const Eo_Class *elm_code_widget2_class_get(void) EINA_CONST; + +/** + * + * No description supplied. + * + * @param[in] font_size No description supplied. + * + */ +EOAPI void elm_code_widget2_font_size_set(Evas_Font_Size font_size); + +/** + * + * No description supplied. + * + * + */ +EOAPI Evas_Font_Size elm_code_widget2_font_size_get(void); + +EOAPI extern const Eo_Event_Description _ELM_CODE_WIDGET2_EVENT_FOCUSED; +EOAPI extern const Eo_Event_Description _ELM_CODE_WIDGET2_EVENT_UNFOCUSED; + +/** + * No description + */ +#define ELM_CODE_WIDGET2_EVENT_FOCUSED (&(_ELM_CODE_WIDGET2_EVENT_FOCUSED)) + +/** + * No description + */ +#define ELM_CODE_WIDGET2_EVENT_UNFOCUSED (&(_ELM_CODE_WIDGET2_EVENT_UNFOCUSED)) + +#endif diff --git a/elm_code/lib/regen.sh b/elm_code/lib/regen.sh new file mode 100755 index 0000000..51acc50 --- /dev/null +++ b/elm_code/lib/regen.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +INCLUDE="-I /usr/local/share/eolian/include/eo-1 -I /usr/local/share/eolian/include/elementary-1 -I /usr/local/share/eolian/include/evas-1 -I /usr/local/share/eolian/include/efl-1" + +eolian_gen $INCLUDE --gh --eo -o elm_code_widget2.eo.h elm_code_widget2.eo +eolian_gen $INCLUDE --gc --eo -o elm_code_widget2.eo.c elm_code_widget2.eo +eolian_gen $INCLUDE --gi --eo -o elm_code_widget2.c elm_code_widget2.eo