forked from enlightenment/efl
167 lines
4.0 KiB
C
167 lines
4.0 KiB
C
#ifdef HAVE_CONFIG_H
|
|
# include "elementary_config.h"
|
|
#endif
|
|
|
|
#include <Elementary.h>
|
|
|
|
#include "elm_priv.h"
|
|
#include "elm_widget_inwin.h"
|
|
#include "elm_widget_layout.h"
|
|
|
|
#define MY_CLASS ELM_OBJ_WIN_INWIN_CLASS
|
|
|
|
#define MY_CLASS_NAME "Elm_Inwin"
|
|
#define MY_CLASS_NAME_LEGACY "elm_inwin"
|
|
|
|
static const Elm_Layout_Part_Alias_Description _content_aliases[] =
|
|
{
|
|
{"default", "elm.swallow.content"},
|
|
{NULL, NULL}
|
|
};
|
|
|
|
EOLIAN static void
|
|
_elm_inwin_elm_layout_sizing_eval(Eo *obj, void *_pd EINA_UNUSED)
|
|
{
|
|
Evas_Object *content;
|
|
Evas_Coord minw = -1, minh = -1;
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
|
|
|
content = elm_layout_content_get(obj, NULL);
|
|
|
|
if (!content) return;
|
|
|
|
evas_object_size_hint_min_get(content, &minw, &minh);
|
|
edje_object_size_min_calc(wd->resize_obj, &minw, &minh);
|
|
|
|
evas_object_size_hint_min_set(obj, minw, minh);
|
|
evas_object_size_hint_max_set(obj, -1, -1);
|
|
}
|
|
|
|
EOLIAN static Eina_Bool
|
|
_elm_inwin_elm_widget_focus_next_manager_is(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED)
|
|
{
|
|
return EINA_TRUE;
|
|
}
|
|
|
|
EOLIAN static Eina_Bool
|
|
_elm_inwin_elm_widget_focus_next(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, Elm_Focus_Direction dir, Evas_Object **next)
|
|
{
|
|
Evas_Object *content;
|
|
|
|
content = elm_layout_content_get(obj, NULL);
|
|
|
|
/* attempt to follow focus cycle into sub-object */
|
|
if (content)
|
|
{
|
|
elm_widget_focus_next_get(content, dir, next);
|
|
if (*next) return EINA_TRUE;
|
|
}
|
|
|
|
*next = (Evas_Object *)obj;
|
|
|
|
return EINA_FALSE;
|
|
}
|
|
|
|
EOLIAN static void
|
|
_elm_inwin_evas_smart_add(Eo *obj, void *_pd EINA_UNUSED)
|
|
{
|
|
eo_do_super(obj, MY_CLASS, evas_obj_smart_add());
|
|
elm_widget_sub_object_parent_add(obj);
|
|
|
|
elm_widget_can_focus_set(obj, EINA_FALSE);
|
|
elm_widget_highlight_ignore_set(obj, EINA_TRUE);
|
|
|
|
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);
|
|
if (!elm_layout_theme_set(obj, "win", "inwin", elm_object_style_get(obj)))
|
|
CRI("Failed to set layout!");
|
|
}
|
|
|
|
EOLIAN static void
|
|
_elm_inwin_elm_widget_parent_set(Eo *obj, void *_pd EINA_UNUSED, Evas_Object *parent)
|
|
{
|
|
elm_win_resize_object_add(parent, obj);
|
|
|
|
elm_layout_sizing_eval(obj);
|
|
}
|
|
|
|
EOLIAN static const Elm_Layout_Part_Alias_Description*
|
|
_elm_inwin_elm_layout_content_aliases_get(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED)
|
|
{
|
|
return _content_aliases;
|
|
}
|
|
|
|
EAPI Evas_Object *
|
|
elm_win_inwin_add(Evas_Object *parent)
|
|
{
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
|
|
Evas_Object *obj = eo_add(MY_CLASS, parent);
|
|
eo_unref(obj);
|
|
return obj;
|
|
}
|
|
|
|
EOLIAN static void
|
|
_elm_inwin_eo_base_constructor(Eo *obj, void *_pd EINA_UNUSED)
|
|
{
|
|
Evas_Object *parent = NULL;
|
|
|
|
eo_do(obj, parent = eo_parent_get());
|
|
|
|
if (parent && !eo_isa(parent, ELM_OBJ_WIN_CLASS))
|
|
{
|
|
eo_error_set(obj); /* *has* to have a parent window */
|
|
return;
|
|
}
|
|
|
|
eo_do_super(obj, MY_CLASS, eo_constructor());
|
|
eo_do(obj, evas_obj_type_set(MY_CLASS_NAME_LEGACY));
|
|
}
|
|
|
|
EOLIAN static void
|
|
_elm_inwin_activate(Eo *obj, void *_pd EINA_UNUSED)
|
|
{
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
|
|
|
if (elm_widget_disabled_get(obj)) return;
|
|
|
|
evas_object_raise(obj);
|
|
evas_object_show(obj);
|
|
edje_object_signal_emit
|
|
(wd->resize_obj, "elm,action,show", "elm");
|
|
elm_object_focus_set(obj, EINA_TRUE);
|
|
}
|
|
|
|
EAPI void
|
|
elm_win_inwin_content_set(Evas_Object *obj,
|
|
Evas_Object *content)
|
|
{
|
|
ELM_INWIN_CHECK(obj);
|
|
eo_do(obj, elm_obj_container_content_set(NULL, content));
|
|
}
|
|
|
|
EAPI Evas_Object *
|
|
elm_win_inwin_content_get(const Evas_Object *obj)
|
|
{
|
|
ELM_INWIN_CHECK(obj) NULL;
|
|
Evas_Object *ret = NULL;
|
|
eo_do((Eo *)obj, ret = elm_obj_container_content_get(NULL));
|
|
return ret;
|
|
}
|
|
|
|
EAPI Evas_Object *
|
|
elm_win_inwin_content_unset(Evas_Object *obj)
|
|
{
|
|
ELM_INWIN_CHECK(obj) NULL;
|
|
Evas_Object *ret = NULL;
|
|
eo_do(obj, ret = elm_obj_container_content_unset(NULL));
|
|
return ret;
|
|
}
|
|
|
|
static void
|
|
_elm_inwin_class_constructor(Eo_Class *klass)
|
|
{
|
|
evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
|
|
}
|
|
|
|
#include "elm_inwin.eo.c"
|