2010-01-08 10:00:33 -08:00
|
|
|
#include <Elementary.h>
|
|
|
|
#include "elm_priv.h"
|
|
|
|
|
2011-05-18 09:49:20 -07:00
|
|
|
#ifndef MIN
|
|
|
|
# define MIN(a,b) ((a) < (b)) ? (a) : (b)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef MAX
|
|
|
|
# define MAX(a,b) ((a) < (b)) ? (b) : (a)
|
|
|
|
#endif
|
|
|
|
|
2010-02-08 18:46:19 -08:00
|
|
|
/**
|
|
|
|
* @defgroup Conformant Conformant
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
*
|
|
|
|
* The aim is to provide a widget that can be used in elementary apps to
|
2011-05-19 03:58:16 -07:00
|
|
|
* account for space taken up by the indicator, virtual keypad & softkey windows when running
|
2010-02-08 18:46:19 -08:00
|
|
|
* the illume2 module of E17.
|
|
|
|
*/
|
|
|
|
|
2010-01-08 10:00:33 -08:00
|
|
|
typedef struct _Widget_Data Widget_Data;
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
struct _Widget_Data
|
2010-01-08 10:00:33 -08:00
|
|
|
{
|
|
|
|
Evas_Object *base;
|
2011-05-19 03:58:16 -07:00
|
|
|
Evas_Object *shelf, *panel, *virtualkeypad;
|
2010-01-08 10:00:33 -08:00
|
|
|
Evas_Object *content;
|
2011-05-19 03:58:16 -07:00
|
|
|
Evas_Object *scroller;
|
2010-01-26 17:48:18 -08:00
|
|
|
Ecore_Event_Handler *prop_hdl;
|
2011-05-19 03:58:16 -07:00
|
|
|
#ifdef HAVE_ELEMENTARY_X
|
|
|
|
Ecore_X_Virtual_Keyboard_State vkb_state;
|
|
|
|
#endif
|
2011-04-19 00:31:59 -07:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
Ecore_Animator *animator; // animaton timer
|
|
|
|
double start; // time started
|
|
|
|
Evas_Coord auto_x, auto_y; // desired delta
|
|
|
|
Evas_Coord x, y; // current delta
|
2010-02-04 22:14:50 -08:00
|
|
|
} delta;
|
2010-01-08 10:00:33 -08:00
|
|
|
};
|
|
|
|
|
2011-04-26 23:33:34 -07:00
|
|
|
/* Enum to identify conformant swallow parts */
|
|
|
|
typedef enum _Conformant_Part_Type Conformant_Part_Type;
|
|
|
|
enum _Conformant_Part_Type
|
|
|
|
{
|
|
|
|
ELM_CONFORM_INDICATOR_PART = 1,
|
2011-05-19 03:58:16 -07:00
|
|
|
ELM_CONFORM_SOFTKEY_PART = 2,
|
|
|
|
ELM_CONFORM_VIRTUAL_KEYPAD_PART = 4
|
2011-04-26 23:33:34 -07:00
|
|
|
};
|
|
|
|
|
2011-05-19 03:58:16 -07:00
|
|
|
#define SUB_TYPE_COUNT 2
|
|
|
|
static char *sub_type[SUB_TYPE_COUNT] = { "scroller", "genlist" };
|
|
|
|
|
2010-01-08 10:00:33 -08:00
|
|
|
/* local function prototypes */
|
2010-03-08 22:15:39 -08:00
|
|
|
static const char *widtype = NULL;
|
2010-01-08 10:00:33 -08:00
|
|
|
static void _del_hook(Evas_Object *obj);
|
2011-02-08 04:08:28 -08:00
|
|
|
static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl);
|
2010-01-08 10:00:33 -08:00
|
|
|
static void _theme_hook(Evas_Object *obj);
|
2011-04-26 23:33:34 -07:00
|
|
|
static void _swallow_conformant_parts(Evas_Object *obj);
|
2011-05-19 03:58:16 -07:00
|
|
|
#ifdef HAVE_ELEMENTARY_X
|
2011-04-26 23:33:34 -07:00
|
|
|
static void _conformant_part_size_set(Evas_Object *obj,
|
|
|
|
Evas_Object *sobj,
|
|
|
|
Evas_Coord sx,
|
|
|
|
Evas_Coord sy,
|
|
|
|
Evas_Coord sw,
|
|
|
|
Evas_Coord sh);
|
|
|
|
static void _conformant_part_sizing_eval(Evas_Object *obj,
|
|
|
|
Conformant_Part_Type part_type);
|
2011-05-19 03:58:16 -07:00
|
|
|
#endif
|
2010-01-08 10:00:33 -08:00
|
|
|
static void _sizing_eval(Evas_Object *obj);
|
2010-06-25 02:58:14 -07:00
|
|
|
static Eina_Bool _prop_change(void *data, int type, void *event);
|
2010-01-08 10:00:33 -08:00
|
|
|
|
|
|
|
/* local functions */
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
static void
|
|
|
|
_del_hook(Evas_Object *obj)
|
2010-01-08 10:00:33 -08:00
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2011-04-19 00:31:59 -07:00
|
|
|
|
2010-03-09 08:46:13 -08:00
|
|
|
if (!wd) return;
|
2010-01-26 17:48:18 -08:00
|
|
|
if (wd->prop_hdl) ecore_event_handler_del(wd->prop_hdl);
|
2010-01-08 10:00:33 -08:00
|
|
|
free(wd);
|
|
|
|
}
|
|
|
|
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
static void
|
2011-02-08 04:08:28 -08:00
|
|
|
_mirrored_set(Evas_Object *obj, Eina_Bool rtl)
|
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2011-04-19 00:31:59 -07:00
|
|
|
|
2011-02-08 04:08:28 -08:00
|
|
|
if (!wd) return;
|
|
|
|
edje_object_mirrored_set(wd->base, rtl);
|
|
|
|
}
|
|
|
|
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
static void
|
|
|
|
_theme_hook(Evas_Object *obj)
|
2010-01-08 10:00:33 -08:00
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2011-04-19 00:31:59 -07:00
|
|
|
|
2010-03-09 08:46:13 -08:00
|
|
|
if (!wd) return;
|
2011-02-09 08:14:02 -08:00
|
|
|
_elm_widget_mirrored_reload(obj);
|
2011-02-08 04:08:28 -08:00
|
|
|
_mirrored_set(obj, elm_widget_mirrored_get(obj));
|
2011-04-19 00:31:59 -07:00
|
|
|
_elm_theme_object_set(obj, wd->base, "conformant", "base",
|
|
|
|
elm_widget_style_get(obj));
|
2011-04-26 23:33:34 -07:00
|
|
|
_swallow_conformant_parts(obj);
|
2011-04-19 00:31:59 -07:00
|
|
|
|
2010-01-08 10:00:33 -08:00
|
|
|
if (wd->content)
|
|
|
|
edje_object_part_swallow(wd->base, "elm.swallow.content", wd->content);
|
2011-04-19 00:31:59 -07:00
|
|
|
edje_object_scale_set(wd->base, elm_widget_scale_get(obj)
|
|
|
|
* _elm_config->scale);
|
2010-01-08 10:00:33 -08:00
|
|
|
_sizing_eval(obj);
|
|
|
|
}
|
|
|
|
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
static void
|
|
|
|
_sizing_eval(Evas_Object *obj)
|
2010-01-08 10:00:33 -08:00
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
Evas_Coord mw = -1, mh = -1;
|
2011-04-19 00:31:59 -07:00
|
|
|
|
2010-03-09 08:46:13 -08:00
|
|
|
if (!wd) return;
|
2010-01-08 10:00:33 -08:00
|
|
|
edje_object_size_min_calc(wd->base, &mw, &mh);
|
|
|
|
evas_object_size_hint_min_set(obj, mw, mh);
|
|
|
|
evas_object_size_hint_max_set(obj, -1, -1);
|
|
|
|
}
|
|
|
|
|
2011-05-19 03:58:16 -07:00
|
|
|
#ifdef HAVE_ELEMENTARY_X
|
2011-04-26 23:33:34 -07:00
|
|
|
static void
|
|
|
|
_conformant_part_size_set(Evas_Object *obj, Evas_Object *sobj, Evas_Coord sx,
|
|
|
|
Evas_Coord sy, Evas_Coord sw, Evas_Coord sh)
|
|
|
|
{
|
|
|
|
Evas_Coord cx, cy, cw, ch;
|
|
|
|
Evas_Coord part_height = 0, part_width = 0;
|
|
|
|
|
|
|
|
evas_object_geometry_get(obj, &cx, &cy, &cw, &ch);
|
|
|
|
|
|
|
|
/* Part overlapping with conformant */
|
|
|
|
if ((cx < (sx + sw)) && ((cx + cw) > sx)
|
|
|
|
&& (cy < (sy + sh)) && ((cy + ch) > sy))
|
|
|
|
{
|
|
|
|
part_height = MIN((cy + ch), (sy + sh)) - MAX(cy, sy);
|
|
|
|
part_width = MIN((cx + cw), (sx + sw)) - MAX(cx, sx);
|
|
|
|
}
|
|
|
|
|
|
|
|
evas_object_size_hint_min_set(sobj, part_width, part_height);
|
|
|
|
evas_object_size_hint_max_set(sobj, part_width, part_height);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_conformant_part_sizing_eval(Evas_Object *obj, Conformant_Part_Type part_type)
|
|
|
|
{
|
|
|
|
Ecore_X_Window zone, xwin;
|
|
|
|
int sx = -1, sy = -1, sw = -1, sh = -1;
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
|
|
|
|
if (!wd) return;
|
|
|
|
|
|
|
|
Evas_Object *top = elm_widget_top_get(obj);
|
|
|
|
xwin = elm_win_xwindow_get(top);
|
|
|
|
zone = ecore_x_e_illume_zone_get(xwin);
|
|
|
|
|
|
|
|
if (part_type & ELM_CONFORM_INDICATOR_PART)
|
|
|
|
{
|
|
|
|
ecore_x_e_illume_indicator_geometry_get(zone, &sx, &sy, &sw, &sh);
|
|
|
|
_conformant_part_size_set(obj, wd->shelf, sx, sy, sw, sh);
|
|
|
|
}
|
2011-05-19 03:58:16 -07:00
|
|
|
if (part_type & ELM_CONFORM_VIRTUAL_KEYPAD_PART)
|
|
|
|
{
|
|
|
|
ecore_x_e_illume_keyboard_geometry_get(zone, &sx, &sy, &sw, &sh);
|
|
|
|
_conformant_part_size_set(obj,wd->virtualkeypad, sx, sy, sw, sh);
|
|
|
|
}
|
2011-04-26 23:33:34 -07:00
|
|
|
if (part_type & ELM_CONFORM_SOFTKEY_PART)
|
|
|
|
{
|
|
|
|
ecore_x_e_illume_softkey_geometry_get(zone, &sx, &sy, &sw, &sh);
|
|
|
|
_conformant_part_size_set(obj, wd->panel, sx, sy, sw, sh);
|
|
|
|
}
|
|
|
|
}
|
2011-05-19 03:58:16 -07:00
|
|
|
#endif
|
2011-04-26 23:33:34 -07:00
|
|
|
|
|
|
|
static void
|
|
|
|
_swallow_conformant_parts(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
|
2011-05-19 03:58:16 -07:00
|
|
|
wd->scroller = NULL;
|
2011-04-26 23:33:34 -07:00
|
|
|
if (!wd->shelf)
|
|
|
|
{
|
|
|
|
wd->shelf = evas_object_rectangle_add(evas_object_evas_get(obj));
|
|
|
|
elm_widget_sub_object_add(obj, wd->shelf);
|
|
|
|
evas_object_size_hint_min_set(wd->shelf, -1, 0);
|
|
|
|
evas_object_size_hint_max_set(wd->shelf, -1, 0);
|
|
|
|
}
|
2011-05-19 03:58:16 -07:00
|
|
|
#ifdef HAVE_ELEMENTARY_X
|
2011-04-26 23:33:34 -07:00
|
|
|
else
|
|
|
|
_conformant_part_sizing_eval(obj, ELM_CONFORM_INDICATOR_PART);
|
2011-05-19 03:58:16 -07:00
|
|
|
#endif
|
2011-04-26 23:33:34 -07:00
|
|
|
evas_object_color_set(wd->shelf, 0, 0, 0, 0);
|
|
|
|
edje_object_part_swallow(wd->base, "elm.swallow.shelf", wd->shelf);
|
|
|
|
|
2011-05-19 03:58:16 -07:00
|
|
|
if (!wd->virtualkeypad)
|
|
|
|
{
|
|
|
|
wd->virtualkeypad = evas_object_rectangle_add(evas_object_evas_get(obj));
|
|
|
|
elm_widget_sub_object_add(obj, wd->virtualkeypad);
|
|
|
|
evas_object_size_hint_min_set(wd->virtualkeypad, -1, 0);
|
|
|
|
evas_object_size_hint_max_set(wd->virtualkeypad, -1, 0);
|
|
|
|
}
|
|
|
|
#ifdef HAVE_ELEMENTARY_X
|
|
|
|
else
|
|
|
|
_conformant_part_sizing_eval(obj, ELM_CONFORM_VIRTUAL_KEYPAD_PART);
|
|
|
|
#endif
|
|
|
|
evas_object_color_set(wd->virtualkeypad, 0, 0, 0, 0);
|
|
|
|
edje_object_part_swallow(wd->base, "elm.swallow.virtualkeypad",
|
|
|
|
wd->virtualkeypad);
|
|
|
|
|
2011-04-26 23:33:34 -07:00
|
|
|
if (!wd->panel)
|
|
|
|
{
|
|
|
|
wd->panel = evas_object_rectangle_add(evas_object_evas_get(obj));
|
|
|
|
elm_widget_sub_object_add(obj, wd->panel);
|
|
|
|
evas_object_size_hint_min_set(wd->panel, -1, 0);
|
|
|
|
evas_object_size_hint_max_set(wd->panel, -1, 0);
|
|
|
|
}
|
2011-05-19 03:58:16 -07:00
|
|
|
#ifdef HAVE_ELEMENTARY_X
|
2011-04-26 23:33:34 -07:00
|
|
|
else
|
|
|
|
_conformant_part_sizing_eval(obj, ELM_CONFORM_SOFTKEY_PART);
|
2011-05-19 03:58:16 -07:00
|
|
|
#endif
|
2011-04-26 23:33:34 -07:00
|
|
|
evas_object_color_set(wd->panel, 0, 0, 0, 0);
|
|
|
|
edje_object_part_swallow(wd->base, "elm.swallow.panel", wd->panel);
|
|
|
|
}
|
|
|
|
|
2010-02-04 01:08:02 -08:00
|
|
|
static void
|
2011-04-19 00:31:59 -07:00
|
|
|
_changed_size_hints(void *data, Evas *e __UNUSED__,
|
|
|
|
Evas_Object *obj __UNUSED__,
|
|
|
|
void *event_info __UNUSED__)
|
2010-02-04 01:08:02 -08:00
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(data);
|
2011-04-19 00:31:59 -07:00
|
|
|
|
2010-03-09 08:46:13 -08:00
|
|
|
if (!wd) return;
|
2010-02-04 01:08:02 -08:00
|
|
|
_sizing_eval(data);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-03-09 09:51:30 -08:00
|
|
|
_sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
|
2010-02-04 01:08:02 -08:00
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
Evas_Object *sub = event_info;
|
2011-04-19 00:31:59 -07:00
|
|
|
|
2010-03-09 08:46:13 -08:00
|
|
|
if (!wd) return;
|
2010-02-04 01:08:02 -08:00
|
|
|
if (sub == wd->content)
|
|
|
|
{
|
2011-04-19 00:31:59 -07:00
|
|
|
evas_object_event_callback_del_full(sub,
|
|
|
|
EVAS_CALLBACK_CHANGED_SIZE_HINTS,
|
2010-02-04 01:08:02 -08:00
|
|
|
_changed_size_hints, obj);
|
|
|
|
wd->content = NULL;
|
|
|
|
_sizing_eval(obj);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-02-04 22:14:50 -08:00
|
|
|
/* unused now - but meant to be for making sure the focused widget is always
|
|
|
|
* visible when the vkbd comes and goes by moving the conformant obj (and thus
|
|
|
|
* its children) to show the focused widget (and if focus changes follow)
|
|
|
|
|
elementary / entry, list, scroller, fileselector_button, config, photocam, map, pan, bg, store, priv, pager, conform, box, clock, flipselector
fixed indentation, removed white spaces.
SVN revision: 58267
2011-04-01 12:08:56 -07:00
|
|
|
static Evas_Object *
|
|
|
|
_focus_object_get(const Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Evas_Object *win, *foc;
|
|
|
|
|
|
|
|
win = elm_widget_top_get(obj);
|
|
|
|
if (!win) return NULL;
|
|
|
|
foc = elm_widget_top_get(win);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_focus_object_region_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
|
|
|
|
{
|
|
|
|
evas_object_geometry_get(obj, x, y, w, h);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_focus_change_del(void *data, Evas_Object *obj, void *event_info)
|
|
|
|
{
|
|
|
|
// called from toplevel when the focused window shanges
|
2010-02-04 22:14:50 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_autoscroll_move(Evas_Object *obj)
|
|
|
|
{
|
elementary / entry, list, scroller, fileselector_button, config, photocam, map, pan, bg, store, priv, pager, conform, box, clock, flipselector
fixed indentation, removed white spaces.
SVN revision: 58267
2011-04-01 12:08:56 -07:00
|
|
|
// move conformant edje by delta to show focused widget
|
2010-02-04 22:14:50 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_autoscroll_mode_enable(Evas_Object *obj)
|
|
|
|
{
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
// called when autoscroll mode should be on - content area smaller than
|
|
|
|
// its min size
|
|
|
|
// 1. get focused object
|
|
|
|
// 2. if not in visible conformant area calculate delta needed to
|
|
|
|
// get it in
|
|
|
|
// 3. store delta and call _autoscroll_move() which either asanimates
|
|
|
|
// or jumps right there
|
2010-02-04 22:14:50 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_autoscroll_mode_disable(Evas_Object *obj)
|
|
|
|
{
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
// called when autoscroll mode should be off - set delta to 0 and
|
|
|
|
// call _autoscroll_move()
|
2010-02-04 22:14:50 -08:00
|
|
|
}
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
*/
|
2010-02-04 22:14:50 -08:00
|
|
|
|
2011-05-19 03:58:16 -07:00
|
|
|
#ifdef HAVE_ELEMENTARY_X
|
2011-04-26 23:33:34 -07:00
|
|
|
static void
|
2011-04-27 06:53:25 -07:00
|
|
|
_conformant_move_resize_event_cb(void *data __UNUSED__, Evas *e __UNUSED__,
|
|
|
|
Evas_Object *obj, void *event_info __UNUSED__)
|
2011-04-26 23:33:34 -07:00
|
|
|
{
|
|
|
|
Conformant_Part_Type part_type;
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
|
|
|
|
if (!wd) return;
|
|
|
|
part_type = (ELM_CONFORM_INDICATOR_PART |
|
2011-05-19 03:58:16 -07:00
|
|
|
ELM_CONFORM_SOFTKEY_PART |
|
|
|
|
ELM_CONFORM_VIRTUAL_KEYPAD_PART);
|
2011-04-26 23:33:34 -07:00
|
|
|
_conformant_part_sizing_eval(obj, part_type);
|
|
|
|
}
|
2011-05-19 03:58:16 -07:00
|
|
|
#endif
|
|
|
|
|
|
|
|
// showing the focused/important region.
|
|
|
|
static void
|
|
|
|
_content_resize_event_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj
|
|
|
|
__UNUSED__, void *event_info __UNUSED__)
|
|
|
|
{
|
|
|
|
Evas_Object *focus_obj;
|
|
|
|
Evas_Object *conformant = (Evas_Object *)data;
|
|
|
|
Widget_Data *wd = elm_widget_data_get(conformant);
|
|
|
|
|
|
|
|
if (!wd) return;
|
|
|
|
#ifdef HAVE_ELEMENTARY_X
|
|
|
|
if (wd->vkb_state == ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF) return;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
focus_obj = elm_widget_focused_object_get(conformant);
|
|
|
|
if (focus_obj)
|
|
|
|
{
|
|
|
|
Evas_Coord x, y, w, h;
|
|
|
|
|
|
|
|
elm_widget_show_region_get(focus_obj, &x, &y, &w, &h);
|
|
|
|
|
|
|
|
if (h < _elm_config->finger_size)
|
|
|
|
h = _elm_config->finger_size;
|
|
|
|
|
|
|
|
elm_widget_show_region_set(focus_obj, x, y, w, h);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef HAVE_ELEMENTARY_X
|
|
|
|
static void
|
|
|
|
_update_autoscroll_objs(void *data)
|
|
|
|
{
|
|
|
|
const char *type;
|
|
|
|
int i;
|
|
|
|
Evas_Object *sub, *top_scroller = NULL;
|
|
|
|
Evas_Object *conformant = (Evas_Object *)data;
|
|
|
|
Widget_Data *wd = elm_widget_data_get(data);
|
|
|
|
|
|
|
|
if (!wd) return;
|
|
|
|
|
|
|
|
sub = elm_widget_focused_object_get(conformant);
|
|
|
|
//Look up for Top most scroller in the Focus Object hierarchy inside Conformant.
|
|
|
|
|
|
|
|
while (sub)
|
|
|
|
{
|
|
|
|
type = elm_widget_type_get(sub);
|
|
|
|
if (!strcmp(type, "conformant")) break;
|
|
|
|
for (i = 0; i < SUB_TYPE_COUNT; i++)
|
|
|
|
if (!strcmp(type, sub_type[i]))
|
|
|
|
{
|
|
|
|
top_scroller = sub;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
sub = elm_object_parent_widget_get(sub);
|
|
|
|
}
|
|
|
|
|
|
|
|
//If the scroller got changed by app, replace it.
|
|
|
|
if (top_scroller != wd->scroller)
|
|
|
|
{
|
|
|
|
if (wd->scroller) evas_object_event_callback_del(wd->scroller,
|
|
|
|
EVAS_CALLBACK_RESIZE,
|
|
|
|
_content_resize_event_cb);
|
|
|
|
wd->scroller = top_scroller;
|
|
|
|
if (wd->scroller) evas_object_event_callback_add(wd->scroller,
|
|
|
|
EVAS_CALLBACK_RESIZE,
|
|
|
|
_content_resize_event_cb,
|
|
|
|
data);
|
|
|
|
}
|
|
|
|
}
|
2011-04-26 23:33:34 -07:00
|
|
|
|
2010-06-25 02:58:14 -07:00
|
|
|
static Eina_Bool
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
_prop_change(void *data, int type __UNUSED__, void *event)
|
2010-01-26 17:48:18 -08:00
|
|
|
{
|
|
|
|
Ecore_X_Event_Window_Property *ev;
|
|
|
|
Widget_Data *wd = elm_widget_data_get(data);
|
2011-04-19 00:31:59 -07:00
|
|
|
|
2010-06-25 02:58:14 -07:00
|
|
|
if (!wd) return ECORE_CALLBACK_PASS_ON;
|
2010-01-26 17:48:18 -08:00
|
|
|
ev = event;
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
if (ev->atom == ECORE_X_ATOM_E_ILLUME_ZONE)
|
2010-01-26 17:48:18 -08:00
|
|
|
{
|
2011-04-26 23:33:34 -07:00
|
|
|
Conformant_Part_Type part_type;
|
|
|
|
|
|
|
|
part_type = (ELM_CONFORM_INDICATOR_PART |
|
2011-05-19 03:58:16 -07:00
|
|
|
ELM_CONFORM_SOFTKEY_PART |
|
|
|
|
ELM_CONFORM_VIRTUAL_KEYPAD_PART);
|
2011-04-26 23:33:34 -07:00
|
|
|
_conformant_part_sizing_eval(data, part_type);
|
|
|
|
evas_object_event_callback_add(data, EVAS_CALLBACK_RESIZE,
|
|
|
|
_conformant_move_resize_event_cb, data);
|
|
|
|
evas_object_event_callback_add(data, EVAS_CALLBACK_MOVE,
|
|
|
|
_conformant_move_resize_event_cb, data);
|
2010-01-26 17:48:18 -08:00
|
|
|
}
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
else if (ev->atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_GEOMETRY)
|
2011-04-26 23:33:34 -07:00
|
|
|
_conformant_part_sizing_eval(data, ELM_CONFORM_INDICATOR_PART);
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
else if (ev->atom == ECORE_X_ATOM_E_ILLUME_SOFTKEY_GEOMETRY)
|
2011-04-26 23:33:34 -07:00
|
|
|
_conformant_part_sizing_eval(data, ELM_CONFORM_SOFTKEY_PART);
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
else if (ev->atom == ECORE_X_ATOM_E_ILLUME_KEYBOARD_GEOMETRY)
|
2011-05-19 03:58:16 -07:00
|
|
|
_conformant_part_sizing_eval(data, ELM_CONFORM_VIRTUAL_KEYPAD_PART);
|
|
|
|
else if (ev->atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE)
|
2010-02-23 12:54:39 -08:00
|
|
|
{
|
|
|
|
Ecore_X_Window zone;
|
2010-02-18 18:33:17 -08:00
|
|
|
|
2010-02-23 12:54:39 -08:00
|
|
|
printf("Keyboard Geometry Changed\n");
|
|
|
|
zone = ecore_x_e_illume_zone_get(ev->win);
|
2011-05-19 03:58:16 -07:00
|
|
|
wd->vkb_state = ecore_x_e_virtual_keyboard_state_get(zone);
|
|
|
|
if (wd->vkb_state == ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF)
|
|
|
|
{
|
|
|
|
evas_object_size_hint_min_set(wd->virtualkeypad, -1, 0);
|
|
|
|
evas_object_size_hint_max_set(wd->virtualkeypad, -1, 0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
_update_autoscroll_objs(data);
|
2010-02-23 12:54:39 -08:00
|
|
|
}
|
2010-01-26 17:48:18 -08:00
|
|
|
|
2010-06-25 02:58:14 -07:00
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
2010-01-26 17:48:18 -08:00
|
|
|
}
|
2011-05-19 03:58:16 -07:00
|
|
|
#endif
|
2010-01-26 17:48:18 -08:00
|
|
|
|
2010-02-08 18:46:19 -08:00
|
|
|
/**
|
|
|
|
* Add a new Conformant object
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
*
|
2010-02-08 18:46:19 -08:00
|
|
|
* @param parent The parent object
|
|
|
|
* @return The new conformant object or NULL if it cannot be created
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
*
|
2010-02-08 18:46:19 -08:00
|
|
|
* @ingroup Conformant
|
|
|
|
*/
|
2010-01-08 10:00:33 -08:00
|
|
|
EAPI Evas_Object *
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
elm_conformant_add(Evas_Object *parent)
|
2010-01-08 10:00:33 -08:00
|
|
|
{
|
|
|
|
Evas_Object *obj;
|
2011-03-31 23:08:02 -07:00
|
|
|
Evas *e;
|
2010-01-08 10:00:33 -08:00
|
|
|
Widget_Data *wd;
|
|
|
|
|
2011-03-31 23:08:02 -07:00
|
|
|
ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
|
2010-03-13 19:48:22 -08:00
|
|
|
ELM_SET_WIDTYPE(widtype, "conformant");
|
2010-01-08 10:00:33 -08:00
|
|
|
elm_widget_type_set(obj, "conformant");
|
|
|
|
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);
|
2010-09-29 05:22:30 -07:00
|
|
|
elm_widget_can_focus_set(obj, EINA_FALSE);
|
2010-01-08 10:00:33 -08:00
|
|
|
|
2011-03-31 23:08:02 -07:00
|
|
|
wd->base = edje_object_add(e);
|
2010-05-11 18:03:46 -07:00
|
|
|
_elm_theme_object_set(obj, wd->base, "conformant", "base", "default");
|
2010-01-08 10:00:33 -08:00
|
|
|
elm_widget_resize_object_set(obj, wd->base);
|
|
|
|
|
2010-01-13 00:37:56 -08:00
|
|
|
#ifdef HAVE_ELEMENTARY_X
|
2011-04-14 03:48:43 -07:00
|
|
|
Evas_Object *top = elm_widget_top_get(obj);
|
2011-04-26 23:33:34 -07:00
|
|
|
Ecore_X_Window xwin = elm_win_xwindow_get(top);
|
2011-04-14 04:43:43 -07:00
|
|
|
|
2011-04-14 03:48:43 -07:00
|
|
|
if ((xwin) && (!elm_win_inlined_image_object_get(top)))
|
|
|
|
{
|
2011-04-26 23:33:34 -07:00
|
|
|
_swallow_conformant_parts(obj);
|
2011-04-14 03:48:43 -07:00
|
|
|
wd->prop_hdl = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROPERTY,
|
|
|
|
_prop_change, obj);
|
2011-05-19 03:58:16 -07:00
|
|
|
wd->vkb_state = ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF;
|
2011-04-14 03:48:43 -07:00
|
|
|
}
|
2010-02-04 22:14:50 -08:00
|
|
|
// FIXME: get kbd region prop
|
2010-02-02 05:55:55 -08:00
|
|
|
#endif
|
2010-02-18 18:33:17 -08:00
|
|
|
|
2010-02-04 01:08:02 -08:00
|
|
|
evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj);
|
2010-02-18 18:33:17 -08:00
|
|
|
|
2011-02-08 04:08:28 -08:00
|
|
|
_mirrored_set(obj, elm_widget_mirrored_get(obj));
|
2010-01-08 10:00:33 -08:00
|
|
|
_sizing_eval(obj);
|
|
|
|
return obj;
|
|
|
|
}
|
|
|
|
|
2010-02-08 18:46:19 -08:00
|
|
|
/**
|
|
|
|
* Set the content of the conformant widget
|
2010-06-16 13:58:09 -07:00
|
|
|
*
|
|
|
|
* Once the content object is set, a previously set one will be deleted.
|
|
|
|
* If you want to keep that old content object, use the
|
|
|
|
* elm_conformat_content_unset() function.
|
|
|
|
*
|
2010-02-08 18:46:19 -08:00
|
|
|
* @param obj The conformant object
|
2010-06-16 13:58:09 -07:00
|
|
|
* @return The content that was being used
|
|
|
|
*
|
2010-02-08 18:46:19 -08:00
|
|
|
* @ingroup Conformant
|
|
|
|
*/
|
2010-06-16 13:58:09 -07:00
|
|
|
EAPI void
|
|
|
|
elm_conformant_content_set(Evas_Object *obj, Evas_Object *content)
|
2010-01-08 10:00:33 -08:00
|
|
|
{
|
2010-03-08 22:15:39 -08:00
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype);
|
2010-01-08 10:00:33 -08:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2011-04-19 00:31:59 -07:00
|
|
|
|
2010-03-09 08:46:13 -08:00
|
|
|
if (!wd) return;
|
2010-06-16 13:58:09 -07:00
|
|
|
if (wd->content == content) return;
|
|
|
|
if (wd->content) evas_object_del(wd->content);
|
2010-01-08 10:00:33 -08:00
|
|
|
wd->content = content;
|
2010-06-16 13:58:09 -07:00
|
|
|
if (content)
|
2010-01-08 10:00:33 -08:00
|
|
|
{
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
elm_widget_sub_object_add(obj, content);
|
2011-04-19 00:31:59 -07:00
|
|
|
evas_object_event_callback_add(content,
|
|
|
|
EVAS_CALLBACK_CHANGED_SIZE_HINTS,
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
_changed_size_hints, obj);
|
|
|
|
edje_object_part_swallow(wd->base, "elm.swallow.content", content);
|
2010-01-08 10:00:33 -08:00
|
|
|
}
|
2010-06-16 13:58:09 -07:00
|
|
|
_sizing_eval(obj);
|
|
|
|
}
|
|
|
|
|
2010-10-14 11:54:42 -07:00
|
|
|
/**
|
|
|
|
* Get the content of the conformant widget
|
|
|
|
*
|
|
|
|
* Return the content object which is set for this widget;
|
|
|
|
*
|
|
|
|
* @param obj The conformant object
|
|
|
|
* @return The content that is being used
|
|
|
|
*
|
|
|
|
* @ingroup Conformant
|
|
|
|
*/
|
|
|
|
EAPI Evas_Object *
|
|
|
|
elm_conformant_content_get(const Evas_Object *obj)
|
|
|
|
{
|
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2011-04-19 00:31:59 -07:00
|
|
|
|
2010-10-14 11:54:42 -07:00
|
|
|
if (!wd) return NULL;
|
|
|
|
return wd->content;
|
|
|
|
}
|
|
|
|
|
2010-06-16 13:58:09 -07:00
|
|
|
/**
|
|
|
|
* Unset the content of the conformant widget
|
|
|
|
*
|
|
|
|
* Unparent and return the content object which was set for this widget;
|
|
|
|
*
|
|
|
|
* @param obj The conformant object
|
|
|
|
* @return The content that was being used
|
|
|
|
*
|
|
|
|
* @ingroup Conformant
|
|
|
|
*/
|
|
|
|
EAPI Evas_Object *
|
|
|
|
elm_conformant_content_unset(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
Evas_Object *content;
|
2011-04-19 00:31:59 -07:00
|
|
|
|
2010-06-16 13:58:09 -07:00
|
|
|
if (!wd) return NULL;
|
|
|
|
if (!wd->content) return NULL;
|
|
|
|
content = wd->content;
|
|
|
|
elm_widget_sub_object_del(obj, wd->content);
|
|
|
|
edje_object_part_unswallow(wd->base, wd->content);
|
|
|
|
wd->content = NULL;
|
|
|
|
return content;
|
2010-01-08 10:00:33 -08:00
|
|
|
}
|
2011-05-19 03:58:16 -07:00
|
|
|
/**
|
|
|
|
* Returns the Evas_Object that represents the content area.
|
|
|
|
*
|
|
|
|
* @param obj The conformant object.
|
|
|
|
* @return The content area of the widget.
|
|
|
|
*
|
|
|
|
* @ingroup Conformant
|
|
|
|
*/
|
|
|
|
EAPI Evas_Object *
|
|
|
|
elm_conformant_content_area_get(const Evas_Object *obj)
|
|
|
|
{
|
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
|
|
|
|
if (!wd) return NULL;
|
|
|
|
/*Finger waggle warning*/
|
|
|
|
_elm_dangerous_call_check(__FUNCTION__);
|
|
|
|
return (Evas_Object *)edje_object_part_object_get(wd->base, "elm.swallow.content");
|
|
|
|
}
|
|
|
|
|