Add a file load callback also - respect that with a widget refresh when called

This commit is contained in:
Andy Williams 2014-11-12 22:59:05 +00:00
parent f429afa47d
commit c28dd39224
4 changed files with 21 additions and 0 deletions

View File

@ -13,6 +13,8 @@ int _elm_code_lib_log_dom = -1;
const Eo_Event_Description ELM_CODE_EVENT_LINE_SET_DONE =
EO_EVENT_DESCRIPTION("line,set,done", "");
const Eo_Event_Description ELM_CODE_EVENT_FILE_LOAD_DONE =
EO_EVENT_DESCRIPTION("file, load,done", "");
EAPI int
elm_code_init(void)

View File

@ -5,6 +5,7 @@
#include <Eina.h>
EAPI extern const Eo_Event_Description ELM_CODE_EVENT_LINE_SET_DONE;
EAPI extern const Eo_Event_Description ELM_CODE_EVENT_FILE_LOAD_DONE;
typedef enum {
ELM_CODE_STATUS_TYPE_DEFAULT = 0,

View File

@ -76,6 +76,8 @@ EAPI Elm_Code_File *elm_code_file_open(const char *path)
}
eina_iterator_free(it);
if (ret->parent)
elm_code_callback_fire(ret->parent, &ELM_CODE_EVENT_FILE_LOAD_DONE, ret);
return ret;
}

View File

@ -92,6 +92,21 @@ _elm_code_widget_line_cb(void *data EINA_UNUSED, Eo *obj,
return EINA_TRUE;
}
static Eina_Bool
_elm_code_widget_file_cb(void *data, Eo *obj, const Eo_Event_Description *desc EINA_UNUSED,
void *event_info EINA_UNUSED)
{
Evas_Object *o;
Elm_Code *code;
code = (Elm_Code *)data;
o = (Evas_Object *)obj;
elm_code_widget_fill(o, code);
return EINA_TRUE;
}
static void
_elm_code_widget_resize_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj,
void *event_info EINA_UNUSED)
@ -130,6 +145,7 @@ EAPI Evas_Object *elm_code_widget_add(Evas_Object *parent, Elm_Code *code)
evas_object_event_callback_add(o, EVAS_CALLBACK_RESIZE, _elm_code_widget_resize_cb, code);
eo_do(o,eo_event_callback_add(&ELM_CODE_EVENT_LINE_SET_DONE, _elm_code_widget_line_cb, code));
eo_do(o,eo_event_callback_add(&ELM_CODE_EVENT_FILE_LOAD_DONE, _elm_code_widget_file_cb, code));
code->widgets = eina_list_append(code->widgets, o);
return o;