2013-04-25 22:13:00 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "elementary_config.h"
|
|
|
|
#endif
|
|
|
|
|
2018-04-03 04:27:30 -07:00
|
|
|
#define EFL_ACCESS_OBJECT_PROTECTED
|
2016-04-20 05:07:38 -07:00
|
|
|
#define ELM_LAYOUT_PROTECTED
|
2019-02-21 09:19:45 -08:00
|
|
|
#define EFL_GFX_HINT_PROTECTED
|
2018-05-03 16:34:17 -07:00
|
|
|
#define EFL_PART_PROTECTED
|
2019-07-29 02:42:34 -07:00
|
|
|
#define EFL_INPUT_CLICKABLE_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"
|
2017-08-01 18:32:30 -07:00
|
|
|
#include "efl_ui_panes_private.h"
|
2010-06-20 09:01:15 -07:00
|
|
|
|
edje/elm: Rename _internal_ to _part_ (EO)
In Edje and Elementary, we have part objects, which are what is returned
by the interface efl_part(). Those objects can't be of an opaque type as
this doesn't work nicely with strongly typed languages such as C++ or
C#. In JS, Lua, C the types are weak and mostly runtime-based so it
doesn't matter much.
As a consequence, the documentation and the types need to look nice in
this EO API. Thus, we remove the abusive term "internal" and explicitly
call all those classes "part" something.
Eventually we want the types to be declared in the EO file so bindings
(C#, C++, ...) can generate the proper access methods, returning the
best possible types.
Note that right now a few of those part types are used in the legacy API
but don't actually need to be exposed externally.
This is kind of a mega commit that does all the renaming at once, but
it's really just a big sed operation. The power of good IDEs :)
Ref T5315
Ref T5306
2017-09-12 21:29:25 -07:00
|
|
|
#include "efl_ui_panes_part.eo.h"
|
2017-08-08 18:49:21 -07:00
|
|
|
#include "elm_part_helper.h"
|
|
|
|
|
2017-08-01 18:32:30 -07:00
|
|
|
#define MY_CLASS EFL_UI_PANES_CLASS
|
|
|
|
#define MY_CLASS_PFX efl_ui_panes
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2017-08-01 18:32:30 -07:00
|
|
|
#define MY_CLASS_NAME "Efl.Ui.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
|
|
|
{
|
2017-08-07 01:20:09 -07:00
|
|
|
//XXX: change elm.swallow.left/right to *.first/second in new theme.
|
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"},
|
2017-08-07 01:20:09 -07:00
|
|
|
{"first", "elm.swallow.left"},
|
|
|
|
{"second", "elm.swallow.right"},
|
2012-05-03 15:43:05 -07:00
|
|
|
{NULL, NULL}
|
|
|
|
};
|
2010-06-20 09:01:15 -07:00
|
|
|
|
2017-08-08 01:22:05 -07:00
|
|
|
static void _set_min_size_new(void *data);
|
|
|
|
|
2017-11-14 02:59:42 -08:00
|
|
|
//TODO: efl_ui_slider also use this.
|
|
|
|
static const char *
|
|
|
|
_theme_group_modify_pos_get(const char *cur_group, const char *search, size_t len, Eina_Bool is_legacy)
|
|
|
|
{
|
|
|
|
const char *pos = NULL;
|
|
|
|
const char *temp_str = NULL;
|
|
|
|
|
|
|
|
if (is_legacy)
|
|
|
|
return cur_group;
|
|
|
|
|
|
|
|
temp_str = cur_group + len - strlen(search);
|
|
|
|
if (temp_str >= cur_group)
|
|
|
|
{
|
|
|
|
if (!strcmp(temp_str, search))
|
|
|
|
pos = temp_str;
|
|
|
|
}
|
|
|
|
|
|
|
|
return pos;
|
|
|
|
}
|
|
|
|
|
|
|
|
static char *
|
|
|
|
_efl_ui_panes_theme_group_get(Evas_Object *obj, Efl_Ui_Panes_Data *sd)
|
|
|
|
{
|
|
|
|
const char *pos = NULL;
|
|
|
|
const char *cur_group = elm_widget_theme_element_get(obj);
|
|
|
|
Eina_Strbuf *new_group = eina_strbuf_new();
|
|
|
|
Eina_Bool is_legacy = elm_widget_is_legacy(obj);
|
|
|
|
size_t len = 0;
|
|
|
|
|
|
|
|
if (cur_group)
|
|
|
|
{
|
|
|
|
len = strlen(cur_group);
|
|
|
|
pos = _theme_group_modify_pos_get(cur_group, "horizontal", len, is_legacy);
|
|
|
|
if (!pos)
|
|
|
|
pos = _theme_group_modify_pos_get(cur_group, "vertical", len, is_legacy);
|
|
|
|
|
|
|
|
// TODO: change separator when it is decided.
|
|
|
|
// can skip when prev_group == cur_group
|
|
|
|
if (!pos)
|
|
|
|
{
|
|
|
|
eina_strbuf_append(new_group, cur_group);
|
|
|
|
eina_strbuf_append(new_group, "/");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
eina_strbuf_append_length(new_group, cur_group, pos - cur_group);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-24 09:30:31 -07:00
|
|
|
if (sd->dir == EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL)
|
2017-11-14 02:59:42 -08:00
|
|
|
eina_strbuf_append(new_group, "horizontal");
|
|
|
|
else
|
|
|
|
eina_strbuf_append(new_group, "vertical");
|
|
|
|
|
|
|
|
return eina_strbuf_release(new_group);
|
|
|
|
}
|
|
|
|
|
2019-03-04 10:37:07 -08:00
|
|
|
EOLIAN static Eina_Error
|
2018-01-07 20:55:35 -08:00
|
|
|
_efl_ui_panes_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_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;
|
2017-11-14 02:59:42 -08:00
|
|
|
char *group;
|
2013-09-27 01:45:08 -07:00
|
|
|
|
2019-03-04 10:37:07 -08:00
|
|
|
Eina_Error int_ret = EFL_UI_THEME_APPLY_ERROR_GENERIC;
|
2012-05-02 09:59:45 -07:00
|
|
|
|
2017-11-14 02:59:42 -08:00
|
|
|
group = _efl_ui_panes_theme_group_get(obj, sd);
|
|
|
|
if (group)
|
|
|
|
{
|
|
|
|
elm_widget_theme_element_set(obj, group);
|
|
|
|
free(group);
|
|
|
|
}
|
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
|
|
|
|
2017-10-23 22:03:46 -07:00
|
|
|
int_ret = efl_ui_widget_theme_apply(efl_super(obj, MY_CLASS));
|
2019-03-04 10:36:41 -08:00
|
|
|
if (int_ret == EFL_UI_THEME_APPLY_ERROR_GENERIC) return int_ret;
|
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)
|
|
|
|
{
|
2018-04-26 04:24:09 -07:00
|
|
|
if (elm_widget_is_legacy(obj))
|
|
|
|
{
|
|
|
|
elm_layout_signal_emit(obj, "elm,panes,fixed", "elm");
|
2013-02-15 21:37:44 -08:00
|
|
|
|
2018-04-26 04:24:09 -07:00
|
|
|
//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");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
elm_layout_signal_emit(obj, "efl,panes,fixed", "efl");
|
2013-02-15 21:37:44 -08:00
|
|
|
}
|
2012-05-03 15:43:05 -07:00
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
{
|
2019-05-13 12:14:13 -07:00
|
|
|
evas_object_smart_callback_call(data, "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
|
|
|
{
|
2017-08-01 18:32:30 -07:00
|
|
|
EFL_UI_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);
|
2019-07-29 02:42:34 -07:00
|
|
|
efl_input_clickable_press(data, 1);
|
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
|
|
|
{
|
2017-08-01 18:32:30 -07:00
|
|
|
EFL_UI_PANES_DATA_GET(data, sd);
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(data, ELM_PANES_EVENT_UNPRESS, NULL);
|
2019-07-29 02:42:34 -07:00
|
|
|
efl_input_clickable_unpress(data, 1);
|
2012-05-03 15:43:05 -07:00
|
|
|
if (sd->double_clicked)
|
2010-06-21 13:15:57 -07:00
|
|
|
{
|
2019-05-13 12:14:13 -07:00
|
|
|
evas_object_smart_callback_call(data, "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
|
|
|
}
|
|
|
|
|
2017-08-08 01:22:05 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_efl_ui_panes_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Panes_Data *sd)
|
|
|
|
{
|
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
|
|
|
|
|
|
|
Eo *first_content, *second_content;
|
2017-09-17 22:49:08 -07:00
|
|
|
Eina_Size2D min;
|
2017-08-08 01:22:05 -07:00
|
|
|
|
2018-01-16 01:10:30 -08:00
|
|
|
if (elm_widget_is_legacy(obj))
|
|
|
|
{
|
|
|
|
first_content = efl_content_get(efl_part(obj, "elm.swallow.left"));
|
|
|
|
second_content = efl_content_get(efl_part(obj, "elm.swallow.right"));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
first_content = efl_content_get(efl_part(obj, "first"));
|
|
|
|
second_content = efl_content_get(efl_part(obj, "second"));
|
|
|
|
}
|
2017-08-08 01:22:05 -07:00
|
|
|
|
|
|
|
if (first_content)
|
2017-08-08 18:49:21 -07:00
|
|
|
{
|
2017-08-10 22:27:27 -07:00
|
|
|
if (!sd->first_hint_min_allow)
|
2019-02-21 09:19:45 -08:00
|
|
|
sd->first_min = efl_gfx_hint_size_combined_min_get(first_content);
|
2017-08-08 18:49:21 -07:00
|
|
|
else
|
2019-02-21 09:19:45 -08:00
|
|
|
sd->first_min = efl_gfx_hint_size_min_get(first_content);
|
2017-08-08 18:49:21 -07:00
|
|
|
}
|
|
|
|
|
2017-08-08 01:22:05 -07:00
|
|
|
if (second_content)
|
2017-08-08 18:49:21 -07:00
|
|
|
{
|
2017-08-10 22:27:27 -07:00
|
|
|
if (!sd->second_hint_min_allow)
|
2019-02-21 09:19:45 -08:00
|
|
|
sd->second_min = efl_gfx_hint_size_combined_min_get(second_content);
|
2017-08-08 18:49:21 -07:00
|
|
|
else
|
2019-02-21 09:19:45 -08:00
|
|
|
sd->second_min = efl_gfx_hint_size_min_get(second_content);
|
2017-08-08 18:49:21 -07:00
|
|
|
}
|
2017-08-08 01:22:05 -07:00
|
|
|
|
2019-05-24 09:30:31 -07:00
|
|
|
if (sd->dir == EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL)
|
2017-08-08 01:22:05 -07:00
|
|
|
{
|
2017-09-17 22:49:08 -07:00
|
|
|
min.w = MAX(sd->first_min.w, sd->second_min.w);
|
|
|
|
min.h = sd->first_min.h + sd->second_min.h;
|
2017-08-08 01:22:05 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-09-17 22:49:08 -07:00
|
|
|
min.w = sd->first_min.w + sd->second_min.w;
|
|
|
|
min.h = MAX(sd->first_min.h, sd->second_min.h);
|
2017-08-08 01:22:05 -07:00
|
|
|
}
|
|
|
|
|
2019-02-21 09:19:45 -08:00
|
|
|
efl_gfx_hint_size_restricted_min_set(obj, min);
|
2017-08-08 01:22:05 -07:00
|
|
|
_set_min_size_new(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_set_min_size_new(void *data)
|
|
|
|
{
|
|
|
|
Eo *obj = data;
|
|
|
|
EFL_UI_PANES_DATA_GET(obj, sd);
|
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
|
|
|
|
2017-09-17 22:35:22 -07:00
|
|
|
Eina_Size2D first_min = sd->first_min;
|
|
|
|
Eina_Size2D second_min = sd->second_min;
|
2017-08-08 01:22:05 -07:00
|
|
|
int w, h;
|
|
|
|
double first_min_relative_size = 0.0, second_min_relative_size = 0.0;
|
|
|
|
|
|
|
|
evas_object_geometry_get(wd->resize_obj, NULL, NULL, &w, &h);
|
|
|
|
|
2019-05-24 09:30:31 -07:00
|
|
|
if (sd->dir == EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL)
|
2017-08-08 01:22:05 -07:00
|
|
|
{
|
2017-09-17 22:35:22 -07:00
|
|
|
if (first_min.h + second_min.h > h)
|
2017-08-08 01:22:05 -07:00
|
|
|
{
|
2017-09-17 22:35:22 -07:00
|
|
|
first_min_relative_size = first_min.h/(first_min.h + second_min.h);
|
|
|
|
second_min_relative_size = second_min.h/(first_min.h + second_min.h);
|
2017-08-08 01:22:05 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (h > 0)
|
|
|
|
{
|
2017-09-17 22:35:22 -07:00
|
|
|
first_min_relative_size = first_min.h/(double)h;
|
|
|
|
second_min_relative_size = second_min.h/(double)h;
|
2017-08-08 01:22:05 -07:00
|
|
|
}
|
|
|
|
}
|
2017-08-09 04:45:02 -07:00
|
|
|
|
|
|
|
first_min_relative_size = MAX(sd->first_min_split_ratio, first_min_relative_size);
|
|
|
|
second_min_relative_size = MAX(sd->second_min_split_ratio, second_min_relative_size);
|
|
|
|
|
2017-08-08 01:22:05 -07:00
|
|
|
edje_object_part_drag_value_set(wd->resize_obj, "right_constraint",
|
|
|
|
0.0, 1.0 - second_min_relative_size);
|
|
|
|
edje_object_part_drag_value_set(wd->resize_obj, "left_constraint",
|
|
|
|
0.0, first_min_relative_size);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-09-17 22:35:22 -07:00
|
|
|
if (first_min.w + second_min.w > w)
|
2017-08-08 01:22:05 -07:00
|
|
|
{
|
2017-09-17 22:35:22 -07:00
|
|
|
first_min_relative_size = first_min.w/(first_min.w + second_min.w);
|
|
|
|
second_min_relative_size = second_min.w/(first_min.w + second_min.w);
|
2017-08-08 01:22:05 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (w > 0)
|
|
|
|
{
|
2017-09-17 22:35:22 -07:00
|
|
|
first_min_relative_size = first_min.w/(double)w;
|
|
|
|
second_min_relative_size = second_min.w/(double)w;
|
2017-08-08 01:22:05 -07:00
|
|
|
}
|
|
|
|
}
|
2017-08-09 04:45:02 -07:00
|
|
|
|
|
|
|
first_min_relative_size = MAX(sd->first_min_split_ratio, first_min_relative_size);
|
|
|
|
second_min_relative_size = MAX(sd->second_min_split_ratio, second_min_relative_size);
|
|
|
|
|
2017-08-08 01:22:05 -07:00
|
|
|
edje_object_part_drag_value_set(wd->resize_obj, "right_constraint",
|
|
|
|
1.0 - second_min_relative_size, 0.0);
|
|
|
|
edje_object_part_drag_value_set(wd->resize_obj, "left_constraint",
|
|
|
|
first_min_relative_size, 0.0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-06-16 18:23:30 -07:00
|
|
|
static void
|
|
|
|
_set_min_size(void *data)
|
|
|
|
{
|
2017-08-01 18:32:30 -07:00
|
|
|
EFL_UI_PANES_DATA_GET(data, sd);
|
2014-06-16 18:23:30 -07:00
|
|
|
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;
|
|
|
|
}
|
2019-05-24 09:30:31 -07:00
|
|
|
if (sd->dir == EFL_UI_LAYOUT_ORIENTATION_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)
|
|
|
|
{
|
2017-08-01 18:32:30 -07:00
|
|
|
EFL_UI_PANES_DATA_GET(data, sd);
|
2014-06-16 18:23:30 -07:00
|
|
|
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)
|
|
|
|
{
|
2019-05-24 09:30:31 -07:00
|
|
|
if (sd->dir == EFL_UI_LAYOUT_ORIENTATION_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;
|
2019-05-24 09:30:31 -07:00
|
|
|
if (sd->dir == EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL && (h > 0))
|
2014-06-16 18:23:30 -07:00
|
|
|
sd->right_min_relative_size = sd->right_min_size / (double)h;
|
2019-05-24 09:30:31 -07:00
|
|
|
if (sd->dir == EFL_UI_LAYOUT_ORIENTATION_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)
|
|
|
|
{
|
2019-05-24 09:30:31 -07:00
|
|
|
if (sd->dir == EFL_UI_LAYOUT_ORIENTATION_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;
|
2019-05-24 09:30:31 -07:00
|
|
|
if (sd->dir == EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL && (h > 0))
|
2014-06-16 18:23:30 -07:00
|
|
|
sd->left_min_relative_size = sd->left_min_size / (double)h;
|
2019-05-24 09:30:31 -07:00
|
|
|
if (sd->dir == EFL_UI_LAYOUT_ORIENTATION_VERTICAL && (w > 0))
|
2014-06-16 18:23:30 -07:00
|
|
|
sd->left_min_relative_size = sd->left_min_size / (double)w;
|
|
|
|
}
|
2017-08-08 01:22:05 -07:00
|
|
|
|
2014-06-16 18:23:30 -07:00
|
|
|
_set_min_size(data);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_on_resize(void *data,
|
|
|
|
Evas *e EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
|
|
|
{
|
2017-08-10 00:29:50 -07:00
|
|
|
if (elm_widget_is_legacy(data)) _update_fixed_sides(data);
|
2017-08-08 18:49:21 -07:00
|
|
|
else _set_min_size_new(data);
|
2014-06-16 18:23:30 -07:00
|
|
|
}
|
|
|
|
|
2014-03-24 23:37:43 -07:00
|
|
|
EOLIAN static void
|
2017-08-01 18:32:30 -07:00
|
|
|
_efl_ui_panes_efl_canvas_group_group_add(Eo *obj, Efl_Ui_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);
|
2017-08-01 18:32:30 -07:00
|
|
|
EFL_UI_PANES_DATA_GET(obj, sd);
|
2017-12-11 11:47:14 -08:00
|
|
|
char *group;
|
2013-09-27 01:45:08 -07:00
|
|
|
|
2017-11-14 05:03:25 -08:00
|
|
|
if (!elm_widget_theme_klass_get(obj))
|
|
|
|
elm_widget_theme_klass_set(obj, "panes");
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_canvas_group_add(efl_super(obj, MY_CLASS));
|
2013-08-26 22:19:19 -07:00
|
|
|
|
2017-12-11 11:47:14 -08:00
|
|
|
group = _efl_ui_panes_theme_group_get(obj, sd);
|
2019-03-04 10:36:41 -08:00
|
|
|
if (elm_widget_theme_object_set(obj, wd->resize_obj,
|
2017-11-14 05:03:25 -08:00
|
|
|
elm_widget_theme_klass_get(obj),
|
2017-12-11 11:47:14 -08:00
|
|
|
group,
|
2019-03-04 10:36:41 -08:00
|
|
|
elm_widget_theme_style_get(obj)) == EFL_UI_THEME_APPLY_ERROR_GENERIC)
|
2013-12-25 20:03:55 -08:00
|
|
|
CRI("Failed to set layout!");
|
2012-05-02 09:59:45 -07:00
|
|
|
|
2017-12-11 11:47:14 -08:00
|
|
|
free(group);
|
|
|
|
|
2012-05-03 15:43:05 -07:00
|
|
|
elm_panes_content_left_size_set(obj, 0.5);
|
|
|
|
|
2018-04-26 04:24:09 -07:00
|
|
|
if (elm_widget_is_legacy(obj))
|
|
|
|
{
|
|
|
|
edje_object_signal_callback_add
|
|
|
|
(wd->resize_obj, "elm,action,click", "*",
|
|
|
|
_on_clicked, obj);
|
|
|
|
edje_object_signal_callback_add
|
|
|
|
(wd->resize_obj, "elm,action,click,double", "*",
|
|
|
|
_double_clicked, obj);
|
|
|
|
edje_object_signal_callback_add
|
|
|
|
(wd->resize_obj, "elm,action,press", "*",
|
|
|
|
_on_pressed, obj);
|
|
|
|
edje_object_signal_callback_add
|
|
|
|
(wd->resize_obj, "elm,action,unpress", "*",
|
|
|
|
_on_unpressed, obj);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-05-14 12:50:53 -07:00
|
|
|
efl_ui_clickable_util_bind_to_theme(wd->resize_obj, obj);
|
2018-04-26 04:24:09 -07:00
|
|
|
}
|
2014-06-16 18:23:30 -07:00
|
|
|
evas_object_event_callback_add
|
|
|
|
(wd->resize_obj, EVAS_CALLBACK_RESIZE,
|
|
|
|
_on_resize, obj);
|
|
|
|
|
2019-05-24 09:30:31 -07:00
|
|
|
sd->dir = EFL_UI_LAYOUT_ORIENTATION_VERTICAL;
|
2014-06-16 18:23:30 -07:00
|
|
|
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;
|
2017-08-10 00:29:50 -07:00
|
|
|
if (elm_widget_is_legacy(obj)) _update_fixed_sides(obj);
|
2017-08-08 18:49:21 -07:00
|
|
|
else _set_min_size_new(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);
|
2018-04-26 03:27:43 -07:00
|
|
|
|
|
|
|
if (elm_widget_is_legacy(obj))
|
2013-04-15 07:55:15 -07:00
|
|
|
{
|
2018-04-26 03:27:43 -07:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (edje_object_part_exists
|
|
|
|
(wd->resize_obj, "efl.event"))
|
|
|
|
{
|
|
|
|
Evas_Coord minw = 0, minh = 0;
|
2013-04-15 07:55:15 -07:00
|
|
|
|
2018-04-26 03:27:43 -07:00
|
|
|
elm_coords_finger_size_adjust(1, &minw, 1, &minh);
|
|
|
|
evas_object_size_hint_min_set(sd->event, minw, minh);
|
|
|
|
elm_layout_content_set(obj, "efl.event", sd->event);
|
|
|
|
}
|
2013-04-15 07:55:15 -07:00
|
|
|
}
|
|
|
|
elm_widget_sub_object_add(obj, sd->event);
|
2011-10-30 08:50:14 -07:00
|
|
|
}
|
|
|
|
|
2015-05-19 05:34:07 -07:00
|
|
|
EOLIAN static Eo *
|
2017-08-01 18:32:30 -07:00
|
|
|
_efl_ui_panes_efl_object_constructor(Eo *obj, Efl_Ui_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-16 22:12:02 -07:00
|
|
|
evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks);
|
2018-04-03 04:27:30 -07:00
|
|
|
efl_access_object_role_set(obj, EFL_ACCESS_ROLE_SPLIT_PANE);
|
2015-05-19 05:34:07 -07:00
|
|
|
|
|
|
|
return obj;
|
2010-06-20 09:01:15 -07:00
|
|
|
}
|
|
|
|
|
2014-03-24 23:37:43 -07:00
|
|
|
EOLIAN static double
|
2018-04-17 11:09:44 -07:00
|
|
|
_efl_ui_panes_split_ratio_get(const Eo *obj, Efl_Ui_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
|
|
|
|
2018-04-26 03:27:43 -07:00
|
|
|
if (elm_widget_is_legacy(obj))
|
|
|
|
edje_object_part_drag_value_get(wd->resize_obj, "elm.bar", &w, &h);
|
|
|
|
else
|
|
|
|
edje_object_part_drag_value_get(wd->resize_obj, "efl.bar", &w, &h);
|
2012-05-03 15:43:05 -07:00
|
|
|
|
2019-05-24 09:30:31 -07:00
|
|
|
if (sd->dir == EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL)
|
2016-05-17 08:00:03 -07:00
|
|
|
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
|
2017-08-09 04:45:02 -07:00
|
|
|
_efl_ui_panes_split_ratio_set(Eo *obj, Efl_Ui_Panes_Data *sd, double ratio)
|
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
|
|
|
|
2017-08-09 04:45:02 -07:00
|
|
|
if (ratio < 0.0) ratio = 0.0;
|
|
|
|
else if (ratio > 1.0) ratio = 1.0;
|
2013-08-10 23:00:43 -07:00
|
|
|
|
2019-05-24 09:30:31 -07:00
|
|
|
if (sd->dir == EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL)
|
2018-04-26 03:27:43 -07:00
|
|
|
{
|
|
|
|
if (elm_widget_is_legacy(obj))
|
|
|
|
edje_object_part_drag_value_set(wd->resize_obj, "elm.bar", 0.0, ratio);
|
|
|
|
else
|
|
|
|
edje_object_part_drag_value_set(wd->resize_obj, "efl.bar", 0.0, ratio);
|
|
|
|
}
|
2010-06-22 12:08:52 -07:00
|
|
|
else
|
2018-04-26 03:27:43 -07:00
|
|
|
{
|
|
|
|
if (elm_widget_is_legacy(obj))
|
|
|
|
edje_object_part_drag_value_set(wd->resize_obj, "elm.bar", ratio, 0.0);
|
|
|
|
else
|
|
|
|
edje_object_part_drag_value_set(wd->resize_obj, "efl.bar", ratio, 0.0);
|
|
|
|
}
|
2012-02-28 19:01:58 -08:00
|
|
|
}
|
|
|
|
|
2014-03-24 23:37:43 -07:00
|
|
|
EOLIAN static void
|
2019-05-24 09:30:31 -07:00
|
|
|
_efl_ui_panes_efl_ui_layout_orientable_orientation_set(Eo *obj, Efl_Ui_Panes_Data *sd, Efl_Ui_Layout_Orientation dir)
|
2010-06-22 12:08:52 -07:00
|
|
|
{
|
2016-07-07 17:49:50 -07:00
|
|
|
double size = elm_panes_content_left_size_get(obj);
|
2019-05-24 09:30:31 -07:00
|
|
|
if (efl_ui_layout_orientation_is_horizontal(dir, EINA_FALSE))
|
|
|
|
dir = EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL;
|
2017-08-09 23:58:34 -07:00
|
|
|
else
|
2019-05-24 09:30:31 -07:00
|
|
|
dir = EFL_UI_LAYOUT_ORIENTATION_VERTICAL;
|
2016-07-07 17:49:50 -07:00
|
|
|
|
2017-08-09 23:58:34 -07:00
|
|
|
sd->dir = dir;
|
2017-10-23 22:03:46 -07:00
|
|
|
efl_ui_widget_theme_apply(obj);
|
2017-08-10 00:29:50 -07:00
|
|
|
if (elm_widget_is_legacy(obj)) _update_fixed_sides(obj);
|
2017-08-08 18:49:21 -07:00
|
|
|
else _set_min_size_new(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
|
|
|
}
|
|
|
|
|
2019-05-24 09:30:31 -07:00
|
|
|
EOLIAN static Efl_Ui_Layout_Orientation
|
|
|
|
_efl_ui_panes_efl_ui_layout_orientable_orientation_get(const Eo *obj EINA_UNUSED, Efl_Ui_Panes_Data *sd)
|
2016-05-17 08:00:03 -07:00
|
|
|
{
|
2017-08-09 23:58:34 -07:00
|
|
|
return sd->dir;
|
2016-05-17 08:00:03 -07:00
|
|
|
}
|
|
|
|
|
2014-03-24 23:37:43 -07:00
|
|
|
EOLIAN static void
|
2017-08-01 18:32:30 -07:00
|
|
|
_efl_ui_panes_fixed_set(Eo *obj, Efl_Ui_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
|
|
|
{
|
2018-04-26 04:24:09 -07:00
|
|
|
if (elm_widget_is_legacy(obj))
|
|
|
|
{
|
|
|
|
elm_layout_signal_emit(obj, "elm,panes,fixed", "elm");
|
2013-02-15 21:37:44 -08:00
|
|
|
|
2018-04-26 04:24:09 -07:00
|
|
|
//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");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
elm_layout_signal_emit(obj, "efl,panes,fixed", "efl");
|
2013-02-15 21:37:44 -08:00
|
|
|
}
|
2011-10-10 19:38:49 -07:00
|
|
|
else
|
2013-02-15 21:37:44 -08:00
|
|
|
{
|
2018-04-26 04:24:09 -07:00
|
|
|
if (elm_widget_is_legacy(obj))
|
|
|
|
{
|
|
|
|
elm_layout_signal_emit(obj, "elm,panes,unfixed", "elm");
|
2013-02-15 21:37:44 -08:00
|
|
|
|
2018-04-26 04:24:09 -07:00
|
|
|
//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");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
elm_layout_signal_emit(obj, "efl,panes,unfixed", "efl");
|
2013-02-15 21:37:44 -08:00
|
|
|
}
|
2011-10-10 19:38:49 -07:00
|
|
|
}
|
|
|
|
|
2014-03-24 23:37:43 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_efl_ui_panes_fixed_get(const Eo *obj EINA_UNUSED, Efl_Ui_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
|
|
|
}
|
|
|
|
|
2017-08-08 18:49:21 -07:00
|
|
|
/* Efl.Part begin */
|
|
|
|
|
2017-12-03 23:01:51 -08:00
|
|
|
static Eina_Bool
|
|
|
|
_part_is_efl_ui_panes_part(const Eo *obj, const char *part)
|
|
|
|
{
|
|
|
|
if (elm_widget_is_legacy(obj))
|
|
|
|
{
|
|
|
|
if ((eina_streq(part, "elm.swallow.left")) || (eina_streq(part, "elm.swallow.right")))
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
2019-05-13 12:14:13 -07:00
|
|
|
|
2017-12-03 23:01:51 -08:00
|
|
|
return (eina_streq(part, "first")) || (eina_streq(part, "second"));
|
|
|
|
}
|
|
|
|
|
|
|
|
ELM_PART_OVERRIDE_PARTIAL(efl_ui_panes, EFL_UI_PANES, Efl_Ui_Panes_Data,
|
|
|
|
_part_is_efl_ui_panes_part)
|
2017-08-08 18:49:21 -07:00
|
|
|
|
2014-06-16 18:23:30 -07:00
|
|
|
EOLIAN static void
|
2017-09-19 04:02:26 -07:00
|
|
|
_efl_ui_panes_part_hint_min_allow_set(Eo *obj, void *_pd EINA_UNUSED, Eina_Bool allow)
|
2014-06-16 18:23:30 -07:00
|
|
|
{
|
2017-09-19 04:02:26 -07:00
|
|
|
Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
|
2017-08-08 18:49:21 -07:00
|
|
|
Efl_Ui_Panes_Data *sd = efl_data_scope_get(pd->obj, EFL_UI_PANES_CLASS);
|
2014-06-16 18:23:30 -07:00
|
|
|
|
2017-08-08 18:49:21 -07:00
|
|
|
if (!strcmp(pd->part, "first"))
|
|
|
|
{
|
2017-08-10 22:27:27 -07:00
|
|
|
if (sd->first_hint_min_allow == allow) return;
|
|
|
|
sd->first_hint_min_allow = allow;
|
2019-07-30 10:11:19 -07:00
|
|
|
efl_canvas_group_change(pd->obj);
|
2017-08-08 18:49:21 -07:00
|
|
|
}
|
|
|
|
else if (!strcmp(pd->part, "second"))
|
|
|
|
{
|
2017-08-10 22:27:27 -07:00
|
|
|
if (sd->second_hint_min_allow == allow) return;
|
|
|
|
sd->second_hint_min_allow = allow;
|
2019-07-30 10:11:19 -07:00
|
|
|
efl_canvas_group_change(pd->obj);
|
2017-08-08 18:49:21 -07:00
|
|
|
}
|
2014-06-16 18:23:30 -07:00
|
|
|
}
|
|
|
|
|
2014-03-24 23:37:43 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_efl_ui_panes_part_hint_min_allow_get(const Eo *obj, void *_pd EINA_UNUSED)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2017-08-08 18:49:21 -07:00
|
|
|
Eina_Bool ret = EINA_FALSE;
|
2017-09-19 04:02:26 -07:00
|
|
|
Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
|
2017-08-08 18:49:21 -07:00
|
|
|
Efl_Ui_Panes_Data *sd = efl_data_scope_get(pd->obj, EFL_UI_PANES_CLASS);
|
2012-05-03 15:43:05 -07:00
|
|
|
|
2017-08-08 18:49:21 -07:00
|
|
|
if (!strcmp(pd->part, "first"))
|
|
|
|
{
|
2017-08-10 22:27:27 -07:00
|
|
|
ret = sd->first_hint_min_allow;
|
2017-08-08 18:49:21 -07:00
|
|
|
}
|
|
|
|
else if (!strcmp(pd->part, "second"))
|
|
|
|
{
|
2017-08-10 22:27:27 -07:00
|
|
|
ret = sd->second_hint_min_allow;
|
2017-08-08 18:49:21 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2014-03-24 23:37:43 -07:00
|
|
|
|
2017-08-09 04:45:02 -07:00
|
|
|
EOLIAN static double
|
2018-04-17 11:09:44 -07:00
|
|
|
_efl_ui_panes_part_split_ratio_min_get(const Eo *obj, void *_pd EINA_UNUSED)
|
2017-08-09 04:45:02 -07:00
|
|
|
{
|
2017-09-19 04:02:26 -07:00
|
|
|
Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
|
2017-08-09 04:45:02 -07:00
|
|
|
Efl_Ui_Panes_Data *sd = efl_data_scope_get(pd->obj, EFL_UI_PANES_CLASS);
|
|
|
|
double ret = 0.0;
|
|
|
|
|
|
|
|
if (!strcmp(pd->part, "first"))
|
|
|
|
ret = sd->first_min_split_ratio;
|
|
|
|
else if (!strcmp(pd->part, "second"))
|
|
|
|
ret = sd->second_min_split_ratio;
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
2017-09-19 04:02:26 -07:00
|
|
|
_efl_ui_panes_part_split_ratio_min_set(Eo *obj, void *_pd EINA_UNUSED, double ratio)
|
2017-08-09 04:45:02 -07:00
|
|
|
{
|
2017-09-19 04:02:26 -07:00
|
|
|
Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
|
2017-08-09 04:45:02 -07:00
|
|
|
Efl_Ui_Panes_Data *sd = efl_data_scope_get(pd->obj, EFL_UI_PANES_CLASS);
|
|
|
|
|
|
|
|
if (!strcmp(pd->part, "first"))
|
|
|
|
{
|
|
|
|
sd->first_min_split_ratio = ratio;
|
|
|
|
if (sd->first_min_split_ratio < 0) sd->first_min_split_ratio = 0;
|
|
|
|
_set_min_size_new(pd->obj);
|
|
|
|
}
|
|
|
|
else if (!strcmp(pd->part, "second"))
|
|
|
|
{
|
|
|
|
sd->second_min_split_ratio = ratio;
|
|
|
|
if (sd->second_min_split_ratio < 0) sd->second_min_split_ratio = 0;
|
|
|
|
_set_min_size_new(pd->obj);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
edje/elm: Rename _internal_ to _part_ (EO)
In Edje and Elementary, we have part objects, which are what is returned
by the interface efl_part(). Those objects can't be of an opaque type as
this doesn't work nicely with strongly typed languages such as C++ or
C#. In JS, Lua, C the types are weak and mostly runtime-based so it
doesn't matter much.
As a consequence, the documentation and the types need to look nice in
this EO API. Thus, we remove the abusive term "internal" and explicitly
call all those classes "part" something.
Eventually we want the types to be declared in the EO file so bindings
(C#, C++, ...) can generate the proper access methods, returning the
best possible types.
Note that right now a few of those part types are used in the legacy API
but don't actually need to be exposed externally.
This is kind of a mega commit that does all the renaming at once, but
it's really just a big sed operation. The power of good IDEs :)
Ref T5315
Ref T5306
2017-09-12 21:29:25 -07:00
|
|
|
#include "efl_ui_panes_part.eo.c"
|
2017-08-08 18:49:21 -07:00
|
|
|
|
|
|
|
/* Efl.Part end */
|
|
|
|
|
2017-05-18 01:52:17 -07:00
|
|
|
/* Internal EO APIs and hidden overrides */
|
|
|
|
|
2017-09-19 05:46:59 -07:00
|
|
|
ELM_LAYOUT_CONTENT_ALIASES_IMPLEMENT(efl_ui_panes)
|
2017-07-27 23:35:10 -07:00
|
|
|
|
2017-08-01 18:32:30 -07:00
|
|
|
#define EFL_UI_PANES_EXTRA_OPS \
|
|
|
|
EFL_CANVAS_GROUP_ADD_OPS(efl_ui_panes), \
|
2017-09-19 05:46:59 -07:00
|
|
|
ELM_LAYOUT_CONTENT_ALIASES_OPS(efl_ui_panes), \
|
2017-08-08 01:22:05 -07:00
|
|
|
ELM_LAYOUT_SIZING_EVAL_OPS(efl_ui_panes)
|
2017-05-18 01:52:17 -07:00
|
|
|
|
2018-01-23 22:50:58 -08:00
|
|
|
#include "efl_ui_panes.eo.c"
|
2019-03-05 14:00:37 -08:00
|
|
|
#include "efl_ui_panes_eo.legacy.c"
|
2018-01-23 22:50:58 -08:00
|
|
|
|
2019-03-05 14:00:37 -08:00
|
|
|
#include "efl_ui_panes_legacy_eo.h"
|
2018-01-23 22:50:58 -08:00
|
|
|
#define MY_CLASS_NAME_LEGACY "elm_panes"
|
|
|
|
|
|
|
|
static void
|
|
|
|
_efl_ui_panes_legacy_class_constructor(Efl_Class *klass)
|
|
|
|
{
|
|
|
|
evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eo *
|
|
|
|
_efl_ui_panes_legacy_efl_object_constructor(Eo *obj, void *_pd EINA_UNUSED)
|
|
|
|
{
|
|
|
|
obj = efl_constructor(efl_super(obj, EFL_UI_PANES_LEGACY_CLASS));
|
|
|
|
efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
|
|
|
|
return obj;
|
|
|
|
}
|
2017-08-13 17:55:38 -07:00
|
|
|
|
|
|
|
EAPI Evas_Object *
|
|
|
|
elm_panes_add(Evas_Object *parent)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
|
2018-01-23 22:50:58 -08:00
|
|
|
return elm_legacy_add(EFL_UI_PANES_LEGACY_CLASS, parent);
|
2017-08-13 17:55:38 -07:00
|
|
|
}
|
|
|
|
|
2017-08-08 18:49:21 -07:00
|
|
|
EAPI void
|
|
|
|
elm_panes_content_left_min_size_set(Evas_Object *obj, int size)
|
|
|
|
{
|
2018-01-30 02:28:19 -08:00
|
|
|
EFL_UI_PANES_DATA_GET_OR_RETURN(obj, sd);
|
2017-08-08 18:49:21 -07:00
|
|
|
|
|
|
|
sd->left_min_size = size;
|
|
|
|
if (sd->left_min_size < 0) sd->left_min_size = 0;
|
|
|
|
sd->left_min_size_is_relative = EINA_FALSE;
|
|
|
|
_update_fixed_sides(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI int
|
|
|
|
elm_panes_content_left_min_size_get(const Evas_Object *obj)
|
|
|
|
{
|
2018-01-30 02:28:19 -08:00
|
|
|
EFL_UI_PANES_DATA_GET_OR_RETURN_VAL(obj, sd, 0);
|
2017-08-08 18:49:21 -07:00
|
|
|
return sd->left_min_size;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_panes_content_right_min_size_set(Evas_Object *obj, int size)
|
|
|
|
{
|
2018-01-30 02:28:19 -08:00
|
|
|
EFL_UI_PANES_DATA_GET_OR_RETURN(obj, sd);
|
2017-08-08 18:49:21 -07:00
|
|
|
|
|
|
|
sd->right_min_size = size;
|
|
|
|
if (sd->right_min_size < 0) sd->right_min_size = 0;
|
|
|
|
sd->right_min_size_is_relative = EINA_FALSE;
|
|
|
|
_update_fixed_sides(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI int
|
|
|
|
elm_panes_content_right_min_size_get(const Evas_Object *obj)
|
|
|
|
{
|
2018-01-30 02:28:19 -08:00
|
|
|
EFL_UI_PANES_DATA_GET_OR_RETURN_VAL(obj, sd, 0);
|
2017-08-08 18:49:21 -07:00
|
|
|
return sd->right_min_size;
|
|
|
|
}
|
|
|
|
|
2017-08-09 04:45:02 -07:00
|
|
|
EAPI double
|
|
|
|
elm_panes_content_left_size_get(const Evas_Object *obj)
|
|
|
|
{
|
|
|
|
return efl_ui_panes_split_ratio_get(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_panes_content_left_size_set(Evas_Object *obj, double size)
|
|
|
|
{
|
|
|
|
efl_ui_panes_split_ratio_set(obj, size);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI double
|
|
|
|
elm_panes_content_right_size_get(const Evas_Object *obj)
|
|
|
|
{
|
2018-01-30 02:28:19 -08:00
|
|
|
EFL_UI_PANES_CHECK(obj) 0.0;
|
|
|
|
|
2017-08-09 04:45:02 -07:00
|
|
|
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_content_left_min_relative_size_set(Evas_Object *obj, double size)
|
|
|
|
{
|
2018-01-30 02:28:19 -08:00
|
|
|
EFL_UI_PANES_DATA_GET_OR_RETURN(obj, sd);
|
2017-08-09 04:45:02 -07:00
|
|
|
sd->left_min_relative_size = size;
|
|
|
|
if (sd->left_min_relative_size < 0) sd->left_min_relative_size = 0;
|
|
|
|
sd->left_min_size_is_relative = EINA_TRUE;
|
|
|
|
_update_fixed_sides(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI double
|
|
|
|
elm_panes_content_left_min_relative_size_get(const Evas_Object *obj)
|
|
|
|
{
|
2018-01-30 02:28:19 -08:00
|
|
|
EFL_UI_PANES_DATA_GET_OR_RETURN_VAL(obj, sd, 0.0);
|
2017-08-09 04:45:02 -07:00
|
|
|
return sd->left_min_relative_size;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_panes_content_right_min_relative_size_set(Evas_Object *obj, double size)
|
|
|
|
{
|
2018-01-30 02:28:19 -08:00
|
|
|
EFL_UI_PANES_DATA_GET_OR_RETURN(obj, sd);
|
2017-08-09 04:45:02 -07:00
|
|
|
|
|
|
|
sd->right_min_relative_size = size;
|
|
|
|
if (sd->right_min_relative_size < 0) sd->right_min_relative_size = 0;
|
|
|
|
sd->right_min_size_is_relative = EINA_TRUE;
|
|
|
|
_update_fixed_sides(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI double
|
|
|
|
elm_panes_content_right_min_relative_size_get(const Evas_Object *obj)
|
|
|
|
{
|
2018-01-30 02:28:19 -08:00
|
|
|
EFL_UI_PANES_DATA_GET_OR_RETURN_VAL(obj, sd, 0.0);
|
2017-08-09 04:45:02 -07:00
|
|
|
return sd->right_min_relative_size;
|
|
|
|
}
|
|
|
|
|
2017-08-13 17:55:38 -07:00
|
|
|
EAPI void
|
|
|
|
elm_panes_horizontal_set(Evas_Object *obj, Eina_Bool horizontal)
|
|
|
|
{
|
2018-01-30 02:28:19 -08:00
|
|
|
EFL_UI_PANES_CHECK(obj);
|
|
|
|
|
2019-05-24 09:30:31 -07:00
|
|
|
Efl_Ui_Layout_Orientation dir;
|
2017-08-13 17:55:38 -07:00
|
|
|
|
|
|
|
if (horizontal)
|
2019-05-24 09:30:31 -07:00
|
|
|
dir = EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL;
|
2017-08-13 17:55:38 -07:00
|
|
|
else
|
2019-05-24 09:30:31 -07:00
|
|
|
dir = EFL_UI_LAYOUT_ORIENTATION_VERTICAL;
|
2017-08-13 17:55:38 -07:00
|
|
|
|
2019-05-24 09:30:31 -07:00
|
|
|
efl_ui_layout_orientation_set(obj, dir);
|
2017-08-13 17:55:38 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
elm_panes_horizontal_get(const Evas_Object *obj)
|
|
|
|
{
|
2018-01-30 02:28:19 -08:00
|
|
|
EFL_UI_PANES_CHECK(obj) EINA_FALSE;
|
|
|
|
|
2019-05-24 09:30:31 -07:00
|
|
|
Efl_Ui_Layout_Orientation dir = efl_ui_layout_orientation_get(obj);
|
2017-08-13 17:55:38 -07:00
|
|
|
|
2019-05-24 09:30:31 -07:00
|
|
|
if (dir == EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL)
|
2017-08-13 17:55:38 -07:00
|
|
|
return EINA_TRUE;
|
|
|
|
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EINA_DEPRECATED EAPI void
|
|
|
|
elm_panes_content_left_set(Evas_Object *obj,
|
|
|
|
Evas_Object *content)
|
|
|
|
{
|
|
|
|
elm_layout_content_set(obj, "left", content);
|
|
|
|
}
|
|
|
|
|
|
|
|
EINA_DEPRECATED EAPI void
|
|
|
|
elm_panes_content_right_set(Evas_Object *obj,
|
|
|
|
Evas_Object *content)
|
|
|
|
{
|
|
|
|
elm_layout_content_set(obj, "right", content);
|
|
|
|
}
|
|
|
|
|
|
|
|
EINA_DEPRECATED EAPI Evas_Object *
|
|
|
|
elm_panes_content_left_get(const Evas_Object *obj)
|
|
|
|
{
|
|
|
|
return elm_layout_content_get(obj, "left");
|
|
|
|
}
|
|
|
|
|
|
|
|
EINA_DEPRECATED EAPI Evas_Object *
|
|
|
|
elm_panes_content_right_get(const Evas_Object *obj)
|
|
|
|
{
|
|
|
|
return elm_layout_content_get(obj, "right");
|
|
|
|
}
|
|
|
|
|
|
|
|
EINA_DEPRECATED EAPI Evas_Object *
|
|
|
|
elm_panes_content_left_unset(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
return elm_layout_content_unset(obj, "left");
|
|
|
|
}
|
|
|
|
|
|
|
|
EINA_DEPRECATED EAPI Evas_Object *
|
|
|
|
elm_panes_content_right_unset(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
return elm_layout_content_unset(obj, "right");
|
|
|
|
}
|
|
|
|
|
2019-03-05 14:00:37 -08:00
|
|
|
#include "efl_ui_panes_legacy_eo.c"
|