2008-09-29 23:58:56 -07:00
|
|
|
#include <Elementary.h>
|
|
|
|
#include "elm_priv.h"
|
|
|
|
|
2008-10-06 18:23:49 -07:00
|
|
|
typedef struct _Elm_Win Elm_Win;
|
2008-09-29 23:58:56 -07:00
|
|
|
|
2008-10-06 18:23:49 -07:00
|
|
|
struct _Elm_Win
|
2008-09-29 23:58:56 -07:00
|
|
|
{
|
2009-11-14 17:51:39 -08:00
|
|
|
Ecore_Evas *ee;
|
|
|
|
Evas *evas;
|
|
|
|
Evas_Object *parent, *win_obj;
|
|
|
|
Eina_List *subobjs;
|
|
|
|
Ecore_X_Window xwin;
|
|
|
|
Ecore_Job *deferred_resize_job;
|
|
|
|
Ecore_Job *deferred_child_eval_job;
|
|
|
|
|
|
|
|
Elm_Win_Type type;
|
2008-11-18 02:11:57 -08:00
|
|
|
Elm_Win_Keyboard_Mode kbdmode;
|
2009-11-14 17:51:39 -08:00
|
|
|
Eina_Bool autodel : 1;
|
|
|
|
int *autodel_clear, rot;
|
2008-09-29 23:58:56 -07:00
|
|
|
};
|
|
|
|
|
2008-10-06 18:23:49 -07:00
|
|
|
static void _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
2009-10-26 01:27:08 -07:00
|
|
|
static void _elm_win_obj_intercept_show(void *data, Evas_Object *obj);
|
2008-12-19 06:32:59 -08:00
|
|
|
static void _elm_win_resize(Ecore_Evas *ee);
|
2008-10-06 18:23:49 -07:00
|
|
|
static void _elm_win_delete_request(Ecore_Evas *ee);
|
|
|
|
static void _elm_win_resize_job(void *data);
|
2009-07-06 23:46:51 -07:00
|
|
|
#ifdef HAVE_ELEMENTARY_X
|
2008-10-06 18:23:49 -07:00
|
|
|
static void _elm_win_xwin_update(Elm_Win *win);
|
2008-12-09 22:33:24 -08:00
|
|
|
#endif
|
2008-10-06 18:23:49 -07:00
|
|
|
static void _elm_win_eval_subobjs(Evas_Object *obj);
|
|
|
|
static void _elm_win_subobj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
|
|
|
static void _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
|
|
|
|
2008-10-22 07:11:59 -07:00
|
|
|
static Eina_List *_elm_win_list = NULL;
|
2008-10-06 18:23:49 -07:00
|
|
|
|
2008-09-29 23:58:56 -07:00
|
|
|
static void
|
2008-10-06 18:23:49 -07:00
|
|
|
_elm_win_resize(Ecore_Evas *ee)
|
2008-09-29 23:58:56 -07:00
|
|
|
{
|
2009-08-09 15:23:46 -07:00
|
|
|
Evas_Object *obj = ecore_evas_object_associate_get(ee);
|
2009-10-26 01:27:08 -07:00
|
|
|
if (strcmp(elm_widget_type_get(obj), "win")) return;
|
2009-11-14 17:51:39 -08:00
|
|
|
Elm_Win *win;
|
2009-08-09 15:23:46 -07:00
|
|
|
win = elm_widget_data_get(obj);
|
2008-10-24 19:11:06 -07:00
|
|
|
if (!win) return;
|
2008-10-06 18:23:49 -07:00
|
|
|
if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
|
|
|
|
win->deferred_resize_job = ecore_job_add(_elm_win_resize_job, win);
|
2008-09-29 23:58:56 -07:00
|
|
|
}
|
|
|
|
|
2009-04-04 09:58:28 -07:00
|
|
|
static void
|
|
|
|
_elm_win_focus_in(Ecore_Evas *ee)
|
|
|
|
{
|
2009-08-09 15:23:46 -07:00
|
|
|
Evas_Object *obj = ecore_evas_object_associate_get(ee);
|
2009-10-26 01:27:08 -07:00
|
|
|
if (strcmp(elm_widget_type_get(obj), "win")) return;
|
2009-11-14 17:51:39 -08:00
|
|
|
Elm_Win *win;
|
2009-08-09 15:23:46 -07:00
|
|
|
win = elm_widget_data_get(obj);
|
2009-04-04 09:58:28 -07:00
|
|
|
if (!win) return;
|
2009-11-14 17:51:39 -08:00
|
|
|
/*NB: Why two different "focus signals" here ??? */
|
2009-10-14 01:41:36 -07:00
|
|
|
evas_object_smart_callback_call(win->win_obj, "focus-in", NULL); // FIXME: remove me
|
|
|
|
evas_object_smart_callback_call(win->win_obj, "focus,in", NULL);
|
2009-04-04 09:58:28 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_elm_win_focus_out(Ecore_Evas *ee)
|
|
|
|
{
|
2009-08-09 15:23:46 -07:00
|
|
|
Evas_Object *obj = ecore_evas_object_associate_get(ee);
|
2009-10-26 01:27:08 -07:00
|
|
|
if (strcmp(elm_widget_type_get(obj), "win")) return;
|
2009-11-14 17:51:39 -08:00
|
|
|
Elm_Win *win;
|
2009-08-09 15:23:46 -07:00
|
|
|
win = elm_widget_data_get(obj);
|
2009-04-04 09:58:28 -07:00
|
|
|
if (!win) return;
|
2009-10-14 01:41:36 -07:00
|
|
|
evas_object_smart_callback_call(win->win_obj, "focus-out", NULL); // FIXME: remove me
|
|
|
|
evas_object_smart_callback_call(win->win_obj, "focus,out", NULL);
|
2009-04-04 09:58:28 -07:00
|
|
|
}
|
|
|
|
|
2008-10-24 19:11:06 -07:00
|
|
|
static void
|
|
|
|
_deferred_ecore_evas_free(void *data)
|
|
|
|
{
|
|
|
|
ecore_evas_free(data);
|
|
|
|
}
|
|
|
|
|
2008-09-29 23:58:56 -07:00
|
|
|
static void
|
2008-10-06 18:23:49 -07:00
|
|
|
_elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
2008-09-29 23:58:56 -07:00
|
|
|
{
|
2008-10-06 18:23:49 -07:00
|
|
|
Elm_Win *win = data;
|
2009-11-13 14:18:01 -08:00
|
|
|
Evas_Object *child;
|
2008-10-06 18:23:49 -07:00
|
|
|
|
2008-12-19 06:32:59 -08:00
|
|
|
if (win->autodel_clear) *(win->autodel_clear) = -1;
|
2008-10-22 07:11:59 -07:00
|
|
|
_elm_win_list = eina_list_remove(_elm_win_list, win->win_obj);
|
2008-10-06 18:23:49 -07:00
|
|
|
while (win->subobjs) elm_win_resize_object_del(obj, win->subobjs->data);
|
2008-10-24 19:11:06 -07:00
|
|
|
ecore_evas_callback_delete_request_set(win->ee, NULL);
|
|
|
|
ecore_evas_callback_resize_set(win->ee, NULL);
|
2008-10-06 18:23:49 -07:00
|
|
|
if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
|
|
|
|
if (win->deferred_child_eval_job) ecore_job_del(win->deferred_child_eval_job);
|
2009-11-13 14:18:01 -08:00
|
|
|
while (((child = evas_object_bottom_get(win->evas)) != NULL) &&
|
|
|
|
(child != obj))
|
2009-02-14 18:53:56 -08:00
|
|
|
{
|
2009-11-13 14:18:01 -08:00
|
|
|
evas_object_del(child);
|
2009-02-14 18:53:56 -08:00
|
|
|
}
|
2009-11-13 14:18:01 -08:00
|
|
|
while (((child = evas_object_top_get(win->evas)) != NULL) &&
|
|
|
|
(child != obj))
|
2009-02-14 18:53:56 -08:00
|
|
|
{
|
2009-11-13 14:18:01 -08:00
|
|
|
evas_object_del(child);
|
2009-02-14 18:53:56 -08:00
|
|
|
}
|
2009-04-17 03:01:45 -07:00
|
|
|
evas_image_cache_flush(win->evas);
|
|
|
|
evas_font_cache_flush(win->evas);
|
2009-11-14 17:51:39 -08:00
|
|
|
// FIXME: Why are we flushing edje on every window destroy ??
|
2009-04-17 03:01:45 -07:00
|
|
|
edje_file_cache_flush();
|
|
|
|
edje_collection_cache_flush();
|
2008-12-19 06:32:59 -08:00
|
|
|
// FIXME: we are in the del handler for the object and delete the canvas
|
2008-10-24 19:11:06 -07:00
|
|
|
// that lives under it from the handler... nasty. deferring doesnt help either
|
|
|
|
ecore_job_add(_deferred_ecore_evas_free, win->ee);
|
|
|
|
// ecore_evas_free(win->ee);
|
2008-10-06 18:23:49 -07:00
|
|
|
free(win);
|
2008-09-29 23:58:56 -07:00
|
|
|
}
|
2008-10-06 18:23:49 -07:00
|
|
|
|
2009-10-07 22:26:58 -07:00
|
|
|
static void
|
2009-10-26 01:27:08 -07:00
|
|
|
_elm_win_obj_intercept_show(void *data, Evas_Object *obj)
|
2009-10-07 22:26:58 -07:00
|
|
|
{
|
|
|
|
// this is called to make sure all smart containers have calculated their
|
|
|
|
// sizes BEFORE we show the window to make sure it initially appears at
|
|
|
|
// our desired size (ie min size is known first)
|
2009-10-26 01:27:08 -07:00
|
|
|
evas_smart_objects_calculate(evas_object_evas_get(obj));
|
|
|
|
evas_object_show(obj);
|
2009-10-07 22:26:58 -07:00
|
|
|
}
|
|
|
|
|
2008-09-29 23:58:56 -07:00
|
|
|
static void
|
|
|
|
_elm_win_delete_request(Ecore_Evas *ee)
|
|
|
|
{
|
2009-08-09 15:23:46 -07:00
|
|
|
Evas_Object *obj = ecore_evas_object_associate_get(ee);
|
2009-10-26 01:27:08 -07:00
|
|
|
if (strcmp(elm_widget_type_get(obj), "win")) return;
|
2009-11-14 17:51:39 -08:00
|
|
|
Elm_Win *win;
|
2009-08-09 15:23:46 -07:00
|
|
|
win = elm_widget_data_get(obj);
|
2008-10-24 19:11:06 -07:00
|
|
|
if (!win) return;
|
2008-12-19 06:32:59 -08:00
|
|
|
int autodel = win->autodel;
|
|
|
|
win->autodel_clear = &autodel;
|
2009-10-14 01:41:36 -07:00
|
|
|
evas_object_smart_callback_call(win->win_obj, "delete-request", NULL); // FIXME: remove me
|
|
|
|
evas_object_smart_callback_call(win->win_obj, "delete,request", NULL);
|
2008-12-19 06:32:59 -08:00
|
|
|
// FIXME: if above callback deletes - then the below will be invalid
|
2009-06-17 08:35:19 -07:00
|
|
|
if (autodel) evas_object_del(win->win_obj);
|
|
|
|
else win->autodel_clear = NULL;
|
2008-09-29 23:58:56 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2008-10-06 18:23:49 -07:00
|
|
|
_elm_win_resize_job(void *data)
|
2008-09-29 23:58:56 -07:00
|
|
|
{
|
2008-10-06 18:23:49 -07:00
|
|
|
Elm_Win *win = data;
|
2009-02-25 11:50:45 -08:00
|
|
|
const Eina_List *l;
|
|
|
|
Evas_Object *obj;
|
2008-09-29 23:58:56 -07:00
|
|
|
int w, h;
|
2009-07-06 23:46:51 -07:00
|
|
|
|
2008-09-29 23:58:56 -07:00
|
|
|
win->deferred_resize_job = NULL;
|
|
|
|
ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
|
2008-10-06 18:23:49 -07:00
|
|
|
evas_object_resize(win->win_obj, w, h);
|
2009-02-25 11:50:45 -08:00
|
|
|
EINA_LIST_FOREACH(win->subobjs, l, obj)
|
2008-09-29 23:58:56 -07:00
|
|
|
{
|
2009-02-25 11:50:45 -08:00
|
|
|
evas_object_move(obj, 0, 0);
|
|
|
|
evas_object_resize(obj, w, h);
|
2008-09-29 23:58:56 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2008-11-18 22:23:08 -08:00
|
|
|
_elm_win_xwindow_get(Elm_Win *win)
|
2008-09-29 23:58:56 -07:00
|
|
|
{
|
2008-10-06 18:23:49 -07:00
|
|
|
win->xwin = 0;
|
|
|
|
switch (_elm_config->engine)
|
|
|
|
{
|
|
|
|
case ELM_SOFTWARE_X11:
|
|
|
|
if (win->ee) win->xwin = ecore_evas_software_x11_window_get(win->ee);
|
|
|
|
break;
|
|
|
|
case ELM_SOFTWARE_FB:
|
2008-12-18 16:34:56 -08:00
|
|
|
case ELM_SOFTWARE_16_WINCE:
|
2008-10-06 18:23:49 -07:00
|
|
|
break;
|
|
|
|
case ELM_SOFTWARE_16_X11:
|
|
|
|
if (win->ee) win->xwin = ecore_evas_software_x11_16_window_get(win->ee);
|
|
|
|
break;
|
|
|
|
case ELM_XRENDER_X11:
|
|
|
|
if (win->ee) win->xwin = ecore_evas_xrender_x11_window_get(win->ee);
|
|
|
|
break;
|
|
|
|
case ELM_OPENGL_X11:
|
|
|
|
if (win->ee) win->xwin = ecore_evas_gl_x11_window_get(win->ee);
|
|
|
|
break;
|
2009-01-22 13:43:07 -08:00
|
|
|
case ELM_SOFTWARE_WIN32:
|
2009-04-03 14:52:01 -07:00
|
|
|
if (win->ee) win->xwin = (long)ecore_evas_win32_window_get(win->ee);
|
2009-01-22 13:43:07 -08:00
|
|
|
break;
|
2008-10-06 18:23:49 -07:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2008-11-18 22:23:08 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_elm_win_xwin_update(Elm_Win *win)
|
|
|
|
{
|
2009-07-06 23:46:51 -07:00
|
|
|
#ifdef HAVE_ELEMENTARY_X
|
2008-11-18 22:23:08 -08:00
|
|
|
_elm_win_xwindow_get(win);
|
2008-10-06 18:23:49 -07:00
|
|
|
if (win->parent)
|
|
|
|
{
|
|
|
|
Elm_Win *win2;
|
2009-07-06 23:46:51 -07:00
|
|
|
|
2008-12-30 08:19:46 -08:00
|
|
|
win2 = elm_widget_data_get(win->parent);
|
2008-10-06 18:23:49 -07:00
|
|
|
if (win2)
|
|
|
|
{
|
|
|
|
if (win->xwin)
|
|
|
|
ecore_x_icccm_transient_for_set(win->xwin, win2->xwin);
|
|
|
|
}
|
|
|
|
}
|
2009-04-14 19:08:07 -07:00
|
|
|
|
|
|
|
if (!win->xwin) return; /* nothing more to do */
|
|
|
|
|
|
|
|
switch (win->type)
|
2008-10-06 18:23:49 -07:00
|
|
|
{
|
2009-04-14 19:08:07 -07:00
|
|
|
case ELM_WIN_BASIC:
|
|
|
|
ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NORMAL);
|
|
|
|
break;
|
|
|
|
case ELM_WIN_DIALOG_BASIC:
|
|
|
|
ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DIALOG);
|
|
|
|
break;
|
|
|
|
case ELM_WIN_DESKTOP:
|
|
|
|
ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DESKTOP);
|
|
|
|
break;
|
|
|
|
case ELM_WIN_DOCK:
|
|
|
|
ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DOCK);
|
|
|
|
break;
|
|
|
|
case ELM_WIN_TOOLBAR:
|
|
|
|
ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLBAR);
|
|
|
|
break;
|
|
|
|
case ELM_WIN_MENU:
|
|
|
|
ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_MENU);
|
|
|
|
break;
|
|
|
|
case ELM_WIN_UTILITY:
|
|
|
|
ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_UTILITY);
|
|
|
|
break;
|
|
|
|
case ELM_WIN_SPLASH:
|
|
|
|
ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_SPLASH);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2008-10-06 18:23:49 -07:00
|
|
|
}
|
2009-04-14 19:08:07 -07:00
|
|
|
ecore_x_e_virtual_keyboard_state_set
|
2008-11-18 02:11:57 -08:00
|
|
|
(win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
|
2008-12-09 22:33:24 -08:00
|
|
|
#endif
|
2008-09-29 23:58:56 -07:00
|
|
|
}
|
|
|
|
|
2008-10-06 18:23:49 -07:00
|
|
|
static void
|
|
|
|
_elm_win_eval_subobjs(Evas_Object *obj)
|
|
|
|
{
|
2009-02-25 11:50:45 -08:00
|
|
|
const Eina_List *l;
|
|
|
|
const Evas_Object *child;
|
2008-12-30 08:19:46 -08:00
|
|
|
Elm_Win *win = elm_widget_data_get(obj);
|
2008-10-06 18:23:49 -07:00
|
|
|
Evas_Coord w, h, minw = -1, minh = -1, maxw = -1, maxh = -1;
|
|
|
|
int xx = 1, xy = 1;
|
|
|
|
double wx, wy;
|
|
|
|
|
2009-02-25 11:50:45 -08:00
|
|
|
EINA_LIST_FOREACH(win->subobjs, l, child)
|
2008-10-06 18:23:49 -07:00
|
|
|
{
|
2009-02-25 11:50:45 -08:00
|
|
|
evas_object_size_hint_weight_get(child, &wx, &wy);
|
2008-10-06 18:23:49 -07:00
|
|
|
if (wx == 0.0) xx = 0;
|
|
|
|
if (wy == 0.0) xy = 0;
|
2009-07-06 23:46:51 -07:00
|
|
|
|
2009-02-25 11:50:45 -08:00
|
|
|
evas_object_size_hint_min_get(child, &w, &h);
|
2008-10-06 18:23:49 -07:00
|
|
|
if (w < 1) w = -1;
|
|
|
|
if (h < 1) h = -1;
|
|
|
|
if (w > minw) minw = w;
|
|
|
|
if (h > minh) minh = h;
|
2009-07-06 23:46:51 -07:00
|
|
|
|
2009-02-25 11:50:45 -08:00
|
|
|
evas_object_size_hint_max_get(child, &w, &h);
|
2008-10-06 18:23:49 -07:00
|
|
|
if (w < 1) w = -1;
|
|
|
|
if (h < 1) h = -1;
|
|
|
|
if (maxw == -1) maxw = w;
|
2009-03-12 22:50:38 -07:00
|
|
|
else if ((w > 0) && (w < maxw)) maxw = w;
|
2008-10-06 18:23:49 -07:00
|
|
|
if (maxh == -1) maxh = h;
|
2009-03-12 22:50:38 -07:00
|
|
|
else if ((h > 0) && (h < maxh)) maxh = h;
|
2008-10-06 18:23:49 -07:00
|
|
|
}
|
|
|
|
if ((maxw >= 0) && (maxw < minw)) maxw = minw;
|
|
|
|
if ((maxh >= 0) && (maxh < minh)) maxh = minh;
|
|
|
|
if (!xx) maxw = minw;
|
|
|
|
else maxw = 32767;
|
|
|
|
if (!xy) maxh = minh;
|
|
|
|
else maxh = 32767;
|
|
|
|
evas_object_size_hint_min_set(obj, minw, minh);
|
|
|
|
evas_object_size_hint_max_set(obj, maxw, maxh);
|
|
|
|
evas_object_geometry_get(obj, NULL, NULL, &w, &h);
|
|
|
|
if (w < minw) w = minw;
|
|
|
|
if (h < minh) h = minh;
|
|
|
|
if ((maxw >= 0) && (w > maxw)) w = maxw;
|
|
|
|
if ((maxh >= 0) && (h > maxh)) h = maxh;
|
|
|
|
evas_object_resize(obj, w, h);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_elm_win_subobj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
|
|
|
{
|
|
|
|
elm_win_resize_object_del(data, obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_elm_win_subobj_callback_changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
|
|
|
{
|
|
|
|
_elm_win_eval_subobjs(data);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_elm_win_shutdown(void)
|
|
|
|
{
|
2009-11-14 17:51:39 -08:00
|
|
|
while (_elm_win_list)
|
|
|
|
evas_object_del(_elm_win_list->data);
|
2008-10-06 18:23:49 -07:00
|
|
|
}
|
|
|
|
|
2008-11-14 22:09:04 -08:00
|
|
|
void
|
|
|
|
_elm_win_rescale(void)
|
|
|
|
{
|
2009-02-25 11:50:45 -08:00
|
|
|
const Eina_List *l;
|
|
|
|
Evas_Object *obj;
|
2009-11-14 17:51:39 -08:00
|
|
|
|
2009-02-25 11:50:45 -08:00
|
|
|
EINA_LIST_FOREACH(_elm_win_list, l, obj)
|
|
|
|
elm_widget_theme(obj);
|
2008-11-14 22:09:04 -08:00
|
|
|
}
|
|
|
|
|
2008-10-06 18:23:49 -07:00
|
|
|
EAPI Evas_Object *
|
|
|
|
elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
|
2008-09-29 23:58:56 -07:00
|
|
|
{
|
|
|
|
Elm_Win *win;
|
2009-02-25 11:50:45 -08:00
|
|
|
const Eina_List *l;
|
|
|
|
const char *fontpath;
|
2009-07-06 23:46:51 -07:00
|
|
|
|
2008-09-29 23:58:56 -07:00
|
|
|
win = ELM_NEW(Elm_Win);
|
|
|
|
switch (_elm_config->engine)
|
|
|
|
{
|
|
|
|
case ELM_SOFTWARE_X11:
|
|
|
|
win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
|
|
|
|
break;
|
|
|
|
case ELM_SOFTWARE_FB:
|
|
|
|
win->ee = ecore_evas_fb_new(NULL, 0, 1, 1);
|
|
|
|
break;
|
|
|
|
case ELM_SOFTWARE_16_X11:
|
|
|
|
win->ee = ecore_evas_software_x11_16_new(NULL, 0, 0, 0, 1, 1);
|
|
|
|
break;
|
|
|
|
case ELM_XRENDER_X11:
|
|
|
|
win->ee = ecore_evas_xrender_x11_new(NULL, 0, 0, 0, 1, 1);
|
|
|
|
break;
|
|
|
|
case ELM_OPENGL_X11:
|
|
|
|
win->ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 1, 1);
|
|
|
|
break;
|
2009-01-22 13:43:07 -08:00
|
|
|
case ELM_SOFTWARE_WIN32:
|
2009-06-08 00:07:21 -07:00
|
|
|
win->ee = ecore_evas_software_gdi_new(NULL, 0, 0, 1, 1);
|
2009-01-22 13:43:07 -08:00
|
|
|
break;
|
2008-12-18 16:34:56 -08:00
|
|
|
case ELM_SOFTWARE_16_WINCE:
|
2009-01-10 06:48:30 -08:00
|
|
|
win->ee = ecore_evas_software_wince_gdi_new(NULL, 0, 0, 1, 1);
|
2008-12-18 16:34:56 -08:00
|
|
|
break;
|
2008-09-29 23:58:56 -07:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (!win->ee)
|
|
|
|
{
|
2009-09-11 07:21:58 -07:00
|
|
|
ERR("Cannot create window.");
|
2008-10-06 18:23:49 -07:00
|
|
|
free(win);
|
2008-09-29 23:58:56 -07:00
|
|
|
return NULL;
|
|
|
|
}
|
2008-11-18 22:23:08 -08:00
|
|
|
_elm_win_xwindow_get(win);
|
2009-11-14 17:51:39 -08:00
|
|
|
if ((_elm_config->bgpixmap) && (!_elm_config->compositing))
|
2008-10-16 07:19:37 -07:00
|
|
|
ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_EXPOSE);
|
|
|
|
// bg pixmap done by x - has other issues like can be redrawn by x before it
|
2009-07-06 23:46:51 -07:00
|
|
|
// is filled/ready by app
|
2008-10-16 07:19:37 -07:00
|
|
|
// ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_BUILT_IN);
|
2009-07-06 23:46:51 -07:00
|
|
|
|
2008-10-06 18:23:49 -07:00
|
|
|
win->type = type;
|
|
|
|
win->parent = parent;
|
2009-07-06 23:46:51 -07:00
|
|
|
|
2008-09-29 23:58:56 -07:00
|
|
|
win->evas = ecore_evas_get(win->ee);
|
2008-10-06 18:23:49 -07:00
|
|
|
win->win_obj = elm_widget_add(win->evas);
|
2009-05-13 05:21:52 -07:00
|
|
|
elm_widget_type_set(win->win_obj, "win");
|
2008-12-30 08:19:46 -08:00
|
|
|
elm_widget_data_set(win->win_obj, win);
|
2008-10-06 18:23:49 -07:00
|
|
|
evas_object_color_set(win->win_obj, 0, 0, 0, 0);
|
|
|
|
evas_object_move(win->win_obj, 0, 0);
|
|
|
|
evas_object_resize(win->win_obj, 1, 1);
|
|
|
|
evas_object_layer_set(win->win_obj, 50);
|
|
|
|
evas_object_pass_events_set(win->win_obj, 1);
|
|
|
|
|
2009-10-26 01:27:08 -07:00
|
|
|
evas_object_intercept_show_callback_add(win->win_obj,
|
|
|
|
_elm_win_obj_intercept_show, win);
|
2008-12-19 06:32:59 -08:00
|
|
|
ecore_evas_object_associate(win->ee, win->win_obj,
|
2009-07-06 23:46:51 -07:00
|
|
|
ECORE_EVAS_OBJECT_ASSOCIATE_BASE |
|
|
|
|
ECORE_EVAS_OBJECT_ASSOCIATE_STACK |
|
|
|
|
ECORE_EVAS_OBJECT_ASSOCIATE_LAYER);
|
2008-12-19 06:32:59 -08:00
|
|
|
evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_DEL,
|
2009-07-06 23:46:51 -07:00
|
|
|
_elm_win_obj_callback_del, win);
|
|
|
|
|
2008-10-06 18:23:49 -07:00
|
|
|
ecore_evas_name_class_set(win->ee, name, _elm_appname);
|
2008-09-29 23:58:56 -07:00
|
|
|
ecore_evas_callback_delete_request_set(win->ee, _elm_win_delete_request);
|
|
|
|
ecore_evas_callback_resize_set(win->ee, _elm_win_resize);
|
2009-04-04 09:58:28 -07:00
|
|
|
ecore_evas_callback_focus_in_set(win->ee, _elm_win_focus_in);
|
|
|
|
ecore_evas_callback_focus_out_set(win->ee, _elm_win_focus_out);
|
2009-11-14 17:51:39 -08:00
|
|
|
evas_image_cache_set(win->evas, (_elm_config->image_cache * 1024));
|
|
|
|
evas_font_cache_set(win->evas, (_elm_config->font_cache * 1024));
|
2009-02-25 11:50:45 -08:00
|
|
|
EINA_LIST_FOREACH(_elm_config->font_dirs, l, fontpath)
|
|
|
|
evas_font_path_append(win->evas, fontpath);
|
2009-02-03 02:27:52 -08:00
|
|
|
if (_elm_config->font_hinting == 0)
|
|
|
|
evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_NONE);
|
|
|
|
else if (_elm_config->font_hinting == 1)
|
|
|
|
evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_AUTO);
|
|
|
|
else if (_elm_config->font_hinting == 2)
|
|
|
|
evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_BYTECODE);
|
2008-09-29 23:58:56 -07:00
|
|
|
|
2008-10-06 18:23:49 -07:00
|
|
|
_elm_win_xwin_update(win);
|
|
|
|
|
2008-10-22 07:11:59 -07:00
|
|
|
_elm_win_list = eina_list_append(_elm_win_list, win->win_obj);
|
2009-07-06 23:46:51 -07:00
|
|
|
|
2008-12-09 22:33:24 -08:00
|
|
|
switch (_elm_config->engine)
|
|
|
|
{
|
2008-12-18 16:34:56 -08:00
|
|
|
case ELM_SOFTWARE_16_WINCE:
|
2008-12-09 22:33:24 -08:00
|
|
|
case ELM_SOFTWARE_FB:
|
2009-07-06 23:46:51 -07:00
|
|
|
ecore_evas_fullscreen_set(win->ee, 1);
|
2008-12-09 22:33:24 -08:00
|
|
|
break;
|
|
|
|
case ELM_SOFTWARE_X11:
|
|
|
|
case ELM_SOFTWARE_16_X11:
|
|
|
|
case ELM_XRENDER_X11:
|
|
|
|
case ELM_OPENGL_X11:
|
2009-01-22 13:43:07 -08:00
|
|
|
case ELM_SOFTWARE_WIN32:
|
2008-12-09 22:33:24 -08:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2008-10-06 18:23:49 -07:00
|
|
|
return win->win_obj;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj)
|
|
|
|
{
|
2008-12-30 08:19:46 -08:00
|
|
|
Evas_Coord w, h;
|
2009-08-09 15:23:46 -07:00
|
|
|
Elm_Win *win;
|
2009-10-26 01:27:08 -07:00
|
|
|
if (strcmp(elm_widget_type_get(obj), "win")) return;
|
2009-08-09 15:23:46 -07:00
|
|
|
win = elm_widget_data_get(obj);
|
2008-10-06 18:23:49 -07:00
|
|
|
if (!win) return;
|
2008-10-22 07:11:59 -07:00
|
|
|
win->subobjs = eina_list_append(win->subobjs, subobj);
|
2008-10-06 18:23:49 -07:00
|
|
|
elm_widget_sub_object_add(obj, subobj);
|
2009-11-14 17:51:39 -08:00
|
|
|
evas_object_event_callback_add(subobj, EVAS_CALLBACK_DEL,
|
|
|
|
_elm_win_subobj_callback_del, obj);
|
|
|
|
evas_object_event_callback_add(subobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
|
|
|
|
_elm_win_subobj_callback_changed_size_hints,
|
|
|
|
obj);
|
2008-12-30 08:19:46 -08:00
|
|
|
ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
|
|
|
|
evas_object_move(subobj, 0, 0);
|
|
|
|
evas_object_resize(subobj, w, h);
|
2008-10-06 18:23:49 -07:00
|
|
|
_elm_win_eval_subobjs(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_win_resize_object_del(Evas_Object *obj, Evas_Object *subobj)
|
|
|
|
{
|
2009-08-09 15:23:46 -07:00
|
|
|
Elm_Win *win;
|
2009-10-26 01:27:08 -07:00
|
|
|
if (strcmp(elm_widget_type_get(obj), "win")) return;
|
2009-08-09 15:23:46 -07:00
|
|
|
win = elm_widget_data_get(obj);
|
2008-10-06 18:23:49 -07:00
|
|
|
if (!win) return;
|
2009-11-14 17:51:39 -08:00
|
|
|
evas_object_event_callback_del_full(subobj,
|
|
|
|
EVAS_CALLBACK_CHANGED_SIZE_HINTS,
|
|
|
|
_elm_win_subobj_callback_changed_size_hints,
|
|
|
|
obj);
|
|
|
|
evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
|
|
|
|
_elm_win_subobj_callback_del, obj);
|
2008-10-22 07:11:59 -07:00
|
|
|
win->subobjs = eina_list_remove(win->subobjs, subobj);
|
2008-10-06 18:23:49 -07:00
|
|
|
elm_widget_sub_object_del(obj, subobj);
|
|
|
|
_elm_win_eval_subobjs(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_win_title_set(Evas_Object *obj, const char *title)
|
|
|
|
{
|
2009-08-09 15:23:46 -07:00
|
|
|
Elm_Win *win;
|
2009-10-26 01:27:08 -07:00
|
|
|
if (strcmp(elm_widget_type_get(obj), "win")) return;
|
2009-08-09 15:23:46 -07:00
|
|
|
win = elm_widget_data_get(obj);
|
2008-10-06 18:23:49 -07:00
|
|
|
if (!win) return;
|
|
|
|
ecore_evas_title_set(win->ee, title);
|
|
|
|
}
|
2009-07-06 23:46:51 -07:00
|
|
|
|
2008-10-06 18:23:49 -07:00
|
|
|
EAPI void
|
2009-06-17 08:35:19 -07:00
|
|
|
elm_win_autodel_set(Evas_Object *obj, Eina_Bool autodel)
|
2008-10-06 18:23:49 -07:00
|
|
|
{
|
2009-08-09 15:23:46 -07:00
|
|
|
Elm_Win *win;
|
2009-10-26 01:27:08 -07:00
|
|
|
if (strcmp(elm_widget_type_get(obj), "win")) return;
|
2009-08-09 15:23:46 -07:00
|
|
|
win = elm_widget_data_get(obj);
|
2008-10-06 18:23:49 -07:00
|
|
|
if (!win) return;
|
|
|
|
win->autodel = autodel;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_win_activate(Evas_Object *obj)
|
|
|
|
{
|
2009-08-09 15:23:46 -07:00
|
|
|
Elm_Win *win;
|
2009-10-26 01:27:08 -07:00
|
|
|
if (strcmp(elm_widget_type_get(obj), "win")) return;
|
2009-08-09 15:23:46 -07:00
|
|
|
win = elm_widget_data_get(obj);
|
2008-10-06 18:23:49 -07:00
|
|
|
if (!win) return;
|
|
|
|
ecore_evas_activate(win->ee);
|
|
|
|
}
|
|
|
|
|
2009-04-03 14:52:01 -07:00
|
|
|
EAPI void
|
|
|
|
elm_win_lower(Evas_Object *obj)
|
|
|
|
{
|
2009-08-09 15:23:46 -07:00
|
|
|
Elm_Win *win;
|
2009-10-26 01:27:08 -07:00
|
|
|
if (strcmp(elm_widget_type_get(obj), "win")) return;
|
2009-08-09 15:23:46 -07:00
|
|
|
win = elm_widget_data_get(obj);
|
2009-04-03 14:52:01 -07:00
|
|
|
if (!win) return;
|
|
|
|
ecore_evas_lower(win->ee);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_win_raise(Evas_Object *obj)
|
|
|
|
{
|
2009-08-09 15:23:46 -07:00
|
|
|
Elm_Win *win;
|
2009-10-26 01:27:08 -07:00
|
|
|
if (strcmp(elm_widget_type_get(obj), "win")) return;
|
2009-08-09 15:23:46 -07:00
|
|
|
win = elm_widget_data_get(obj);
|
2009-04-03 14:52:01 -07:00
|
|
|
if (!win) return;
|
|
|
|
ecore_evas_raise(win->ee);
|
|
|
|
}
|
|
|
|
|
2008-10-06 18:23:49 -07:00
|
|
|
EAPI void
|
2009-06-17 08:35:19 -07:00
|
|
|
elm_win_borderless_set(Evas_Object *obj, Eina_Bool borderless)
|
2008-10-06 18:23:49 -07:00
|
|
|
{
|
2009-08-09 15:23:46 -07:00
|
|
|
Elm_Win *win;
|
2009-10-26 01:27:08 -07:00
|
|
|
if (strcmp(elm_widget_type_get(obj), "win")) return;
|
2009-08-09 15:23:46 -07:00
|
|
|
win = elm_widget_data_get(obj);
|
2008-10-06 18:23:49 -07:00
|
|
|
if (!win) return;
|
|
|
|
ecore_evas_borderless_set(win->ee, borderless);
|
|
|
|
_elm_win_xwin_update(win);
|
|
|
|
}
|
|
|
|
|
2009-10-12 02:09:55 -07:00
|
|
|
EAPI Eina_Bool
|
|
|
|
elm_win_borderless_get(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Elm_Win *win;
|
2009-10-26 01:27:08 -07:00
|
|
|
if (strcmp(elm_widget_type_get(obj), "win")) return EINA_FALSE;
|
2009-10-12 02:09:55 -07:00
|
|
|
win = elm_widget_data_get(obj);
|
|
|
|
if (!win) return EINA_FALSE;
|
|
|
|
return ecore_evas_borderless_get(win->ee);
|
|
|
|
}
|
|
|
|
|
2008-10-06 18:23:49 -07:00
|
|
|
EAPI void
|
2009-06-17 08:35:19 -07:00
|
|
|
elm_win_shaped_set(Evas_Object *obj, Eina_Bool shaped)
|
2008-10-06 18:23:49 -07:00
|
|
|
{
|
2009-08-09 15:23:46 -07:00
|
|
|
Elm_Win *win;
|
2009-10-26 01:27:08 -07:00
|
|
|
if (strcmp(elm_widget_type_get(obj), "win")) return;
|
2009-08-09 15:23:46 -07:00
|
|
|
win = elm_widget_data_get(obj);
|
2008-10-06 18:23:49 -07:00
|
|
|
if (!win) return;
|
|
|
|
ecore_evas_shaped_set(win->ee, shaped);
|
|
|
|
_elm_win_xwin_update(win);
|
|
|
|
}
|
|
|
|
|
2009-10-12 02:09:55 -07:00
|
|
|
EAPI Eina_Bool
|
|
|
|
elm_win_shaped_get(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Elm_Win *win;
|
2009-10-26 01:27:08 -07:00
|
|
|
if (strcmp(elm_widget_type_get(obj), "win")) return EINA_FALSE;
|
2009-10-12 02:09:55 -07:00
|
|
|
win = elm_widget_data_get(obj);
|
|
|
|
if (!win) return EINA_FALSE;
|
|
|
|
return ecore_evas_shaped_get(win->ee);
|
|
|
|
}
|
|
|
|
|
2008-10-06 18:23:49 -07:00
|
|
|
EAPI void
|
2009-06-17 08:35:19 -07:00
|
|
|
elm_win_alpha_set(Evas_Object *obj, Eina_Bool alpha)
|
2008-10-06 18:23:49 -07:00
|
|
|
{
|
2009-08-09 15:23:46 -07:00
|
|
|
Elm_Win *win;
|
2009-10-26 01:27:08 -07:00
|
|
|
if (strcmp(elm_widget_type_get(obj), "win")) return;
|
2009-08-09 15:23:46 -07:00
|
|
|
win = elm_widget_data_get(obj);
|
2008-10-06 18:23:49 -07:00
|
|
|
if (!win) return;
|
|
|
|
if (win->xwin)
|
|
|
|
{
|
|
|
|
if (alpha)
|
|
|
|
{
|
2008-10-16 05:03:01 -07:00
|
|
|
if (!_elm_config->compositing)
|
2008-10-06 18:23:49 -07:00
|
|
|
elm_win_shaped_set(obj, alpha);
|
|
|
|
else
|
|
|
|
ecore_evas_alpha_set(win->ee, alpha);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ecore_evas_alpha_set(win->ee, alpha);
|
|
|
|
_elm_win_xwin_update(win);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ecore_evas_alpha_set(win->ee, alpha);
|
|
|
|
}
|
|
|
|
|
2009-10-12 02:09:55 -07:00
|
|
|
EAPI Eina_Bool
|
|
|
|
elm_win_alpha_get(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Elm_Win *win;
|
2009-10-26 01:27:08 -07:00
|
|
|
if (strcmp(elm_widget_type_get(obj), "win")) return EINA_FALSE;
|
2009-10-12 02:09:55 -07:00
|
|
|
win = elm_widget_data_get(obj);
|
|
|
|
if (!win) return EINA_FALSE;
|
|
|
|
return ecore_evas_alpha_get(win->ee);
|
|
|
|
}
|
|
|
|
|
2008-10-06 18:23:49 -07:00
|
|
|
EAPI void
|
2009-06-17 08:35:19 -07:00
|
|
|
elm_win_override_set(Evas_Object *obj, Eina_Bool override)
|
2008-10-06 18:23:49 -07:00
|
|
|
{
|
2009-08-09 15:23:46 -07:00
|
|
|
Elm_Win *win;
|
2009-10-26 01:27:08 -07:00
|
|
|
if (strcmp(elm_widget_type_get(obj), "win")) return;
|
2009-08-09 15:23:46 -07:00
|
|
|
win = elm_widget_data_get(obj);
|
2008-10-06 18:23:49 -07:00
|
|
|
if (!win) return;
|
|
|
|
ecore_evas_override_set(win->ee, override);
|
|
|
|
_elm_win_xwin_update(win);
|
2008-09-29 23:58:56 -07:00
|
|
|
}
|
2008-11-18 02:11:57 -08:00
|
|
|
|
2009-10-12 02:09:55 -07:00
|
|
|
EAPI Eina_Bool
|
|
|
|
elm_win_override_get(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Elm_Win *win;
|
2009-10-26 01:27:08 -07:00
|
|
|
if (strcmp(elm_widget_type_get(obj), "win")) return EINA_FALSE;
|
2009-10-12 02:09:55 -07:00
|
|
|
win = elm_widget_data_get(obj);
|
|
|
|
if (!win) return EINA_FALSE;
|
|
|
|
return ecore_evas_override_get(win->ee);
|
|
|
|
}
|
|
|
|
|
2009-03-12 22:50:38 -07:00
|
|
|
EAPI void
|
2009-06-17 08:35:19 -07:00
|
|
|
elm_win_fullscreen_set(Evas_Object *obj, Eina_Bool fullscreen)
|
2009-03-12 22:50:38 -07:00
|
|
|
{
|
2009-08-09 15:23:46 -07:00
|
|
|
Elm_Win *win;
|
2009-10-26 01:27:08 -07:00
|
|
|
if (strcmp(elm_widget_type_get(obj), "win")) return;
|
2009-08-09 15:23:46 -07:00
|
|
|
win = elm_widget_data_get(obj);
|
2009-03-12 22:50:38 -07:00
|
|
|
if (!win) return;
|
2009-03-14 11:03:19 -07:00
|
|
|
switch (_elm_config->engine)
|
|
|
|
{
|
|
|
|
case ELM_SOFTWARE_16_WINCE:
|
|
|
|
case ELM_SOFTWARE_FB:
|
2009-07-06 23:46:51 -07:00
|
|
|
// these engines... can ONLY be fullscreen
|
|
|
|
break;
|
2009-03-14 11:03:19 -07:00
|
|
|
default:
|
2009-07-06 23:46:51 -07:00
|
|
|
ecore_evas_fullscreen_set(win->ee, fullscreen);
|
|
|
|
_elm_win_xwin_update(win);
|
|
|
|
break;
|
2009-03-14 11:03:19 -07:00
|
|
|
}
|
2009-03-12 22:50:38 -07:00
|
|
|
}
|
|
|
|
|
2009-10-12 02:09:55 -07:00
|
|
|
EAPI Eina_Bool
|
|
|
|
elm_win_fullscreen_get(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Elm_Win *win;
|
2009-10-26 01:27:08 -07:00
|
|
|
if (strcmp(elm_widget_type_get(obj), "win")) return EINA_FALSE;
|
2009-10-12 02:09:55 -07:00
|
|
|
win = elm_widget_data_get(obj);
|
|
|
|
if (!win) return EINA_FALSE;
|
|
|
|
switch (_elm_config->engine)
|
|
|
|
{
|
|
|
|
case ELM_SOFTWARE_16_WINCE:
|
|
|
|
case ELM_SOFTWARE_FB:
|
|
|
|
// these engines... can ONLY be fullscreen
|
|
|
|
return EINA_TRUE;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return ecore_evas_fullscreen_get(win->ee);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2009-03-12 22:50:38 -07:00
|
|
|
EAPI void
|
2009-06-17 08:35:19 -07:00
|
|
|
elm_win_maximized_set(Evas_Object *obj, Eina_Bool maximized)
|
2009-03-12 22:50:38 -07:00
|
|
|
{
|
2009-08-09 15:23:46 -07:00
|
|
|
Elm_Win *win;
|
2009-10-26 01:27:08 -07:00
|
|
|
if (strcmp(elm_widget_type_get(obj), "win")) return;
|
2009-08-09 15:23:46 -07:00
|
|
|
win = elm_widget_data_get(obj);
|
2009-03-12 22:50:38 -07:00
|
|
|
if (!win) return;
|
|
|
|
ecore_evas_maximized_set(win->ee, maximized);
|
|
|
|
_elm_win_xwin_update(win);
|
|
|
|
}
|
|
|
|
|
2009-10-12 02:09:55 -07:00
|
|
|
EAPI Eina_Bool
|
|
|
|
elm_win_maximized_get(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Elm_Win *win;
|
2009-10-26 01:27:08 -07:00
|
|
|
if (strcmp(elm_widget_type_get(obj), "win")) return EINA_FALSE;
|
2009-10-12 02:09:55 -07:00
|
|
|
win = elm_widget_data_get(obj);
|
|
|
|
if (!win) return EINA_FALSE;
|
|
|
|
return ecore_evas_maximized_get(win->ee);
|
|
|
|
}
|
|
|
|
|
2009-03-12 22:50:38 -07:00
|
|
|
EAPI void
|
2009-06-17 08:35:19 -07:00
|
|
|
elm_win_iconified_set(Evas_Object *obj, Eina_Bool iconified)
|
2009-03-12 22:50:38 -07:00
|
|
|
{
|
2009-08-09 15:23:46 -07:00
|
|
|
Elm_Win *win;
|
2009-10-26 01:27:08 -07:00
|
|
|
if (strcmp(elm_widget_type_get(obj), "win")) return;
|
2009-08-09 15:23:46 -07:00
|
|
|
win = elm_widget_data_get(obj);
|
2009-03-12 22:50:38 -07:00
|
|
|
if (!win) return;
|
|
|
|
ecore_evas_iconified_set(win->ee, iconified);
|
|
|
|
_elm_win_xwin_update(win);
|
|
|
|
}
|
|
|
|
|
2009-10-12 02:09:55 -07:00
|
|
|
EAPI Eina_Bool
|
|
|
|
elm_win_iconified_get(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Elm_Win *win;
|
2009-10-26 01:27:08 -07:00
|
|
|
if (strcmp(elm_widget_type_get(obj), "win")) return EINA_FALSE;
|
2009-10-12 02:09:55 -07:00
|
|
|
win = elm_widget_data_get(obj);
|
|
|
|
if (!win) return EINA_FALSE;
|
|
|
|
return ecore_evas_iconified_get(win->ee);
|
|
|
|
}
|
|
|
|
|
2009-03-12 22:50:38 -07:00
|
|
|
EAPI void
|
|
|
|
elm_win_layer_set(Evas_Object *obj, int layer)
|
|
|
|
{
|
2009-08-09 15:23:46 -07:00
|
|
|
Elm_Win *win;
|
2009-10-26 01:27:08 -07:00
|
|
|
if (strcmp(elm_widget_type_get(obj), "win")) return;
|
2009-08-09 15:23:46 -07:00
|
|
|
win = elm_widget_data_get(obj);
|
2009-03-12 22:50:38 -07:00
|
|
|
if (!win) return;
|
|
|
|
ecore_evas_layer_set(win->ee, layer);
|
|
|
|
_elm_win_xwin_update(win);
|
|
|
|
}
|
|
|
|
|
2009-10-12 02:09:55 -07:00
|
|
|
EAPI int
|
|
|
|
elm_win_layer_get(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Elm_Win *win;
|
2009-10-26 01:27:08 -07:00
|
|
|
if (strcmp(elm_widget_type_get(obj), "win")) return -1;
|
2009-10-12 02:09:55 -07:00
|
|
|
win = elm_widget_data_get(obj);
|
|
|
|
if (!win) return -1;
|
|
|
|
return ecore_evas_layer_get(win->ee);
|
|
|
|
}
|
|
|
|
|
2009-03-14 11:03:19 -07:00
|
|
|
EAPI void
|
|
|
|
elm_win_rotation_set(Evas_Object *obj, int rotation)
|
|
|
|
{
|
2009-08-09 15:23:46 -07:00
|
|
|
Elm_Win *win;
|
2009-10-26 01:27:08 -07:00
|
|
|
if (strcmp(elm_widget_type_get(obj), "win")) return;
|
2009-08-09 15:23:46 -07:00
|
|
|
win = elm_widget_data_get(obj);
|
2009-03-14 11:03:19 -07:00
|
|
|
if (!win) return;
|
2009-05-06 05:41:23 -07:00
|
|
|
if (win->rot == rotation) return;
|
|
|
|
win->rot = rotation;
|
2009-03-14 11:03:19 -07:00
|
|
|
ecore_evas_rotation_set(win->ee, rotation);
|
2009-05-06 05:41:23 -07:00
|
|
|
evas_object_size_hint_min_set(obj, -1, -1);
|
|
|
|
evas_object_size_hint_max_set(obj, -1, -1);
|
|
|
|
_elm_win_eval_subobjs(obj);
|
2009-03-14 11:03:19 -07:00
|
|
|
_elm_win_xwin_update(win);
|
|
|
|
}
|
|
|
|
|
2009-10-12 02:09:55 -07:00
|
|
|
EAPI int
|
|
|
|
elm_win_rotation_get(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Elm_Win *win;
|
2009-10-26 01:27:08 -07:00
|
|
|
if (strcmp(elm_widget_type_get(obj), "win")) return -1;
|
2009-10-12 02:09:55 -07:00
|
|
|
win = elm_widget_data_get(obj);
|
|
|
|
if (!win) return -1;
|
|
|
|
return win->rot;
|
|
|
|
}
|
|
|
|
|
2009-04-03 14:52:01 -07:00
|
|
|
EAPI void
|
|
|
|
elm_win_sticky_set(Evas_Object *obj, Eina_Bool sticky)
|
|
|
|
{
|
2009-08-09 15:23:46 -07:00
|
|
|
Elm_Win *win;
|
2009-10-26 01:27:08 -07:00
|
|
|
if (strcmp(elm_widget_type_get(obj), "win")) return;
|
2009-08-09 15:23:46 -07:00
|
|
|
win = elm_widget_data_get(obj);
|
2009-04-03 14:52:01 -07:00
|
|
|
if (!win) return;
|
|
|
|
ecore_evas_sticky_set(win->ee, sticky);
|
|
|
|
_elm_win_xwin_update(win);
|
|
|
|
}
|
|
|
|
|
2009-10-12 02:09:55 -07:00
|
|
|
EAPI Eina_Bool
|
|
|
|
elm_win_sticky_get(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Elm_Win *win;
|
2009-10-26 01:27:08 -07:00
|
|
|
if (strcmp(elm_widget_type_get(obj), "win")) return EINA_FALSE;
|
2009-10-12 02:09:55 -07:00
|
|
|
win = elm_widget_data_get(obj);
|
|
|
|
if (!win) return EINA_FALSE;
|
|
|
|
return ecore_evas_sticky_get(win->ee);
|
|
|
|
}
|
|
|
|
|
2008-11-18 02:11:57 -08:00
|
|
|
EAPI void
|
|
|
|
elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode)
|
|
|
|
{
|
2009-08-09 15:23:46 -07:00
|
|
|
Elm_Win *win;
|
2009-10-26 01:27:08 -07:00
|
|
|
if (strcmp(elm_widget_type_get(obj), "win")) return;
|
2009-08-09 15:23:46 -07:00
|
|
|
win = elm_widget_data_get(obj);
|
2008-11-18 02:11:57 -08:00
|
|
|
if (!win) return;
|
|
|
|
if (mode == win->kbdmode) return;
|
2008-11-18 22:23:08 -08:00
|
|
|
_elm_win_xwindow_get(win);
|
2008-11-18 02:11:57 -08:00
|
|
|
win->kbdmode = mode;
|
2009-07-06 23:46:51 -07:00
|
|
|
#ifdef HAVE_ELEMENTARY_X
|
2008-11-18 02:11:57 -08:00
|
|
|
if (win->xwin)
|
|
|
|
ecore_x_e_virtual_keyboard_state_set
|
|
|
|
(win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
|
2009-07-06 23:46:51 -07:00
|
|
|
#endif
|
2008-11-18 02:11:57 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2009-06-17 08:35:19 -07:00
|
|
|
elm_win_keyboard_win_set(Evas_Object *obj, Eina_Bool is_keyboard)
|
2008-11-18 02:11:57 -08:00
|
|
|
{
|
2009-08-09 15:23:46 -07:00
|
|
|
Elm_Win *win;
|
2009-10-26 01:27:08 -07:00
|
|
|
if (strcmp(elm_widget_type_get(obj), "win")) return;
|
2009-08-09 15:23:46 -07:00
|
|
|
win = elm_widget_data_get(obj);
|
2008-11-18 02:11:57 -08:00
|
|
|
if (!win) return;
|
2008-11-18 22:23:08 -08:00
|
|
|
_elm_win_xwindow_get(win);
|
2009-07-06 23:46:51 -07:00
|
|
|
#ifdef HAVE_ELEMENTARY_X
|
2008-11-18 02:11:57 -08:00
|
|
|
if (win->xwin)
|
|
|
|
ecore_x_e_virtual_keyboard_set
|
|
|
|
(win->xwin, is_keyboard);
|
2009-07-06 23:46:51 -07:00
|
|
|
#endif
|
2008-11-18 02:11:57 -08:00
|
|
|
}
|
2008-11-18 22:23:08 -08:00
|
|
|
|
2008-12-30 08:19:46 -08:00
|
|
|
typedef struct _Widget_Data Widget_Data;
|
|
|
|
|
|
|
|
struct _Widget_Data
|
|
|
|
{
|
|
|
|
Evas_Object *frm;
|
|
|
|
Evas_Object *content;
|
|
|
|
};
|
|
|
|
|
|
|
|
static void _del_hook(Evas_Object *obj);
|
|
|
|
static void _theme_hook(Evas_Object *obj);
|
|
|
|
static void _sizing_eval(Evas_Object *obj);
|
|
|
|
static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
|
|
|
static void _sub_del(void *data, Evas_Object *obj, void *event_info);
|
|
|
|
|
|
|
|
static void
|
|
|
|
_del_hook(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
free(wd);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_theme_hook(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2009-04-22 21:03:27 -07:00
|
|
|
_elm_theme_set(wd->frm, "win", "inwin", elm_widget_style_get(obj));
|
2008-12-30 08:19:46 -08:00
|
|
|
if (wd->content)
|
|
|
|
edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->content);
|
|
|
|
_sizing_eval(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_sizing_eval(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2009-11-14 17:51:39 -08:00
|
|
|
Evas_Coord minw = -1, minh = -1;
|
2009-07-06 23:46:51 -07:00
|
|
|
|
2008-12-30 08:19:46 -08:00
|
|
|
evas_object_size_hint_min_get(wd->content, &minw, &minh);
|
|
|
|
edje_object_size_min_calc(wd->frm, &minw, &minh);
|
|
|
|
evas_object_size_hint_min_set(obj, minw, minh);
|
2009-11-14 17:51:39 -08:00
|
|
|
evas_object_size_hint_max_set(obj, -1, -1);
|
2008-12-30 08:19:46 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
|
|
|
{
|
|
|
|
_sizing_eval(data);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_sub_del(void *data, Evas_Object *obj, void *event_info)
|
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
Evas_Object *sub = event_info;
|
|
|
|
if (sub == wd->content)
|
|
|
|
{
|
2009-10-22 15:10:23 -07:00
|
|
|
evas_object_event_callback_del_full
|
2009-11-14 17:51:39 -08:00
|
|
|
(sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
|
2009-07-06 23:46:51 -07:00
|
|
|
wd->content = NULL;
|
|
|
|
_sizing_eval(obj);
|
2008-12-30 08:19:46 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Evas_Object *
|
|
|
|
elm_win_inwin_add(Evas_Object *obj)
|
|
|
|
{
|
2009-11-14 17:51:39 -08:00
|
|
|
if (strcmp(elm_widget_type_get(obj), "win")) return;
|
|
|
|
|
2008-12-30 08:19:46 -08:00
|
|
|
Evas_Object *obj2;
|
|
|
|
Widget_Data *wd;
|
2009-11-14 17:51:39 -08:00
|
|
|
Elm_Win *win;
|
|
|
|
|
2009-08-09 15:23:46 -07:00
|
|
|
win = elm_widget_data_get(obj);
|
2008-12-30 08:19:46 -08:00
|
|
|
if (!win) return NULL;
|
|
|
|
wd = ELM_NEW(Widget_Data);
|
|
|
|
obj2 = elm_widget_add(win->evas);
|
2009-05-13 05:21:52 -07:00
|
|
|
elm_widget_type_set(obj2, "inwin");
|
|
|
|
elm_widget_sub_object_add(obj, obj2);
|
2009-11-14 17:51:39 -08:00
|
|
|
evas_object_size_hint_weight_set(obj2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_size_hint_align_set(obj2, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
2008-12-30 08:19:46 -08:00
|
|
|
elm_win_resize_object_add(obj, obj2);
|
2009-07-06 23:46:51 -07:00
|
|
|
|
2008-12-30 08:19:46 -08:00
|
|
|
elm_widget_data_set(obj2, wd);
|
|
|
|
elm_widget_del_hook_set(obj2, _del_hook);
|
|
|
|
elm_widget_theme_hook_set(obj2, _theme_hook);
|
2009-07-06 23:46:51 -07:00
|
|
|
|
2008-12-30 08:19:46 -08:00
|
|
|
wd->frm = edje_object_add(win->evas);
|
|
|
|
_elm_theme_set(wd->frm, "win", "inwin", "default");
|
|
|
|
elm_widget_resize_object_set(obj2, wd->frm);
|
2009-07-06 23:46:51 -07:00
|
|
|
|
2008-12-30 08:19:46 -08:00
|
|
|
evas_object_smart_callback_add(obj2, "sub-object-del", _sub_del, obj2);
|
2009-07-06 23:46:51 -07:00
|
|
|
|
2008-12-30 08:19:46 -08:00
|
|
|
_sizing_eval(obj2);
|
|
|
|
return obj2;
|
|
|
|
}
|
|
|
|
|
2009-10-15 06:18:11 -07:00
|
|
|
/** DEPRECATED. use elm_object_style_set() instead */
|
2008-12-30 08:19:46 -08:00
|
|
|
EAPI void
|
|
|
|
elm_win_inwin_style_set(Evas_Object *obj, const char *style)
|
|
|
|
{
|
2009-04-22 21:03:27 -07:00
|
|
|
elm_widget_style_set(obj, style);
|
2008-12-30 08:19:46 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_win_inwin_activate(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
evas_object_raise(obj);
|
|
|
|
evas_object_show(obj);
|
|
|
|
edje_object_signal_emit(wd->frm, "elm,action,show", "elm");
|
|
|
|
elm_widget_focused_object_clear(elm_widget_parent_get(obj));
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_win_inwin_content_set(Evas_Object *obj, Evas_Object *content)
|
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2009-11-14 17:51:39 -08:00
|
|
|
if ((wd->content) && (wd->content != content))
|
2008-12-30 08:19:46 -08:00
|
|
|
elm_widget_sub_object_del(obj, wd->content);
|
|
|
|
wd->content = content;
|
|
|
|
if (content)
|
|
|
|
{
|
2009-07-06 23:46:51 -07:00
|
|
|
elm_widget_sub_object_add(obj, content);
|
|
|
|
edje_object_part_swallow(wd->frm, "elm.swallow.content", content);
|
|
|
|
evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
|
|
|
|
_changed_size_hints, obj);
|
|
|
|
_sizing_eval(obj);
|
2008-12-30 08:19:46 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* windowing spcific calls - shall we do this differently? */
|
2008-11-18 22:23:08 -08:00
|
|
|
EAPI Ecore_X_Window
|
2009-02-25 07:54:26 -08:00
|
|
|
elm_win_xwindow_get(const Evas_Object *obj)
|
2008-11-18 22:23:08 -08:00
|
|
|
{
|
2009-08-09 15:23:46 -07:00
|
|
|
Ecore_X_Window xwin = 0;
|
|
|
|
Ecore_Evas *ee = NULL;
|
|
|
|
|
|
|
|
ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
|
|
|
|
if (ee) xwin = (Ecore_X_Window)ecore_evas_window_get(ee);
|
|
|
|
return xwin;
|
2008-11-18 22:23:08 -08:00
|
|
|
}
|