2016-06-03 14:04:36 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
2016-06-02 17:19:08 -07:00
|
|
|
# include "elementary_config.h"
|
2014-10-17 13:36:03 -07:00
|
|
|
#endif
|
|
|
|
|
2014-11-06 15:43:56 -08:00
|
|
|
#include <Eo.h>
|
2014-12-24 10:16:38 -08:00
|
|
|
#include <Evas.h>
|
2014-11-06 15:43:56 -08:00
|
|
|
|
2016-06-02 17:19:08 -07:00
|
|
|
#include "Elementary.h"
|
2014-10-17 13:36:03 -07:00
|
|
|
|
|
|
|
#include "elm_code_private.h"
|
|
|
|
|
2016-08-10 07:23:04 -07:00
|
|
|
EAPI const Efl_Event_Description ELM_CODE_EVENT_LINE_LOAD_DONE =
|
|
|
|
EFL_EVENT_DESCRIPTION("line,load,done");
|
|
|
|
EAPI const Efl_Event_Description ELM_CODE_EVENT_FILE_LOAD_DONE =
|
|
|
|
EFL_EVENT_DESCRIPTION("file,load,done");
|
2014-11-09 13:53:30 -08:00
|
|
|
|
2014-12-24 10:16:38 -08:00
|
|
|
|
2014-10-26 15:47:27 -07:00
|
|
|
EAPI Elm_Code *
|
2016-06-10 13:26:40 -07:00
|
|
|
elm_code_create(void)
|
2014-10-19 14:33:49 -07:00
|
|
|
{
|
2014-10-26 15:47:27 -07:00
|
|
|
Elm_Code *ret;
|
2014-10-19 14:33:49 -07:00
|
|
|
|
2014-10-26 15:47:27 -07:00
|
|
|
ret = calloc(1, sizeof(Elm_Code));
|
2019-01-29 06:23:44 -08:00
|
|
|
if (!ret) return NULL;
|
2018-03-24 03:39:32 -07:00
|
|
|
ret->config.indent_style_efl = EINA_TRUE;
|
2014-10-17 15:36:07 -07:00
|
|
|
|
2014-11-28 00:55:42 -08:00
|
|
|
// create an in-memory backing for this elm_code by default
|
|
|
|
elm_code_file_new(ret);
|
2014-10-17 15:36:07 -07:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2014-10-26 15:47:27 -07:00
|
|
|
EAPI void
|
|
|
|
elm_code_free(Elm_Code *code)
|
2014-10-19 14:33:49 -07:00
|
|
|
{
|
2014-11-06 15:43:56 -08:00
|
|
|
Evas_Object *widget;
|
2014-11-16 15:52:41 -08:00
|
|
|
Elm_Code_Parser *parser;
|
2014-11-06 15:43:56 -08:00
|
|
|
|
2014-10-26 15:47:27 -07:00
|
|
|
if (code->file)
|
2014-11-06 15:43:56 -08:00
|
|
|
elm_code_file_free(code->file);
|
|
|
|
|
2014-11-16 15:52:41 -08:00
|
|
|
EINA_LIST_FREE(code->widgets, widget)
|
2014-11-06 15:43:56 -08:00
|
|
|
{
|
|
|
|
evas_object_hide(widget);
|
|
|
|
evas_object_del(widget);
|
|
|
|
}
|
2014-10-19 14:33:49 -07:00
|
|
|
|
2014-11-16 15:52:41 -08:00
|
|
|
EINA_LIST_FREE(code->parsers, parser)
|
|
|
|
{
|
2016-05-16 03:01:12 -07:00
|
|
|
_elm_code_parser_free(parser);
|
2014-11-16 15:52:41 -08:00
|
|
|
}
|
|
|
|
|
2014-10-26 15:47:27 -07:00
|
|
|
free(code);
|
2014-10-19 14:33:49 -07:00
|
|
|
}
|
2014-11-06 15:43:56 -08:00
|
|
|
|
|
|
|
EAPI void
|
2016-08-10 07:23:04 -07:00
|
|
|
elm_code_callback_fire(Elm_Code *code, const Efl_Event_Description *signal, void *data)
|
2014-11-06 15:43:56 -08:00
|
|
|
{
|
|
|
|
Eina_List *item;
|
2015-01-24 14:07:00 -08:00
|
|
|
Eo *widget;
|
2014-11-06 15:43:56 -08:00
|
|
|
|
|
|
|
EINA_LIST_FOREACH(code->widgets, item, widget)
|
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(widget, signal, data);
|
2014-11-06 15:43:56 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|