diff --git a/src/Makefile_Elementary.am b/src/Makefile_Elementary.am index 3f632df72e..f8b2319bf6 100644 --- a/src/Makefile_Elementary.am +++ b/src/Makefile_Elementary.am @@ -146,8 +146,6 @@ elm_public_eolian_files += \ lib/elementary/elm_atspi_bridge.eo \ lib/elementary/elm_atspi_app_object.eo \ lib/elementary/efl_ui_image_zoomable_pan.eo \ - lib/elementary/elm_toolbar.eo \ - lib/elementary/elm_toolbar_item.eo \ lib/elementary/elm_view_list.eo \ lib/elementary/elm_view_form.eo \ lib/elementary/elm_web.eo \ @@ -392,6 +390,10 @@ lib/elementary/elm_systray_eo.legacy.c \ lib/elementary/elm_table_eo.c \ lib/elementary/elm_table_eo.legacy.c \ lib/elementary/elm_thumb_eo.c \ +lib/elementary/elm_toolbar_eo.c \ +lib/elementary/elm_toolbar_eo.legacy.c \ +lib/elementary/elm_toolbar_item_eo.c \ +lib/elementary/elm_toolbar_item_eo.legacy.c \ $(NULL) elm_legacy_eo_headers = \ @@ -595,6 +597,10 @@ lib/elementary/elm_table_eo.h \ lib/elementary/elm_table_eo.legacy.h \ lib/elementary/elm_thumb_eo.h \ lib/elementary/elm_thumb_eo.legacy.h \ +lib/elementary/elm_toolbar_eo.h \ +lib/elementary/elm_toolbar_eo.legacy.h \ +lib/elementary/elm_toolbar_item_eo.h \ +lib/elementary/elm_toolbar_item_eo.legacy.h \ $(NULL) diff --git a/src/lib/elementary/elm_toolbar.c b/src/lib/elementary/elm_toolbar.c index d2a447f341..fd1ab52057 100644 --- a/src/lib/elementary/elm_toolbar.c +++ b/src/lib/elementary/elm_toolbar.c @@ -4087,5 +4087,5 @@ ELM_WIDGET_KEY_DOWN_DEFAULT_IMPLEMENT(elm_toolbar, Elm_Toolbar_Data) #define ELM_TOOLBAR_EXTRA_OPS \ EFL_CANVAS_GROUP_ADD_DEL_OPS(elm_toolbar) -#include "elm_toolbar.eo.c" -#include "elm_toolbar_item.eo.c" +#include "elm_toolbar_eo.c" +#include "elm_toolbar_item_eo.c" diff --git a/src/lib/elementary/elm_toolbar.eo b/src/lib/elementary/elm_toolbar.eo deleted file mode 100644 index 43f98de4ba..0000000000 --- a/src/lib/elementary/elm_toolbar.eo +++ /dev/null @@ -1,379 +0,0 @@ -import elm_general; - -enum Elm.Toolbar_Shrink_Mode -{ - [[Set toolbar's items display behavior, it can be scrollable, - show a menu with exceeding items, or simply hide them. - - Default value is #ELM_TOOLBAR_SHRINK_MENU. It reads value - from elm config. - - Values don't work as bitmask, only one can be chosen. - - See also @Elm.Toolbar.shrink_mode.set, @Elm.Toolbar.shrink_mode.get. - ]] - - legacy: elm_toolbar_shrink; - - none, [[Set toolbar minimum size to fit all the items.]] - hide, [[Hide exceeding items.]] - scroll, [[Allow accessing exceeding items through a scroller.]] - menu, [[Inserts a button to pop up a menu with exceeding items.]] - expand, [[Expand all items according the size of the toolbar.]] - last [[Indicates error if returned by elm_toolbar_shrink_mode_get()]] -} - -class Elm.Toolbar extends Efl.Ui.Widget implements Efl.Ui.Focus.Composition, Elm.Interface_Scrollable, Efl.Ui.Direction, - Efl.Access.Widget.Action, Efl.Access.Selection, Efl.Access.Object, - Efl.Ui.Clickable, Efl.Ui.Selectable, Efl.Ui.Legacy, Elm.Widget_Item_Container -{ - [[Elementary toolbar class]] - legacy_prefix: elm_toolbar; - eo_prefix: elm_obj_toolbar; - event_prefix: elm_toolbar; - methods { - @property selected_item { - get { - [[Get the selected item in the widget.]] - } - values { - item: Elm.Widget.Item; [[The selected item or $null.]] - } - } - @property first_item { - get { - [[Get the first item in the widget.]] - } - values { - item: Elm.Widget.Item; [[The first item or $null.]] - } - } - @property last_item { - get { - [[Get the last item in the widget.]] - } - values { - item: Elm.Widget.Item; [[The last item or $null.]] - } - } - @property items { - get { - [[Returns a list of the widget item.]] - return: iterator @owned @warn_unused; [[iterator to widget items]] - } - } - @property homogeneous { - [[Control homogeneous mode. - - This will enable the homogeneous mode where items are of the same size.]] - set { - } - get { - } - values { - homogeneous: bool; [[Assume the items within the toolbar are of the same size (true = on, false = off). Default is $false.]] - } - } - @property align { - [[Control the alignment of the items. - - Alignment of toolbar items, from 0.0 to indicates to align - left, to 1.0, to align to right. 0.5 centralize - items. - - Centered items by default.]] - set { - } - get { - } - values { - align: double; [[The new alignment, a float between 0.0 and 1.0.]] - } - } - @property select_mode { - [[Control the toolbar select mode. - - elm_toolbar_select_mode_set() changes item select mode in the toolbar widget. - - #ELM_OBJECT_SELECT_MODE_DEFAULT : Items will only call their selection func and - callback when first becoming selected. Any further clicks will - do nothing, unless you set always select mode. - - #ELM_OBJECT_SELECT_MODE_ALWAYS : This means that, even if selected, - every click will make the selected callbacks be called. - - #ELM_OBJECT_SELECT_MODE_NONE : This will turn off the ability to select items - entirely and they will neither appear selected nor call selected - callback functions.]] - set { - } - get { - } - values { - mode: Elm.Object.Select_Mode(Elm.Object.Select_Mode.max); [[The select mode If getting mode fails, it returns #ELM_OBJECT_SELECT_MODE_MAX]] - } - } - @property icon_size { - [[Control the icon size, in pixels, to be used by toolbar items. - - Note: Default value is $32. It reads value from elm config.]] - set { - } - get { - } - values { - icon_size: int; [[The icon size in pixels]] - } - } - @property shrink_mode { - [[Control the item displaying mode of a given toolbar widget $obj. - - The toolbar won't scroll under #ELM_TOOLBAR_SHRINK_NONE mode, but - it will enforce a minimum size, so that all the items will fit - inside it. It won't scroll and won't show the items that don't fit - under #ELM_TOOLBAR_SHRINK_HIDE mode. Finally, it'll scroll under - #ELM_TOOLBAR_SHRINK_SCROLL mode, and it will create a button to - aggregate items which didn't fit with the #ELM_TOOLBAR_SHRINK_MENU - mode. - - If shrink mode is changed, Toolbar will send one of the following - signal to each item for informing the current shrink mode. - "elm,state,shrink,default" - "elm,state,shrink,hide" - "elm,state,shrink,scroll" - "elm,state,shrink,menu" - "elm,state,shrink,expand" - - Warning: This function's behavior will clash with those of - elm_scroller_policy_set(), so use either one of them, but not both.]] - set { - } - get { - } - values { - shrink_mode: Elm.Toolbar_Shrink_Mode; [[Toolbar's items display behavior]] - } - } - @property menu_parent { - [[Control the parent object of the toolbar items' menus. - - Each item can be set as item menu, with elm_toolbar_item_menu_set(). - - For more details about setting the parent for toolbar menus, see - elm_menu_parent_set(). - - See: elm_menu_parent_set() for details. - See: elm_toolbar_item_menu_set() for details.]] - set { - } - get { - } - values { - parent: Efl.Canvas.Object; [[The parent of the menu objects.]] - } - } - @property standard_priority { - [[Set the standard priority of visible items in a toolbar - - If the priority of the item is up to standard priority, it is shown in basic panel. - The other items are located in more menu or panel. The more menu or panel can be shown when the more item is clicked. - - @since 1.7]] - set { - } - get { - } - values { - priority: int; [[The standard_priority of visible items]] - } - } - @property more_item { - get { - [[Get the more item which is auto-generated by toolbar. - - Toolbar generates 'more' item when there is no more space to fit items in - and toolbar is in #ELM_TOOLBAR_SHRINK_MENU or #ELM_TOOLBAR_SHRINK_EXPAND mode. - The more item can be manipulated by elm_object_item_text_set() and - elm_object_item_content_set.]] - - return: Elm.Widget.Item; [[The toolbar more item.]] - } - } - item_insert_before { - [[Insert a new item into the toolbar object before item $before. - - A new item will be created and added to the toolbar. Its position in - this toolbar will be just before item $before. - - Items created with this method can be deleted with - elm_object_item_del(). - - Associated $data can be properly freed when item is deleted if a - callback function is set with elm_object_item_del_cb_set(). - - If a function is passed as argument, it will be called every time this item - is selected, i.e., the user clicks over an unselected item. - If such function isn't needed, just passing - $NULL as $func is enough. The same should be done for $data. - - Toolbar will load icon image from fdo or current theme. - This behavior can be set by elm_toolbar_icon_order_lookup_set() function. - If an absolute path is provided it will load it direct from a file. - - Note: This function does not accept relative icon path. - - See: elm_toolbar_item_icon_set()]] - - return: Elm.Widget.Item; [[The created item or $NULL upon failure.]] - params { - @in before: Elm.Widget.Item; [[The toolbar item to insert before.]] - @in icon: string @optional; [[A string with icon name or the absolute path of an image file.]] - @in label: string; [[The label of the item.]] - @in func: Evas_Smart_Cb @optional; [[The function to call when the item is clicked.]] - @in data: const(void_ptr) @optional; [[The data to associate with the item for related callbacks.]] - } - } - item_insert_after { - [[Insert a new item into the toolbar object after item $after. - - A new item will be created and added to the toolbar. Its position in - this toolbar will be just after item $after. - - Items created with this method can be deleted with - elm_object_item_del(). - - Associated $data can be properly freed when item is deleted if a - callback function is set with elm_object_item_del_cb_set(). - - If a function is passed as argument, it will be called every time this item - is selected, i.e., the user clicks over an unselected item. - If such function isn't needed, just passing - $NULL as $func is enough. The same should be done for $data. - - Toolbar will load icon image from fdo or current theme. - This behavior can be set by elm_toolbar_icon_order_lookup_set() function. - If an absolute path is provided it will load it direct from a file. - - Note: This function does not accept relative icon path. - - See: elm_toolbar_item_icon_set()]] - - return: Elm.Widget.Item; [[The created item or $NULL upon failure.]] - params { - @in after: Elm.Widget.Item; [[The toolbar item to insert after.]] - @in icon: string @optional; [[A string with icon name or the absolute path of an image file.]] - @in label: string; [[The label of the item.]] - @in func: Evas_Smart_Cb @optional; [[The function to call when the item is clicked.]] - @in data: const(void_ptr) @optional; [[The data to associate with the item for related callbacks.]] - } - } - item_append { - [[Append item to the toolbar. - - A new item will be created and appended to the toolbar, i.e., will - be set as last item. - - Items created with this method can be deleted with - elm_object_item_del(). - - Associated $data can be properly freed when item is deleted if a - callback function is set with elm_object_item_del_cb_set(). - - If a function is passed as argument, it will be called every time this item - is selected, i.e., the user clicks over an unselected item. - If such function isn't needed, just passing - $NULL as $func is enough. The same should be done for $data. - - Toolbar will load icon image from fdo or current theme. - This behavior can be set by elm_toolbar_icon_order_lookup_set() function. - If an absolute path is provided it will load it direct from a file. - - Note: This function does not accept relative icon path. - - See: elm_toolbar_item_icon_set()]] - - return: Elm.Widget.Item; [[The created item or $NULL upon failure.]] - params { - @in icon: string @optional; [[A string with icon name or the absolute path of an image file.]] - @in label: string; [[The label of the item.]] - @in func: Evas_Smart_Cb @optional; [[The function to call when the item is clicked.]] - @in data: const(void_ptr) @optional; [[The data to associate with the item for related callbacks.]] - } - } - items_count @const { - [[Get the number of items in a toolbar]] - return: uint; [[The number of items in $obj toolbar]] - } - item_prepend { - [[Prepend item to the toolbar. - - A new item will be created and prepended to the toolbar, i.e., will - be set as first item. - - Items created with this method can be deleted with - elm_object_item_del(). - - Associated $data can be properly freed when item is deleted if a - callback function is set with elm_object_item_del_cb_set(). - - If a function is passed as argument, it will be called every time this item - is selected, i.e., the user clicks over an unselected item. - If such function isn't needed, just passing - $NULL as $func is enough. The same should be done for $data. - - Toolbar will load icon image from fdo or current theme. - This behavior can be set by elm_toolbar_icon_order_lookup_set() function. - If an absolute path is provided it will load it direct from a file. - - Note: This function does not accept relative icon path. - - See: elm_toolbar_item_icon_set()]] - - return: Elm.Widget.Item; [[The created item or $NULL upon failure.]] - params { - @in icon: string @optional; [[A string with icon name or the absolute path of an image file.]] - @in label: string; [[The label of the item.]] - @in func: Evas_Smart_Cb @optional; [[The function to call when the item is clicked.]] - @in data: const(void_ptr) @optional; [[The data to associate with the item for related callbacks.]] - } - } - item_find_by_label @const { - [[Returns a pointer to a toolbar item by its label.]] - - return: Elm.Widget.Item; [[The pointer to the toolbar item matching $label or $NULL on failure.]] - params { - @in label: string; [[The label of the item to find.]] - } - } - } - implements { - class.constructor; - Efl.Object.constructor; - Efl.Gfx.Entity.position { set; } - Efl.Gfx.Entity.size { set; } - Efl.Canvas.Group.group_calculate; - Efl.Canvas.Group.group_member_add; - Efl.Ui.Widget.on_access_update; - Efl.Ui.Widget.theme_apply; - Efl.Ui.Focus.Object.on_focus_update; - Efl.Ui.L10n.translation_update; - Efl.Ui.Widget.widget_input_event_handler; - Efl.Ui.Widget.focus_highlight_geometry { get; } - Elm.Widget_Item_Container.focused_item { get; } - Efl.Ui.Direction.direction { get; set; [[Only supports $vertical and $horizontal. Default is $horizontal.]] } - Efl.Ui.Widget.focus_state_apply; - Efl.Access.Widget.Action.elm_actions { get; } - Efl.Access.Object.access_children { get; } - Efl.Access.Object.state_set { get; } - Efl.Access.Selection.selected_children_count { get; } - Efl.Access.Selection.selected_child { get; } - Efl.Access.Selection.selected_child_deselect; - Efl.Access.Selection.child_select; - Efl.Access.Selection.child_deselect; - Efl.Access.Selection.is_child_selected; - Efl.Access.Selection.all_children_select; - Efl.Access.Selection.access_selection_clear; - Efl.Ui.Focus.Composition.prepare; - } - events { - item,focused: Efl.Object; [[Called when toolbar item got focus]] - item,unfocused: Efl.Object; [[Called when toolbar item lost focus]] - } -} diff --git a/src/lib/elementary/elm_toolbar.h b/src/lib/elementary/elm_toolbar.h index ef237c47a5..9e9ec74d37 100644 --- a/src/lib/elementary/elm_toolbar.h +++ b/src/lib/elementary/elm_toolbar.h @@ -71,6 +71,7 @@ #include #ifdef EFL_EO_API_SUPPORT #include +#include #endif #ifndef EFL_NOLEGACY_API_SUPPORT #include diff --git a/src/lib/elementary/elm_toolbar_eo.c b/src/lib/elementary/elm_toolbar_eo.c new file mode 100644 index 0000000000..ee20e4605e --- /dev/null +++ b/src/lib/elementary/elm_toolbar_eo.c @@ -0,0 +1,377 @@ +EWAPI const Efl_Event_Description _ELM_TOOLBAR_EVENT_ITEM_FOCUSED = + EFL_EVENT_DESCRIPTION("item,focused"); +EWAPI const Efl_Event_Description _ELM_TOOLBAR_EVENT_ITEM_UNFOCUSED = + EFL_EVENT_DESCRIPTION("item,unfocused"); + +Elm_Widget_Item *_elm_toolbar_selected_item_get(const Eo *obj, Elm_Toolbar_Data *pd); + +EOAPI EFL_FUNC_BODY_CONST(elm_obj_toolbar_selected_item_get, Elm_Widget_Item *, NULL); + +Elm_Widget_Item *_elm_toolbar_first_item_get(const Eo *obj, Elm_Toolbar_Data *pd); + +EOAPI EFL_FUNC_BODY_CONST(elm_obj_toolbar_first_item_get, Elm_Widget_Item *, NULL); + +Elm_Widget_Item *_elm_toolbar_last_item_get(const Eo *obj, Elm_Toolbar_Data *pd); + +EOAPI EFL_FUNC_BODY_CONST(elm_obj_toolbar_last_item_get, Elm_Widget_Item *, NULL); + +Eina_Iterator *_elm_toolbar_items_get(const Eo *obj, Elm_Toolbar_Data *pd); + +EOAPI EFL_FUNC_BODY_CONST(elm_obj_toolbar_items_get, Eina_Iterator *, NULL); + +void _elm_toolbar_homogeneous_set(Eo *obj, Elm_Toolbar_Data *pd, Eina_Bool homogeneous); + + +static Eina_Error +__eolian_elm_toolbar_homogeneous_set_reflect(Eo *obj, Eina_Value val) +{ + Eina_Error r = 0; Eina_Bool cval; + if (!eina_value_bool_convert(&val, &cval)) + { + r = EINA_ERROR_VALUE_FAILED; + goto end; + } + elm_obj_toolbar_homogeneous_set(obj, cval); + end: + eina_value_flush(&val); + return r; +} + +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_toolbar_homogeneous_set, EFL_FUNC_CALL(homogeneous), Eina_Bool homogeneous); + +Eina_Bool _elm_toolbar_homogeneous_get(const Eo *obj, Elm_Toolbar_Data *pd); + + +static Eina_Value +__eolian_elm_toolbar_homogeneous_get_reflect(Eo *obj) +{ + Eina_Bool val = elm_obj_toolbar_homogeneous_get(obj); + return eina_value_bool_init(val); +} + +EOAPI EFL_FUNC_BODY_CONST(elm_obj_toolbar_homogeneous_get, Eina_Bool, 0); + +void _elm_toolbar_align_set(Eo *obj, Elm_Toolbar_Data *pd, double align); + + +static Eina_Error +__eolian_elm_toolbar_align_set_reflect(Eo *obj, Eina_Value val) +{ + Eina_Error r = 0; double cval; + if (!eina_value_double_convert(&val, &cval)) + { + r = EINA_ERROR_VALUE_FAILED; + goto end; + } + elm_obj_toolbar_align_set(obj, cval); + end: + eina_value_flush(&val); + return r; +} + +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_toolbar_align_set, EFL_FUNC_CALL(align), double align); + +double _elm_toolbar_align_get(const Eo *obj, Elm_Toolbar_Data *pd); + + +static Eina_Value +__eolian_elm_toolbar_align_get_reflect(Eo *obj) +{ + double val = elm_obj_toolbar_align_get(obj); + return eina_value_double_init(val); +} + +EOAPI EFL_FUNC_BODY_CONST(elm_obj_toolbar_align_get, double, 0); + +void _elm_toolbar_select_mode_set(Eo *obj, Elm_Toolbar_Data *pd, Elm_Object_Select_Mode mode); + +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_toolbar_select_mode_set, EFL_FUNC_CALL(mode), Elm_Object_Select_Mode mode); + +Elm_Object_Select_Mode _elm_toolbar_select_mode_get(const Eo *obj, Elm_Toolbar_Data *pd); + +EOAPI EFL_FUNC_BODY_CONST(elm_obj_toolbar_select_mode_get, Elm_Object_Select_Mode, 4 /* Elm.Object.Select_Mode.max */); + +void _elm_toolbar_icon_size_set(Eo *obj, Elm_Toolbar_Data *pd, int icon_size); + + +static Eina_Error +__eolian_elm_toolbar_icon_size_set_reflect(Eo *obj, Eina_Value val) +{ + Eina_Error r = 0; int cval; + if (!eina_value_int_convert(&val, &cval)) + { + r = EINA_ERROR_VALUE_FAILED; + goto end; + } + elm_obj_toolbar_icon_size_set(obj, cval); + end: + eina_value_flush(&val); + return r; +} + +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_toolbar_icon_size_set, EFL_FUNC_CALL(icon_size), int icon_size); + +int _elm_toolbar_icon_size_get(const Eo *obj, Elm_Toolbar_Data *pd); + + +static Eina_Value +__eolian_elm_toolbar_icon_size_get_reflect(Eo *obj) +{ + int val = elm_obj_toolbar_icon_size_get(obj); + return eina_value_int_init(val); +} + +EOAPI EFL_FUNC_BODY_CONST(elm_obj_toolbar_icon_size_get, int, 0); + +void _elm_toolbar_shrink_mode_set(Eo *obj, Elm_Toolbar_Data *pd, Elm_Toolbar_Shrink_Mode shrink_mode); + +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_toolbar_shrink_mode_set, EFL_FUNC_CALL(shrink_mode), Elm_Toolbar_Shrink_Mode shrink_mode); + +Elm_Toolbar_Shrink_Mode _elm_toolbar_shrink_mode_get(const Eo *obj, Elm_Toolbar_Data *pd); + +EOAPI EFL_FUNC_BODY_CONST(elm_obj_toolbar_shrink_mode_get, Elm_Toolbar_Shrink_Mode, 0); + +void _elm_toolbar_menu_parent_set(Eo *obj, Elm_Toolbar_Data *pd, Efl_Canvas_Object *parent); + +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_toolbar_menu_parent_set, EFL_FUNC_CALL(parent), Efl_Canvas_Object *parent); + +Efl_Canvas_Object *_elm_toolbar_menu_parent_get(const Eo *obj, Elm_Toolbar_Data *pd); + +EOAPI EFL_FUNC_BODY_CONST(elm_obj_toolbar_menu_parent_get, Efl_Canvas_Object *, NULL); + +void _elm_toolbar_standard_priority_set(Eo *obj, Elm_Toolbar_Data *pd, int priority); + + +static Eina_Error +__eolian_elm_toolbar_standard_priority_set_reflect(Eo *obj, Eina_Value val) +{ + Eina_Error r = 0; int cval; + if (!eina_value_int_convert(&val, &cval)) + { + r = EINA_ERROR_VALUE_FAILED; + goto end; + } + elm_obj_toolbar_standard_priority_set(obj, cval); + end: + eina_value_flush(&val); + return r; +} + +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_toolbar_standard_priority_set, EFL_FUNC_CALL(priority), int priority); + +int _elm_toolbar_standard_priority_get(const Eo *obj, Elm_Toolbar_Data *pd); + + +static Eina_Value +__eolian_elm_toolbar_standard_priority_get_reflect(Eo *obj) +{ + int val = elm_obj_toolbar_standard_priority_get(obj); + return eina_value_int_init(val); +} + +EOAPI EFL_FUNC_BODY_CONST(elm_obj_toolbar_standard_priority_get, int, 0); + +Elm_Widget_Item *_elm_toolbar_more_item_get(const Eo *obj, Elm_Toolbar_Data *pd); + +EOAPI EFL_FUNC_BODY_CONST(elm_obj_toolbar_more_item_get, Elm_Widget_Item *, NULL); + +Elm_Widget_Item *_elm_toolbar_item_insert_before(Eo *obj, Elm_Toolbar_Data *pd, Elm_Widget_Item *before, const char *icon, const char *label, Evas_Smart_Cb func, const void *data); + +EOAPI EFL_FUNC_BODYV(elm_obj_toolbar_item_insert_before, Elm_Widget_Item *, NULL, EFL_FUNC_CALL(before, icon, label, func, data), Elm_Widget_Item *before, const char *icon, const char *label, Evas_Smart_Cb func, const void *data); + +Elm_Widget_Item *_elm_toolbar_item_insert_after(Eo *obj, Elm_Toolbar_Data *pd, Elm_Widget_Item *after, const char *icon, const char *label, Evas_Smart_Cb func, const void *data); + +EOAPI EFL_FUNC_BODYV(elm_obj_toolbar_item_insert_after, Elm_Widget_Item *, NULL, EFL_FUNC_CALL(after, icon, label, func, data), Elm_Widget_Item *after, const char *icon, const char *label, Evas_Smart_Cb func, const void *data); + +Elm_Widget_Item *_elm_toolbar_item_append(Eo *obj, Elm_Toolbar_Data *pd, const char *icon, const char *label, Evas_Smart_Cb func, const void *data); + +EOAPI EFL_FUNC_BODYV(elm_obj_toolbar_item_append, Elm_Widget_Item *, NULL, EFL_FUNC_CALL(icon, label, func, data), const char *icon, const char *label, Evas_Smart_Cb func, const void *data); + +unsigned int _elm_toolbar_items_count(const Eo *obj, Elm_Toolbar_Data *pd); + +EOAPI EFL_FUNC_BODY_CONST(elm_obj_toolbar_items_count, unsigned int, 0); + +Elm_Widget_Item *_elm_toolbar_item_prepend(Eo *obj, Elm_Toolbar_Data *pd, const char *icon, const char *label, Evas_Smart_Cb func, const void *data); + +EOAPI EFL_FUNC_BODYV(elm_obj_toolbar_item_prepend, Elm_Widget_Item *, NULL, EFL_FUNC_CALL(icon, label, func, data), const char *icon, const char *label, Evas_Smart_Cb func, const void *data); + +Elm_Widget_Item *_elm_toolbar_item_find_by_label(const Eo *obj, Elm_Toolbar_Data *pd, const char *label); + +EOAPI EFL_FUNC_BODYV_CONST(elm_obj_toolbar_item_find_by_label, Elm_Widget_Item *, NULL, EFL_FUNC_CALL(label), const char *label); + +Efl_Object *_elm_toolbar_efl_object_constructor(Eo *obj, Elm_Toolbar_Data *pd); + + +void _elm_toolbar_efl_gfx_entity_position_set(Eo *obj, Elm_Toolbar_Data *pd, Eina_Position2D pos); + + +void _elm_toolbar_efl_gfx_entity_size_set(Eo *obj, Elm_Toolbar_Data *pd, Eina_Size2D size); + + +void _elm_toolbar_efl_canvas_group_group_calculate(Eo *obj, Elm_Toolbar_Data *pd); + + +void _elm_toolbar_efl_canvas_group_group_member_add(Eo *obj, Elm_Toolbar_Data *pd, Efl_Canvas_Object *sub_obj); + + +void _elm_toolbar_efl_ui_widget_on_access_update(Eo *obj, Elm_Toolbar_Data *pd, Eina_Bool enable); + + +Eina_Error _elm_toolbar_efl_ui_widget_theme_apply(Eo *obj, Elm_Toolbar_Data *pd); + + +Eina_Bool _elm_toolbar_efl_ui_focus_object_on_focus_update(Eo *obj, Elm_Toolbar_Data *pd); + + +void _elm_toolbar_efl_ui_l10n_translation_update(Eo *obj, Elm_Toolbar_Data *pd); + + +Eina_Bool _elm_toolbar_efl_ui_widget_widget_input_event_handler(Eo *obj, Elm_Toolbar_Data *pd, const Efl_Event *eo_event, Efl_Canvas_Object *source); + + +Eina_Rect _elm_toolbar_efl_ui_widget_focus_highlight_geometry_get(const Eo *obj, Elm_Toolbar_Data *pd); + + +Elm_Widget_Item *_elm_toolbar_elm_widget_item_container_focused_item_get(const Eo *obj, Elm_Toolbar_Data *pd); + + +void _elm_toolbar_efl_ui_direction_direction_set(Eo *obj, Elm_Toolbar_Data *pd, Efl_Ui_Dir dir); + + +Efl_Ui_Dir _elm_toolbar_efl_ui_direction_direction_get(const Eo *obj, Elm_Toolbar_Data *pd); + + +Eina_Bool _elm_toolbar_efl_ui_widget_focus_state_apply(Eo *obj, Elm_Toolbar_Data *pd, Efl_Ui_Widget_Focus_State current_state, Efl_Ui_Widget_Focus_State *configured_state, Efl_Ui_Widget *redirect); + + +const Efl_Access_Action_Data *_elm_toolbar_efl_access_widget_action_elm_actions_get(const Eo *obj, Elm_Toolbar_Data *pd); + + +Eina_List *_elm_toolbar_efl_access_object_access_children_get(const Eo *obj, Elm_Toolbar_Data *pd); + + +Efl_Access_State_Set _elm_toolbar_efl_access_object_state_set_get(const Eo *obj, Elm_Toolbar_Data *pd); + + +int _elm_toolbar_efl_access_selection_selected_children_count_get(const Eo *obj, Elm_Toolbar_Data *pd); + + +Efl_Object *_elm_toolbar_efl_access_selection_selected_child_get(const Eo *obj, Elm_Toolbar_Data *pd, int selected_child_index); + + +Eina_Bool _elm_toolbar_efl_access_selection_selected_child_deselect(Eo *obj, Elm_Toolbar_Data *pd, int child_index); + + +Eina_Bool _elm_toolbar_efl_access_selection_child_select(Eo *obj, Elm_Toolbar_Data *pd, int child_index); + + +Eina_Bool _elm_toolbar_efl_access_selection_child_deselect(Eo *obj, Elm_Toolbar_Data *pd, int child_index); + + +Eina_Bool _elm_toolbar_efl_access_selection_is_child_selected(Eo *obj, Elm_Toolbar_Data *pd, int child_index); + + +Eina_Bool _elm_toolbar_efl_access_selection_all_children_select(Eo *obj, Elm_Toolbar_Data *pd); + + +Eina_Bool _elm_toolbar_efl_access_selection_access_selection_clear(Eo *obj, Elm_Toolbar_Data *pd); + + +void _elm_toolbar_efl_ui_focus_composition_prepare(Eo *obj, Elm_Toolbar_Data *pd); + + +static Eina_Bool +_elm_toolbar_class_initializer(Efl_Class *klass) +{ + const Efl_Object_Ops *opsp = NULL; + + const Efl_Object_Property_Reflection_Ops *ropsp = NULL; + +#ifndef ELM_TOOLBAR_EXTRA_OPS +#define ELM_TOOLBAR_EXTRA_OPS +#endif + + EFL_OPS_DEFINE(ops, + EFL_OBJECT_OP_FUNC(elm_obj_toolbar_selected_item_get, _elm_toolbar_selected_item_get), + EFL_OBJECT_OP_FUNC(elm_obj_toolbar_first_item_get, _elm_toolbar_first_item_get), + EFL_OBJECT_OP_FUNC(elm_obj_toolbar_last_item_get, _elm_toolbar_last_item_get), + EFL_OBJECT_OP_FUNC(elm_obj_toolbar_items_get, _elm_toolbar_items_get), + EFL_OBJECT_OP_FUNC(elm_obj_toolbar_homogeneous_set, _elm_toolbar_homogeneous_set), + EFL_OBJECT_OP_FUNC(elm_obj_toolbar_homogeneous_get, _elm_toolbar_homogeneous_get), + EFL_OBJECT_OP_FUNC(elm_obj_toolbar_align_set, _elm_toolbar_align_set), + EFL_OBJECT_OP_FUNC(elm_obj_toolbar_align_get, _elm_toolbar_align_get), + EFL_OBJECT_OP_FUNC(elm_obj_toolbar_select_mode_set, _elm_toolbar_select_mode_set), + EFL_OBJECT_OP_FUNC(elm_obj_toolbar_select_mode_get, _elm_toolbar_select_mode_get), + EFL_OBJECT_OP_FUNC(elm_obj_toolbar_icon_size_set, _elm_toolbar_icon_size_set), + EFL_OBJECT_OP_FUNC(elm_obj_toolbar_icon_size_get, _elm_toolbar_icon_size_get), + EFL_OBJECT_OP_FUNC(elm_obj_toolbar_shrink_mode_set, _elm_toolbar_shrink_mode_set), + EFL_OBJECT_OP_FUNC(elm_obj_toolbar_shrink_mode_get, _elm_toolbar_shrink_mode_get), + EFL_OBJECT_OP_FUNC(elm_obj_toolbar_menu_parent_set, _elm_toolbar_menu_parent_set), + EFL_OBJECT_OP_FUNC(elm_obj_toolbar_menu_parent_get, _elm_toolbar_menu_parent_get), + EFL_OBJECT_OP_FUNC(elm_obj_toolbar_standard_priority_set, _elm_toolbar_standard_priority_set), + EFL_OBJECT_OP_FUNC(elm_obj_toolbar_standard_priority_get, _elm_toolbar_standard_priority_get), + EFL_OBJECT_OP_FUNC(elm_obj_toolbar_more_item_get, _elm_toolbar_more_item_get), + EFL_OBJECT_OP_FUNC(elm_obj_toolbar_item_insert_before, _elm_toolbar_item_insert_before), + EFL_OBJECT_OP_FUNC(elm_obj_toolbar_item_insert_after, _elm_toolbar_item_insert_after), + EFL_OBJECT_OP_FUNC(elm_obj_toolbar_item_append, _elm_toolbar_item_append), + EFL_OBJECT_OP_FUNC(elm_obj_toolbar_items_count, _elm_toolbar_items_count), + EFL_OBJECT_OP_FUNC(elm_obj_toolbar_item_prepend, _elm_toolbar_item_prepend), + EFL_OBJECT_OP_FUNC(elm_obj_toolbar_item_find_by_label, _elm_toolbar_item_find_by_label), + EFL_OBJECT_OP_FUNC(efl_constructor, _elm_toolbar_efl_object_constructor), + EFL_OBJECT_OP_FUNC(efl_gfx_entity_position_set, _elm_toolbar_efl_gfx_entity_position_set), + EFL_OBJECT_OP_FUNC(efl_gfx_entity_size_set, _elm_toolbar_efl_gfx_entity_size_set), + EFL_OBJECT_OP_FUNC(efl_canvas_group_calculate, _elm_toolbar_efl_canvas_group_group_calculate), + EFL_OBJECT_OP_FUNC(efl_canvas_group_member_add, _elm_toolbar_efl_canvas_group_group_member_add), + EFL_OBJECT_OP_FUNC(efl_ui_widget_on_access_update, _elm_toolbar_efl_ui_widget_on_access_update), + EFL_OBJECT_OP_FUNC(efl_ui_widget_theme_apply, _elm_toolbar_efl_ui_widget_theme_apply), + EFL_OBJECT_OP_FUNC(efl_ui_focus_object_on_focus_update, _elm_toolbar_efl_ui_focus_object_on_focus_update), + EFL_OBJECT_OP_FUNC(efl_ui_l10n_translation_update, _elm_toolbar_efl_ui_l10n_translation_update), + EFL_OBJECT_OP_FUNC(efl_ui_widget_input_event_handler, _elm_toolbar_efl_ui_widget_widget_input_event_handler), + EFL_OBJECT_OP_FUNC(efl_ui_widget_focus_highlight_geometry_get, _elm_toolbar_efl_ui_widget_focus_highlight_geometry_get), + EFL_OBJECT_OP_FUNC(elm_widget_item_container_focused_item_get, _elm_toolbar_elm_widget_item_container_focused_item_get), + EFL_OBJECT_OP_FUNC(efl_ui_direction_set, _elm_toolbar_efl_ui_direction_direction_set), + EFL_OBJECT_OP_FUNC(efl_ui_direction_get, _elm_toolbar_efl_ui_direction_direction_get), + EFL_OBJECT_OP_FUNC(efl_ui_widget_focus_state_apply, _elm_toolbar_efl_ui_widget_focus_state_apply), + EFL_OBJECT_OP_FUNC(efl_access_widget_action_elm_actions_get, _elm_toolbar_efl_access_widget_action_elm_actions_get), + EFL_OBJECT_OP_FUNC(efl_access_object_access_children_get, _elm_toolbar_efl_access_object_access_children_get), + EFL_OBJECT_OP_FUNC(efl_access_object_state_set_get, _elm_toolbar_efl_access_object_state_set_get), + EFL_OBJECT_OP_FUNC(efl_access_selection_selected_children_count_get, _elm_toolbar_efl_access_selection_selected_children_count_get), + EFL_OBJECT_OP_FUNC(efl_access_selection_selected_child_get, _elm_toolbar_efl_access_selection_selected_child_get), + EFL_OBJECT_OP_FUNC(efl_access_selection_selected_child_deselect, _elm_toolbar_efl_access_selection_selected_child_deselect), + EFL_OBJECT_OP_FUNC(efl_access_selection_child_select, _elm_toolbar_efl_access_selection_child_select), + EFL_OBJECT_OP_FUNC(efl_access_selection_child_deselect, _elm_toolbar_efl_access_selection_child_deselect), + EFL_OBJECT_OP_FUNC(efl_access_selection_is_child_selected, _elm_toolbar_efl_access_selection_is_child_selected), + EFL_OBJECT_OP_FUNC(efl_access_selection_all_children_select, _elm_toolbar_efl_access_selection_all_children_select), + EFL_OBJECT_OP_FUNC(efl_access_selection_clear, _elm_toolbar_efl_access_selection_access_selection_clear), + EFL_OBJECT_OP_FUNC(efl_ui_focus_composition_prepare, _elm_toolbar_efl_ui_focus_composition_prepare), + ELM_TOOLBAR_EXTRA_OPS + ); + opsp = &ops; + + static const Efl_Object_Property_Reflection refl_table[] = { + {"homogeneous", __eolian_elm_toolbar_homogeneous_set_reflect, __eolian_elm_toolbar_homogeneous_get_reflect}, + {"align", __eolian_elm_toolbar_align_set_reflect, __eolian_elm_toolbar_align_get_reflect}, + {"icon_size", __eolian_elm_toolbar_icon_size_set_reflect, __eolian_elm_toolbar_icon_size_get_reflect}, + {"standard_priority", __eolian_elm_toolbar_standard_priority_set_reflect, __eolian_elm_toolbar_standard_priority_get_reflect}, + }; + static const Efl_Object_Property_Reflection_Ops rops = { + refl_table, EINA_C_ARRAY_LENGTH(refl_table) + }; + ropsp = &rops; + + return efl_class_functions_set(klass, opsp, ropsp); +} + +static const Efl_Class_Description _elm_toolbar_class_desc = { + EO_VERSION, + "Elm.Toolbar", + EFL_CLASS_TYPE_REGULAR, + sizeof(Elm_Toolbar_Data), + _elm_toolbar_class_initializer, + _elm_toolbar_class_constructor, + NULL +}; + +EFL_DEFINE_CLASS(elm_toolbar_class_get, &_elm_toolbar_class_desc, EFL_UI_WIDGET_CLASS, EFL_UI_FOCUS_COMPOSITION_MIXIN, ELM_INTERFACE_SCROLLABLE_MIXIN, EFL_UI_DIRECTION_INTERFACE, EFL_ACCESS_WIDGET_ACTION_MIXIN, EFL_ACCESS_SELECTION_INTERFACE, EFL_ACCESS_OBJECT_MIXIN, EFL_UI_CLICKABLE_INTERFACE, EFL_UI_SELECTABLE_INTERFACE, EFL_UI_LEGACY_INTERFACE, ELM_WIDGET_ITEM_CONTAINER_INTERFACE, NULL); + +#include "elm_toolbar_eo.legacy.c" diff --git a/src/lib/elementary/elm_toolbar_eo.h b/src/lib/elementary/elm_toolbar_eo.h index 604ca3fdcc..ae7d8ae467 100644 --- a/src/lib/elementary/elm_toolbar_eo.h +++ b/src/lib/elementary/elm_toolbar_eo.h @@ -1,13 +1,551 @@ +#ifndef _ELM_TOOLBAR_EO_H_ +#define _ELM_TOOLBAR_EO_H_ + +#ifndef _ELM_TOOLBAR_EO_CLASS_TYPE +#define _ELM_TOOLBAR_EO_CLASS_TYPE + +typedef Eo Elm_Toolbar; + +#endif + +#ifndef _ELM_TOOLBAR_EO_TYPES +#define _ELM_TOOLBAR_EO_TYPES + /** - * @ingroup Elm_Toolbar + * @brief Set toolbar's items display behavior, it can be scrollable, show a + * menu with exceeding items, or simply hide them. * - * @{ + * Default value is #ELM_TOOLBAR_SHRINK_MENU. It reads value from elm config. + * + * Values don't work as bitmask, only one can be chosen. + * + * See also @ref elm_obj_toolbar_shrink_mode_set, + * @ref elm_obj_toolbar_shrink_mode_get. + * + * @ingroup Elm */ +typedef enum +{ + ELM_TOOLBAR_SHRINK_NONE = 0, /**< Set toolbar minimum size to fit all the + * items. */ + ELM_TOOLBAR_SHRINK_HIDE, /**< Hide exceeding items. */ + ELM_TOOLBAR_SHRINK_SCROLL, /**< Allow accessing exceeding items through a + * scroller. */ + ELM_TOOLBAR_SHRINK_MENU, /**< Inserts a button to pop up a menu with exceeding + * items. */ + ELM_TOOLBAR_SHRINK_EXPAND, /**< Expand all items according the size of the + * toolbar. */ + ELM_TOOLBAR_SHRINK_LAST /**< Indicates error if returned by + * elm_toolbar_shrink_mode_get() */ +} Elm_Toolbar_Shrink_Mode; -#include "elm_toolbar_item.eo.h" -#include "elm_toolbar.eo.h" + +#endif +/** Elementary toolbar class + * + * @ingroup Elm_Toolbar + */ +#define ELM_TOOLBAR_CLASS elm_toolbar_class_get() + +EWAPI const Efl_Class *elm_toolbar_class_get(void); /** - * @} + * @brief Get the selected item in the widget. + * + * @param[in] obj The object. + * + * @return The selected item or @c null. + * + * @ingroup Elm_Toolbar */ +EOAPI Elm_Widget_Item *elm_obj_toolbar_selected_item_get(const Eo *obj); +/** + * @brief Get the first item in the widget. + * + * @param[in] obj The object. + * + * @return The first item or @c null. + * + * @ingroup Elm_Toolbar + */ +EOAPI Elm_Widget_Item *elm_obj_toolbar_first_item_get(const Eo *obj); + +/** + * @brief Get the last item in the widget. + * + * @param[in] obj The object. + * + * @return The last item or @c null. + * + * @ingroup Elm_Toolbar + */ +EOAPI Elm_Widget_Item *elm_obj_toolbar_last_item_get(const Eo *obj); + +/** + * @brief Returns a list of the widget item. + * + * @param[in] obj The object. + * + * @return iterator to widget items + * + * @ingroup Elm_Toolbar + */ +EOAPI Eina_Iterator *elm_obj_toolbar_items_get(const Eo *obj) EINA_WARN_UNUSED_RESULT; + +/** + * @brief Control homogeneous mode. + * + * This will enable the homogeneous mode where items are of the same size. + * + * @param[in] obj The object. + * @param[in] homogeneous Assume the items within the toolbar are of the same + * size (true = on, false = off). Default is @c false. + * + * @ingroup Elm_Toolbar + */ +EOAPI void elm_obj_toolbar_homogeneous_set(Eo *obj, Eina_Bool homogeneous); + +/** + * @brief Control homogeneous mode. + * + * This will enable the homogeneous mode where items are of the same size. + * + * @param[in] obj The object. + * + * @return Assume the items within the toolbar are of the same size (true = on, + * false = off). Default is @c false. + * + * @ingroup Elm_Toolbar + */ +EOAPI Eina_Bool elm_obj_toolbar_homogeneous_get(const Eo *obj); + +/** + * @brief Control the alignment of the items. + * + * Alignment of toolbar items, from 0.0 to indicates to align left, to 1.0, to + * align to right. 0.5 centralize items. + * + * Centered items by default. + * + * @param[in] obj The object. + * @param[in] align The new alignment, a float between 0.0 and 1.0. + * + * @ingroup Elm_Toolbar + */ +EOAPI void elm_obj_toolbar_align_set(Eo *obj, double align); + +/** + * @brief Control the alignment of the items. + * + * Alignment of toolbar items, from 0.0 to indicates to align left, to 1.0, to + * align to right. 0.5 centralize items. + * + * Centered items by default. + * + * @param[in] obj The object. + * + * @return The new alignment, a float between 0.0 and 1.0. + * + * @ingroup Elm_Toolbar + */ +EOAPI double elm_obj_toolbar_align_get(const Eo *obj); + +/** + * @brief Control the toolbar select mode. + * + * elm_toolbar_select_mode_set() changes item select mode in the toolbar + * widget. - #ELM_OBJECT_SELECT_MODE_DEFAULT : Items will only call their + * selection func and callback when first becoming selected. Any further clicks + * will do nothing, unless you set always select mode. - + * #ELM_OBJECT_SELECT_MODE_ALWAYS : This means that, even if selected, every + * click will make the selected callbacks be called. - + * #ELM_OBJECT_SELECT_MODE_NONE : This will turn off the ability to select + * items entirely and they will neither appear selected nor call selected + * callback functions. + * + * @param[in] obj The object. + * @param[in] mode The select mode If getting mode fails, it returns + * #ELM_OBJECT_SELECT_MODE_MAX + * + * @ingroup Elm_Toolbar + */ +EOAPI void elm_obj_toolbar_select_mode_set(Eo *obj, Elm_Object_Select_Mode mode); + +/** + * @brief Control the toolbar select mode. + * + * elm_toolbar_select_mode_set() changes item select mode in the toolbar + * widget. - #ELM_OBJECT_SELECT_MODE_DEFAULT : Items will only call their + * selection func and callback when first becoming selected. Any further clicks + * will do nothing, unless you set always select mode. - + * #ELM_OBJECT_SELECT_MODE_ALWAYS : This means that, even if selected, every + * click will make the selected callbacks be called. - + * #ELM_OBJECT_SELECT_MODE_NONE : This will turn off the ability to select + * items entirely and they will neither appear selected nor call selected + * callback functions. + * + * @param[in] obj The object. + * + * @return The select mode If getting mode fails, it returns + * #ELM_OBJECT_SELECT_MODE_MAX + * + * @ingroup Elm_Toolbar + */ +EOAPI Elm_Object_Select_Mode elm_obj_toolbar_select_mode_get(const Eo *obj); + +/** + * @brief Control the icon size, in pixels, to be used by toolbar items. + * + * @note Default value is $32. It reads value from elm config. + * + * @param[in] obj The object. + * @param[in] icon_size The icon size in pixels + * + * @ingroup Elm_Toolbar + */ +EOAPI void elm_obj_toolbar_icon_size_set(Eo *obj, int icon_size); + +/** + * @brief Control the icon size, in pixels, to be used by toolbar items. + * + * @note Default value is $32. It reads value from elm config. + * + * @param[in] obj The object. + * + * @return The icon size in pixels + * + * @ingroup Elm_Toolbar + */ +EOAPI int elm_obj_toolbar_icon_size_get(const Eo *obj); + +/** + * @brief Control the item displaying mode of a given toolbar widget @c obj. + * + * The toolbar won't scroll under #ELM_TOOLBAR_SHRINK_NONE mode, but it will + * enforce a minimum size, so that all the items will fit inside it. It won't + * scroll and won't show the items that don't fit under + * #ELM_TOOLBAR_SHRINK_HIDE mode. Finally, it'll scroll under + * #ELM_TOOLBAR_SHRINK_SCROLL mode, and it will create a button to aggregate + * items which didn't fit with the #ELM_TOOLBAR_SHRINK_MENU mode. + * + * If shrink mode is changed, Toolbar will send one of the following signal to + * each item for informing the current shrink mode. "elm,state,shrink,default" + * "elm,state,shrink,hide" "elm,state,shrink,scroll" "elm,state,shrink,menu" + * "elm,state,shrink,expand" + * + * @warning This function's behavior will clash with those of + * elm_scroller_policy_set(), so use either one of them, but not both. + * + * @param[in] obj The object. + * @param[in] shrink_mode Toolbar's items display behavior + * + * @ingroup Elm_Toolbar + */ +EOAPI void elm_obj_toolbar_shrink_mode_set(Eo *obj, Elm_Toolbar_Shrink_Mode shrink_mode); + +/** + * @brief Control the item displaying mode of a given toolbar widget @c obj. + * + * The toolbar won't scroll under #ELM_TOOLBAR_SHRINK_NONE mode, but it will + * enforce a minimum size, so that all the items will fit inside it. It won't + * scroll and won't show the items that don't fit under + * #ELM_TOOLBAR_SHRINK_HIDE mode. Finally, it'll scroll under + * #ELM_TOOLBAR_SHRINK_SCROLL mode, and it will create a button to aggregate + * items which didn't fit with the #ELM_TOOLBAR_SHRINK_MENU mode. + * + * If shrink mode is changed, Toolbar will send one of the following signal to + * each item for informing the current shrink mode. "elm,state,shrink,default" + * "elm,state,shrink,hide" "elm,state,shrink,scroll" "elm,state,shrink,menu" + * "elm,state,shrink,expand" + * + * @warning This function's behavior will clash with those of + * elm_scroller_policy_set(), so use either one of them, but not both. + * + * @param[in] obj The object. + * + * @return Toolbar's items display behavior + * + * @ingroup Elm_Toolbar + */ +EOAPI Elm_Toolbar_Shrink_Mode elm_obj_toolbar_shrink_mode_get(const Eo *obj); + +/** + * @brief Control the parent object of the toolbar items' menus. + * + * Each item can be set as item menu, with elm_toolbar_item_menu_set(). + * + * For more details about setting the parent for toolbar menus, see + * elm_menu_parent_set(). + * + * See: elm_menu_parent_set() for details. See: elm_toolbar_item_menu_set() for + * details. + * + * @param[in] obj The object. + * @param[in] parent The parent of the menu objects. + * + * @ingroup Elm_Toolbar + */ +EOAPI void elm_obj_toolbar_menu_parent_set(Eo *obj, Efl_Canvas_Object *parent); + +/** + * @brief Control the parent object of the toolbar items' menus. + * + * Each item can be set as item menu, with elm_toolbar_item_menu_set(). + * + * For more details about setting the parent for toolbar menus, see + * elm_menu_parent_set(). + * + * See: elm_menu_parent_set() for details. See: elm_toolbar_item_menu_set() for + * details. + * + * @param[in] obj The object. + * + * @return The parent of the menu objects. + * + * @ingroup Elm_Toolbar + */ +EOAPI Efl_Canvas_Object *elm_obj_toolbar_menu_parent_get(const Eo *obj); + +/** + * @brief Set the standard priority of visible items in a toolbar + * + * If the priority of the item is up to standard priority, it is shown in basic + * panel. The other items are located in more menu or panel. The more menu or + * panel can be shown when the more item is clicked. + * + * @param[in] obj The object. + * @param[in] priority The standard_priority of visible items + * + * @since 1.7 + * + * @ingroup Elm_Toolbar + */ +EOAPI void elm_obj_toolbar_standard_priority_set(Eo *obj, int priority); + +/** + * @brief Set the standard priority of visible items in a toolbar + * + * If the priority of the item is up to standard priority, it is shown in basic + * panel. The other items are located in more menu or panel. The more menu or + * panel can be shown when the more item is clicked. + * + * @param[in] obj The object. + * + * @return The standard_priority of visible items + * + * @since 1.7 + * + * @ingroup Elm_Toolbar + */ +EOAPI int elm_obj_toolbar_standard_priority_get(const Eo *obj); + +/** + * @brief Get the more item which is auto-generated by toolbar. + * + * Toolbar generates 'more' item when there is no more space to fit items in + * and toolbar is in #ELM_TOOLBAR_SHRINK_MENU or #ELM_TOOLBAR_SHRINK_EXPAND + * mode. The more item can be manipulated by elm_object_item_text_set() and + * elm_object_item_content_set. + * + * @param[in] obj The object. + * + * @return The toolbar more item. + * + * @ingroup Elm_Toolbar + */ +EOAPI Elm_Widget_Item *elm_obj_toolbar_more_item_get(const Eo *obj); + +/** + * @brief Insert a new item into the toolbar object before item @c before. + * + * A new item will be created and added to the toolbar. Its position in this + * toolbar will be just before item @c before. + * + * Items created with this method can be deleted with elm_object_item_del(). + * + * Associated @c data can be properly freed when item is deleted if a callback + * function is set with elm_object_item_del_cb_set(). + * + * If a function is passed as argument, it will be called every time this item + * is selected, i.e., the user clicks over an unselected item. If such function + * isn't needed, just passing @c NULL as @c func is enough. The same should be + * done for @c data. + * + * Toolbar will load icon image from fdo or current theme. This behavior can be + * set by elm_toolbar_icon_order_lookup_set() function. If an absolute path is + * provided it will load it direct from a file. + * + * @note This function does not accept relative icon path. + * + * See: elm_toolbar_item_icon_set() + * + * @param[in] obj The object. + * @param[in] before The toolbar item to insert before. + * @param[in] icon A string with icon name or the absolute path of an image + * file. + * @param[in] label The label of the item. + * @param[in] func The function to call when the item is clicked. + * @param[in] data The data to associate with the item for related callbacks. + * + * @return The created item or @c NULL upon failure. + * + * @ingroup Elm_Toolbar + */ +EOAPI Elm_Widget_Item *elm_obj_toolbar_item_insert_before(Eo *obj, Elm_Widget_Item *before, const char *icon, const char *label, Evas_Smart_Cb func, const void *data); + +/** + * @brief Insert a new item into the toolbar object after item @c after. + * + * A new item will be created and added to the toolbar. Its position in this + * toolbar will be just after item @c after. + * + * Items created with this method can be deleted with elm_object_item_del(). + * + * Associated @c data can be properly freed when item is deleted if a callback + * function is set with elm_object_item_del_cb_set(). + * + * If a function is passed as argument, it will be called every time this item + * is selected, i.e., the user clicks over an unselected item. If such function + * isn't needed, just passing @c NULL as @c func is enough. The same should be + * done for @c data. + * + * Toolbar will load icon image from fdo or current theme. This behavior can be + * set by elm_toolbar_icon_order_lookup_set() function. If an absolute path is + * provided it will load it direct from a file. + * + * @note This function does not accept relative icon path. + * + * See: elm_toolbar_item_icon_set() + * + * @param[in] obj The object. + * @param[in] after The toolbar item to insert after. + * @param[in] icon A string with icon name or the absolute path of an image + * file. + * @param[in] label The label of the item. + * @param[in] func The function to call when the item is clicked. + * @param[in] data The data to associate with the item for related callbacks. + * + * @return The created item or @c NULL upon failure. + * + * @ingroup Elm_Toolbar + */ +EOAPI Elm_Widget_Item *elm_obj_toolbar_item_insert_after(Eo *obj, Elm_Widget_Item *after, const char *icon, const char *label, Evas_Smart_Cb func, const void *data); + +/** + * @brief Append item to the toolbar. + * + * A new item will be created and appended to the toolbar, i.e., will be set as + * last item. + * + * Items created with this method can be deleted with elm_object_item_del(). + * + * Associated @c data can be properly freed when item is deleted if a callback + * function is set with elm_object_item_del_cb_set(). + * + * If a function is passed as argument, it will be called every time this item + * is selected, i.e., the user clicks over an unselected item. If such function + * isn't needed, just passing @c NULL as @c func is enough. The same should be + * done for @c data. + * + * Toolbar will load icon image from fdo or current theme. This behavior can be + * set by elm_toolbar_icon_order_lookup_set() function. If an absolute path is + * provided it will load it direct from a file. + * + * @note This function does not accept relative icon path. + * + * See: elm_toolbar_item_icon_set() + * + * @param[in] obj The object. + * @param[in] icon A string with icon name or the absolute path of an image + * file. + * @param[in] label The label of the item. + * @param[in] func The function to call when the item is clicked. + * @param[in] data The data to associate with the item for related callbacks. + * + * @return The created item or @c NULL upon failure. + * + * @ingroup Elm_Toolbar + */ +EOAPI Elm_Widget_Item *elm_obj_toolbar_item_append(Eo *obj, const char *icon, const char *label, Evas_Smart_Cb func, const void *data); + +/** + * @brief Get the number of items in a toolbar + * + * @param[in] obj The object. + * + * @return The number of items in @c obj toolbar + * + * @ingroup Elm_Toolbar + */ +EOAPI unsigned int elm_obj_toolbar_items_count(const Eo *obj); + +/** + * @brief Prepend item to the toolbar. + * + * A new item will be created and prepended to the toolbar, i.e., will be set + * as first item. + * + * Items created with this method can be deleted with elm_object_item_del(). + * + * Associated @c data can be properly freed when item is deleted if a callback + * function is set with elm_object_item_del_cb_set(). + * + * If a function is passed as argument, it will be called every time this item + * is selected, i.e., the user clicks over an unselected item. If such function + * isn't needed, just passing @c NULL as @c func is enough. The same should be + * done for @c data. + * + * Toolbar will load icon image from fdo or current theme. This behavior can be + * set by elm_toolbar_icon_order_lookup_set() function. If an absolute path is + * provided it will load it direct from a file. + * + * @note This function does not accept relative icon path. + * + * See: elm_toolbar_item_icon_set() + * + * @param[in] obj The object. + * @param[in] icon A string with icon name or the absolute path of an image + * file. + * @param[in] label The label of the item. + * @param[in] func The function to call when the item is clicked. + * @param[in] data The data to associate with the item for related callbacks. + * + * @return The created item or @c NULL upon failure. + * + * @ingroup Elm_Toolbar + */ +EOAPI Elm_Widget_Item *elm_obj_toolbar_item_prepend(Eo *obj, const char *icon, const char *label, Evas_Smart_Cb func, const void *data); + +/** + * @brief Returns a pointer to a toolbar item by its label. + * + * @param[in] obj The object. + * @param[in] label The label of the item to find. + * + * @return The pointer to the toolbar item matching @c label or @c NULL on + * failure. + * + * @ingroup Elm_Toolbar + */ +EOAPI Elm_Widget_Item *elm_obj_toolbar_item_find_by_label(const Eo *obj, const char *label); + +EWAPI extern const Efl_Event_Description _ELM_TOOLBAR_EVENT_ITEM_FOCUSED; + +/** Called when toolbar item got focus + * @return Efl_Object * + * + * @ingroup Elm_Toolbar + */ +#define ELM_TOOLBAR_EVENT_ITEM_FOCUSED (&(_ELM_TOOLBAR_EVENT_ITEM_FOCUSED)) + +EWAPI extern const Efl_Event_Description _ELM_TOOLBAR_EVENT_ITEM_UNFOCUSED; + +/** Called when toolbar item lost focus + * @return Efl_Object * + * + * @ingroup Elm_Toolbar + */ +#define ELM_TOOLBAR_EVENT_ITEM_UNFOCUSED (&(_ELM_TOOLBAR_EVENT_ITEM_UNFOCUSED)) + +#endif diff --git a/src/lib/elementary/elm_toolbar_eo.legacy.c b/src/lib/elementary/elm_toolbar_eo.legacy.c new file mode 100644 index 0000000000..f0083b5047 --- /dev/null +++ b/src/lib/elementary/elm_toolbar_eo.legacy.c @@ -0,0 +1,150 @@ + +EAPI Elm_Widget_Item * +elm_toolbar_selected_item_get(const Elm_Toolbar *obj) +{ + return elm_obj_toolbar_selected_item_get(obj); +} + +EAPI Elm_Widget_Item * +elm_toolbar_first_item_get(const Elm_Toolbar *obj) +{ + return elm_obj_toolbar_first_item_get(obj); +} + +EAPI Elm_Widget_Item * +elm_toolbar_last_item_get(const Elm_Toolbar *obj) +{ + return elm_obj_toolbar_last_item_get(obj); +} + +EAPI Eina_Iterator * +elm_toolbar_items_get(const Elm_Toolbar *obj) +{ + return elm_obj_toolbar_items_get(obj); +} + +EAPI void +elm_toolbar_homogeneous_set(Elm_Toolbar *obj, Eina_Bool homogeneous) +{ + elm_obj_toolbar_homogeneous_set(obj, homogeneous); +} + +EAPI Eina_Bool +elm_toolbar_homogeneous_get(const Elm_Toolbar *obj) +{ + return elm_obj_toolbar_homogeneous_get(obj); +} + +EAPI void +elm_toolbar_align_set(Elm_Toolbar *obj, double align) +{ + elm_obj_toolbar_align_set(obj, align); +} + +EAPI double +elm_toolbar_align_get(const Elm_Toolbar *obj) +{ + return elm_obj_toolbar_align_get(obj); +} + +EAPI void +elm_toolbar_select_mode_set(Elm_Toolbar *obj, Elm_Object_Select_Mode mode) +{ + elm_obj_toolbar_select_mode_set(obj, mode); +} + +EAPI Elm_Object_Select_Mode +elm_toolbar_select_mode_get(const Elm_Toolbar *obj) +{ + return elm_obj_toolbar_select_mode_get(obj); +} + +EAPI void +elm_toolbar_icon_size_set(Elm_Toolbar *obj, int icon_size) +{ + elm_obj_toolbar_icon_size_set(obj, icon_size); +} + +EAPI int +elm_toolbar_icon_size_get(const Elm_Toolbar *obj) +{ + return elm_obj_toolbar_icon_size_get(obj); +} + +EAPI void +elm_toolbar_shrink_mode_set(Elm_Toolbar *obj, Elm_Toolbar_Shrink_Mode shrink_mode) +{ + elm_obj_toolbar_shrink_mode_set(obj, shrink_mode); +} + +EAPI Elm_Toolbar_Shrink_Mode +elm_toolbar_shrink_mode_get(const Elm_Toolbar *obj) +{ + return elm_obj_toolbar_shrink_mode_get(obj); +} + +EAPI void +elm_toolbar_menu_parent_set(Elm_Toolbar *obj, Efl_Canvas_Object *parent) +{ + elm_obj_toolbar_menu_parent_set(obj, parent); +} + +EAPI Efl_Canvas_Object * +elm_toolbar_menu_parent_get(const Elm_Toolbar *obj) +{ + return elm_obj_toolbar_menu_parent_get(obj); +} + +EAPI void +elm_toolbar_standard_priority_set(Elm_Toolbar *obj, int priority) +{ + elm_obj_toolbar_standard_priority_set(obj, priority); +} + +EAPI int +elm_toolbar_standard_priority_get(const Elm_Toolbar *obj) +{ + return elm_obj_toolbar_standard_priority_get(obj); +} + +EAPI Elm_Widget_Item * +elm_toolbar_more_item_get(const Elm_Toolbar *obj) +{ + return elm_obj_toolbar_more_item_get(obj); +} + +EAPI Elm_Widget_Item * +elm_toolbar_item_insert_before(Elm_Toolbar *obj, Elm_Widget_Item *before, const char *icon, const char *label, Evas_Smart_Cb func, const void *data) +{ + return elm_obj_toolbar_item_insert_before(obj, before, icon, label, func, data); +} + +EAPI Elm_Widget_Item * +elm_toolbar_item_insert_after(Elm_Toolbar *obj, Elm_Widget_Item *after, const char *icon, const char *label, Evas_Smart_Cb func, const void *data) +{ + return elm_obj_toolbar_item_insert_after(obj, after, icon, label, func, data); +} + +EAPI Elm_Widget_Item * +elm_toolbar_item_append(Elm_Toolbar *obj, const char *icon, const char *label, Evas_Smart_Cb func, const void *data) +{ + return elm_obj_toolbar_item_append(obj, icon, label, func, data); +} + +EAPI unsigned int +elm_toolbar_items_count(const Elm_Toolbar *obj) +{ + return elm_obj_toolbar_items_count(obj); +} + +EAPI Elm_Widget_Item * +elm_toolbar_item_prepend(Elm_Toolbar *obj, const char *icon, const char *label, Evas_Smart_Cb func, const void *data) +{ + return elm_obj_toolbar_item_prepend(obj, icon, label, func, data); +} + +EAPI Elm_Widget_Item * +elm_toolbar_item_find_by_label(const Elm_Toolbar *obj, const char *label) +{ + return elm_obj_toolbar_item_find_by_label(obj, label); +} diff --git a/src/lib/elementary/elm_toolbar_eo.legacy.h b/src/lib/elementary/elm_toolbar_eo.legacy.h new file mode 100644 index 0000000000..d16a3b2ba5 --- /dev/null +++ b/src/lib/elementary/elm_toolbar_eo.legacy.h @@ -0,0 +1,525 @@ +#ifndef _ELM_TOOLBAR_EO_LEGACY_H_ +#define _ELM_TOOLBAR_EO_LEGACY_H_ + +#ifndef _ELM_TOOLBAR_EO_CLASS_TYPE +#define _ELM_TOOLBAR_EO_CLASS_TYPE + +typedef Eo Elm_Toolbar; + +#endif + +#ifndef _ELM_TOOLBAR_EO_TYPES +#define _ELM_TOOLBAR_EO_TYPES + +/** + * @brief Set toolbar's items display behavior, it can be scrollable, show a + * menu with exceeding items, or simply hide them. + * + * Default value is #ELM_TOOLBAR_SHRINK_MENU. It reads value from elm config. + * + * Values don't work as bitmask, only one can be chosen. + * + * See also @ref elm_toolbar_shrink_mode_set, @ref elm_toolbar_shrink_mode_get. + * + * @ingroup Elm + */ +typedef enum +{ + ELM_TOOLBAR_SHRINK_NONE = 0, /**< Set toolbar minimum size to fit all the + * items. */ + ELM_TOOLBAR_SHRINK_HIDE, /**< Hide exceeding items. */ + ELM_TOOLBAR_SHRINK_SCROLL, /**< Allow accessing exceeding items through a + * scroller. */ + ELM_TOOLBAR_SHRINK_MENU, /**< Inserts a button to pop up a menu with exceeding + * items. */ + ELM_TOOLBAR_SHRINK_EXPAND, /**< Expand all items according the size of the + * toolbar. */ + ELM_TOOLBAR_SHRINK_LAST /**< Indicates error if returned by + * elm_toolbar_shrink_mode_get() */ +} Elm_Toolbar_Shrink_Mode; + + +#endif + +/** + * @brief Get the selected item in the widget. + * + * @param[in] obj The object. + * + * @return The selected item or @c null. + * + * @ingroup Elm_Toolbar_Group + */ +EAPI Elm_Widget_Item *elm_toolbar_selected_item_get(const Elm_Toolbar *obj); + +/** + * @brief Get the first item in the widget. + * + * @param[in] obj The object. + * + * @return The first item or @c null. + * + * @ingroup Elm_Toolbar_Group + */ +EAPI Elm_Widget_Item *elm_toolbar_first_item_get(const Elm_Toolbar *obj); + +/** + * @brief Get the last item in the widget. + * + * @param[in] obj The object. + * + * @return The last item or @c null. + * + * @ingroup Elm_Toolbar_Group + */ +EAPI Elm_Widget_Item *elm_toolbar_last_item_get(const Elm_Toolbar *obj); + +/** + * @brief Returns a list of the widget item. + * + * @param[in] obj The object. + * + * @return iterator to widget items + * + * @ingroup Elm_Toolbar_Group + */ +EAPI Eina_Iterator *elm_toolbar_items_get(const Elm_Toolbar *obj) EINA_WARN_UNUSED_RESULT; + +/** + * @brief Control homogeneous mode. + * + * This will enable the homogeneous mode where items are of the same size. + * + * @param[in] obj The object. + * @param[in] homogeneous Assume the items within the toolbar are of the same + * size (true = on, false = off). Default is @c false. + * + * @ingroup Elm_Toolbar_Group + */ +EAPI void elm_toolbar_homogeneous_set(Elm_Toolbar *obj, Eina_Bool homogeneous); + +/** + * @brief Control homogeneous mode. + * + * This will enable the homogeneous mode where items are of the same size. + * + * @param[in] obj The object. + * + * @return Assume the items within the toolbar are of the same size (true = on, + * false = off). Default is @c false. + * + * @ingroup Elm_Toolbar_Group + */ +EAPI Eina_Bool elm_toolbar_homogeneous_get(const Elm_Toolbar *obj); + +/** + * @brief Control the alignment of the items. + * + * Alignment of toolbar items, from 0.0 to indicates to align left, to 1.0, to + * align to right. 0.5 centralize items. + * + * Centered items by default. + * + * @param[in] obj The object. + * @param[in] align The new alignment, a float between 0.0 and 1.0. + * + * @ingroup Elm_Toolbar_Group + */ +EAPI void elm_toolbar_align_set(Elm_Toolbar *obj, double align); + +/** + * @brief Control the alignment of the items. + * + * Alignment of toolbar items, from 0.0 to indicates to align left, to 1.0, to + * align to right. 0.5 centralize items. + * + * Centered items by default. + * + * @param[in] obj The object. + * + * @return The new alignment, a float between 0.0 and 1.0. + * + * @ingroup Elm_Toolbar_Group + */ +EAPI double elm_toolbar_align_get(const Elm_Toolbar *obj); + +/** + * @brief Control the toolbar select mode. + * + * elm_toolbar_select_mode_set() changes item select mode in the toolbar + * widget. - #ELM_OBJECT_SELECT_MODE_DEFAULT : Items will only call their + * selection func and callback when first becoming selected. Any further clicks + * will do nothing, unless you set always select mode. - + * #ELM_OBJECT_SELECT_MODE_ALWAYS : This means that, even if selected, every + * click will make the selected callbacks be called. - + * #ELM_OBJECT_SELECT_MODE_NONE : This will turn off the ability to select + * items entirely and they will neither appear selected nor call selected + * callback functions. + * + * @param[in] obj The object. + * @param[in] mode The select mode If getting mode fails, it returns + * #ELM_OBJECT_SELECT_MODE_MAX + * + * @ingroup Elm_Toolbar_Group + */ +EAPI void elm_toolbar_select_mode_set(Elm_Toolbar *obj, Elm_Object_Select_Mode mode); + +/** + * @brief Control the toolbar select mode. + * + * elm_toolbar_select_mode_set() changes item select mode in the toolbar + * widget. - #ELM_OBJECT_SELECT_MODE_DEFAULT : Items will only call their + * selection func and callback when first becoming selected. Any further clicks + * will do nothing, unless you set always select mode. - + * #ELM_OBJECT_SELECT_MODE_ALWAYS : This means that, even if selected, every + * click will make the selected callbacks be called. - + * #ELM_OBJECT_SELECT_MODE_NONE : This will turn off the ability to select + * items entirely and they will neither appear selected nor call selected + * callback functions. + * + * @param[in] obj The object. + * + * @return The select mode If getting mode fails, it returns + * #ELM_OBJECT_SELECT_MODE_MAX + * + * @ingroup Elm_Toolbar_Group + */ +EAPI Elm_Object_Select_Mode elm_toolbar_select_mode_get(const Elm_Toolbar *obj); + +/** + * @brief Control the icon size, in pixels, to be used by toolbar items. + * + * @note Default value is $32. It reads value from elm config. + * + * @param[in] obj The object. + * @param[in] icon_size The icon size in pixels + * + * @ingroup Elm_Toolbar_Group + */ +EAPI void elm_toolbar_icon_size_set(Elm_Toolbar *obj, int icon_size); + +/** + * @brief Control the icon size, in pixels, to be used by toolbar items. + * + * @note Default value is $32. It reads value from elm config. + * + * @param[in] obj The object. + * + * @return The icon size in pixels + * + * @ingroup Elm_Toolbar_Group + */ +EAPI int elm_toolbar_icon_size_get(const Elm_Toolbar *obj); + +/** + * @brief Control the item displaying mode of a given toolbar widget @c obj. + * + * The toolbar won't scroll under #ELM_TOOLBAR_SHRINK_NONE mode, but it will + * enforce a minimum size, so that all the items will fit inside it. It won't + * scroll and won't show the items that don't fit under + * #ELM_TOOLBAR_SHRINK_HIDE mode. Finally, it'll scroll under + * #ELM_TOOLBAR_SHRINK_SCROLL mode, and it will create a button to aggregate + * items which didn't fit with the #ELM_TOOLBAR_SHRINK_MENU mode. + * + * If shrink mode is changed, Toolbar will send one of the following signal to + * each item for informing the current shrink mode. "elm,state,shrink,default" + * "elm,state,shrink,hide" "elm,state,shrink,scroll" "elm,state,shrink,menu" + * "elm,state,shrink,expand" + * + * @warning This function's behavior will clash with those of + * elm_scroller_policy_set(), so use either one of them, but not both. + * + * @param[in] obj The object. + * @param[in] shrink_mode Toolbar's items display behavior + * + * @ingroup Elm_Toolbar_Group + */ +EAPI void elm_toolbar_shrink_mode_set(Elm_Toolbar *obj, Elm_Toolbar_Shrink_Mode shrink_mode); + +/** + * @brief Control the item displaying mode of a given toolbar widget @c obj. + * + * The toolbar won't scroll under #ELM_TOOLBAR_SHRINK_NONE mode, but it will + * enforce a minimum size, so that all the items will fit inside it. It won't + * scroll and won't show the items that don't fit under + * #ELM_TOOLBAR_SHRINK_HIDE mode. Finally, it'll scroll under + * #ELM_TOOLBAR_SHRINK_SCROLL mode, and it will create a button to aggregate + * items which didn't fit with the #ELM_TOOLBAR_SHRINK_MENU mode. + * + * If shrink mode is changed, Toolbar will send one of the following signal to + * each item for informing the current shrink mode. "elm,state,shrink,default" + * "elm,state,shrink,hide" "elm,state,shrink,scroll" "elm,state,shrink,menu" + * "elm,state,shrink,expand" + * + * @warning This function's behavior will clash with those of + * elm_scroller_policy_set(), so use either one of them, but not both. + * + * @param[in] obj The object. + * + * @return Toolbar's items display behavior + * + * @ingroup Elm_Toolbar_Group + */ +EAPI Elm_Toolbar_Shrink_Mode elm_toolbar_shrink_mode_get(const Elm_Toolbar *obj); + +/** + * @brief Control the parent object of the toolbar items' menus. + * + * Each item can be set as item menu, with elm_toolbar_item_menu_set(). + * + * For more details about setting the parent for toolbar menus, see + * elm_menu_parent_set(). + * + * See: elm_menu_parent_set() for details. See: elm_toolbar_item_menu_set() for + * details. + * + * @param[in] obj The object. + * @param[in] parent The parent of the menu objects. + * + * @ingroup Elm_Toolbar_Group + */ +EAPI void elm_toolbar_menu_parent_set(Elm_Toolbar *obj, Efl_Canvas_Object *parent); + +/** + * @brief Control the parent object of the toolbar items' menus. + * + * Each item can be set as item menu, with elm_toolbar_item_menu_set(). + * + * For more details about setting the parent for toolbar menus, see + * elm_menu_parent_set(). + * + * See: elm_menu_parent_set() for details. See: elm_toolbar_item_menu_set() for + * details. + * + * @param[in] obj The object. + * + * @return The parent of the menu objects. + * + * @ingroup Elm_Toolbar_Group + */ +EAPI Efl_Canvas_Object *elm_toolbar_menu_parent_get(const Elm_Toolbar *obj); + +/** + * @brief Set the standard priority of visible items in a toolbar + * + * If the priority of the item is up to standard priority, it is shown in basic + * panel. The other items are located in more menu or panel. The more menu or + * panel can be shown when the more item is clicked. + * + * @param[in] obj The object. + * @param[in] priority The standard_priority of visible items + * + * @since 1.7 + * + * @ingroup Elm_Toolbar_Group + */ +EAPI void elm_toolbar_standard_priority_set(Elm_Toolbar *obj, int priority); + +/** + * @brief Set the standard priority of visible items in a toolbar + * + * If the priority of the item is up to standard priority, it is shown in basic + * panel. The other items are located in more menu or panel. The more menu or + * panel can be shown when the more item is clicked. + * + * @param[in] obj The object. + * + * @return The standard_priority of visible items + * + * @since 1.7 + * + * @ingroup Elm_Toolbar_Group + */ +EAPI int elm_toolbar_standard_priority_get(const Elm_Toolbar *obj); + +/** + * @brief Get the more item which is auto-generated by toolbar. + * + * Toolbar generates 'more' item when there is no more space to fit items in + * and toolbar is in #ELM_TOOLBAR_SHRINK_MENU or #ELM_TOOLBAR_SHRINK_EXPAND + * mode. The more item can be manipulated by elm_object_item_text_set() and + * elm_object_item_content_set. + * + * @param[in] obj The object. + * + * @return The toolbar more item. + * + * @ingroup Elm_Toolbar_Group + */ +EAPI Elm_Widget_Item *elm_toolbar_more_item_get(const Elm_Toolbar *obj); + +/** + * @brief Insert a new item into the toolbar object before item @c before. + * + * A new item will be created and added to the toolbar. Its position in this + * toolbar will be just before item @c before. + * + * Items created with this method can be deleted with elm_object_item_del(). + * + * Associated @c data can be properly freed when item is deleted if a callback + * function is set with elm_object_item_del_cb_set(). + * + * If a function is passed as argument, it will be called every time this item + * is selected, i.e., the user clicks over an unselected item. If such function + * isn't needed, just passing @c NULL as @c func is enough. The same should be + * done for @c data. + * + * Toolbar will load icon image from fdo or current theme. This behavior can be + * set by elm_toolbar_icon_order_lookup_set() function. If an absolute path is + * provided it will load it direct from a file. + * + * @note This function does not accept relative icon path. + * + * See: elm_toolbar_item_icon_set() + * + * @param[in] obj The object. + * @param[in] before The toolbar item to insert before. + * @param[in] icon A string with icon name or the absolute path of an image + * file. + * @param[in] label The label of the item. + * @param[in] func The function to call when the item is clicked. + * @param[in] data The data to associate with the item for related callbacks. + * + * @return The created item or @c NULL upon failure. + * + * @ingroup Elm_Toolbar_Group + */ +EAPI Elm_Widget_Item *elm_toolbar_item_insert_before(Elm_Toolbar *obj, Elm_Widget_Item *before, const char *icon, const char *label, Evas_Smart_Cb func, const void *data); + +/** + * @brief Insert a new item into the toolbar object after item @c after. + * + * A new item will be created and added to the toolbar. Its position in this + * toolbar will be just after item @c after. + * + * Items created with this method can be deleted with elm_object_item_del(). + * + * Associated @c data can be properly freed when item is deleted if a callback + * function is set with elm_object_item_del_cb_set(). + * + * If a function is passed as argument, it will be called every time this item + * is selected, i.e., the user clicks over an unselected item. If such function + * isn't needed, just passing @c NULL as @c func is enough. The same should be + * done for @c data. + * + * Toolbar will load icon image from fdo or current theme. This behavior can be + * set by elm_toolbar_icon_order_lookup_set() function. If an absolute path is + * provided it will load it direct from a file. + * + * @note This function does not accept relative icon path. + * + * See: elm_toolbar_item_icon_set() + * + * @param[in] obj The object. + * @param[in] after The toolbar item to insert after. + * @param[in] icon A string with icon name or the absolute path of an image + * file. + * @param[in] label The label of the item. + * @param[in] func The function to call when the item is clicked. + * @param[in] data The data to associate with the item for related callbacks. + * + * @return The created item or @c NULL upon failure. + * + * @ingroup Elm_Toolbar_Group + */ +EAPI Elm_Widget_Item *elm_toolbar_item_insert_after(Elm_Toolbar *obj, Elm_Widget_Item *after, const char *icon, const char *label, Evas_Smart_Cb func, const void *data); + +/** + * @brief Append item to the toolbar. + * + * A new item will be created and appended to the toolbar, i.e., will be set as + * last item. + * + * Items created with this method can be deleted with elm_object_item_del(). + * + * Associated @c data can be properly freed when item is deleted if a callback + * function is set with elm_object_item_del_cb_set(). + * + * If a function is passed as argument, it will be called every time this item + * is selected, i.e., the user clicks over an unselected item. If such function + * isn't needed, just passing @c NULL as @c func is enough. The same should be + * done for @c data. + * + * Toolbar will load icon image from fdo or current theme. This behavior can be + * set by elm_toolbar_icon_order_lookup_set() function. If an absolute path is + * provided it will load it direct from a file. + * + * @note This function does not accept relative icon path. + * + * See: elm_toolbar_item_icon_set() + * + * @param[in] obj The object. + * @param[in] icon A string with icon name or the absolute path of an image + * file. + * @param[in] label The label of the item. + * @param[in] func The function to call when the item is clicked. + * @param[in] data The data to associate with the item for related callbacks. + * + * @return The created item or @c NULL upon failure. + * + * @ingroup Elm_Toolbar_Group + */ +EAPI Elm_Widget_Item *elm_toolbar_item_append(Elm_Toolbar *obj, const char *icon, const char *label, Evas_Smart_Cb func, const void *data); + +/** + * @brief Get the number of items in a toolbar + * + * @param[in] obj The object. + * + * @return The number of items in @c obj toolbar + * + * @ingroup Elm_Toolbar_Group + */ +EAPI unsigned int elm_toolbar_items_count(const Elm_Toolbar *obj); + +/** + * @brief Prepend item to the toolbar. + * + * A new item will be created and prepended to the toolbar, i.e., will be set + * as first item. + * + * Items created with this method can be deleted with elm_object_item_del(). + * + * Associated @c data can be properly freed when item is deleted if a callback + * function is set with elm_object_item_del_cb_set(). + * + * If a function is passed as argument, it will be called every time this item + * is selected, i.e., the user clicks over an unselected item. If such function + * isn't needed, just passing @c NULL as @c func is enough. The same should be + * done for @c data. + * + * Toolbar will load icon image from fdo or current theme. This behavior can be + * set by elm_toolbar_icon_order_lookup_set() function. If an absolute path is + * provided it will load it direct from a file. + * + * @note This function does not accept relative icon path. + * + * See: elm_toolbar_item_icon_set() + * + * @param[in] obj The object. + * @param[in] icon A string with icon name or the absolute path of an image + * file. + * @param[in] label The label of the item. + * @param[in] func The function to call when the item is clicked. + * @param[in] data The data to associate with the item for related callbacks. + * + * @return The created item or @c NULL upon failure. + * + * @ingroup Elm_Toolbar_Group + */ +EAPI Elm_Widget_Item *elm_toolbar_item_prepend(Elm_Toolbar *obj, const char *icon, const char *label, Evas_Smart_Cb func, const void *data); + +/** + * @brief Returns a pointer to a toolbar item by its label. + * + * @param[in] obj The object. + * @param[in] label The label of the item to find. + * + * @return The pointer to the toolbar item matching @c label or @c NULL on + * failure. + * + * @ingroup Elm_Toolbar_Group + */ +EAPI Elm_Widget_Item *elm_toolbar_item_find_by_label(const Elm_Toolbar *obj, const char *label); + +#endif diff --git a/src/lib/elementary/elm_toolbar_item.eo b/src/lib/elementary/elm_toolbar_item.eo deleted file mode 100644 index 6abdc3981b..0000000000 --- a/src/lib/elementary/elm_toolbar_item.eo +++ /dev/null @@ -1,329 +0,0 @@ -enum Elm.Toolbar_Item_Scrollto_Type -{ - [[Defines where to position the item in the toolbar.]] - legacy: elm_toolbar_item_scrollto; - - none = 0, [[no scrollto]] - in = (1 << 0), [[to the nearest viewport]] - first = (1 << 1), [[to the first of viewport]] - middle = (1 << 2), [[to the middle of viewport]] - last = (1 << 3) [[to the last of viewport]] -} - -struct Elm.Toolbar_Item_State -{ - [[ - State of a Elm_Toolbar_Item. - Can be created with elm_toolbar_item_state_add() and removed with elm_toolbar_item_state_del(). - ]] - label: string; [[Item label]] - icon_str: string; [[Item icon string]] - icon: Efl.Canvas.Object; [[Item icon]] - func: Evas_Smart_Cb ; [[Item callback function]] - data: const(void_ptr); [[Item data]] -} - -class Elm.Toolbar_Item extends Elm.Widget.Item implements Efl.Ui.Focus.Object, Efl.Ui.Legacy -{ - [[Elementary toolbar item class]] - legacy_prefix: elm_toolbar_item; - eo_prefix: elm_obj_toolbar_item; - methods { - @property prev { - get { - [[Get the item before this one in the widget's list of items. - - See also @.next. - ]] - } - values { - item: Elm.Widget.Item; [[The item before the object in its parent's - list. If there is no previous item or in case - of error, $null is returned.]] - } - } - @property next { - get { - [[Get the item after this one in the widget's list of items. - - See also @.prev. - ]] - } - values { - item: Elm.Widget.Item; [[The item after the object in its parent's - list. If there is no next item or in case - of error, $null is returned.]] - } - } - @property selected { - [[Indicates whether this item is currently selected.]] - get { - [[Get the selected state of this item.]] - } - set { - [[Set the selected state of $item. - - This sets the selected state of the given item $it. - $true for selected, $false for not selected. - - If a new item is selected the previously selected will - be unselected. Previously selected item can be retrieved - with @Elm.Toolbar.selected_item.get. - - Selected items will be highlighted. - ]] - } - values { - selected: bool; [[The selection state.]] - } - } - @property priority { - get { - [[Get the priority of a toolbar item.]] - } - set { - [[Set the priority of a toolbar item. - - This is used only when the toolbar shrink mode is set - to #ELM_TOOLBAR_SHRINK_MENU or #ELM_TOOLBAR_SHRINK_HIDE. - When space is less than required, items with low priority - will be removed from the toolbar and added to a - dynamically-created menu, while items with higher - priority will remain on the toolbar, with the same - order they were added. - ]] - } - values { - priority: int; [[The $item priority. The default is zero - for set and 0 is returned on failure.]] - } - } - @property icon { - get { - [[Get the string used to set the icon of $item.]] - } - set { - [[Set the icon associated with $item. - - Toolbar will load icon image from fdo or current theme. - This behavior can be set by - elm_toolbar_icon_order_lookup_set function. - If an absolute path is provided it will load it direct - from a file. - - Note: This function does not accept relative icon path. - ]] - } - values { - icon: string; [[A string with icon name or the - absolute path of an image file.]] - } - } - @property object { - get { - [[Get the real Evas(Edje) object created to implement the - view of a given toolbar $item. - ]] - } - values { - obj: Efl.Canvas.Object; [[The base Edje object associated with $it.]] - } - } - @property icon_object { - get { - [[Get the icon object of $item. - - See also @.icon.set, @.icon_file_set, @.icon_memfile_set. - ]] - } - values { - obj: Efl.Canvas.Object; [[The icon object.]] - } - } - @property separator { - get { - [[Get a value whether item is a separator or not.]] - } - set { - [[Set or unset item as a separator. - - Items aren't set as separator by default. - - If set as separator it will display separator theme, so - won't display icons or label. - ]] - } - values { - separator: bool; [[$true if the item is a separator, $false otherwise]] - } - } - @property menu { - get { - [[Get toolbar item's menu. - - If $item wasn't set as menu item with @.menu_set, - this function will set it. - ]] - } - values { - menu: Efl.Canvas.Object; [[Item's menu object or $null on failure.]] - } - } - @property state { - get { - [[Get the current state of $it.]] - } - set { - [[Set $state as the current state of $it. - - If $state is $NULL, it won't select any state and the - default item's icon and label will be used. It's the - behavior as \@ref elm_toolbar_item_state_unset. - ]] - return: bool; [[$true on success, $false otherwise]] - } - values { - state: ptr(Elm.Toolbar_Item_State) @nullable; [[Item state]] - } - } - /* init { FIXME - params { - Evas_Smart_Cb func; - const(void_ptr) data; - } - }*/ - icon_memfile_set { - [[Set the icon associated with $item to an image in a binary buffer. - - Note: The icon image set by this function can be changed by - @.icon.set. - ]] - params { - @in img: const(void_ptr); [[The binary data that will be used as an image.]] - @in size: size; [[The size of binary data $img.]] - @in format: string; [[Optional format of $img to pass to the image loader.]] - @in key: string; [[Optional key of $img to pass to the image loader (eg. if $img is an edje file).]] - } - return: bool; [[$true on success, $false otherwise]] - } - icon_file_set { - [[Set the icon associated with $item to an image in a binary buffer. - - Note: The icon image set by this function can be changed by - elm_toolbar_item_icon_set(). - ]] - params { - @in file: string; [[The file that contains the image.]] - @in key: string; [[Optional key of $img to pass to the image loader (eg. if $img is an edje file).]] - } - return: bool; [[$true on success, $false otherwise]] - } - state_add { - [[Add a new state to $item. - - Toolbar will load icon image from fdo or current theme. - This behavior can be set by elm_toolbar_icon_order_lookup_set - function. If an absolute path is provided it will load it - direct from a file. - - States created with this function can be removed with - @.state_del. - ]] - params { - @in icon: string; [[A string with icon name or the absolute path of an image file.]] - @in label: string; [[The label of the new state.]] - @in func: Evas_Smart_Cb @optional; [[The function to call when the item is clicked when this state is selected.]] - @in data: const(void_ptr) @optional; [[The data to associate with the state.]] - } - return: ptr(Elm.Toolbar_Item_State); [[The toolbar item state, or $null upon failure.]] - } - state_del { - [[Delete a previously added state to $item.]] - params { - @in state: ptr(Elm.Toolbar_Item_State); [[The state to be deleted.]] - } - return: bool; [[$true on success or $false on failure.]] - } - state_next { - [[Get the state after selected state in toolbar's $item. - - If last state is selected, this function will return first - state. - ]] - return: ptr(Elm.Toolbar_Item_State); [[The state after current state, or $null on failure.]] - } - state_prev { - [[Get the state before selected state in toolbar's $item. - - If first state is selected, this function will return last - state. - ]] - return: ptr(Elm.Toolbar_Item_State); [[The state before current state, or $null on failure.]] - } - show { - [[Show a specific item, when the toolbar can be scrolled. - - @since 1.8 - ]] - params { - @in scrollto: Elm.Toolbar_Item_Scrollto_Type; [[The position the item should appear at.]] - } - } - bring_in { - [[Show a specific item with scroll animation, when the toolbar - can be scrolled. - - @since 1.8 - ]] - params { - @in scrollto: Elm.Toolbar_Item_Scrollto_Type; [[The position the item should appear at.]] - } - } - menu_set { - [[Set whether the toolbar item opens a menu. - - A toolbar item can be set to be a menu, using this function. - - Once it is set to be a menu, it can be manipulated through the - menu-like function @Elm.Toolbar.menu_parent.set and the - other elm_menu functions, using the Evas_Object $menu returned - by @.menu.get. - - So, items to be displayed in this item's menu should be added - with \@ref elm_menu_item_add. - ]] - /* FIXME-doc - The following code exemplifies the most basic usage: - @code - tb = elm_toolbar_add(win) - item = elm_toolbar_item_append(tb, "refresh", "Menu", NULL, NULL); - elm_toolbar_item_menu_set(item, true); - elm_toolbar_menu_parent_set(tb, win); - menu = elm_toolbar_item_menu_get(item); - elm_menu_item_add(menu, NULL, "edit-cut", "Cut", NULL, NULL); - menu_item = elm_menu_item_add(menu, NULL, "edit-copy", "Copy", NULL, - NULL); - @endcode - */ - params { - @in menu: bool; [[If $true, $item will opens a menu when selected.]] - } - } - } - implements { - Efl.Object.constructor; - Efl.Object.invalidate; - Elm.Widget.Item.disable; - Elm.Widget.Item.disabled { set; } - Elm.Widget.Item.item_focus { get; set; } - Elm.Widget.Item.signal_emit; - Elm.Widget.Item.part_text { get; set; } - Elm.Widget.Item.part_content { get; set; } - Elm.Widget.Item.part_content_unset; - Efl.Ui.Focus.Object.focus_geometry { get; } - Efl.Ui.Focus.Object.focus { set; } - Efl.Ui.Focus.Object.focus_parent { get; } - Efl.Access.Object.i18n_name { get; } - Efl.Access.Object.state_set { get; } - } -} diff --git a/src/lib/elementary/elm_toolbar_item_eo.c b/src/lib/elementary/elm_toolbar_item_eo.c new file mode 100644 index 0000000000..59d22dbcd3 --- /dev/null +++ b/src/lib/elementary/elm_toolbar_item_eo.c @@ -0,0 +1,328 @@ + +Elm_Widget_Item *_elm_toolbar_item_prev_get(const Eo *obj, Elm_Toolbar_Item_Data *pd); + +EOAPI EFL_FUNC_BODY_CONST(elm_obj_toolbar_item_prev_get, Elm_Widget_Item *, NULL); + +Elm_Widget_Item *_elm_toolbar_item_next_get(const Eo *obj, Elm_Toolbar_Item_Data *pd); + +EOAPI EFL_FUNC_BODY_CONST(elm_obj_toolbar_item_next_get, Elm_Widget_Item *, NULL); + +void _elm_toolbar_item_selected_set(Eo *obj, Elm_Toolbar_Item_Data *pd, Eina_Bool selected); + + +static Eina_Error +__eolian_elm_toolbar_item_selected_set_reflect(Eo *obj, Eina_Value val) +{ + Eina_Error r = 0; Eina_Bool cval; + if (!eina_value_bool_convert(&val, &cval)) + { + r = EINA_ERROR_VALUE_FAILED; + goto end; + } + elm_obj_toolbar_item_selected_set(obj, cval); + end: + eina_value_flush(&val); + return r; +} + +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_toolbar_item_selected_set, EFL_FUNC_CALL(selected), Eina_Bool selected); + +Eina_Bool _elm_toolbar_item_selected_get(const Eo *obj, Elm_Toolbar_Item_Data *pd); + + +static Eina_Value +__eolian_elm_toolbar_item_selected_get_reflect(Eo *obj) +{ + Eina_Bool val = elm_obj_toolbar_item_selected_get(obj); + return eina_value_bool_init(val); +} + +EOAPI EFL_FUNC_BODY_CONST(elm_obj_toolbar_item_selected_get, Eina_Bool, 0); + +void _elm_toolbar_item_priority_set(Eo *obj, Elm_Toolbar_Item_Data *pd, int priority); + + +static Eina_Error +__eolian_elm_toolbar_item_priority_set_reflect(Eo *obj, Eina_Value val) +{ + Eina_Error r = 0; int cval; + if (!eina_value_int_convert(&val, &cval)) + { + r = EINA_ERROR_VALUE_FAILED; + goto end; + } + elm_obj_toolbar_item_priority_set(obj, cval); + end: + eina_value_flush(&val); + return r; +} + +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_toolbar_item_priority_set, EFL_FUNC_CALL(priority), int priority); + +int _elm_toolbar_item_priority_get(const Eo *obj, Elm_Toolbar_Item_Data *pd); + + +static Eina_Value +__eolian_elm_toolbar_item_priority_get_reflect(Eo *obj) +{ + int val = elm_obj_toolbar_item_priority_get(obj); + return eina_value_int_init(val); +} + +EOAPI EFL_FUNC_BODY_CONST(elm_obj_toolbar_item_priority_get, int, 0); + +void _elm_toolbar_item_icon_set(Eo *obj, Elm_Toolbar_Item_Data *pd, const char *icon); + + +static Eina_Error +__eolian_elm_toolbar_item_icon_set_reflect(Eo *obj, Eina_Value val) +{ + Eina_Error r = 0; const char *cval; + if (!eina_value_string_convert(&val, &cval)) + { + r = EINA_ERROR_VALUE_FAILED; + goto end; + } + elm_obj_toolbar_item_icon_set(obj, cval); + end: + eina_value_flush(&val); + return r; +} + +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_toolbar_item_icon_set, EFL_FUNC_CALL(icon), const char *icon); + +const char *_elm_toolbar_item_icon_get(const Eo *obj, Elm_Toolbar_Item_Data *pd); + + +static Eina_Value +__eolian_elm_toolbar_item_icon_get_reflect(Eo *obj) +{ + const char *val = elm_obj_toolbar_item_icon_get(obj); + return eina_value_string_init(val); +} + +EOAPI EFL_FUNC_BODY_CONST(elm_obj_toolbar_item_icon_get, const char *, NULL); + +Efl_Canvas_Object *_elm_toolbar_item_object_get(const Eo *obj, Elm_Toolbar_Item_Data *pd); + +EOAPI EFL_FUNC_BODY_CONST(elm_obj_toolbar_item_object_get, Efl_Canvas_Object *, NULL); + +Efl_Canvas_Object *_elm_toolbar_item_icon_object_get(const Eo *obj, Elm_Toolbar_Item_Data *pd); + +EOAPI EFL_FUNC_BODY_CONST(elm_obj_toolbar_item_icon_object_get, Efl_Canvas_Object *, NULL); + +void _elm_toolbar_item_separator_set(Eo *obj, Elm_Toolbar_Item_Data *pd, Eina_Bool separator); + + +static Eina_Error +__eolian_elm_toolbar_item_separator_set_reflect(Eo *obj, Eina_Value val) +{ + Eina_Error r = 0; Eina_Bool cval; + if (!eina_value_bool_convert(&val, &cval)) + { + r = EINA_ERROR_VALUE_FAILED; + goto end; + } + elm_obj_toolbar_item_separator_set(obj, cval); + end: + eina_value_flush(&val); + return r; +} + +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_toolbar_item_separator_set, EFL_FUNC_CALL(separator), Eina_Bool separator); + +Eina_Bool _elm_toolbar_item_separator_get(const Eo *obj, Elm_Toolbar_Item_Data *pd); + + +static Eina_Value +__eolian_elm_toolbar_item_separator_get_reflect(Eo *obj) +{ + Eina_Bool val = elm_obj_toolbar_item_separator_get(obj); + return eina_value_bool_init(val); +} + +EOAPI EFL_FUNC_BODY_CONST(elm_obj_toolbar_item_separator_get, Eina_Bool, 0); + +Efl_Canvas_Object *_elm_toolbar_item_menu_get(const Eo *obj, Elm_Toolbar_Item_Data *pd); + +EOAPI EFL_FUNC_BODY_CONST(elm_obj_toolbar_item_menu_get, Efl_Canvas_Object *, NULL); + +Eina_Bool _elm_toolbar_item_state_set(Eo *obj, Elm_Toolbar_Item_Data *pd, Elm_Toolbar_Item_State *state); + +EOAPI EFL_FUNC_BODYV(elm_obj_toolbar_item_state_set, Eina_Bool, 0, EFL_FUNC_CALL(state), Elm_Toolbar_Item_State *state); + +Elm_Toolbar_Item_State *_elm_toolbar_item_state_get(const Eo *obj, Elm_Toolbar_Item_Data *pd); + +EOAPI EFL_FUNC_BODY_CONST(elm_obj_toolbar_item_state_get, Elm_Toolbar_Item_State *, NULL); + +Eina_Bool _elm_toolbar_item_icon_memfile_set(Eo *obj, Elm_Toolbar_Item_Data *pd, const void *img, size_t size, const char *format, const char *key); + +EOAPI EFL_FUNC_BODYV(elm_obj_toolbar_item_icon_memfile_set, Eina_Bool, 0, EFL_FUNC_CALL(img, size, format, key), const void *img, size_t size, const char *format, const char *key); + +Eina_Bool _elm_toolbar_item_icon_file_set(Eo *obj, Elm_Toolbar_Item_Data *pd, const char *file, const char *key); + +EOAPI EFL_FUNC_BODYV(elm_obj_toolbar_item_icon_file_set, Eina_Bool, 0, EFL_FUNC_CALL(file, key), const char *file, const char *key); + +Elm_Toolbar_Item_State *_elm_toolbar_item_state_add(Eo *obj, Elm_Toolbar_Item_Data *pd, const char *icon, const char *label, Evas_Smart_Cb func, const void *data); + +EOAPI EFL_FUNC_BODYV(elm_obj_toolbar_item_state_add, Elm_Toolbar_Item_State *, NULL, EFL_FUNC_CALL(icon, label, func, data), const char *icon, const char *label, Evas_Smart_Cb func, const void *data); + +Eina_Bool _elm_toolbar_item_state_del(Eo *obj, Elm_Toolbar_Item_Data *pd, Elm_Toolbar_Item_State *state); + +EOAPI EFL_FUNC_BODYV(elm_obj_toolbar_item_state_del, Eina_Bool, 0, EFL_FUNC_CALL(state), Elm_Toolbar_Item_State *state); + +Elm_Toolbar_Item_State *_elm_toolbar_item_state_next(Eo *obj, Elm_Toolbar_Item_Data *pd); + +EOAPI EFL_FUNC_BODY(elm_obj_toolbar_item_state_next, Elm_Toolbar_Item_State *, NULL); + +Elm_Toolbar_Item_State *_elm_toolbar_item_state_prev(Eo *obj, Elm_Toolbar_Item_Data *pd); + +EOAPI EFL_FUNC_BODY(elm_obj_toolbar_item_state_prev, Elm_Toolbar_Item_State *, NULL); + +void _elm_toolbar_item_show(Eo *obj, Elm_Toolbar_Item_Data *pd, Elm_Toolbar_Item_Scrollto_Type scrollto); + +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_toolbar_item_show, EFL_FUNC_CALL(scrollto), Elm_Toolbar_Item_Scrollto_Type scrollto); + +void _elm_toolbar_item_bring_in(Eo *obj, Elm_Toolbar_Item_Data *pd, Elm_Toolbar_Item_Scrollto_Type scrollto); + +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_toolbar_item_bring_in, EFL_FUNC_CALL(scrollto), Elm_Toolbar_Item_Scrollto_Type scrollto); + +void _elm_toolbar_item_menu_set(Eo *obj, Elm_Toolbar_Item_Data *pd, Eina_Bool menu); + +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_toolbar_item_menu_set, EFL_FUNC_CALL(menu), Eina_Bool menu); + +Efl_Object *_elm_toolbar_item_efl_object_constructor(Eo *obj, Elm_Toolbar_Item_Data *pd); + + +void _elm_toolbar_item_efl_object_invalidate(Eo *obj, Elm_Toolbar_Item_Data *pd); + + +void _elm_toolbar_item_elm_widget_item_disable(Eo *obj, Elm_Toolbar_Item_Data *pd); + + +void _elm_toolbar_item_elm_widget_item_disabled_set(Eo *obj, Elm_Toolbar_Item_Data *pd, Eina_Bool disable); + + +void _elm_toolbar_item_elm_widget_item_item_focus_set(Eo *obj, Elm_Toolbar_Item_Data *pd, Eina_Bool focused); + + +Eina_Bool _elm_toolbar_item_elm_widget_item_item_focus_get(const Eo *obj, Elm_Toolbar_Item_Data *pd); + + +void _elm_toolbar_item_elm_widget_item_signal_emit(Eo *obj, Elm_Toolbar_Item_Data *pd, const char *emission, const char *source); + + +void _elm_toolbar_item_elm_widget_item_part_text_set(Eo *obj, Elm_Toolbar_Item_Data *pd, const char *part, const char *label); + + +const char *_elm_toolbar_item_elm_widget_item_part_text_get(const Eo *obj, Elm_Toolbar_Item_Data *pd, const char *part); + + +void _elm_toolbar_item_elm_widget_item_part_content_set(Eo *obj, Elm_Toolbar_Item_Data *pd, const char *part, Efl_Canvas_Object *content); + + +Efl_Canvas_Object *_elm_toolbar_item_elm_widget_item_part_content_get(const Eo *obj, Elm_Toolbar_Item_Data *pd, const char *part); + + +Efl_Canvas_Object *_elm_toolbar_item_elm_widget_item_part_content_unset(Eo *obj, Elm_Toolbar_Item_Data *pd, const char *part); + + +Eina_Rect _elm_toolbar_item_efl_ui_focus_object_focus_geometry_get(const Eo *obj, Elm_Toolbar_Item_Data *pd); + + +void _elm_toolbar_item_efl_ui_focus_object_focus_set(Eo *obj, Elm_Toolbar_Item_Data *pd, Eina_Bool focus); + + +Efl_Ui_Focus_Object *_elm_toolbar_item_efl_ui_focus_object_focus_parent_get(const Eo *obj, Elm_Toolbar_Item_Data *pd); + + +const char *_elm_toolbar_item_efl_access_object_i18n_name_get(const Eo *obj, Elm_Toolbar_Item_Data *pd); + + +Efl_Access_State_Set _elm_toolbar_item_efl_access_object_state_set_get(const Eo *obj, Elm_Toolbar_Item_Data *pd); + + +static Eina_Bool +_elm_toolbar_item_class_initializer(Efl_Class *klass) +{ + const Efl_Object_Ops *opsp = NULL; + + const Efl_Object_Property_Reflection_Ops *ropsp = NULL; + +#ifndef ELM_TOOLBAR_ITEM_EXTRA_OPS +#define ELM_TOOLBAR_ITEM_EXTRA_OPS +#endif + + EFL_OPS_DEFINE(ops, + EFL_OBJECT_OP_FUNC(elm_obj_toolbar_item_prev_get, _elm_toolbar_item_prev_get), + EFL_OBJECT_OP_FUNC(elm_obj_toolbar_item_next_get, _elm_toolbar_item_next_get), + EFL_OBJECT_OP_FUNC(elm_obj_toolbar_item_selected_set, _elm_toolbar_item_selected_set), + EFL_OBJECT_OP_FUNC(elm_obj_toolbar_item_selected_get, _elm_toolbar_item_selected_get), + EFL_OBJECT_OP_FUNC(elm_obj_toolbar_item_priority_set, _elm_toolbar_item_priority_set), + EFL_OBJECT_OP_FUNC(elm_obj_toolbar_item_priority_get, _elm_toolbar_item_priority_get), + EFL_OBJECT_OP_FUNC(elm_obj_toolbar_item_icon_set, _elm_toolbar_item_icon_set), + EFL_OBJECT_OP_FUNC(elm_obj_toolbar_item_icon_get, _elm_toolbar_item_icon_get), + EFL_OBJECT_OP_FUNC(elm_obj_toolbar_item_object_get, _elm_toolbar_item_object_get), + EFL_OBJECT_OP_FUNC(elm_obj_toolbar_item_icon_object_get, _elm_toolbar_item_icon_object_get), + EFL_OBJECT_OP_FUNC(elm_obj_toolbar_item_separator_set, _elm_toolbar_item_separator_set), + EFL_OBJECT_OP_FUNC(elm_obj_toolbar_item_separator_get, _elm_toolbar_item_separator_get), + EFL_OBJECT_OP_FUNC(elm_obj_toolbar_item_menu_get, _elm_toolbar_item_menu_get), + EFL_OBJECT_OP_FUNC(elm_obj_toolbar_item_state_set, _elm_toolbar_item_state_set), + EFL_OBJECT_OP_FUNC(elm_obj_toolbar_item_state_get, _elm_toolbar_item_state_get), + EFL_OBJECT_OP_FUNC(elm_obj_toolbar_item_icon_memfile_set, _elm_toolbar_item_icon_memfile_set), + EFL_OBJECT_OP_FUNC(elm_obj_toolbar_item_icon_file_set, _elm_toolbar_item_icon_file_set), + EFL_OBJECT_OP_FUNC(elm_obj_toolbar_item_state_add, _elm_toolbar_item_state_add), + EFL_OBJECT_OP_FUNC(elm_obj_toolbar_item_state_del, _elm_toolbar_item_state_del), + EFL_OBJECT_OP_FUNC(elm_obj_toolbar_item_state_next, _elm_toolbar_item_state_next), + EFL_OBJECT_OP_FUNC(elm_obj_toolbar_item_state_prev, _elm_toolbar_item_state_prev), + EFL_OBJECT_OP_FUNC(elm_obj_toolbar_item_show, _elm_toolbar_item_show), + EFL_OBJECT_OP_FUNC(elm_obj_toolbar_item_bring_in, _elm_toolbar_item_bring_in), + EFL_OBJECT_OP_FUNC(elm_obj_toolbar_item_menu_set, _elm_toolbar_item_menu_set), + EFL_OBJECT_OP_FUNC(efl_constructor, _elm_toolbar_item_efl_object_constructor), + EFL_OBJECT_OP_FUNC(efl_invalidate, _elm_toolbar_item_efl_object_invalidate), + EFL_OBJECT_OP_FUNC(elm_wdg_item_disable, _elm_toolbar_item_elm_widget_item_disable), + EFL_OBJECT_OP_FUNC(elm_wdg_item_disabled_set, _elm_toolbar_item_elm_widget_item_disabled_set), + EFL_OBJECT_OP_FUNC(elm_wdg_item_focus_set, _elm_toolbar_item_elm_widget_item_item_focus_set), + EFL_OBJECT_OP_FUNC(elm_wdg_item_focus_get, _elm_toolbar_item_elm_widget_item_item_focus_get), + EFL_OBJECT_OP_FUNC(elm_wdg_item_signal_emit, _elm_toolbar_item_elm_widget_item_signal_emit), + EFL_OBJECT_OP_FUNC(elm_wdg_item_part_text_set, _elm_toolbar_item_elm_widget_item_part_text_set), + EFL_OBJECT_OP_FUNC(elm_wdg_item_part_text_get, _elm_toolbar_item_elm_widget_item_part_text_get), + EFL_OBJECT_OP_FUNC(elm_wdg_item_part_content_set, _elm_toolbar_item_elm_widget_item_part_content_set), + EFL_OBJECT_OP_FUNC(elm_wdg_item_part_content_get, _elm_toolbar_item_elm_widget_item_part_content_get), + EFL_OBJECT_OP_FUNC(elm_wdg_item_part_content_unset, _elm_toolbar_item_elm_widget_item_part_content_unset), + EFL_OBJECT_OP_FUNC(efl_ui_focus_object_focus_geometry_get, _elm_toolbar_item_efl_ui_focus_object_focus_geometry_get), + EFL_OBJECT_OP_FUNC(efl_ui_focus_object_focus_set, _elm_toolbar_item_efl_ui_focus_object_focus_set), + EFL_OBJECT_OP_FUNC(efl_ui_focus_object_focus_parent_get, _elm_toolbar_item_efl_ui_focus_object_focus_parent_get), + EFL_OBJECT_OP_FUNC(efl_access_object_i18n_name_get, _elm_toolbar_item_efl_access_object_i18n_name_get), + EFL_OBJECT_OP_FUNC(efl_access_object_state_set_get, _elm_toolbar_item_efl_access_object_state_set_get), + ELM_TOOLBAR_ITEM_EXTRA_OPS + ); + opsp = &ops; + + static const Efl_Object_Property_Reflection refl_table[] = { + {"selected", __eolian_elm_toolbar_item_selected_set_reflect, __eolian_elm_toolbar_item_selected_get_reflect}, + {"priority", __eolian_elm_toolbar_item_priority_set_reflect, __eolian_elm_toolbar_item_priority_get_reflect}, + {"icon", __eolian_elm_toolbar_item_icon_set_reflect, __eolian_elm_toolbar_item_icon_get_reflect}, + {"separator", __eolian_elm_toolbar_item_separator_set_reflect, __eolian_elm_toolbar_item_separator_get_reflect}, + }; + static const Efl_Object_Property_Reflection_Ops rops = { + refl_table, EINA_C_ARRAY_LENGTH(refl_table) + }; + ropsp = &rops; + + return efl_class_functions_set(klass, opsp, ropsp); +} + +static const Efl_Class_Description _elm_toolbar_item_class_desc = { + EO_VERSION, + "Elm.Toolbar_Item", + EFL_CLASS_TYPE_REGULAR, + sizeof(Elm_Toolbar_Item_Data), + _elm_toolbar_item_class_initializer, + NULL, + NULL +}; + +EFL_DEFINE_CLASS(elm_toolbar_item_class_get, &_elm_toolbar_item_class_desc, ELM_WIDGET_ITEM_CLASS, EFL_UI_FOCUS_OBJECT_MIXIN, EFL_UI_LEGACY_INTERFACE, NULL); + +#include "elm_toolbar_item_eo.legacy.c" diff --git a/src/lib/elementary/elm_toolbar_item_eo.h b/src/lib/elementary/elm_toolbar_item_eo.h new file mode 100644 index 0000000000..44bb2d9810 --- /dev/null +++ b/src/lib/elementary/elm_toolbar_item_eo.h @@ -0,0 +1,410 @@ +#ifndef _ELM_TOOLBAR_ITEM_EO_H_ +#define _ELM_TOOLBAR_ITEM_EO_H_ + +#ifndef _ELM_TOOLBAR_ITEM_EO_CLASS_TYPE +#define _ELM_TOOLBAR_ITEM_EO_CLASS_TYPE + +typedef Eo Elm_Toolbar_Item; + +#endif + +#ifndef _ELM_TOOLBAR_ITEM_EO_TYPES +#define _ELM_TOOLBAR_ITEM_EO_TYPES + +/** Defines where to position the item in the toolbar. + * + * @ingroup Elm + */ +typedef enum +{ + ELM_TOOLBAR_ITEM_SCROLLTO_NONE = 0, /**< no scrollto */ + ELM_TOOLBAR_ITEM_SCROLLTO_IN = 1 /* 1 >> 0 */, /**< to the nearest viewport */ + ELM_TOOLBAR_ITEM_SCROLLTO_FIRST = 2 /* 1 >> 1 */, /**< to the first of + * viewport */ + ELM_TOOLBAR_ITEM_SCROLLTO_MIDDLE = 4 /* 1 >> 2 */, /**< to the middle of + * viewport */ + ELM_TOOLBAR_ITEM_SCROLLTO_LAST = 8 /* 1 >> 3 */ /**< to the last of viewport + */ +} Elm_Toolbar_Item_Scrollto_Type; + +/** State of a Elm_Toolbar_Item. Can be created with + * elm_toolbar_item_state_add() and removed with elm_toolbar_item_state_del(). + * + * @ingroup Elm + */ +typedef struct _Elm_Toolbar_Item_State +{ + const char *label; /**< Item label */ + const char *icon_str; /**< Item icon string */ + Efl_Canvas_Object *icon; /**< Item icon */ + Evas_Smart_Cb func; /**< Item callback function */ + const void *data; /**< Item data */ +} Elm_Toolbar_Item_State; + + +#endif +/** Elementary toolbar item class + * + * @ingroup Elm_Toolbar_Item + */ +#define ELM_TOOLBAR_ITEM_CLASS elm_toolbar_item_class_get() + +EWAPI const Efl_Class *elm_toolbar_item_class_get(void); + +/** + * @brief Get the item before this one in the widget's list of items. + * + * See also @ref elm_obj_toolbar_item_next_get. + * + * @param[in] obj The object. + * + * @return The item before the object in its parent's list. If there is no + * previous item or in case of error, @c null is returned. + * + * @ingroup Elm_Toolbar_Item + */ +EOAPI Elm_Widget_Item *elm_obj_toolbar_item_prev_get(const Eo *obj); + +/** + * @brief Get the item after this one in the widget's list of items. + * + * See also @ref elm_obj_toolbar_item_prev_get. + * + * @param[in] obj The object. + * + * @return The item after the object in its parent's list. If there is no next + * item or in case of error, @c null is returned. + * + * @ingroup Elm_Toolbar_Item + */ +EOAPI Elm_Widget_Item *elm_obj_toolbar_item_next_get(const Eo *obj); + +/** + * @brief Indicates whether this item is currently selected. + * + * Set the selected state of @c item. + * + * This sets the selected state of the given item @c it. @c true for selected, + * @c false for not selected. + * + * If a new item is selected the previously selected will be unselected. + * Previously selected item can be retrieved with + * @ref elm_obj_toolbar_selected_item_get. + * + * Selected items will be highlighted. + * + * @param[in] obj The object. + * @param[in] selected The selection state. + * + * @ingroup Elm_Toolbar_Item + */ +EOAPI void elm_obj_toolbar_item_selected_set(Eo *obj, Eina_Bool selected); + +/** + * @brief Indicates whether this item is currently selected. + * + * Get the selected state of this item. + * + * @param[in] obj The object. + * + * @return The selection state. + * + * @ingroup Elm_Toolbar_Item + */ +EOAPI Eina_Bool elm_obj_toolbar_item_selected_get(const Eo *obj); + +/** + * @brief Set the priority of a toolbar item. + * + * This is used only when the toolbar shrink mode is set to + * #ELM_TOOLBAR_SHRINK_MENU or #ELM_TOOLBAR_SHRINK_HIDE. When space is less + * than required, items with low priority will be removed from the toolbar and + * added to a dynamically-created menu, while items with higher priority will + * remain on the toolbar, with the same order they were added. + * + * @param[in] obj The object. + * @param[in] priority The @c item priority. The default is zero for set and 0 + * is returned on failure. + * + * @ingroup Elm_Toolbar_Item + */ +EOAPI void elm_obj_toolbar_item_priority_set(Eo *obj, int priority); + +/** + * @brief Get the priority of a toolbar item. + * + * @param[in] obj The object. + * + * @return The @c item priority. The default is zero for set and 0 is returned + * on failure. + * + * @ingroup Elm_Toolbar_Item + */ +EOAPI int elm_obj_toolbar_item_priority_get(const Eo *obj); + +/** + * @brief Set the icon associated with @c item. + * + * Toolbar will load icon image from fdo or current theme. This behavior can be + * set by elm_toolbar_icon_order_lookup_set function. If an absolute path is + * provided it will load it direct from a file. + * + * @note This function does not accept relative icon path. + * + * @param[in] obj The object. + * @param[in] icon A string with icon name or the absolute path of an image + * file. + * + * @ingroup Elm_Toolbar_Item + */ +EOAPI void elm_obj_toolbar_item_icon_set(Eo *obj, const char *icon); + +/** + * @brief Get the string used to set the icon of @c item. + * + * @param[in] obj The object. + * + * @return A string with icon name or the absolute path of an image file. + * + * @ingroup Elm_Toolbar_Item + */ +EOAPI const char *elm_obj_toolbar_item_icon_get(const Eo *obj); + +/** + * @brief Get the real Evas(Edje) object created to implement the view of a + * given toolbar @c item. + * + * @param[in] obj The object. + * + * @return The base Edje object associated with @c it. + * + * @ingroup Elm_Toolbar_Item + */ +EOAPI Efl_Canvas_Object *elm_obj_toolbar_item_object_get(const Eo *obj); + +/** + * @brief Get the icon object of @c item. + * + * See also @ref elm_obj_toolbar_item_icon_set, + * @ref elm_obj_toolbar_item_icon_file_set, + * @ref elm_obj_toolbar_item_icon_memfile_set. + * + * @param[in] obj The object. + * + * @return The icon object. + * + * @ingroup Elm_Toolbar_Item + */ +EOAPI Efl_Canvas_Object *elm_obj_toolbar_item_icon_object_get(const Eo *obj); + +/** + * @brief Set or unset item as a separator. + * + * Items aren't set as separator by default. + * + * If set as separator it will display separator theme, so won't display icons + * or label. + * + * @param[in] obj The object. + * @param[in] separator @c true if the item is a separator, @c false otherwise + * + * @ingroup Elm_Toolbar_Item + */ +EOAPI void elm_obj_toolbar_item_separator_set(Eo *obj, Eina_Bool separator); + +/** + * @brief Get a value whether item is a separator or not. + * + * @param[in] obj The object. + * + * @return @c true if the item is a separator, @c false otherwise + * + * @ingroup Elm_Toolbar_Item + */ +EOAPI Eina_Bool elm_obj_toolbar_item_separator_get(const Eo *obj); + +/** + * @brief Get toolbar item's menu. + * + * If @c item wasn't set as menu item with @ref elm_obj_toolbar_item_menu_set, + * this function will set it. + * + * @param[in] obj The object. + * + * @return Item's menu object or @c null on failure. + * + * @ingroup Elm_Toolbar_Item + */ +EOAPI Efl_Canvas_Object *elm_obj_toolbar_item_menu_get(const Eo *obj); + +/** + * @brief Set @c state as the current state of @c it. + * + * If @c state is @c NULL, it won't select any state and the default item's + * icon and label will be used. It's the behavior as @ref + * elm_toolbar_item_state_unset. + * + * @param[in] obj The object. + * @param[in] state Item state + * + * @return @c true on success, @c false otherwise + * + * @ingroup Elm_Toolbar_Item + */ +EOAPI Eina_Bool elm_obj_toolbar_item_state_set(Eo *obj, Elm_Toolbar_Item_State *state); + +/** + * @brief Get the current state of @c it. + * + * @param[in] obj The object. + * + * @return Item state + * + * @ingroup Elm_Toolbar_Item + */ +EOAPI Elm_Toolbar_Item_State *elm_obj_toolbar_item_state_get(const Eo *obj); + +/** + * @brief Set the icon associated with @c item to an image in a binary buffer. + * + * @note The icon image set by this function can be changed by + * @ref elm_obj_toolbar_item_icon_set. + * + * @param[in] obj The object. + * @param[in] img The binary data that will be used as an image. + * @param[in] size The size of binary data @c img. + * @param[in] format Optional format of @c img to pass to the image loader. + * @param[in] key Optional key of @c img to pass to the image loader (eg. if + * @c img is an edje file). + * + * @return @c true on success, @c false otherwise + * + * @ingroup Elm_Toolbar_Item + */ +EOAPI Eina_Bool elm_obj_toolbar_item_icon_memfile_set(Eo *obj, const void *img, size_t size, const char *format, const char *key); + +/** + * @brief Set the icon associated with @c item to an image in a binary buffer. + * + * @note The icon image set by this function can be changed by + * elm_toolbar_item_icon_set(). + * + * @param[in] obj The object. + * @param[in] file The file that contains the image. + * @param[in] key Optional key of @c img to pass to the image loader (eg. if + * @c img is an edje file). + * + * @return @c true on success, @c false otherwise + * + * @ingroup Elm_Toolbar_Item + */ +EOAPI Eina_Bool elm_obj_toolbar_item_icon_file_set(Eo *obj, const char *file, const char *key); + +/** + * @brief Add a new state to @c item. + * + * Toolbar will load icon image from fdo or current theme. This behavior can be + * set by elm_toolbar_icon_order_lookup_set function. If an absolute path is + * provided it will load it direct from a file. + * + * States created with this function can be removed with + * @ref elm_obj_toolbar_item_state_del. + * + * @param[in] obj The object. + * @param[in] icon A string with icon name or the absolute path of an image + * file. + * @param[in] label The label of the new state. + * @param[in] func The function to call when the item is clicked when this + * state is selected. + * @param[in] data The data to associate with the state. + * + * @return The toolbar item state, or @c null upon failure. + * + * @ingroup Elm_Toolbar_Item + */ +EOAPI Elm_Toolbar_Item_State *elm_obj_toolbar_item_state_add(Eo *obj, const char *icon, const char *label, Evas_Smart_Cb func, const void *data); + +/** + * @brief Delete a previously added state to @c item. + * + * @param[in] obj The object. + * @param[in] state The state to be deleted. + * + * @return @c true on success or @c false on failure. + * + * @ingroup Elm_Toolbar_Item + */ +EOAPI Eina_Bool elm_obj_toolbar_item_state_del(Eo *obj, Elm_Toolbar_Item_State *state); + +/** + * @brief Get the state after selected state in toolbar's @c item. + * + * If last state is selected, this function will return first state. + * + * @param[in] obj The object. + * + * @return The state after current state, or @c null on failure. + * + * @ingroup Elm_Toolbar_Item + */ +EOAPI Elm_Toolbar_Item_State *elm_obj_toolbar_item_state_next(Eo *obj); + +/** + * @brief Get the state before selected state in toolbar's @c item. + * + * If first state is selected, this function will return last state. + * + * @param[in] obj The object. + * + * @return The state before current state, or @c null on failure. + * + * @ingroup Elm_Toolbar_Item + */ +EOAPI Elm_Toolbar_Item_State *elm_obj_toolbar_item_state_prev(Eo *obj); + +/** + * @brief Show a specific item, when the toolbar can be scrolled. + * + * @param[in] obj The object. + * @param[in] scrollto The position the item should appear at. + * + * @since 1.8 + * + * @ingroup Elm_Toolbar_Item + */ +EOAPI void elm_obj_toolbar_item_show(Eo *obj, Elm_Toolbar_Item_Scrollto_Type scrollto); + +/** + * @brief Show a specific item with scroll animation, when the toolbar can be + * scrolled. + * + * @param[in] obj The object. + * @param[in] scrollto The position the item should appear at. + * + * @since 1.8 + * + * @ingroup Elm_Toolbar_Item + */ +EOAPI void elm_obj_toolbar_item_bring_in(Eo *obj, Elm_Toolbar_Item_Scrollto_Type scrollto); + +/** + * @brief Set whether the toolbar item opens a menu. + * + * A toolbar item can be set to be a menu, using this function. + * + * Once it is set to be a menu, it can be manipulated through the menu-like + * function @ref elm_obj_toolbar_menu_parent_set and the other elm_menu + * functions, using the Evas_Object @c menu returned by + * @ref elm_obj_toolbar_item_menu_get. + * + * So, items to be displayed in this item's menu should be added with @ref + * elm_menu_item_add. + * + * @param[in] obj The object. + * @param[in] menu If @c true, @c item will opens a menu when selected. + * + * @ingroup Elm_Toolbar_Item + */ +EOAPI void elm_obj_toolbar_item_menu_set(Eo *obj, Eina_Bool menu); + +#endif diff --git a/src/lib/elementary/elm_toolbar_item_eo.legacy.c b/src/lib/elementary/elm_toolbar_item_eo.legacy.c new file mode 100644 index 0000000000..ebb4d64f09 --- /dev/null +++ b/src/lib/elementary/elm_toolbar_item_eo.legacy.c @@ -0,0 +1,144 @@ + +EAPI Elm_Widget_Item * +elm_toolbar_item_prev_get(const Elm_Toolbar_Item *obj) +{ + return elm_obj_toolbar_item_prev_get(obj); +} + +EAPI Elm_Widget_Item * +elm_toolbar_item_next_get(const Elm_Toolbar_Item *obj) +{ + return elm_obj_toolbar_item_next_get(obj); +} + +EAPI void +elm_toolbar_item_selected_set(Elm_Toolbar_Item *obj, Eina_Bool selected) +{ + elm_obj_toolbar_item_selected_set(obj, selected); +} + +EAPI Eina_Bool +elm_toolbar_item_selected_get(const Elm_Toolbar_Item *obj) +{ + return elm_obj_toolbar_item_selected_get(obj); +} + +EAPI void +elm_toolbar_item_priority_set(Elm_Toolbar_Item *obj, int priority) +{ + elm_obj_toolbar_item_priority_set(obj, priority); +} + +EAPI int +elm_toolbar_item_priority_get(const Elm_Toolbar_Item *obj) +{ + return elm_obj_toolbar_item_priority_get(obj); +} + +EAPI void +elm_toolbar_item_icon_set(Elm_Toolbar_Item *obj, const char *icon) +{ + elm_obj_toolbar_item_icon_set(obj, icon); +} + +EAPI const char * +elm_toolbar_item_icon_get(const Elm_Toolbar_Item *obj) +{ + return elm_obj_toolbar_item_icon_get(obj); +} + +EAPI Efl_Canvas_Object * +elm_toolbar_item_object_get(const Elm_Toolbar_Item *obj) +{ + return elm_obj_toolbar_item_object_get(obj); +} + +EAPI Efl_Canvas_Object * +elm_toolbar_item_icon_object_get(const Elm_Toolbar_Item *obj) +{ + return elm_obj_toolbar_item_icon_object_get(obj); +} + +EAPI void +elm_toolbar_item_separator_set(Elm_Toolbar_Item *obj, Eina_Bool separator) +{ + elm_obj_toolbar_item_separator_set(obj, separator); +} + +EAPI Eina_Bool +elm_toolbar_item_separator_get(const Elm_Toolbar_Item *obj) +{ + return elm_obj_toolbar_item_separator_get(obj); +} + +EAPI Efl_Canvas_Object * +elm_toolbar_item_menu_get(const Elm_Toolbar_Item *obj) +{ + return elm_obj_toolbar_item_menu_get(obj); +} + +EAPI Eina_Bool +elm_toolbar_item_state_set(Elm_Toolbar_Item *obj, Elm_Toolbar_Item_State *state) +{ + return elm_obj_toolbar_item_state_set(obj, state); +} + +EAPI Elm_Toolbar_Item_State * +elm_toolbar_item_state_get(const Elm_Toolbar_Item *obj) +{ + return elm_obj_toolbar_item_state_get(obj); +} + +EAPI Eina_Bool +elm_toolbar_item_icon_memfile_set(Elm_Toolbar_Item *obj, const void *img, size_t size, const char *format, const char *key) +{ + return elm_obj_toolbar_item_icon_memfile_set(obj, img, size, format, key); +} + +EAPI Eina_Bool +elm_toolbar_item_icon_file_set(Elm_Toolbar_Item *obj, const char *file, const char *key) +{ + return elm_obj_toolbar_item_icon_file_set(obj, file, key); +} + +EAPI Elm_Toolbar_Item_State * +elm_toolbar_item_state_add(Elm_Toolbar_Item *obj, const char *icon, const char *label, Evas_Smart_Cb func, const void *data) +{ + return elm_obj_toolbar_item_state_add(obj, icon, label, func, data); +} + +EAPI Eina_Bool +elm_toolbar_item_state_del(Elm_Toolbar_Item *obj, Elm_Toolbar_Item_State *state) +{ + return elm_obj_toolbar_item_state_del(obj, state); +} + +EAPI Elm_Toolbar_Item_State * +elm_toolbar_item_state_next(Elm_Toolbar_Item *obj) +{ + return elm_obj_toolbar_item_state_next(obj); +} + +EAPI Elm_Toolbar_Item_State * +elm_toolbar_item_state_prev(Elm_Toolbar_Item *obj) +{ + return elm_obj_toolbar_item_state_prev(obj); +} + +EAPI void +elm_toolbar_item_show(Elm_Toolbar_Item *obj, Elm_Toolbar_Item_Scrollto_Type scrollto) +{ + elm_obj_toolbar_item_show(obj, scrollto); +} + +EAPI void +elm_toolbar_item_bring_in(Elm_Toolbar_Item *obj, Elm_Toolbar_Item_Scrollto_Type scrollto) +{ + elm_obj_toolbar_item_bring_in(obj, scrollto); +} + +EAPI void +elm_toolbar_item_menu_set(Elm_Toolbar_Item *obj, Eina_Bool menu) +{ + elm_obj_toolbar_item_menu_set(obj, menu); +} diff --git a/src/lib/elementary/elm_toolbar_item_eo.legacy.h b/src/lib/elementary/elm_toolbar_item_eo.legacy.h new file mode 100644 index 0000000000..8caac89692 --- /dev/null +++ b/src/lib/elementary/elm_toolbar_item_eo.legacy.h @@ -0,0 +1,401 @@ +#ifndef _ELM_TOOLBAR_ITEM_EO_LEGACY_H_ +#define _ELM_TOOLBAR_ITEM_EO_LEGACY_H_ + +#ifndef _ELM_TOOLBAR_ITEM_EO_CLASS_TYPE +#define _ELM_TOOLBAR_ITEM_EO_CLASS_TYPE + +typedef Eo Elm_Toolbar_Item; + +#endif + +#ifndef _ELM_TOOLBAR_ITEM_EO_TYPES +#define _ELM_TOOLBAR_ITEM_EO_TYPES + +/** Defines where to position the item in the toolbar. + * + * @ingroup Elm + */ +typedef enum +{ + ELM_TOOLBAR_ITEM_SCROLLTO_NONE = 0, /**< no scrollto */ + ELM_TOOLBAR_ITEM_SCROLLTO_IN = 1 /* 1 >> 0 */, /**< to the nearest viewport */ + ELM_TOOLBAR_ITEM_SCROLLTO_FIRST = 2 /* 1 >> 1 */, /**< to the first of + * viewport */ + ELM_TOOLBAR_ITEM_SCROLLTO_MIDDLE = 4 /* 1 >> 2 */, /**< to the middle of + * viewport */ + ELM_TOOLBAR_ITEM_SCROLLTO_LAST = 8 /* 1 >> 3 */ /**< to the last of viewport + */ +} Elm_Toolbar_Item_Scrollto_Type; + +/** State of a Elm_Toolbar_Item. Can be created with + * elm_toolbar_item_state_add() and removed with elm_toolbar_item_state_del(). + * + * @ingroup Elm + */ +typedef struct _Elm_Toolbar_Item_State +{ + const char *label; /**< Item label */ + const char *icon_str; /**< Item icon string */ + Efl_Canvas_Object *icon; /**< Item icon */ + Evas_Smart_Cb func; /**< Item callback function */ + const void *data; /**< Item data */ +} Elm_Toolbar_Item_State; + + +#endif + +/** + * @brief Get the item before this one in the widget's list of items. + * + * See also @ref elm_toolbar_item_next_get. + * + * @param[in] obj The object. + * + * @return The item before the object in its parent's list. If there is no + * previous item or in case of error, @c null is returned. + * + * @ingroup Elm_Toolbar_Item_Group + */ +EAPI Elm_Widget_Item *elm_toolbar_item_prev_get(const Elm_Toolbar_Item *obj); + +/** + * @brief Get the item after this one in the widget's list of items. + * + * See also @ref elm_toolbar_item_prev_get. + * + * @param[in] obj The object. + * + * @return The item after the object in its parent's list. If there is no next + * item or in case of error, @c null is returned. + * + * @ingroup Elm_Toolbar_Item_Group + */ +EAPI Elm_Widget_Item *elm_toolbar_item_next_get(const Elm_Toolbar_Item *obj); + +/** + * @brief Indicates whether this item is currently selected. + * + * Set the selected state of @c item. + * + * This sets the selected state of the given item @c it. @c true for selected, + * @c false for not selected. + * + * If a new item is selected the previously selected will be unselected. + * Previously selected item can be retrieved with + * @ref elm_toolbar_selected_item_get. + * + * Selected items will be highlighted. + * + * @param[in] obj The object. + * @param[in] selected The selection state. + * + * @ingroup Elm_Toolbar_Item_Group + */ +EAPI void elm_toolbar_item_selected_set(Elm_Toolbar_Item *obj, Eina_Bool selected); + +/** + * @brief Indicates whether this item is currently selected. + * + * Get the selected state of this item. + * + * @param[in] obj The object. + * + * @return The selection state. + * + * @ingroup Elm_Toolbar_Item_Group + */ +EAPI Eina_Bool elm_toolbar_item_selected_get(const Elm_Toolbar_Item *obj); + +/** + * @brief Set the priority of a toolbar item. + * + * This is used only when the toolbar shrink mode is set to + * #ELM_TOOLBAR_SHRINK_MENU or #ELM_TOOLBAR_SHRINK_HIDE. When space is less + * than required, items with low priority will be removed from the toolbar and + * added to a dynamically-created menu, while items with higher priority will + * remain on the toolbar, with the same order they were added. + * + * @param[in] obj The object. + * @param[in] priority The @c item priority. The default is zero for set and 0 + * is returned on failure. + * + * @ingroup Elm_Toolbar_Item_Group + */ +EAPI void elm_toolbar_item_priority_set(Elm_Toolbar_Item *obj, int priority); + +/** + * @brief Get the priority of a toolbar item. + * + * @param[in] obj The object. + * + * @return The @c item priority. The default is zero for set and 0 is returned + * on failure. + * + * @ingroup Elm_Toolbar_Item_Group + */ +EAPI int elm_toolbar_item_priority_get(const Elm_Toolbar_Item *obj); + +/** + * @brief Set the icon associated with @c item. + * + * Toolbar will load icon image from fdo or current theme. This behavior can be + * set by elm_toolbar_icon_order_lookup_set function. If an absolute path is + * provided it will load it direct from a file. + * + * @note This function does not accept relative icon path. + * + * @param[in] obj The object. + * @param[in] icon A string with icon name or the absolute path of an image + * file. + * + * @ingroup Elm_Toolbar_Item_Group + */ +EAPI void elm_toolbar_item_icon_set(Elm_Toolbar_Item *obj, const char *icon); + +/** + * @brief Get the string used to set the icon of @c item. + * + * @param[in] obj The object. + * + * @return A string with icon name or the absolute path of an image file. + * + * @ingroup Elm_Toolbar_Item_Group + */ +EAPI const char *elm_toolbar_item_icon_get(const Elm_Toolbar_Item *obj); + +/** + * @brief Get the real Evas(Edje) object created to implement the view of a + * given toolbar @c item. + * + * @param[in] obj The object. + * + * @return The base Edje object associated with @c it. + * + * @ingroup Elm_Toolbar_Item_Group + */ +EAPI Efl_Canvas_Object *elm_toolbar_item_object_get(const Elm_Toolbar_Item *obj); + +/** + * @brief Get the icon object of @c item. + * + * See also @ref elm_toolbar_item_icon_set, + * @ref elm_toolbar_item_icon_file_set, @ref elm_toolbar_item_icon_memfile_set. + * + * @param[in] obj The object. + * + * @return The icon object. + * + * @ingroup Elm_Toolbar_Item_Group + */ +EAPI Efl_Canvas_Object *elm_toolbar_item_icon_object_get(const Elm_Toolbar_Item *obj); + +/** + * @brief Set or unset item as a separator. + * + * Items aren't set as separator by default. + * + * If set as separator it will display separator theme, so won't display icons + * or label. + * + * @param[in] obj The object. + * @param[in] separator @c true if the item is a separator, @c false otherwise + * + * @ingroup Elm_Toolbar_Item_Group + */ +EAPI void elm_toolbar_item_separator_set(Elm_Toolbar_Item *obj, Eina_Bool separator); + +/** + * @brief Get a value whether item is a separator or not. + * + * @param[in] obj The object. + * + * @return @c true if the item is a separator, @c false otherwise + * + * @ingroup Elm_Toolbar_Item_Group + */ +EAPI Eina_Bool elm_toolbar_item_separator_get(const Elm_Toolbar_Item *obj); + +/** + * @brief Get toolbar item's menu. + * + * If @c item wasn't set as menu item with @ref elm_toolbar_item_menu_set, this + * function will set it. + * + * @param[in] obj The object. + * + * @return Item's menu object or @c null on failure. + * + * @ingroup Elm_Toolbar_Item_Group + */ +EAPI Efl_Canvas_Object *elm_toolbar_item_menu_get(const Elm_Toolbar_Item *obj); + +/** + * @brief Set @c state as the current state of @c it. + * + * If @c state is @c NULL, it won't select any state and the default item's + * icon and label will be used. It's the behavior as @ref + * elm_toolbar_item_state_unset. + * + * @param[in] obj The object. + * @param[in] state Item state + * + * @return @c true on success, @c false otherwise + * + * @ingroup Elm_Toolbar_Item_Group + */ +EAPI Eina_Bool elm_toolbar_item_state_set(Elm_Toolbar_Item *obj, Elm_Toolbar_Item_State *state); + +/** + * @brief Get the current state of @c it. + * + * @param[in] obj The object. + * + * @return Item state + * + * @ingroup Elm_Toolbar_Item_Group + */ +EAPI Elm_Toolbar_Item_State *elm_toolbar_item_state_get(const Elm_Toolbar_Item *obj); + +/** + * @brief Set the icon associated with @c item to an image in a binary buffer. + * + * @note The icon image set by this function can be changed by + * @ref elm_toolbar_item_icon_set. + * + * @param[in] obj The object. + * @param[in] img The binary data that will be used as an image. + * @param[in] size The size of binary data @c img. + * @param[in] format Optional format of @c img to pass to the image loader. + * @param[in] key Optional key of @c img to pass to the image loader (eg. if + * @c img is an edje file). + * + * @return @c true on success, @c false otherwise + * + * @ingroup Elm_Toolbar_Item_Group + */ +EAPI Eina_Bool elm_toolbar_item_icon_memfile_set(Elm_Toolbar_Item *obj, const void *img, size_t size, const char *format, const char *key); + +/** + * @brief Set the icon associated with @c item to an image in a binary buffer. + * + * @note The icon image set by this function can be changed by + * elm_toolbar_item_icon_set(). + * + * @param[in] obj The object. + * @param[in] file The file that contains the image. + * @param[in] key Optional key of @c img to pass to the image loader (eg. if + * @c img is an edje file). + * + * @return @c true on success, @c false otherwise + * + * @ingroup Elm_Toolbar_Item_Group + */ +EAPI Eina_Bool elm_toolbar_item_icon_file_set(Elm_Toolbar_Item *obj, const char *file, const char *key); + +/** + * @brief Add a new state to @c item. + * + * Toolbar will load icon image from fdo or current theme. This behavior can be + * set by elm_toolbar_icon_order_lookup_set function. If an absolute path is + * provided it will load it direct from a file. + * + * States created with this function can be removed with + * @ref elm_toolbar_item_state_del. + * + * @param[in] obj The object. + * @param[in] icon A string with icon name or the absolute path of an image + * file. + * @param[in] label The label of the new state. + * @param[in] func The function to call when the item is clicked when this + * state is selected. + * @param[in] data The data to associate with the state. + * + * @return The toolbar item state, or @c null upon failure. + * + * @ingroup Elm_Toolbar_Item_Group + */ +EAPI Elm_Toolbar_Item_State *elm_toolbar_item_state_add(Elm_Toolbar_Item *obj, const char *icon, const char *label, Evas_Smart_Cb func, const void *data); + +/** + * @brief Delete a previously added state to @c item. + * + * @param[in] obj The object. + * @param[in] state The state to be deleted. + * + * @return @c true on success or @c false on failure. + * + * @ingroup Elm_Toolbar_Item_Group + */ +EAPI Eina_Bool elm_toolbar_item_state_del(Elm_Toolbar_Item *obj, Elm_Toolbar_Item_State *state); + +/** + * @brief Get the state after selected state in toolbar's @c item. + * + * If last state is selected, this function will return first state. + * + * @param[in] obj The object. + * + * @return The state after current state, or @c null on failure. + * + * @ingroup Elm_Toolbar_Item_Group + */ +EAPI Elm_Toolbar_Item_State *elm_toolbar_item_state_next(Elm_Toolbar_Item *obj); + +/** + * @brief Get the state before selected state in toolbar's @c item. + * + * If first state is selected, this function will return last state. + * + * @param[in] obj The object. + * + * @return The state before current state, or @c null on failure. + * + * @ingroup Elm_Toolbar_Item_Group + */ +EAPI Elm_Toolbar_Item_State *elm_toolbar_item_state_prev(Elm_Toolbar_Item *obj); + +/** + * @brief Show a specific item, when the toolbar can be scrolled. + * + * @param[in] obj The object. + * @param[in] scrollto The position the item should appear at. + * + * @since 1.8 + * + * @ingroup Elm_Toolbar_Item_Group + */ +EAPI void elm_toolbar_item_show(Elm_Toolbar_Item *obj, Elm_Toolbar_Item_Scrollto_Type scrollto); + +/** + * @brief Show a specific item with scroll animation, when the toolbar can be + * scrolled. + * + * @param[in] obj The object. + * @param[in] scrollto The position the item should appear at. + * + * @since 1.8 + * + * @ingroup Elm_Toolbar_Item_Group + */ +EAPI void elm_toolbar_item_bring_in(Elm_Toolbar_Item *obj, Elm_Toolbar_Item_Scrollto_Type scrollto); + +/** + * @brief Set whether the toolbar item opens a menu. + * + * A toolbar item can be set to be a menu, using this function. + * + * Once it is set to be a menu, it can be manipulated through the menu-like + * function @ref elm_toolbar_menu_parent_set and the other elm_menu functions, + * using the Evas_Object @c menu returned by @ref elm_toolbar_item_menu_get. + * + * So, items to be displayed in this item's menu should be added with @ref + * elm_menu_item_add. + * + * @param[in] obj The object. + * @param[in] menu If @c true, @c item will opens a menu when selected. + * + * @ingroup Elm_Toolbar_Item_Group + */ +EAPI void elm_toolbar_item_menu_set(Elm_Toolbar_Item *obj, Eina_Bool menu); + +#endif diff --git a/src/lib/elementary/elm_toolbar_legacy.h b/src/lib/elementary/elm_toolbar_legacy.h index 9d0fe5b007..65cdf7e6fb 100644 --- a/src/lib/elementary/elm_toolbar_legacy.h +++ b/src/lib/elementary/elm_toolbar_legacy.h @@ -109,5 +109,5 @@ EAPI void elm_toolbar_horizontal_set(Evas_Object *obj, Eina_Bool horizontal); */ EAPI Eina_Bool elm_toolbar_horizontal_get(const Evas_Object *obj); -#include "elm_toolbar_item.eo.legacy.h" -#include "elm_toolbar.eo.legacy.h" +#include "elm_toolbar_item_eo.legacy.h" +#include "elm_toolbar_eo.legacy.h" diff --git a/src/lib/elementary/meson.build b/src/lib/elementary/meson.build index 2e792823e5..04f682ef1a 100644 --- a/src/lib/elementary/meson.build +++ b/src/lib/elementary/meson.build @@ -176,8 +176,6 @@ pub_eo_files = [ 'elm_atspi_bridge.eo', 'elm_atspi_app_object.eo', 'efl_ui_image_zoomable_pan.eo', - 'elm_toolbar.eo', - 'elm_toolbar_item.eo', 'elm_view_list.eo', 'elm_view_form.eo', 'elm_web.eo', @@ -802,6 +800,10 @@ elementary_pub_headers = [ 'elm_table_eo.legacy.h', 'elm_thumb_eo.h', 'elm_thumb_eo.legacy.h', + 'elm_toolbar_eo.h', + 'elm_toolbar_eo.legacy.h', + 'elm_toolbar_item_eo.h', + 'elm_toolbar_item_eo.legacy.h', ] elementary_header_src = [