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;
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);
#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;
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"
$false otherwise.]]
}
}
- @property aspect {
- set {
- [[Set the aspect ratio of a window.]]
- }
- get {
- [[Get the aspect ratio of a window.]]
- }
- values {
- aspect: double; [[If 0, the window has no aspect limits,
- otherwise it is width divided by height.]]
- }
- }
socket_listen {
[[Create a socket to provide the service for Plug widget.]]
return: bool;
Efl.Gfx.Size.Hint.base.get;
Efl.Gfx.Size.Hint.step.set;
Efl.Gfx.Size.Hint.step.get;
+ Efl.Gfx.Size.Hint.aspect.set;
+ Efl.Gfx.Size.Hint.aspect.get;
Efl.Text.text.set;
Efl.Text.text.get;
}
* @ingroup Elm_Win
*/
EAPI Elm_Win_Keyboard_Mode elm_win_keyboard_mode_get(const Elm_Win *obj);
+
+/**
+ * @brief Set the aspect ratio of a window.
+ *
+ * @param[in] aspect If 0, the window has no aspect limits, otherwise it is
+ * width divided by height.
+ */
+EAPI void elm_win_aspect_set(Elm_Win *obj, double aspect);
+
+/**
+ * @brief Get the aspect ratio of a window.
+ *
+ * @return If 0, the window has no aspect limits, otherwise it is width divided
+ * by height.
+ */
+EAPI double elm_win_aspect_get(const Elm_Win *obj);