aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/elementary/efl_ui_win.c
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2016-06-08 15:24:08 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2016-06-08 17:09:01 +0900
commitcfa739fbf6f974dd5f7225d8b3d8290d25e3ba0e (patch)
tree34627c5a7cefcb40852637532d19edf649bec71c /src/lib/elementary/efl_ui_win.c
parentwin: Remove inexisting EAPI definitions from legacy (diff)
downloadefl-cfa739fbf6f974dd5f7225d8b3d8290d25e3ba0e.tar.gz
win: Implement aspect control with Efl.Gfx.Size.Hint
This changes the API from a double to int, int. Still not sure which API variant is the best (int,int or double).
Diffstat (limited to 'src/lib/elementary/efl_ui_win.c')
-rw-r--r--src/lib/elementary/efl_ui_win.c47
1 files changed, 42 insertions, 5 deletions
diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c
index a071507fe9..e58a14d460 100644
--- a/src/lib/elementary/efl_ui_win.c
+++ b/src/lib/elementary/efl_ui_win.c
@@ -208,7 +208,8 @@ struct _Efl_Ui_Win_Data
void *trap_data;
- double aspect;
+ double aspect; /* defined as w/h or 0 */
+ int aspect_w, aspect_h; /* used for the get API */
int size_base_w, size_base_h;
int size_step_w, size_step_h;
int norender;
@@ -4766,8 +4767,8 @@ _efl_ui_win_modal_get(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd)
return EFL_UI_WIN_MODAL_NONE;
}
-EOLIAN static void
-_efl_ui_win_aspect_set(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd, double aspect)
+static void
+_win_aspect_set(Efl_Ui_Win_Data *sd, double aspect)
{
sd->aspect = aspect;
TRAP(sd, aspect_set, aspect);
@@ -4776,13 +4777,32 @@ _efl_ui_win_aspect_set(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd, double aspect)
#endif
}
-EOLIAN static double
-_efl_ui_win_aspect_get(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd)
+static double
+_win_aspect_get(Efl_Ui_Win_Data *sd)
{
return sd->aspect;
}
EOLIAN static void
+_efl_ui_win_efl_gfx_size_hint_aspect_set(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *pd,
+ Efl_Gfx_Size_Hint_Aspect mode EINA_UNUSED, int w, int h)
+{
+ pd->aspect_w = w;
+ pd->aspect_h = h;
+ if (h) _win_aspect_set(pd, (double) w / (double) h);
+ else _win_aspect_set(pd, 0.0);
+}
+
+EOLIAN static void
+_efl_ui_win_efl_gfx_size_hint_aspect_get(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *pd,
+ Efl_Gfx_Size_Hint_Aspect *mode, int *w, int *h)
+{
+ if (mode) *mode = EFL_GFX_SIZE_HINT_ASPECT_NONE;
+ if (w) *w = pd->aspect_w;
+ if (h) *h = pd->aspect_h;
+}
+
+EOLIAN static void
_efl_ui_win_efl_gfx_size_hint_base_set(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd, int w, int h)
{
sd->size_base_w = w;
@@ -6489,4 +6509,21 @@ end:
return sd->main_menu;
}
+EAPI void
+elm_win_aspect_set(Eo *obj, double aspect)
+{
+ if (aspect > DBL_EPSILON)
+ efl_gfx_size_hint_aspect_set(obj, EFL_GFX_SIZE_HINT_ASPECT_NONE, 1000 * aspect, 1000);
+ else
+ efl_gfx_size_hint_aspect_set(obj, EFL_GFX_SIZE_HINT_ASPECT_NONE, 0, 0);
+}
+
+EAPI double
+elm_win_aspect_get(const Eo *obj)
+{
+ ELM_WIN_CHECK(obj) 0.0;
+ ELM_WIN_DATA_GET_OR_RETURN(obj, sd, 0.0);
+ return _win_aspect_get(sd);
+}
+
#include "efl_ui_win.eo.c"