diff --git a/src/Makefile_Elementary.am b/src/Makefile_Elementary.am index 3c31959a52..71471e2647 100644 --- a/src/Makefile_Elementary.am +++ b/src/Makefile_Elementary.am @@ -330,6 +330,7 @@ lib/elementary/efl_ui_textpath_eo.legacy.c \ lib/elementary/efl_ui_textpath_legacy_eo.c \ lib/elementary/efl_ui_video_eo.legacy.c \ lib/elementary/efl_ui_video_legacy_eo.c \ +lib/elementary/efl_ui_widget_eo.legacy.c \ lib/elementary/elm_hoversel_eo.c \ lib/elementary/elm_hoversel_eo.legacy.c \ lib/elementary/elm_hoversel_item_eo.c \ @@ -372,6 +373,7 @@ lib/elementary/efl_ui_textpath_legacy_eo.legacy.h \ lib/elementary/efl_ui_video_eo.legacy.h \ lib/elementary/efl_ui_video_legacy_eo.h \ lib/elementary/efl_ui_video_legacy_eo.legacy.h \ +lib/elementary/efl_ui_widget_eo.legacy.h \ lib/elementary/elm_hoversel_eo.h \ lib/elementary/elm_hoversel_eo.legacy.h \ lib/elementary/elm_hoversel_item_eo.h \ diff --git a/src/lib/elementary/efl_ui_widget.c b/src/lib/elementary/efl_ui_widget.c index 5c8aa75748..e6f95cf397 100644 --- a/src/lib/elementary/efl_ui_widget.c +++ b/src/lib/elementary/efl_ui_widget.c @@ -5962,6 +5962,7 @@ ELM_PART_TEXT_DEFAULT_GET(efl_ui_widget, NULL) #include "elm_widget_item.eo.c" #include "elm_widget_item_container.eo.c" #include "efl_ui_widget.eo.c" +#include "efl_ui_widget_eo.legacy.c" /* Others */ #include "efl_ui_l10n.eo.c" diff --git a/src/lib/elementary/efl_ui_widget.eo b/src/lib/elementary/efl_ui_widget.eo index 61456d7e9c..69ef4f517c 100644 --- a/src/lib/elementary/efl_ui_widget.eo +++ b/src/lib/elementary/efl_ui_widget.eo @@ -19,7 +19,6 @@ abstract @beta Efl.Ui.Widget extends Efl.Canvas.Group implements Efl.Access.Obje Efl.Ui.Selection, Efl.Ui.Dnd { [[Efl UI widget abstract class]] - legacy_prefix: elm_widget; //eo_prefix: efl_ui_widget; event_prefix: efl_ui_widget; data: Efl_Ui_Widget_Data; @@ -175,7 +174,6 @@ abstract @beta Efl.Ui.Widget extends Efl.Canvas.Group implements Efl.Access.Obje [[Source object where the event originated. Often same as this.]] } return: bool; [[$true on success, $false otherwise]] - legacy: null; } // FIXME: focus_allow? can_focus? focusable? @property focus_allow { @@ -193,10 +191,8 @@ abstract @beta Efl.Ui.Widget extends Efl.Canvas.Group implements Efl.Access.Obje not focusable, but a button is). ]] set { - legacy: elm_widget_can_focus_set; } get { - legacy: elm_widget_can_focus_get; } values { can_focus: bool; [[Whether the object is focusable.]] @@ -210,10 +206,8 @@ abstract @beta Efl.Ui.Widget extends Efl.Canvas.Group implements Efl.Access.Obje meant for internal handling. ]] set { - legacy: elm_widget_parent_set; /* internal in legacy */ } get { - legacy: elm_widget_parent_get; /* internal in legacy */ } values { parent: Efl.Ui.Widget @nullable; [[Widget parent object]] @@ -244,7 +238,6 @@ abstract @beta Efl.Ui.Widget extends Efl.Canvas.Group implements Efl.Access.Obje @in act: Efl.Ui.Activate; [[Type of activation.]] } return: bool; [[$true on success, $false otherwise]] - legacy: null; /* FIXME: legacy API does extra work */ } on_access_update @protected @beta { [[Hook function called when accessibility is changed on the widget. @@ -255,7 +248,6 @@ abstract @beta Efl.Ui.Widget extends Efl.Canvas.Group implements Efl.Access.Obje params { @in enable: bool; [[$true if accessibility is enabled.]] } - legacy: null; /* FIXME: legacy API does extra work */ } /* Internal hooks. */ @@ -271,7 +263,6 @@ abstract @beta Efl.Ui.Widget extends Efl.Canvas.Group implements Efl.Access.Obje [[Sub object to be added. Not necessarily a widget itself.]] } return: bool; [[Indicates if the operation succeeded.]] - legacy: elm_widget_sub_object_add; } widget_sub_object_del @protected { [[Virtual function handling sub objects being removed. @@ -285,7 +276,6 @@ abstract @beta Efl.Ui.Widget extends Efl.Canvas.Group implements Efl.Access.Obje [[Sub object to be removed. Should be a child of this widget.]] } return: bool; [[Indicates if the operation succeeded.]] - legacy: elm_widget_sub_object_del; } theme_apply @protected { [[Virtual function called when the widget needs to re-apply its theme. @@ -335,7 +325,6 @@ abstract @beta Efl.Ui.Widget extends Efl.Canvas.Group implements Efl.Access.Obje taken into account, otherwise it is ignored. ]] get { - legacy: elm_widget_focus_region_get; } values { region: Eina.Rect; diff --git a/src/lib/elementary/efl_ui_widget_eo.legacy.c b/src/lib/elementary/efl_ui_widget_eo.legacy.c new file mode 100644 index 0000000000..0d1665bea0 --- /dev/null +++ b/src/lib/elementary/efl_ui_widget_eo.legacy.c @@ -0,0 +1,90 @@ + +EAPI void +elm_widget_resize_object_set(Efl_Ui_Widget *obj, Efl_Canvas_Object *sobj) +{ + efl_ui_widget_resize_object_set(obj, sobj); +} + +EAPI void +elm_widget_disabled_set(Efl_Ui_Widget *obj, Eina_Bool disabled) +{ + efl_ui_widget_disabled_set(obj, disabled); +} + +EAPI Eina_Bool +elm_widget_disabled_get(const Efl_Ui_Widget *obj) +{ + return efl_ui_widget_disabled_get(obj); +} + +EAPI Eina_Error +elm_widget_style_set(Efl_Ui_Widget *obj, const char *style) +{ + return efl_ui_widget_style_set(obj, style); +} + +EAPI const char * +elm_widget_style_get(const Efl_Ui_Widget *obj) +{ + return efl_ui_widget_style_get(obj); +} + +EAPI void +elm_widget_can_focus_set(Efl_Ui_Widget *obj, Eina_Bool can_focus) +{ + efl_ui_widget_focus_allow_set(obj, can_focus); +} + +EAPI Eina_Bool +elm_widget_can_focus_get(const Efl_Ui_Widget *obj) +{ + return efl_ui_widget_focus_allow_get(obj); +} + +EAPI void +elm_widget_parent_set(Efl_Ui_Widget *obj, Efl_Ui_Widget *parent) +{ + efl_ui_widget_parent_set(obj, parent); +} + +EAPI Efl_Ui_Widget * +elm_widget_parent_get(const Efl_Ui_Widget *obj) +{ + return efl_ui_widget_parent_get(obj); +} + +EAPI Eina_Bool +elm_widget_sub_object_add(Efl_Ui_Widget *obj, Efl_Canvas_Object *sub_obj) +{ + return efl_ui_widget_sub_object_add(obj, sub_obj); +} + +EAPI Eina_Bool +elm_widget_sub_object_del(Efl_Ui_Widget *obj, Efl_Canvas_Object *sub_obj) +{ + return efl_ui_widget_sub_object_del(obj, sub_obj); +} + +EAPI Eina_Error +elm_widget_theme_apply(Efl_Ui_Widget *obj) +{ + return efl_ui_widget_theme_apply(obj); +} + +EAPI Eina_Rect +elm_widget_focus_region_get(const Efl_Ui_Widget *obj) +{ + return efl_ui_widget_interest_region_get(obj); +} + +EAPI Eina_Rect +elm_widget_focus_highlight_geometry_get(const Efl_Ui_Widget *obj) +{ + return efl_ui_widget_focus_highlight_geometry_get(obj); +} + +EAPI Eina_Bool +elm_widget_focus_state_apply(Efl_Ui_Widget *obj, Efl_Ui_Widget_Focus_State current_state, Efl_Ui_Widget_Focus_State *configured_state, Efl_Ui_Widget *redirect) +{ + return efl_ui_widget_focus_state_apply(obj, current_state, configured_state, redirect); +} diff --git a/src/lib/elementary/efl_ui_widget_eo.legacy.h b/src/lib/elementary/efl_ui_widget_eo.legacy.h new file mode 100644 index 0000000000..70ae62e88b --- /dev/null +++ b/src/lib/elementary/efl_ui_widget_eo.legacy.h @@ -0,0 +1,334 @@ +#ifndef _EFL_UI_WIDGET_EO_LEGACY_H_ +#define _EFL_UI_WIDGET_EO_LEGACY_H_ + +#ifndef _EFL_UI_WIDGET_EO_CLASS_TYPE +#define _EFL_UI_WIDGET_EO_CLASS_TYPE + +typedef Eo Efl_Ui_Widget; + +#endif + +#ifndef _EFL_UI_WIDGET_EO_TYPES +#define _EFL_UI_WIDGET_EO_TYPES + +/** Function pointer for on show region hook + * + * @ingroup Efl_Ui + */ +typedef void (*Efl_Ui_Scrollable_On_Show_Region)(void *data, Efl_Canvas_Object *obj, Eina_Rect region); + +/** All relevant fields needed for the current state of focus registeration + * + * @ingroup Efl_Ui + */ +typedef struct _Efl_Ui_Widget_Focus_State +{ + Efl_Ui_Focus_Manager *manager; /**< The manager where the widget is registered + * in */ + Efl_Ui_Focus_Object *parent; /**< The parent the widget is using as logical + * parent */ + Eina_Bool logical; /**< @c true if this is registered as logical currently */ +} Efl_Ui_Widget_Focus_State; + + +#endif + +/** + * @brief This is the internal canvas object managed by a widget. + * + * This property is protected as it is meant for widget implementations only, + * to set and access the internal canvas object. Do use this function unless + * you're implementing a widget. + * + * Sets the new resize object for this widget. + * + * @param[in] obj The object. + * @param[in] sobj A canvas object (often a @ref Efl_Canvas_Layout object). + * + * @ingroup Elm_Widget_Group + */ +EAPI void elm_widget_resize_object_set(Efl_Ui_Widget *obj, Efl_Canvas_Object *sobj); + +/** + * @brief Whether the widget is enabled (accepts and reacts to user inputs). + * + * The property works counted, this means, whenever n-caller set the value to + * @c true, n-caller have to set it to @c false in order to get it out of the + * disabled state again. + * + * Each widget may handle the disabled state differently, but overall disabled + * widgets shall not respond to any input events. This is @c false by default, + * meaning the widget is enabled. + * + * Enables or disables this widget. + * + * Disabling a widget will disable all its children recursively, but only this + * widget will be marked as disabled internally. + * + * @param[in] obj The object. + * @param[in] disabled @c true if the widget is disabled. + * + * @ingroup Elm_Widget_Group + */ +EAPI void elm_widget_disabled_set(Efl_Ui_Widget *obj, Eina_Bool disabled); + +/** + * @brief Whether the widget is enabled (accepts and reacts to user inputs). + * + * The property works counted, this means, whenever n-caller set the value to + * @c true, n-caller have to set it to @c false in order to get it out of the + * disabled state again. + * + * Each widget may handle the disabled state differently, but overall disabled + * widgets shall not respond to any input events. This is @c false by default, + * meaning the widget is enabled. + * + * Returns whether the widget is disabled. + * + * This will return @c true if any widget in the parent hierarchy is disabled. + * Re-enabling that parent may in turn change the disabled state of this + * widget. + * + * @param[in] obj The object. + * + * @return @c true if the widget is disabled. + * + * @ingroup Elm_Widget_Group + */ +EAPI Eina_Bool elm_widget_disabled_get(const Efl_Ui_Widget *obj); + +/** + * @brief The widget style to use. + * + * Styles define different look and feel for widgets, and may provide different + * parts for layout-based widgets. Styles vary from widget to widget and may be + * defined by other themes by means of extensions and overlays. + * + * The style can only be set before @ref Efl.Object.finalize, which means at + * construction time of the object (inside @c efl_add in C). + * + * Can only be called during construction, before finalize. + * + * @param[in] obj The object. + * @param[in] style Name of the style to use. Refer to each widget's + * documentation for the available style names, or to the themes in use. + * + * @return Whether the style was successfully applied or not, see the values of + * Efl.Ui.Theme.Apply_Error for more information. + * + * @ingroup Elm_Widget_Group + */ +EAPI Eina_Error elm_widget_style_set(Efl_Ui_Widget *obj, const char *style); + +/** + * @brief The widget style to use. + * + * Styles define different look and feel for widgets, and may provide different + * parts for layout-based widgets. Styles vary from widget to widget and may be + * defined by other themes by means of extensions and overlays. + * + * The style can only be set before @ref Efl.Object.finalize, which means at + * construction time of the object (inside @c efl_add in C). + * + * Returns the current style of a widget. + * + * @param[in] obj The object. + * + * @return Name of the style to use. Refer to each widget's documentation for + * the available style names, or to the themes in use. + * + * @ingroup Elm_Widget_Group + */ +EAPI const char *elm_widget_style_get(const Efl_Ui_Widget *obj); + + +/** + * @brief The ability for a widget to be focused. + * + * Unfocusable objects do nothing when programmatically focused. The nearest + * focusable parent object the one really getting focus. Also, when they + * receive mouse input, they will get the event, but not take away the focus + * from where it was previously. + * + * @note Objects which are meant to be interacted with by input events are + * created able to be focused, by default. All the others are not. + * + * This property's default value depends on the widget (eg. a box is not + * focusable, but a button is). + * + * @param[in] obj The object. + * @param[in] can_focus Whether the object is focusable. + * + * @ingroup Elm_Widget_Group + */ +EAPI void elm_widget_can_focus_set(Efl_Ui_Widget *obj, Eina_Bool can_focus); + +/** + * @brief The ability for a widget to be focused. + * + * Unfocusable objects do nothing when programmatically focused. The nearest + * focusable parent object the one really getting focus. Also, when they + * receive mouse input, they will get the event, but not take away the focus + * from where it was previously. + * + * @note Objects which are meant to be interacted with by input events are + * created able to be focused, by default. All the others are not. + * + * This property's default value depends on the widget (eg. a box is not + * focusable, but a button is). + * + * @param[in] obj The object. + * + * @return Whether the object is focusable. + * + * @ingroup Elm_Widget_Group + */ +EAPI Eina_Bool elm_widget_can_focus_get(const Efl_Ui_Widget *obj); + +/** + * @brief The internal parent of this widget. + * + * @ref Efl_Ui_Widget objects have a parent hierarchy that may differ slightly + * from their @ref Efl_Object or @ref Efl_Canvas_Object hierarchy. This is + * meant for internal handling. + * + * @param[in] obj The object. + * @param[in] parent Widget parent object + * + * @ingroup Elm_Widget_Group + */ +EAPI void elm_widget_parent_set(Efl_Ui_Widget *obj, Efl_Ui_Widget *parent); + +/** + * @brief The internal parent of this widget. + * + * @ref Efl_Ui_Widget objects have a parent hierarchy that may differ slightly + * from their @ref Efl_Object or @ref Efl_Canvas_Object hierarchy. This is + * meant for internal handling. + * + * @param[in] obj The object. + * + * @return Widget parent object + * + * @ingroup Elm_Widget_Group + */ +EAPI Efl_Ui_Widget *elm_widget_parent_get(const Efl_Ui_Widget *obj); + +/** + * @brief Virtual function handling sub objects being added. + * + * Sub objects can be any canvas object, not necessarily widgets. + * + * See also @ref elm_widget_parent_get. + * + * @param[in] obj The object. + * @param[in] sub_obj Sub object to be added. Not necessarily a widget itself. + * + * @return Indicates if the operation succeeded. + * + * @ingroup Elm_Widget_Group + */ +EAPI Eina_Bool elm_widget_sub_object_add(Efl_Ui_Widget *obj, Efl_Canvas_Object *sub_obj); + +/** + * @brief Virtual function handling sub objects being removed. + * + * Sub objects can be any canvas object, not necessarily widgets. + * + * See also @ref elm_widget_parent_get. + * + * @param[in] obj The object. + * @param[in] sub_obj Sub object to be removed. Should be a child of this + * widget. + * + * @return Indicates if the operation succeeded. + * + * @ingroup Elm_Widget_Group + */ +EAPI Eina_Bool elm_widget_sub_object_del(Efl_Ui_Widget *obj, Efl_Canvas_Object *sub_obj); + +/** + * @brief Virtual function called when the widget needs to re-apply its theme. + * + * This may be called when the object is first created, or whenever the widget + * is modified in any way that may require a reload of the theme. This may + * include but is not limited to scale, theme, or mirrored mode changes. + * + * @note even widgets not based on layouts may override this method to handle + * widget updates (scale, mirrored mode, etc...). + * + * @param[in] obj The object. + * + * @return Indicates success, and if the current theme or default theme was + * used. + * + * @ingroup Elm_Widget_Group + */ +EAPI Eina_Error elm_widget_theme_apply(Efl_Ui_Widget *obj); + +/** + * @brief Region of interest inside this widget, that should be given priority + * to be visible inside a scroller. + * + * When this widget or one of its subwidgets is given focus, this region should + * be shown, which means any parent scroller should attempt to display the + * given area of this widget. For instance, an entry given focus should scroll + * to show the text cursor if that cursor moves. In this example, this region + * defines the relative geometry of the cursor within the widget. + * + * @note The region is relative to the top-left corner of the widget, i.e. X,Y + * start from 0,0 to indicate the top-left corner of the widget. W,H must be + * greater or equal to 1 for this region to be taken into account, otherwise it + * is ignored. + * + * @param[in] obj The object. + * + * @return The relative region to show. If width or height is <= 0 it will be + * ignored, and no action will be taken. + * + * @ingroup Elm_Widget_Group + */ +EAPI Eina_Rect elm_widget_focus_region_get(const Efl_Ui_Widget *obj); + +/** + * @brief The rectangle region to be highlighted on focus. + * + * This is a rectangle region where the focus highlight should be displayed. + * + * This is a read-only property. + * + * @param[in] obj The object. + * + * @return The rectangle area. + * + * @ingroup Elm_Widget_Group + */ +EAPI Eina_Rect elm_widget_focus_highlight_geometry_get(const Efl_Ui_Widget *obj); + +/** + * @brief Register focus with the given configuration. + * + * The implementation can feel free to change the logical flag as it wants, but + * other than that it should strictly keep the configuration. + * + * The implementation in elm.widget updates the current state into what is + * passed as configured state, respecting manager changes, registeration and + * unregistration based on if it should be registered or unregistered. + * + * A manager field that is @c null means that the widget should not or was not + * registered. + * + * @param[in] obj The object. + * @param[in] current_state The focus manager to register with. + * @param[in,out] configured_state The evaluated Focus state that should be + * used. + * @param[in] redirect A redirect that will be set by the elm.widget + * implementation. + * + * @return Returns whether the widget is registered or not. + * + * @ingroup Elm_Widget_Group + */ +EAPI Eina_Bool elm_widget_focus_state_apply(Efl_Ui_Widget *obj, Efl_Ui_Widget_Focus_State current_state, Efl_Ui_Widget_Focus_State *configured_state, Efl_Ui_Widget *redirect); + +#endif diff --git a/src/lib/elementary/meson.build b/src/lib/elementary/meson.build index 3b3eae2436..83a02b1791 100644 --- a/src/lib/elementary/meson.build +++ b/src/lib/elementary/meson.build @@ -718,6 +718,7 @@ elementary_pub_headers = [ 'efl_ui_video_eo.legacy.h', 'efl_ui_video_legacy_eo.h', 'efl_ui_video_legacy_eo.legacy.h', + 'efl_ui_widget_eo.legacy.h', 'elm_hoversel_eo.h', 'elm_hoversel_eo.legacy.h', 'elm_hoversel_item_eo.h',