forked from enlightenment/efl
elementary/panes - content_part_set/get/unset
SVN revision: 64524
This commit is contained in:
parent
0aadefe6b2
commit
1e3d557d25
|
@ -10,13 +10,13 @@ elm_object_text_set(bt, "Left");
|
|||
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);
|
||||
|
||||
bt = elm_button_add(win);
|
||||
elm_object_text_set(bt, "Right");
|
||||
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_right_set(panes, bt);
|
||||
elm_object_content_part_set(panes, ELM_PANES_CONTENT_RIGHT, bt);
|
||||
|
||||
#include "widget_preview_tmpl_foot.c"
|
||||
|
|
|
@ -73,7 +73,7 @@ test_panes(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
|
|||
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);
|
||||
//
|
||||
|
||||
//
|
||||
|
@ -88,7 +88,7 @@ test_panes(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
|
|||
|
||||
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);
|
||||
//
|
||||
|
||||
//
|
||||
|
@ -97,7 +97,7 @@ test_panes(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
|
|||
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);
|
||||
//
|
||||
|
||||
//
|
||||
|
@ -106,7 +106,7 @@ test_panes(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
|
|||
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);
|
||||
//
|
||||
|
||||
|
||||
|
|
|
@ -27,10 +27,10 @@ static void external_panes_state_set(void *data __UNUSED__,
|
|||
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);
|
||||
|
@ -51,7 +51,7 @@ static Eina_Bool external_panes_param_set(void *data __UNUSED__,
|
|||
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"))
|
||||
|
@ -60,7 +60,7 @@ static Eina_Bool external_panes_param_set(void *data __UNUSED__,
|
|||
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"))
|
||||
|
@ -170,9 +170,9 @@ external_panes_content_get(void *data __UNUSED__, const Evas_Object *obj,
|
|||
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);
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ elm_main(int argc __UNUSED__, char **argv __UNUSED__)
|
|||
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, bt);
|
||||
elm_object_content_part_set(panes, ELM_PANES_CONTENT_LEFT, bt);
|
||||
|
||||
panes_h = elm_panes_add(win);
|
||||
elm_panes_horizontal_set(panes_h, EINA_TRUE);
|
||||
|
@ -94,21 +94,21 @@ elm_main(int argc __UNUSED__, char **argv __UNUSED__)
|
|||
EVAS_HINT_EXPAND);
|
||||
evas_object_size_hint_align_set(panes_h, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
evas_object_show(panes_h);
|
||||
elm_panes_content_right_set(panes, panes_h);
|
||||
elm_object_content_part_set(panes, ELM_PANES_CONTENT_RIGHT, panes_h);
|
||||
|
||||
bt = elm_button_add(win);
|
||||
elm_object_text_set(bt, "Up");
|
||||
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);
|
||||
|
||||
bt = elm_button_add(win);
|
||||
elm_object_text_set(bt, "Down");
|
||||
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);
|
||||
|
||||
evas_object_smart_callback_add(panes, "clicked", _clicked, panes);
|
||||
evas_object_smart_callback_add(panes, "clicked,double", _clicked_double,
|
||||
|
|
|
@ -23681,7 +23681,7 @@ extern "C" {
|
|||
* @li ELM_PANEL_ORIENT_LEFT
|
||||
* @li ELM_PANEL_ORIENT_RIGHT
|
||||
*
|
||||
* To set/get/unset the contetn of the panel, you can use
|
||||
* To set/get/unset the content of the panel, you can use
|
||||
* elm_object_content_set/get/unset APIs.
|
||||
* Once the content object is set, a previously set one will be deleted.
|
||||
* If you want to keep that old content object, use the
|
||||
|
@ -23806,10 +23806,20 @@ extern "C" {
|
|||
* Available styles for it:
|
||||
* - @c "default"
|
||||
*
|
||||
* Default contents parts of the panes widget that you can use for are:
|
||||
* @li "elm.swallow.left" - A leftside content of the panes
|
||||
* @li "elm.swallow.right" - A rightside content of the panes
|
||||
*
|
||||
* If panes is displayed vertically, left content will be displayed at
|
||||
* top.
|
||||
*
|
||||
* Here is an example on its usage:
|
||||
* @li @ref panes_example
|
||||
*/
|
||||
|
||||
#define ELM_PANES_CONTENT_LEFT "elm.swallow.left"
|
||||
#define ELM_PANES_CONTENT_RIGHT "elm.swallow.right"
|
||||
|
||||
/**
|
||||
* @addtogroup Panes
|
||||
* @{
|
||||
|
@ -23846,7 +23856,7 @@ extern "C" {
|
|||
*
|
||||
* @ingroup Panes
|
||||
*/
|
||||
EAPI void elm_panes_content_left_set(Evas_Object *obj, Evas_Object *content) EINA_ARG_NONNULL(1);
|
||||
EINA_DEPRECATED EAPI void elm_panes_content_left_set(Evas_Object *obj, Evas_Object *content) EINA_ARG_NONNULL(1);
|
||||
|
||||
/**
|
||||
* Set the right content of the panes widget.
|
||||
|
@ -23866,7 +23876,7 @@ extern "C" {
|
|||
*
|
||||
* @ingroup Panes
|
||||
*/
|
||||
EAPI void elm_panes_content_right_set(Evas_Object *obj, Evas_Object *content) EINA_ARG_NONNULL(1);
|
||||
EINA_DEPRECATED EAPI void elm_panes_content_right_set(Evas_Object *obj, Evas_Object *content) EINA_ARG_NONNULL(1);
|
||||
|
||||
/**
|
||||
* Get the left content of the panes.
|
||||
|
@ -23880,7 +23890,7 @@ extern "C" {
|
|||
*
|
||||
* @ingroup Panes
|
||||
*/
|
||||
EAPI Evas_Object *elm_panes_content_left_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
EINA_DEPRECATED EAPI Evas_Object *elm_panes_content_left_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
|
||||
/**
|
||||
* Get the right content of the panes.
|
||||
|
@ -23894,7 +23904,7 @@ extern "C" {
|
|||
*
|
||||
* @ingroup Panes
|
||||
*/
|
||||
EAPI Evas_Object *elm_panes_content_right_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
EINA_DEPRECATED EAPI Evas_Object *elm_panes_content_right_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
|
||||
/**
|
||||
* Unset the left content used for the panes.
|
||||
|
@ -23909,7 +23919,7 @@ extern "C" {
|
|||
*
|
||||
* @ingroup Panes
|
||||
*/
|
||||
EAPI Evas_Object *elm_panes_content_left_unset(Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
EINA_DEPRECATED EAPI Evas_Object *elm_panes_content_left_unset(Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
|
||||
/**
|
||||
* Unset the right content used for the panes.
|
||||
|
@ -24361,7 +24371,6 @@ extern "C" {
|
|||
* - @c "default"
|
||||
*
|
||||
* Default contents parts of the conformant widget that you can use for are:
|
||||
*
|
||||
* @li "elm.swallow.content" - A content of the conformant
|
||||
*
|
||||
* See how to use this widget in this example:
|
||||
|
@ -28192,6 +28201,9 @@ extern "C" {
|
|||
* @ref tutorial_naviframe gives a good overview of the usage of the API.
|
||||
*/
|
||||
|
||||
#define ELM_NAVIFRAME_ITEM_PREV_BTN "elm.swallow.prev_btn"
|
||||
#define ELM_NAVIFRAME_ITEM_NEXT_BTN "elm.swallow.next_btn"
|
||||
|
||||
/**
|
||||
* @addtogroup Naviframe
|
||||
* @{
|
||||
|
|
|
@ -212,6 +212,105 @@ _unpress(void *data, Evas_Object *obj __UNUSED__ , const char *emission __UNUSED
|
|||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -228,6 +327,9 @@ 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);
|
||||
|
@ -257,88 +359,40 @@ elm_panes_add(Evas_Object *parent)
|
|||
return obj;
|
||||
}
|
||||
|
||||
|
||||
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) return;
|
||||
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);
|
||||
}
|
||||
_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) return;
|
||||
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);
|
||||
}
|
||||
_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);
|
||||
if (!wd) return NULL;
|
||||
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);
|
||||
wd->contents.left = NULL;
|
||||
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);
|
||||
wd->contents.right = NULL;
|
||||
return content;
|
||||
return _content_unset_hook(obj, "elm.swallow.right");
|
||||
}
|
||||
|
||||
EAPI double
|
||||
|
|
Loading…
Reference in New Issue