2013-04-25 22:13:00 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "elementary_config.h"
|
|
|
|
#endif
|
|
|
|
|
2014-10-17 08:56:11 -07:00
|
|
|
#define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED
|
2016-04-20 05:07:38 -07:00
|
|
|
#define ELM_LAYOUT_PROTECTED
|
2014-10-17 08:56:11 -07:00
|
|
|
|
2010-06-20 09:01:15 -07:00
|
|
|
#include <Elementary.h>
|
2013-04-25 22:13:00 -07:00
|
|
|
|
2010-06-20 09:01:15 -07:00
|
|
|
#include "elm_priv.h"
|
2012-11-25 22:32:53 -08:00
|
|
|
#include "elm_widget_layout.h"
|
2012-08-01 14:04:56 -07:00
|
|
|
#include "elm_widget_panes.h"
|
2010-06-20 09:01:15 -07:00
|
|
|
|
2014-06-03 03:35:28 -07:00
|
|
|
#define MY_CLASS ELM_PANES_CLASS
|
2017-07-27 23:35:10 -07:00
|
|
|
#define MY_CLASS_PFX elm_panes
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2013-11-07 03:44:22 -08:00
|
|
|
#define MY_CLASS_NAME "Elm_Panes"
|
|
|
|
#define MY_CLASS_NAME_LEGACY "elm_panes"
|
2010-06-20 09:01:15 -07:00
|
|
|
/**
|
2011-07-27 10:06:40 -07:00
|
|
|
* TODO
|
|
|
|
* Update the minimun height of the bar in the theme.
|
|
|
|
* No minimun should be set in the vertical theme
|
|
|
|
* Add events (move, start ...)
|
2010-06-20 09:01:15 -07:00
|
|
|
*/
|
|
|
|
|
2011-04-21 17:42:32 -07:00
|
|
|
static const char SIG_CLICKED[] = "clicked";
|
|
|
|
static const char SIG_PRESS[] = "press";
|
|
|
|
static const char SIG_UNPRESS[] = "unpress";
|
2012-05-03 15:43:05 -07:00
|
|
|
static const char SIG_DOUBLE_CLICKED[] = "clicked,double";
|
|
|
|
static const Evas_Smart_Cb_Description _smart_callbacks[] = {
|
2011-04-21 17:42:32 -07:00
|
|
|
{SIG_CLICKED, ""},
|
|
|
|
{SIG_PRESS, ""},
|
|
|
|
{SIG_UNPRESS, ""},
|
2012-05-03 15:43:05 -07:00
|
|
|
{SIG_DOUBLE_CLICKED, ""},
|
2011-04-21 17:42:32 -07:00
|
|
|
{NULL, NULL}
|
|
|
|
};
|
|
|
|
|
2012-05-03 15:43:05 -07:00
|
|
|
static const Elm_Layout_Part_Alias_Description _content_aliases[] =
|
2010-06-20 09:01:15 -07:00
|
|
|
{
|
2012-05-03 15:43:05 -07:00
|
|
|
{"left", "elm.swallow.left"},
|
|
|
|
{"right", "elm.swallow.right"},
|
2012-11-29 10:43:39 -08:00
|
|
|
{"top", "elm.swallow.left"},
|
|
|
|
{"bottom", "elm.swallow.right"},
|
2012-05-03 15:43:05 -07:00
|
|
|
{NULL, NULL}
|
|
|
|
};
|
2010-06-20 09:01:15 -07:00
|
|
|
|
theme: return enum from elm_widget_style_set instead of bool
Summary:
if trying to apply incorrect theme, widget apply default theme and return TRUE.
so there is no way to check it really apply correct theme.
To resolve this problem, _elm_theme_set return three type enum
* related history : 4ca3ef45146e05908a13d1010909abeba9693ad6
* elm_object_style_set is public api, so I didn't change it.
* typedef name [ Theme_Apply ] is temporarily, please suggest better one.
@fix
Reviewers: singh.amitesh, herb, Hermet, cedric, jpeg, raster
Subscribers: cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4073
2016-06-30 23:09:42 -07:00
|
|
|
EOLIAN static Elm_Theme_Apply
|
2014-03-24 23:37:43 -07:00
|
|
|
_elm_panes_elm_widget_theme_apply(Eo *obj, Elm_Panes_Data *sd)
|
2010-06-20 09:01:15 -07:00
|
|
|
{
|
2010-09-14 16:42:31 -07:00
|
|
|
double size;
|
2013-04-15 07:55:15 -07:00
|
|
|
Evas_Coord minw = 0, minh = 0;
|
2013-09-27 01:45:08 -07:00
|
|
|
|
theme: return enum from elm_widget_style_set instead of bool
Summary:
if trying to apply incorrect theme, widget apply default theme and return TRUE.
so there is no way to check it really apply correct theme.
To resolve this problem, _elm_theme_set return three type enum
* related history : 4ca3ef45146e05908a13d1010909abeba9693ad6
* elm_object_style_set is public api, so I didn't change it.
* typedef name [ Theme_Apply ] is temporarily, please suggest better one.
@fix
Reviewers: singh.amitesh, herb, Hermet, cedric, jpeg, raster
Subscribers: cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4073
2016-06-30 23:09:42 -07:00
|
|
|
Elm_Theme_Apply int_ret = ELM_THEME_APPLY_FAILED;
|
2013-10-05 01:29:13 -07:00
|
|
|
ELM_LAYOUT_DATA_GET(obj, ld);
|
2012-05-02 09:59:45 -07:00
|
|
|
|
2016-05-17 08:00:03 -07:00
|
|
|
if (sd->orientation == EFL_ORIENT_HORIZONTAL)
|
2012-11-25 22:32:53 -08:00
|
|
|
eina_stringshare_replace(&ld->group, "horizontal");
|
2012-05-02 18:19:05 -07:00
|
|
|
else
|
2012-11-25 22:32:53 -08:00
|
|
|
eina_stringshare_replace(&ld->group, "vertical");
|
2012-05-03 15:43:05 -07:00
|
|
|
|
2013-04-15 07:55:15 -07:00
|
|
|
evas_object_hide(sd->event);
|
|
|
|
elm_coords_finger_size_adjust(1, &minw, 1, &minh);
|
|
|
|
evas_object_size_hint_min_set(sd->event, minw, minh);
|
2013-09-27 01:45:08 -07:00
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
int_ret = elm_obj_widget_theme_apply(efl_super(obj, MY_CLASS));
|
theme: return enum from elm_widget_style_set instead of bool
Summary:
if trying to apply incorrect theme, widget apply default theme and return TRUE.
so there is no way to check it really apply correct theme.
To resolve this problem, _elm_theme_set return three type enum
* related history : 4ca3ef45146e05908a13d1010909abeba9693ad6
* elm_object_style_set is public api, so I didn't change it.
* typedef name [ Theme_Apply ] is temporarily, please suggest better one.
@fix
Reviewers: singh.amitesh, herb, Hermet, cedric, jpeg, raster
Subscribers: cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4073
2016-06-30 23:09:42 -07:00
|
|
|
if (!int_ret) return ELM_THEME_APPLY_FAILED;
|
2012-05-03 15:43:05 -07:00
|
|
|
|
|
|
|
size = elm_panes_content_left_size_get(obj);
|
|
|
|
|
2013-02-15 21:37:44 -08:00
|
|
|
if (sd->fixed)
|
|
|
|
{
|
|
|
|
elm_layout_signal_emit(obj, "elm,panes,fixed", "elm");
|
|
|
|
|
|
|
|
//TODO: remove this signal on EFL 2.0.
|
|
|
|
// I left this due to the backward compatibility.
|
|
|
|
elm_layout_signal_emit(obj, "elm.panes.fixed", "elm");
|
|
|
|
}
|
2012-05-03 15:43:05 -07:00
|
|
|
|
|
|
|
elm_layout_sizing_eval(obj);
|
|
|
|
|
2010-09-14 16:42:31 -07:00
|
|
|
elm_panes_content_left_size_set(obj, size);
|
2012-05-03 15:43:05 -07:00
|
|
|
|
theme: return enum from elm_widget_style_set instead of bool
Summary:
if trying to apply incorrect theme, widget apply default theme and return TRUE.
so there is no way to check it really apply correct theme.
To resolve this problem, _elm_theme_set return three type enum
* related history : 4ca3ef45146e05908a13d1010909abeba9693ad6
* elm_object_style_set is public api, so I didn't change it.
* typedef name [ Theme_Apply ] is temporarily, please suggest better one.
@fix
Reviewers: singh.amitesh, herb, Hermet, cedric, jpeg, raster
Subscribers: cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4073
2016-06-30 23:09:42 -07:00
|
|
|
return int_ret;
|
2010-06-20 09:01:15 -07:00
|
|
|
}
|
|
|
|
|
2014-03-24 23:37:43 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2017-06-15 05:40:51 -07:00
|
|
|
_elm_panes_elm_widget_focus_next(Eo *obj, Elm_Panes_Data *sd EINA_UNUSED, Elm_Focus_Direction dir, Evas_Object **next, Elm_Object_Item **next_item)
|
2010-10-04 11:37:45 -07:00
|
|
|
{
|
2017-06-15 05:40:51 -07:00
|
|
|
Eina_Bool int_ret = EINA_FALSE;
|
2012-05-03 15:43:05 -07:00
|
|
|
|
2017-06-15 05:40:51 -07:00
|
|
|
Eina_List *items = NULL;
|
|
|
|
Eina_List *(*list_free)(Eina_List *list);
|
|
|
|
void *(*list_data_get)(const Eina_List *list);
|
|
|
|
Evas_Object *left = NULL;
|
|
|
|
Evas_Object *right = NULL;
|
2012-05-03 15:43:05 -07:00
|
|
|
|
2017-06-15 05:40:51 -07:00
|
|
|
/* Focus chain */
|
|
|
|
/* TODO: Change this to use other chain */
|
|
|
|
if ((items = (Eina_List *)elm_widget_focus_custom_chain_get(obj)))
|
2010-10-04 11:37:45 -07:00
|
|
|
{
|
2017-06-15 05:40:51 -07:00
|
|
|
list_data_get = eina_list_data_get;
|
|
|
|
list_free = NULL;
|
2010-10-04 11:37:45 -07:00
|
|
|
}
|
2017-06-15 05:40:51 -07:00
|
|
|
else
|
2010-10-04 11:37:45 -07:00
|
|
|
{
|
2017-06-15 05:40:51 -07:00
|
|
|
left = elm_layout_content_get(obj, "left");
|
|
|
|
if (left)
|
|
|
|
items = eina_list_append(items, left);
|
2010-10-15 10:28:33 -07:00
|
|
|
|
2017-06-15 05:40:51 -07:00
|
|
|
right = elm_layout_content_get(obj, "right");
|
|
|
|
if (right)
|
|
|
|
items = eina_list_append(items, right);
|
2010-10-15 10:28:33 -07:00
|
|
|
|
2017-06-15 05:40:51 -07:00
|
|
|
list_data_get = eina_list_data_get;
|
|
|
|
list_free = eina_list_free;
|
2010-10-15 10:28:33 -07:00
|
|
|
|
2017-06-15 05:40:51 -07:00
|
|
|
if (!items) return EINA_FALSE;
|
2010-10-06 13:24:09 -07:00
|
|
|
}
|
2014-03-24 23:37:43 -07:00
|
|
|
|
2017-06-15 05:40:51 -07:00
|
|
|
int_ret = elm_widget_focus_list_next_get
|
|
|
|
(obj, (const Eina_List *)items, list_data_get, dir, next, next_item);
|
|
|
|
|
|
|
|
if (list_free) list_free((Eina_List *)items);
|
|
|
|
|
|
|
|
return int_ret;
|
2010-10-04 11:37:45 -07:00
|
|
|
}
|
|
|
|
|
2010-06-20 09:01:15 -07:00
|
|
|
static void
|
2012-05-03 15:43:05 -07:00
|
|
|
_on_clicked(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
2010-06-20 09:01:15 -07:00
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(data, EFL_UI_EVENT_CLICKED, NULL);
|
2010-06-20 09:01:15 -07:00
|
|
|
}
|
|
|
|
|
2010-06-21 13:15:57 -07:00
|
|
|
static void
|
2012-05-03 15:43:05 -07:00
|
|
|
_double_clicked(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
2010-06-21 13:15:57 -07:00
|
|
|
{
|
2012-05-03 15:43:05 -07:00
|
|
|
ELM_PANES_DATA_GET(data, sd);
|
2010-06-21 13:15:57 -07:00
|
|
|
|
2012-05-03 15:43:05 -07:00
|
|
|
sd->double_clicked = EINA_TRUE;
|
2010-06-21 13:15:57 -07:00
|
|
|
}
|
|
|
|
|
2010-06-20 09:01:15 -07:00
|
|
|
static void
|
2012-05-03 15:43:05 -07:00
|
|
|
_on_pressed(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
2010-06-20 09:01:15 -07:00
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(data, ELM_PANES_EVENT_PRESS, NULL);
|
2010-06-20 09:01:15 -07:00
|
|
|
}
|
|
|
|
|
2010-08-08 16:00:09 -07:00
|
|
|
static void
|
2012-05-03 15:43:05 -07:00
|
|
|
_on_unpressed(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
2010-06-20 09:01:15 -07:00
|
|
|
{
|
2012-05-03 15:43:05 -07:00
|
|
|
ELM_PANES_DATA_GET(data, sd);
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(data, ELM_PANES_EVENT_UNPRESS, NULL);
|
2010-06-21 13:15:57 -07:00
|
|
|
|
2012-05-03 15:43:05 -07:00
|
|
|
if (sd->double_clicked)
|
2010-06-21 13:15:57 -07:00
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(data, EFL_UI_EVENT_CLICKED_DOUBLE, NULL);
|
2012-05-03 15:43:05 -07:00
|
|
|
sd->double_clicked = EINA_FALSE;
|
2010-06-21 13:15:57 -07:00
|
|
|
}
|
2010-06-20 09:01:15 -07:00
|
|
|
}
|
|
|
|
|
2014-06-16 18:23:30 -07:00
|
|
|
static void
|
|
|
|
_set_min_size(void *data)
|
|
|
|
{
|
|
|
|
ELM_PANES_DATA_GET(data, sd);
|
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(data, wd);
|
|
|
|
|
|
|
|
double sizer = sd->right_min_relative_size;
|
|
|
|
double sizel = sd->left_min_relative_size;
|
|
|
|
if ((sd->left_min_relative_size + sd->right_min_relative_size) > 1)
|
|
|
|
{
|
|
|
|
double sum = sizer + sizel;
|
|
|
|
sizer = sizer / sum;
|
|
|
|
sizel = sizel / sum;
|
|
|
|
}
|
2016-05-17 08:00:03 -07:00
|
|
|
if (sd->orientation == EFL_ORIENT_HORIZONTAL)
|
2014-06-16 18:23:30 -07:00
|
|
|
{
|
|
|
|
edje_object_part_drag_value_set
|
|
|
|
(wd->resize_obj, "right_constraint", 0.0, (1 - sizer));
|
|
|
|
edje_object_part_drag_value_set
|
|
|
|
(wd->resize_obj, "left_constraint", 0.0, sizel);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
edje_object_part_drag_value_set
|
|
|
|
(wd->resize_obj, "right_constraint", (1 - sizer), 0.0);
|
|
|
|
edje_object_part_drag_value_set
|
|
|
|
(wd->resize_obj, "left_constraint", sizel, 0.0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_update_fixed_sides(void *data)
|
|
|
|
{
|
|
|
|
ELM_PANES_DATA_GET(data, sd);
|
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(data, wd);
|
|
|
|
Evas_Coord w, h;
|
|
|
|
evas_object_geometry_get(wd->resize_obj, NULL, NULL, &w, &h);
|
|
|
|
|
|
|
|
if (sd->right_min_size_is_relative)
|
|
|
|
{
|
2016-05-17 08:00:03 -07:00
|
|
|
if (sd->orientation == EFL_ORIENT_HORIZONTAL)
|
2014-06-16 18:23:30 -07:00
|
|
|
sd->right_min_size = (int)(h * sd->right_min_relative_size);
|
|
|
|
else
|
|
|
|
sd->right_min_size =(int)(w * sd->right_min_relative_size);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sd->right_min_relative_size = 0;
|
2016-05-17 08:00:03 -07:00
|
|
|
if (sd->orientation == EFL_ORIENT_HORIZONTAL && (h > 0))
|
2014-06-16 18:23:30 -07:00
|
|
|
sd->right_min_relative_size = sd->right_min_size / (double)h;
|
2016-05-17 08:00:03 -07:00
|
|
|
if (sd->orientation == EFL_ORIENT_VERTICAL && (w > 0))
|
2014-06-16 18:23:30 -07:00
|
|
|
sd->right_min_relative_size = sd->right_min_size / (double)w;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(sd->left_min_size_is_relative)
|
|
|
|
{
|
2016-05-17 08:00:03 -07:00
|
|
|
if (sd->orientation == EFL_ORIENT_HORIZONTAL)
|
2014-06-16 18:23:30 -07:00
|
|
|
sd->left_min_size = (int)(h * sd->left_min_relative_size);
|
|
|
|
else
|
|
|
|
sd->left_min_size = (int)(w * sd->left_min_relative_size);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sd->left_min_relative_size = 0;
|
2016-05-17 08:00:03 -07:00
|
|
|
if (sd->orientation == EFL_ORIENT_HORIZONTAL && (h > 0))
|
2014-06-16 18:23:30 -07:00
|
|
|
sd->left_min_relative_size = sd->left_min_size / (double)h;
|
2016-05-17 08:00:03 -07:00
|
|
|
if (sd->orientation == EFL_ORIENT_VERTICAL && (w > 0))
|
2014-06-16 18:23:30 -07:00
|
|
|
sd->left_min_relative_size = sd->left_min_size / (double)w;
|
|
|
|
}
|
|
|
|
_set_min_size(data);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_on_resize(void *data,
|
|
|
|
Evas *e EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
|
|
|
{
|
|
|
|
_update_fixed_sides(data);
|
|
|
|
}
|
|
|
|
|
2014-03-24 23:37:43 -07:00
|
|
|
EOLIAN static void
|
2016-06-17 01:26:08 -07:00
|
|
|
_elm_panes_efl_canvas_group_group_add(Eo *obj, Elm_Panes_Data *_pd EINA_UNUSED)
|
2011-10-30 08:50:14 -07:00
|
|
|
{
|
2013-10-05 01:15:03 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2013-04-15 07:55:15 -07:00
|
|
|
ELM_PANES_DATA_GET(obj, sd);
|
2013-09-27 01:45:08 -07:00
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_canvas_group_add(efl_super(obj, MY_CLASS));
|
2013-09-24 21:33:39 -07:00
|
|
|
elm_widget_sub_object_parent_add(obj);
|
2013-08-26 22:19:19 -07:00
|
|
|
|
2013-03-01 18:04:31 -08:00
|
|
|
if (!elm_layout_theme_set
|
|
|
|
(obj, "panes", "vertical", elm_widget_style_get(obj)))
|
2013-12-25 20:03:55 -08:00
|
|
|
CRI("Failed to set layout!");
|
2012-05-02 09:59:45 -07:00
|
|
|
|
2012-05-03 15:43:05 -07:00
|
|
|
elm_panes_content_left_size_set(obj, 0.5);
|
|
|
|
|
|
|
|
edje_object_signal_callback_add
|
2014-01-13 06:00:28 -08:00
|
|
|
(wd->resize_obj, "elm,action,click", "*",
|
2012-05-03 15:43:05 -07:00
|
|
|
_on_clicked, obj);
|
|
|
|
edje_object_signal_callback_add
|
2014-01-13 06:00:28 -08:00
|
|
|
(wd->resize_obj, "elm,action,click,double", "*",
|
2012-05-03 15:43:05 -07:00
|
|
|
_double_clicked, obj);
|
|
|
|
edje_object_signal_callback_add
|
2014-01-13 06:00:28 -08:00
|
|
|
(wd->resize_obj, "elm,action,press", "*",
|
2012-05-03 15:43:05 -07:00
|
|
|
_on_pressed, obj);
|
|
|
|
edje_object_signal_callback_add
|
2014-01-13 06:00:28 -08:00
|
|
|
(wd->resize_obj, "elm,action,unpress", "*",
|
2012-05-03 15:43:05 -07:00
|
|
|
_on_unpressed, obj);
|
2014-06-16 18:23:30 -07:00
|
|
|
evas_object_event_callback_add
|
|
|
|
(wd->resize_obj, EVAS_CALLBACK_RESIZE,
|
|
|
|
_on_resize, obj);
|
|
|
|
|
|
|
|
sd->right_min_size_is_relative = EINA_TRUE;
|
|
|
|
sd->left_min_size_is_relative = EINA_TRUE;
|
|
|
|
sd->right_min_size = 0;
|
|
|
|
sd->left_min_size = 0;
|
|
|
|
sd->right_min_relative_size = 0;
|
|
|
|
sd->left_min_relative_size = 0;
|
|
|
|
_update_fixed_sides(obj);
|
2012-05-03 15:43:05 -07:00
|
|
|
|
|
|
|
elm_widget_can_focus_set(obj, EINA_FALSE);
|
|
|
|
|
2013-04-15 07:55:15 -07:00
|
|
|
sd->event = evas_object_rectangle_add(evas_object_evas_get(obj));
|
|
|
|
evas_object_color_set(sd->event, 0, 0, 0, 0);
|
|
|
|
evas_object_pass_events_set(sd->event, EINA_TRUE);
|
|
|
|
if (edje_object_part_exists
|
|
|
|
(wd->resize_obj, "elm.swallow.event"))
|
|
|
|
{
|
|
|
|
Evas_Coord minw = 0, minh = 0;
|
|
|
|
|
|
|
|
elm_coords_finger_size_adjust(1, &minw, 1, &minh);
|
|
|
|
evas_object_size_hint_min_set(sd->event, minw, minh);
|
|
|
|
elm_layout_content_set(obj, "elm.swallow.event", sd->event);
|
|
|
|
}
|
|
|
|
elm_widget_sub_object_add(obj, sd->event);
|
|
|
|
|
2012-05-03 15:43:05 -07:00
|
|
|
elm_layout_sizing_eval(obj);
|
2011-10-30 08:50:14 -07:00
|
|
|
}
|
|
|
|
|
2010-06-20 09:01:15 -07:00
|
|
|
EAPI Evas_Object *
|
|
|
|
elm_panes_add(Evas_Object *parent)
|
|
|
|
{
|
2012-05-03 15:43:05 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
|
2017-07-06 00:47:41 -07:00
|
|
|
return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added));
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2012-05-02 18:19:05 -07:00
|
|
|
|
2015-05-19 05:34:07 -07:00
|
|
|
EOLIAN static Eo *
|
2016-08-10 07:23:04 -07:00
|
|
|
_elm_panes_efl_object_constructor(Eo *obj, Elm_Panes_Data *_pd EINA_UNUSED)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
obj = efl_constructor(efl_super(obj, MY_CLASS));
|
2016-06-20 21:26:15 -07:00
|
|
|
efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
|
2016-06-16 22:12:02 -07:00
|
|
|
evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks);
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_atspi_accessible_role_set(obj, ELM_ATSPI_ROLE_SPLIT_PANE);
|
2015-05-19 05:34:07 -07:00
|
|
|
|
|
|
|
return obj;
|
2010-06-20 09:01:15 -07:00
|
|
|
}
|
|
|
|
|
2012-02-20 16:33:38 -08:00
|
|
|
EINA_DEPRECATED EAPI void
|
2012-05-03 15:43:05 -07:00
|
|
|
elm_panes_content_left_set(Evas_Object *obj,
|
|
|
|
Evas_Object *content)
|
2010-06-20 09:01:15 -07:00
|
|
|
{
|
2012-05-03 15:43:05 -07:00
|
|
|
elm_layout_content_set(obj, "left", content);
|
2010-06-20 09:01:15 -07:00
|
|
|
}
|
|
|
|
|
2012-02-20 16:33:38 -08:00
|
|
|
EINA_DEPRECATED EAPI void
|
2012-05-03 15:43:05 -07:00
|
|
|
elm_panes_content_right_set(Evas_Object *obj,
|
|
|
|
Evas_Object *content)
|
2010-06-20 09:01:15 -07:00
|
|
|
{
|
2012-05-03 15:43:05 -07:00
|
|
|
elm_layout_content_set(obj, "right", content);
|
2010-06-20 09:01:15 -07:00
|
|
|
}
|
|
|
|
|
2012-02-20 16:33:38 -08:00
|
|
|
EINA_DEPRECATED EAPI Evas_Object *
|
2010-09-14 16:42:31 -07:00
|
|
|
elm_panes_content_left_get(const Evas_Object *obj)
|
2010-08-01 10:29:20 -07:00
|
|
|
{
|
2012-05-03 15:43:05 -07:00
|
|
|
return elm_layout_content_get(obj, "left");
|
2010-08-01 10:29:20 -07:00
|
|
|
}
|
|
|
|
|
2012-02-20 16:33:38 -08:00
|
|
|
EINA_DEPRECATED EAPI Evas_Object *
|
2010-09-14 16:42:31 -07:00
|
|
|
elm_panes_content_right_get(const Evas_Object *obj)
|
2010-08-01 10:29:20 -07:00
|
|
|
{
|
2012-05-03 15:43:05 -07:00
|
|
|
return elm_layout_content_get(obj, "right");
|
2010-08-01 10:29:20 -07:00
|
|
|
}
|
|
|
|
|
2012-02-20 16:33:38 -08:00
|
|
|
EINA_DEPRECATED EAPI Evas_Object *
|
2010-10-14 11:54:42 -07:00
|
|
|
elm_panes_content_left_unset(Evas_Object *obj)
|
|
|
|
{
|
2012-05-03 15:43:05 -07:00
|
|
|
return elm_layout_content_unset(obj, "left");
|
2010-10-14 11:54:42 -07:00
|
|
|
}
|
|
|
|
|
2012-02-20 16:33:38 -08:00
|
|
|
EINA_DEPRECATED EAPI Evas_Object *
|
2010-10-14 11:54:42 -07:00
|
|
|
elm_panes_content_right_unset(Evas_Object *obj)
|
|
|
|
{
|
2012-05-03 15:43:05 -07:00
|
|
|
return elm_layout_content_unset(obj, "right");
|
2010-10-14 11:54:42 -07:00
|
|
|
}
|
|
|
|
|
2014-03-24 23:37:43 -07:00
|
|
|
EOLIAN static double
|
|
|
|
_elm_panes_content_left_size_get(Eo *obj, Elm_Panes_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2010-06-21 13:15:57 -07:00
|
|
|
double w, h;
|
|
|
|
|
2014-03-24 23:37:43 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, 0.0);
|
2012-05-03 15:43:05 -07:00
|
|
|
|
|
|
|
edje_object_part_drag_value_get
|
2012-11-25 22:32:53 -08:00
|
|
|
(wd->resize_obj, "elm.bar", &w, &h);
|
2012-05-03 15:43:05 -07:00
|
|
|
|
2016-05-17 08:00:03 -07:00
|
|
|
if (sd->orientation == EFL_ORIENT_HORIZONTAL)
|
|
|
|
return h;
|
2014-03-24 23:37:43 -07:00
|
|
|
else return w;
|
2010-06-21 13:15:57 -07:00
|
|
|
}
|
|
|
|
|
2014-03-24 23:37:43 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_panes_content_left_size_set(Eo *obj, Elm_Panes_Data *sd, double size)
|
2010-06-21 13:15:57 -07:00
|
|
|
{
|
2013-10-05 01:15:03 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2012-05-03 15:43:05 -07:00
|
|
|
|
2010-09-14 16:42:31 -07:00
|
|
|
if (size < 0.0) size = 0.0;
|
2013-08-10 23:00:43 -07:00
|
|
|
else if (size > 1.0) size = 1.0;
|
|
|
|
|
2016-05-17 08:00:03 -07:00
|
|
|
if (sd->orientation == EFL_ORIENT_HORIZONTAL)
|
2012-05-03 15:43:05 -07:00
|
|
|
edje_object_part_drag_value_set
|
2012-11-25 22:32:53 -08:00
|
|
|
(wd->resize_obj, "elm.bar", 0.0, size);
|
2010-06-22 12:08:52 -07:00
|
|
|
else
|
2012-05-03 15:43:05 -07:00
|
|
|
edje_object_part_drag_value_set
|
2012-11-25 22:32:53 -08:00
|
|
|
(wd->resize_obj, "elm.bar", size, 0.0);
|
2010-06-22 12:08:52 -07:00
|
|
|
}
|
|
|
|
|
2014-03-24 23:37:43 -07:00
|
|
|
EOLIAN static double
|
|
|
|
_elm_panes_content_right_size_get(Eo *obj, Elm_Panes_Data *_pd EINA_UNUSED)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-24 23:37:43 -07:00
|
|
|
return 1.0 - elm_panes_content_left_size_get(obj);
|
2012-02-28 19:01:58 -08:00
|
|
|
}
|
|
|
|
|
2014-03-24 23:37:43 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_panes_content_right_size_set(Eo *obj, Elm_Panes_Data *_pd EINA_UNUSED, double size)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
|
|
|
elm_panes_content_left_size_set(obj, (1.0 - size));
|
2012-02-28 19:01:58 -08:00
|
|
|
}
|
|
|
|
|
2014-03-24 23:37:43 -07:00
|
|
|
EOLIAN static void
|
2016-05-17 08:00:03 -07:00
|
|
|
_elm_panes_efl_orientation_orientation_set(Eo *obj, Elm_Panes_Data *sd, Efl_Orient dir)
|
2010-06-22 12:08:52 -07:00
|
|
|
{
|
2016-05-17 08:00:03 -07:00
|
|
|
if ((dir != EFL_ORIENT_HORIZONTAL) && (dir != EFL_ORIENT_VERTICAL))
|
|
|
|
return;
|
|
|
|
|
2016-07-07 17:49:50 -07:00
|
|
|
double size = elm_panes_content_left_size_get(obj);
|
|
|
|
|
2016-05-17 08:00:03 -07:00
|
|
|
sd->orientation = dir;
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_obj_widget_theme_apply(obj);
|
2014-06-16 18:23:30 -07:00
|
|
|
_update_fixed_sides(obj);
|
2012-05-03 15:43:05 -07:00
|
|
|
|
2016-07-07 17:49:50 -07:00
|
|
|
elm_panes_content_left_size_set(obj, size);
|
2010-06-21 13:15:57 -07:00
|
|
|
}
|
|
|
|
|
2016-05-17 08:00:03 -07:00
|
|
|
EOLIAN static Efl_Orient
|
|
|
|
_elm_panes_efl_orientation_orientation_get(Eo *obj EINA_UNUSED, Elm_Panes_Data *sd)
|
|
|
|
{
|
|
|
|
return sd->orientation;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_panes_horizontal_set(Evas_Object *obj, Eina_Bool horizontal)
|
|
|
|
{
|
|
|
|
Efl_Orient orient;
|
|
|
|
|
|
|
|
if (horizontal)
|
|
|
|
orient = EFL_ORIENT_HORIZONTAL;
|
|
|
|
else
|
|
|
|
orient = EFL_ORIENT_VERTICAL;
|
|
|
|
|
|
|
|
efl_orientation_set(obj, orient);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
elm_panes_horizontal_get(const Evas_Object *obj)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2016-05-17 08:00:03 -07:00
|
|
|
Efl_Orient orient = efl_orientation_get(obj);
|
|
|
|
|
|
|
|
if (orient == EFL_ORIENT_HORIZONTAL)
|
|
|
|
return EINA_TRUE;
|
|
|
|
|
|
|
|
return EINA_FALSE;
|
2010-07-26 13:33:33 -07:00
|
|
|
}
|
2011-10-10 19:38:49 -07:00
|
|
|
|
2014-03-24 23:37:43 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_panes_fixed_set(Eo *obj, Elm_Panes_Data *sd, Eina_Bool fixed)
|
2011-10-10 19:38:49 -07:00
|
|
|
{
|
2012-05-03 15:43:05 -07:00
|
|
|
sd->fixed = !!fixed;
|
|
|
|
if (sd->fixed == EINA_TRUE)
|
2013-02-15 21:37:44 -08:00
|
|
|
{
|
|
|
|
elm_layout_signal_emit(obj, "elm,panes,fixed", "elm");
|
|
|
|
|
|
|
|
//TODO: remove this signal on EFL 2.0.
|
|
|
|
// I left this due to the backward compatibility.
|
|
|
|
elm_layout_signal_emit(obj, "elm.panes.fixed", "elm");
|
|
|
|
}
|
2011-10-10 19:38:49 -07:00
|
|
|
else
|
2013-02-15 21:37:44 -08:00
|
|
|
{
|
|
|
|
elm_layout_signal_emit(obj, "elm,panes,unfixed", "elm");
|
|
|
|
|
|
|
|
//TODO: remove this signal on EFL 2.0.
|
|
|
|
// I left this due to the backward compatibility.
|
|
|
|
elm_layout_signal_emit(obj, "elm.panes.unfixed", "elm");
|
|
|
|
}
|
2011-10-10 19:38:49 -07:00
|
|
|
}
|
|
|
|
|
2014-03-24 23:37:43 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_panes_fixed_get(Eo *obj EINA_UNUSED, Elm_Panes_Data *sd)
|
2011-10-10 19:38:49 -07:00
|
|
|
{
|
2014-03-24 23:37:43 -07:00
|
|
|
return sd->fixed;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-06-16 18:23:30 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_panes_content_left_min_relative_size_set(Eo *obj, Elm_Panes_Data *_pd, double size)
|
|
|
|
{
|
|
|
|
_pd->left_min_relative_size = size;
|
|
|
|
if (_pd->left_min_relative_size < 0) _pd->left_min_relative_size = 0;
|
|
|
|
_pd->left_min_size_is_relative = EINA_TRUE;
|
|
|
|
_update_fixed_sides(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static double
|
|
|
|
_elm_panes_content_left_min_relative_size_get(Eo *obj EINA_UNUSED, Elm_Panes_Data *_pd)
|
|
|
|
{
|
|
|
|
return _pd->left_min_relative_size;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
|
|
|
_elm_panes_content_right_min_relative_size_set(Eo *obj, Elm_Panes_Data *_pd, double size)
|
|
|
|
{
|
|
|
|
_pd->right_min_relative_size = size;
|
|
|
|
if (_pd->right_min_relative_size < 0) _pd->right_min_relative_size = 0;
|
|
|
|
_pd->right_min_size_is_relative = EINA_TRUE;
|
|
|
|
_update_fixed_sides(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static double
|
|
|
|
_elm_panes_content_right_min_relative_size_get(Eo *obj EINA_UNUSED, Elm_Panes_Data *_pd)
|
|
|
|
{
|
|
|
|
return _pd->right_min_relative_size;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
|
|
|
_elm_panes_content_left_min_size_set(Eo *obj, Elm_Panes_Data *_pd, Evas_Coord size)
|
|
|
|
{
|
|
|
|
_pd->left_min_size = size;
|
|
|
|
if (_pd->left_min_size < 0) _pd->left_min_size = 0;
|
|
|
|
_pd->left_min_size_is_relative = EINA_FALSE;
|
|
|
|
_update_fixed_sides(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Evas_Coord
|
|
|
|
_elm_panes_content_left_min_size_get(Eo *obj EINA_UNUSED, Elm_Panes_Data *_pd)
|
|
|
|
{
|
|
|
|
return _pd->left_min_size;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
|
|
|
_elm_panes_content_right_min_size_set(Eo *obj, Elm_Panes_Data *_pd, Evas_Coord size)
|
|
|
|
{
|
|
|
|
_pd->right_min_size = size;
|
|
|
|
if (_pd->right_min_size < 0) _pd->right_min_size = 0;
|
|
|
|
_pd->right_min_size_is_relative = EINA_FALSE;
|
|
|
|
_update_fixed_sides(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Evas_Coord
|
|
|
|
_elm_panes_content_right_min_size_get(Eo *obj EINA_UNUSED, Elm_Panes_Data *_pd)
|
|
|
|
{
|
|
|
|
return _pd->right_min_size;
|
|
|
|
}
|
|
|
|
|
2014-03-24 23:37:43 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_panes_elm_widget_focus_next_manager_is(Eo *obj EINA_UNUSED, Elm_Panes_Data *_pd EINA_UNUSED)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-24 23:37:43 -07:00
|
|
|
return EINA_TRUE;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2012-05-03 15:43:05 -07:00
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
static void
|
2016-08-10 07:23:04 -07:00
|
|
|
_elm_panes_class_constructor(Efl_Class *klass)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2013-11-07 03:44:22 -08:00
|
|
|
evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2014-03-24 23:37:43 -07:00
|
|
|
|
2017-05-18 01:52:17 -07:00
|
|
|
/* Internal EO APIs and hidden overrides */
|
|
|
|
|
2017-07-27 23:35:10 -07:00
|
|
|
ELM_LAYOUT_CONTENT_ALIASES_IMPLEMENT()
|
|
|
|
|
2017-05-18 01:52:17 -07:00
|
|
|
#define ELM_PANES_EXTRA_OPS \
|
2017-07-27 23:35:10 -07:00
|
|
|
EFL_CANVAS_GROUP_ADD_OPS(elm_panes), \
|
|
|
|
ELM_LAYOUT_CONTENT_ALIASES_OPS()
|
2017-05-18 01:52:17 -07:00
|
|
|
|
2014-03-24 23:37:43 -07:00
|
|
|
#include "elm_panes.eo.c"
|