edje_object_part_swallow(wd->panes, "elm.swallow.left", wd->contents.left);
if (wd->contents.right)
edje_object_part_swallow(wd->panes, "elm.swallow.right", wd->contents.right);
- if(wd->contents.left && wd->contents.right)
+ if (wd->contents.left && wd->contents.right)
edje_object_signal_emit(wd->panes, "elm.panes.pair", "elm");
- if(wd->fixed)
+ if (wd->fixed)
edje_object_signal_emit(wd->panes, "elm.panes.fixed", "elm");
edje_object_scale_set(wd->panes, elm_widget_scale_get(obj) *
_elm_panes_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
{
Widget_Data *wd = elm_widget_data_get(obj);
-
- if (!wd)
- return EINA_FALSE;
+ if (!wd) return EINA_FALSE;
double w, h;
edje_object_part_drag_value_get(wd->panes, "elm.bar", &w, &h);
{
evas_object_event_callback_del_full(sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
_changed_size_hints, obj);
+ edje_object_part_unswallow(wd->panes, sub);
wd->contents.left = NULL;
_sizing_eval(obj);
}
{
evas_object_event_callback_del_full(sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
_changed_size_hints, obj);
+ edje_object_part_unswallow(wd->panes, sub);
wd->contents.right= NULL;
_sizing_eval(obj);
}
}
}
+static void
+_content_left_set(Evas_Object *obj, Evas_Object *content)
+{
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (wd->contents.left == content) return;
+ if (wd->contents.left)
+ {
+ evas_object_del(wd->contents.left);
+ edje_object_signal_emit(wd->panes, "elm.panes.unpair", "elm");
+ }
+ wd->contents.left = content;
+ if (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");
+ }
+}
+
+static void
+_content_right_set(Evas_Object *obj, Evas_Object *content)
+{
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (wd->contents.right == content) return;
+ if (wd->contents.right)
+ {
+ evas_object_del(wd->contents.right);
+ edje_object_signal_emit(wd->panes, "elm.panes.unpair", "elm");
+ }
+ wd->contents.right = content;
+ if (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");
+ }
+}
+
+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_signal_emit(wd->panes, "elm.panes.unpair", "elm");
+ 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_signal_emit(wd->panes, "elm.panes.unpair", "elm");
+ 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 && (!strncmp(part, "elm.swallow.", 12))) part += 12;
+ if (!part || !strcmp(part, "left"))
+ _content_left_set(obj, content);
+ else if (!strcmp(part, "right"))
+ _content_right_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 && (!strncmp(part, "elm.swallow.", 12))) part += 12;
+ if (!part || !strcmp(part, "left"))
+ return wd->contents.left;
+ else if (!strcmp(part, "right"))
+ 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 && (!strncmp(part, "elm.swallow.", 12))) part += 12;
+ if (!part || !strcmp(part, "left"))
+ return _content_left_unset(obj);
+ else if (!strcmp(part, "right"))
+ return _content_right_unset(obj);
+ return NULL;
+}
+
EAPI Evas_Object *
elm_panes_add(Evas_Object *parent)
{
ELM_SET_WIDTYPE(widtype, "panes");
elm_widget_type_set(obj, "panes");
- elm_widget_can_focus_set(obj, EINA_FALSE);
elm_widget_sub_object_add(parent, obj);
elm_widget_data_set(obj, wd);
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");
return obj;
}
-EAPI void
+EINA_DEPRECATED 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, "left", content);
}
-EAPI void
+EINA_DEPRECATED 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, "right", content);
}
-EAPI Evas_Object *
+EINA_DEPRECATED 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, "left");
}
-EAPI Evas_Object *
+EINA_DEPRECATED 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, "right");
}
-EAPI Evas_Object *
+EINA_DEPRECATED 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, "left");
}
-EAPI Evas_Object *
+EINA_DEPRECATED 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, "right");
}
EAPI double
Widget_Data *wd = elm_widget_data_get(obj);
double w, h;
+ if (!wd) return 0;
edje_object_part_drag_value_get(wd->panes, "elm.bar", &w, &h);
if (wd->horizontal) return h;
else return w;
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
-
+ if (!wd) return;
if (size < 0.0) size = 0.0;
else if (size > 1.0) size = 1.0;
if (wd->horizontal)
edje_object_part_drag_value_set(wd->panes, "elm.bar", size, 0.0);
}
+EAPI double
+elm_panes_content_right_size_get(const Evas_Object *obj)
+{
+ return (1.0 - elm_panes_content_left_size_get(obj));
+}
+
+EAPI void
+elm_panes_content_right_size_set(Evas_Object *obj, double size)
+{
+ elm_panes_content_left_size_set(obj, (1.0 - size));
+}
+
EAPI void
elm_panes_horizontal_set(Evas_Object *obj, Eina_Bool horizontal)
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
-
+ if (!wd) return;
wd->horizontal = horizontal;
_theme_hook(obj);
elm_panes_content_left_size_set(obj, 0.5);
{
ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return EINA_FALSE;
return wd->horizontal;
}
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
- wd->fixed = fixed;
+ if (!wd) return;
+ wd->fixed = !!fixed;
if (wd->fixed == EINA_TRUE)
edje_object_signal_emit(wd->panes, "elm.panes.fixed", "elm");
else
{
ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return EINA_FALSE;
return wd->fixed;
}