aboutsummaryrefslogtreecommitdiffstats
path: root/legacy/elementary/src/lib/elm_win.c
diff options
context:
space:
mode:
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>2011-12-03 22:51:12 +0000
committerMike Blumenkrantz <michael.blumenkrantz@gmail.com>2011-12-03 22:51:12 +0000
commitd3b755cbe6a15b3cc42311704144378755665553 (patch)
treed45029cc85049d518cf355788c3fd7b6803d66ef /legacy/elementary/src/lib/elm_win.c
parentcompletely disable selection and cnp in password entries (diff)
downloadefl-d3b755cbe6a15b3cc42311704144378755665553.tar.gz
MIN/MAX macros -> elm_priv.h
+elm_win_center +elm_win_screen_constrain_get/set SVN revision: 65859
Diffstat (limited to 'legacy/elementary/src/lib/elm_win.c')
-rw-r--r--legacy/elementary/src/lib/elm_win.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/legacy/elementary/src/lib/elm_win.c b/legacy/elementary/src/lib/elm_win.c
index 8713dfe2e4..6eedc60ec7 100644
--- a/legacy/elementary/src/lib/elm_win.c
+++ b/legacy/elementary/src/lib/elm_win.c
@@ -25,6 +25,7 @@ struct _Elm_Win
int shot_counter;
} shot;
Eina_Bool autodel : 1;
+ Eina_Bool constrain : 1;
int *autodel_clear, rot;
int show_count;
struct {
@@ -640,6 +641,13 @@ _elm_win_obj_callback_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, v
evas_object_geometry_get(obj, NULL, NULL, &w, &h);
if (w < 1) w = 1;
if (h < 1) h = 1;
+ if (win->constrain)
+ {
+ int sw, sh;
+ ecore_evas_screen_geometry_get(win->ee, NULL, NULL, &sw, &sh);
+ w = MIN(w, sw);
+ h = MIN(h, sh);
+ }
evas_object_image_size_set(win->img_obj, w, h);
}
}
@@ -673,6 +681,13 @@ _elm_win_resize_job(void *data)
win->deferred_resize_job = NULL;
ecore_evas_request_geometry_get(win->ee, NULL, NULL, &w, &h);
+ if (win->constrain)
+ {
+ int sw, sh;
+ ecore_evas_screen_geometry_get(win->ee, NULL, NULL, &sw, &sh);
+ w = MIN(w, sw);
+ h = MIN(h, sh);
+ }
evas_object_resize(win->win_obj, w, h);
if (win->frame_obj)
{
@@ -1755,6 +1770,23 @@ elm_win_raise(Evas_Object *obj)
}
EAPI void
+elm_win_center(Evas_Object *obj, Eina_Bool h, Eina_Bool v)
+{
+ Elm_Win *win;
+ int win_w, win_h, screen_w, screen_h, nx, ny;
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ win = elm_widget_data_get(obj);
+ if (!win) return;
+ ecore_evas_screen_geometry_get(win->ee, NULL, NULL, &screen_w, &screen_h);
+ evas_object_geometry_get(obj, NULL, NULL, &win_w, &win_h);
+ if (h) nx = win_w >= screen_w ? 0 : (screen_w / 2) - (win_w / 2);
+ else nx = win->screen.x;
+ if (v) ny = win_h >= screen_h ? 0 : (screen_h / 2) - (win_h / 2);
+ else ny = win->screen.y;
+ evas_object_move(obj, nx, ny);
+}
+
+EAPI void
elm_win_borderless_set(Evas_Object *obj, Eina_Bool borderless)
{
Elm_Win *win;
@@ -2186,6 +2218,26 @@ elm_win_focus_get(const Evas_Object *obj)
}
EAPI void
+elm_win_screen_constrain_set(Evas_Object *obj, Eina_Bool constrain)
+{
+ Elm_Win *win;
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ win = elm_widget_data_get(obj);
+ if (!win) return;
+ win->constrain = !!constrain;
+}
+
+EAPI Eina_Bool
+elm_win_screen_constrain_get(Evas_Object *obj)
+{
+ Elm_Win *win;
+ ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
+ win = elm_widget_data_get(obj);
+ if (!win) return EINA_FALSE;
+ return win->constrain;
+}
+
+EAPI void
elm_win_screen_size_get(const Evas_Object *obj, int *x, int *y, int *w, int *h)
{
Elm_Win *win;