evas_object_size_hint_weight_set(bt, 1.0, 1.0);
evas_object_size_hint_align_set(bt, -1.0, -1.0);
evas_object_show(bt);
- elm_panes_content_left_set(panes, bt);
+ elm_object_content_part_set(panes, ELM_PANES_CONTENT_LEFT, bt);
//
//
evas_object_smart_callback_add(panes_h, "press", _press, panes_h);
evas_object_smart_callback_add(panes_h, "unpress", _unpress, panes_h);
- elm_panes_content_right_set(panes, panes_h);
+ elm_object_content_part_set(panes, ELM_PANES_CONTENT_RIGHT, panes_h);
//
//
evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(bt);
- elm_panes_content_left_set(panes_h, bt);
+ elm_object_content_part_set(panes_h, ELM_PANES_CONTENT_LEFT, bt);
//
//
evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(bt);
- elm_panes_content_right_set(panes_h, bt);
+ elm_object_content_part_set(panes_h, ELM_PANES_CONTENT_RIGHT, bt);
//
else return;
if (p->content_left)
- elm_panes_content_left_set(obj, p->content_left);
+ elm_object_content_part_set(obj, ELM_PANES_CONTENT_LEFT, p->content_left);
if (p->content_right)
- elm_panes_content_right_set(obj, p->content_right);
+ elm_object_content_part_set(obj, ELM_PANES_CONTENT_RIGHT, p->content_right);
if (p->is_left_size)
elm_panes_content_left_size_set(obj, p->left_size);
Evas_Object *content = external_common_param_edje_object_get(obj, param);
if ((strcmp(param->s, "")) && (!content))
return EINA_FALSE;
- elm_panes_content_left_set(obj, content);
+ elm_object_content_part_set(obj, ELM_PANES_CONTENT_LEFT, content);
return EINA_TRUE;
}
else if ((!strcmp(param->name, "content right"))
Evas_Object *content = external_common_param_edje_object_get(obj, param);
if ((strcmp(param->s, "")) && (!content))
return EINA_FALSE;
- elm_panes_content_right_set(obj, content);
+ elm_object_content_part_set(obj, ELM_PANES_CONTENT_RIGHT, content);
return EINA_TRUE;
}
else if ((!strcmp(param->name, "horizontal"))
const char *content)
{
if (!strcmp(content, "left"))
- return elm_panes_content_left_get(obj);
+ return elm_object_content_part_get(obj, ELM_PANES_CONTENT_LEFT);
else if (!strcmp(content, "right"))
- return elm_panes_content_right_get(obj);
+ return elm_object_content_part_get(obj, ELM_PANES_CONTENT_RIGHT);
ERR("unknown content '%s'", content);
}
}
+static void
+_content_left_set(Evas_Object *obj, Evas_Object *content)
+{
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (wd->contents.left)
+ {
+ evas_object_del(wd->contents.left);
+ wd->contents.left = NULL;
+ }
+ if (content)
+ {
+ wd->contents.left = content;
+ elm_widget_sub_object_add(obj, content);
+ edje_object_part_swallow(wd->panes, "elm.swallow.left", content);
+ }
+}
+
+static void
+_content_right_set(Evas_Object *obj, Evas_Object *content)
+{
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (wd->contents.right)
+ {
+ evas_object_del(wd->contents.right);
+ wd->contents.right = NULL;
+ }
+ if (content)
+ {
+ wd->contents.right = content;
+ elm_widget_sub_object_add(obj, content);
+ edje_object_part_swallow(wd->panes, "elm.swallow.right", content);
+ }
+}
+
+static Evas_Object *
+_content_left_unset(Evas_Object *obj)
+{
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd->contents.left) return NULL;
+ Evas_Object *content = wd->contents.left;
+ elm_widget_sub_object_del(obj, content);
+ edje_object_part_unswallow(wd->panes, content);
+ wd->contents.left = NULL;
+ return content;
+}
+
+static Evas_Object *
+_content_right_unset(Evas_Object *obj)
+{
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd->contents.right) return NULL;
+ Evas_Object *content = wd->contents.right;
+ elm_widget_sub_object_del(obj, content);
+ edje_object_part_unswallow(wd->panes, content);
+ wd->contents.right = NULL;
+ return content;
+}
+
+static void
+_content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+
+ if ((!part) || (!strcmp(part, "elm.swallow.right")))
+ _content_right_set(obj, content);
+ else if(!strcmp(part, "elm.swallow.left"))
+ _content_left_set(obj, content);
+}
+
+static Evas_Object *
+_content_get_hook(const Evas_Object *obj, const char *part)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return NULL;
+ if ((!part) || (!strcmp(part, "elm.swallow.right")))
+ return wd->contents.left;
+ else if (!strcmp(part, "elm.swallow.left"))
+ return wd->contents.right;
+ return NULL;
+}
+
+static Evas_Object *
+_content_unset_hook(Evas_Object *obj, const char *part)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return NULL;
+
+ if ((!part) || (!strcmp(part, "elm.swallow.right")))
+ _content_right_unset(obj);
+ else if (!strcmp(part, "elm.swallow.left"))
+ _content_left_unset(obj);
+
+ return NULL;
+}
+
EAPI Evas_Object *
elm_panes_add(Evas_Object *parent)
{
elm_widget_del_hook_set(obj, _del_hook);
elm_widget_theme_hook_set(obj, _theme_hook);
elm_widget_focus_next_hook_set(obj, _elm_panes_focus_next_hook);
+ elm_widget_content_set_hook_set(obj, _content_set_hook);
+ elm_widget_content_get_hook_set(obj, _content_get_hook);
+ elm_widget_content_unset_hook_set(obj, _content_unset_hook);
+ elm_widget_can_focus_set(obj, EINA_FALSE);
wd->panes = edje_object_add(e);
_elm_theme_object_set(obj, wd->panes, "panes", "vertical", "default");
EAPI void
elm_panes_content_left_set(Evas_Object *obj, Evas_Object *content)
{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (wd->contents.left)
- {
- evas_object_del(wd->contents.left);
- wd->contents.left = NULL;
- }
- if (content)
- {
- wd->contents.left = content;
- elm_widget_sub_object_add(obj, content);
- edje_object_part_swallow(wd->panes, "elm.swallow.left", content);
- if (wd->contents.right)
- edje_object_signal_emit(wd->panes, "elm.panes.pair", "elm");
- }
- else
- edje_object_signal_emit(wd->panes, "elm.panes.unpair", "elm");
+ _content_set_hook(obj, "elm.swallow.left", content);
}
EAPI void
elm_panes_content_right_set(Evas_Object *obj, Evas_Object *content)
{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (wd->contents.right)
- {
- evas_object_del(wd->contents.right);
- wd->contents.right = NULL;
- }
- if (content)
- {
- wd->contents.right = content;
- elm_widget_sub_object_add(obj, content);
- edje_object_part_swallow(wd->panes, "elm.swallow.right", content);
- if (wd->contents.left)
- edje_object_signal_emit(wd->panes, "elm.panes.pair", "elm");
- }
- else
- edje_object_signal_emit(wd->panes, "elm.panes.unpair", "elm");
+ _content_set_hook(obj, NULL, content);
}
EAPI Evas_Object *
elm_panes_content_left_get(const Evas_Object *obj)
{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- return wd->contents.left;
+ return _content_get_hook(obj, "elm.swallow.left");
}
EAPI Evas_Object *
elm_panes_content_right_get(const Evas_Object *obj)
{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- return wd->contents.right;
+ return _content_get_hook(obj, NULL);
}
EAPI Evas_Object *
elm_panes_content_left_unset(Evas_Object *obj)
{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return NULL;
- if (!wd->contents.left) return NULL;
- Evas_Object *content = wd->contents.left;
- elm_widget_sub_object_del(obj, content);
- edje_object_part_unswallow(wd->panes, content);
- evas_object_hide(content);
- wd->contents.left = NULL;
- edje_object_signal_emit(wd->panes, "elm.panes.unpair", "elm");
- return content;
+ return _content_unset_hook(obj, "elm.swallow.left");
}
EAPI Evas_Object *
elm_panes_content_right_unset(Evas_Object *obj)
{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return NULL;
- if (!wd->contents.right) return NULL;
- Evas_Object *content = wd->contents.right;
- elm_widget_sub_object_del(obj, content);
- edje_object_part_unswallow(wd->panes, content);
- evas_object_hide(content);
- wd->contents.right = NULL;
- edje_object_signal_emit(wd->panes, "elm.panes.unpair", "elm");
- return content;
+ return _content_unset_hook(obj, "elm.swallow.right");
}
EAPI double