diff --git a/legacy/elementary/src/lib/Elementary.h.in b/legacy/elementary/src/lib/Elementary.h.in index c685e75b6e..5e1a5ad5ea 100644 --- a/legacy/elementary/src/lib/Elementary.h.in +++ b/legacy/elementary/src/lib/Elementary.h.in @@ -635,7 +635,9 @@ extern "C" { } Elm_Hover_Axis; EAPI Evas_Object *elm_hover_add(Evas_Object *parent); EAPI void elm_hover_target_set(Evas_Object *obj, Evas_Object *target); + EAPI Evas_Object *elm_hover_target_get(Evas_Object *obj); EAPI void elm_hover_parent_set(Evas_Object *obj, Evas_Object *parent); + EAPI Evas_Object *elm_hover_parent_get(Evas_Object *obj); EAPI void elm_hover_content_set(Evas_Object *obj, const char *swallow, Evas_Object *content); EAPI const char *elm_hover_best_content_location_get(const Evas_Object *obj, Elm_Hover_Axis pref_axis); /* available styles: @@ -870,9 +872,20 @@ extern "C" { EAPI void elm_toolbar_item_disabled_set(Elm_Toolbar_Item *item, Eina_Bool disabled); EAPI void elm_toolbar_item_separator_set(Elm_Toolbar_Item *item, Eina_Bool separator); EAPI Eina_Bool elm_toolbar_item_separator_get(Elm_Toolbar_Item *item); + EAPI Eina_List *elm_toolbar_item_get_all(Evas_Object *obj); + EAPI Elm_Toolbar_Item *elm_toolbar_item_get_first(Evas_Object *obj); + EAPI Elm_Toolbar_Item *elm_toolbar_item_get_last(Evas_Object *obj); + EAPI Elm_Toolbar_Item *elm_toolbar_item_get_next(Evas_Object *obj); + EAPI Elm_Toolbar_Item *elm_toolbar_item_select_next(Evas_Object *obj); + EAPI Elm_Toolbar_Item *elm_toolbar_item_select_first(Evas_Object *obj); + EAPI Elm_Toolbar_Item *elm_toolbar_item_select_last(Evas_Object *obj); + EAPI Elm_Toolbar_Item *elm_toolbar_item_find_by_label(Evas_Object *obj, const char *label); EAPI void elm_toolbar_scrollable_set(Evas_Object *obj, Eina_Bool scrollable); + EAPI Eina_Bool elm_toolbar_scrollable_get(Evas_Object *obj); EAPI void elm_toolbar_homogenous_set(Evas_Object *obj, Eina_Bool homogenous); + EAPI Eina_Bool elm_toolbar_homogenous_get(Evas_Object *obj); EAPI void elm_toolbar_menu_parent_set(Evas_Object *obj, Evas_Object *parent); + EAPI Evas_Object *elm_toolbar_menu_parent_get(Evas_Object *obj); EAPI void elm_toolbar_item_unselect_all(Evas_Object *obj); EAPI void elm_toolbar_align_set(Evas_Object *obj, double align); EAPI double elm_toolbar_align_get(const Evas_Object *obj); @@ -891,8 +904,11 @@ extern "C" { EAPI void elm_menu_item_label_set(Elm_Menu_Item *item, const char *label); EAPI const char *elm_menu_item_label_get(Elm_Menu_Item *item); EAPI void elm_menu_item_icon_set(Elm_Menu_Item *item, Evas_Object *icon); + EAPI Evas_Object *elm_menu_item_icon_get(Elm_Menu_Item *item); EAPI void elm_menu_item_disabled_set(Elm_Menu_Item *item, Eina_Bool disabled); + EAPI Eina_Bool elm_menu_item_disabled_get(Elm_Menu_Item *item); EAPI Elm_Menu_Item *elm_menu_item_separator_add(Evas_Object *obj, Elm_Menu_Item *parent); + EAPI Eina_Bool elm_menu_item_is_separator(Elm_Menu_Item *item); EAPI void elm_menu_item_del(Elm_Menu_Item *item); EAPI void elm_menu_item_del_cb_set(Elm_Menu_Item *it, Evas_Smart_Cb func); EAPI void *elm_menu_item_data_get(const Elm_Menu_Item *it); @@ -1372,9 +1388,14 @@ extern "C" { ELM_PANEL_ORIENT_LEFT, ELM_PANEL_ORIENT_RIGHT, } Elm_Panel_Orient; - EAPI Evas_Object *elm_panel_add(Evas_Object *parent); - EAPI void elm_panel_orient_set(Evas_Object *obj, Elm_Panel_Orient orient); - EAPI void elm_panel_content_set(Evas_Object *obj, Evas_Object *content); + EAPI Evas_Object *elm_panel_add(Evas_Object *parent); + EAPI void elm_panel_orient_set(Evas_Object *obj, Elm_Panel_Orient orient); + EAPI Elm_Panel_Orient elm_panel_orient_get(Evas_Object *obj); + EAPI void elm_panel_content_set(Evas_Object *obj, Evas_Object *content); +EAPI void elm_panel_hidden_set(Evas_Object *obj, Eina_Bool hidden); +EAPI Eina_Bool elm_panel_hidden_get(Evas_Object *obj); +EAPI void elm_panel_toggle(Evas_Object *obj); + #if 1 // working on it // flip types: diff --git a/legacy/elementary/src/lib/elm_hover.c b/legacy/elementary/src/lib/elm_hover.c index 248de3c489..27c3bde097 100644 --- a/legacy/elementary/src/lib/elm_hover.c +++ b/legacy/elementary/src/lib/elm_hover.c @@ -386,6 +386,41 @@ elm_hover_parent_set(Evas_Object *obj, Evas_Object *parent) _sizing_eval(obj); } +/** + * Gets the target object for the hover. + * + * @param obj The hover object + * @return The target object of the hover. + * + * @ingroup Hover + */ +EAPI Evas_Object * +elm_hover_target_get(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + return wd->target; +} + +/** + * Gets the parent object for the hover. + * + * @param obj The hover object + * @return The parent object to locate the hover over. + * + * @ingroup Hover + */ +EAPI Evas_Object * +elm_hover_parent_get(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + return wd->parent; +} /** * Sets the content of the hover object and the direction in which diff --git a/legacy/elementary/src/lib/elm_menu.c b/legacy/elementary/src/lib/elm_menu.c index f220a7e58b..1304e5f479 100644 --- a/legacy/elementary/src/lib/elm_menu.c +++ b/legacy/elementary/src/lib/elm_menu.c @@ -646,6 +646,20 @@ elm_menu_item_disabled_set(Elm_Menu_Item *item, Eina_Bool disabled) edje_object_message_signal_process(item->o); } +/** + * Get the disabled state of @p item. + * + * @param it The menu item object. + * @return The enabled/disabled state of the item + * + * @ingroup Menu + */ +EAPI Eina_Bool +elm_menu_item_disabled_get(Elm_Menu_Item *item) +{ + if (!item) return 0; + return item->disabled; +} /** * Add a separator item to menu @p obj under @p parent. @@ -693,6 +707,36 @@ elm_menu_item_separator_add(Evas_Object *obj, Elm_Menu_Item *parent) * @ingroup Menu */ +/** + * Get the icon of a menu item + * + * @param it The menu item object. + * @return The icon object of @p item or NULL + * + * @ingroup Menu + */ +EAPI Evas_Object * +elm_menu_item_icon_get(Elm_Menu_Item *item) +{ + if (!item) return NULL; + return item->icon; +} + +/** + * Returns whether @p item is a separator. + * + * @param item The item to check + * @return If true, @p item is a separator + * + * @ingroup Menu + */ +EAPI Eina_Bool +elm_menu_item_is_separator(Elm_Menu_Item *item) +{ + if (!item) return 0; + return item->separator; +} + EAPI void elm_menu_item_del(Elm_Menu_Item *item) { diff --git a/legacy/elementary/src/lib/elm_panel.c b/legacy/elementary/src/lib/elm_panel.c index 79cf4a8ba2..0b312f8287 100644 --- a/legacy/elementary/src/lib/elm_panel.c +++ b/legacy/elementary/src/lib/elm_panel.c @@ -211,6 +211,22 @@ elm_panel_orient_set(Evas_Object *obj, Elm_Panel_Orient orient) _sizing_eval(obj); } +/** + * Get the orientation of the panel. + * + * @param obj The panel object + * @return The Elm_Panel_Orient, or ELM_PANEL_ORIENT_LEFT on failure. + * + * @ingroup Panel + */ +EAPI Elm_Panel_Orient +elm_panel_orient_get(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) ELM_PANEL_ORIENT_LEFT; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return ELM_PANEL_ORIENT_LEFT; + return wd->orient; +} /** * Set the content of the panel. @@ -232,3 +248,56 @@ elm_panel_content_set(Evas_Object *obj, Evas_Object *content) evas_object_show(content); _sizing_eval(obj); } + +/** + * Set the state of the panel. + * + * @param obj The panel object + * @param hidden If true, the panel will run the edje animation to contract + * + * @ingroup Panel + */ +EAPI void +elm_panel_hidden_set(Evas_Object *obj, Eina_Bool hidden) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->hidden == hidden) return; + wd->hidden = hidden; + _toggle_panel(obj, NULL, "elm,action,panel,toggle", "*"); +} + +/** + * Get the state of the panel. + * + * @param obj The panel object + * @param hidden If true, the panel is in the "hide" state + * + * @ingroup Panel + */ +EAPI Eina_Bool +elm_panel_hidden_get(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->hidden; +} + +/** + * Toggle the state of the panel from code + * + * @param obj The panel object + * + * @ingroup Panel + */ +EAPI void +elm_panel_toggle(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->hidden = !(wd->hidden); + _toggle_panel(obj, NULL, "elm,action,panel,toggle", "*"); +} diff --git a/legacy/elementary/src/lib/elm_toolbar.c b/legacy/elementary/src/lib/elm_toolbar.c index 4711d231a9..8f15d1cb59 100644 --- a/legacy/elementary/src/lib/elm_toolbar.c +++ b/legacy/elementary/src/lib/elm_toolbar.c @@ -646,6 +646,24 @@ elm_toolbar_scrollable_set(Evas_Object *obj, Eina_Bool scrollable) _sizing_eval(obj); } +/** + * Get the scrollable state of toolbar @p obj. + * + * @param obj The toolbar object + * @return If true, the toolbar is scrollable + * + * @ingroup Toolbar + */ +EAPI Eina_Bool +elm_toolbar_scrollable_get(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + return wd->scrollable; +} + /** * Set the homogenous mode of toolbar @p obj. * @@ -665,6 +683,24 @@ elm_toolbar_homogenous_set(Evas_Object *obj, Eina_Bool homogenous) evas_object_smart_calculate(wd->bx); } +/** + * Get the homogenous mode of toolbar @p obj. + * + * @param obj The toolbar object + * @return If true, the toolbar items are uniform in size + * + * @ingroup Toolbar + */ +EAPI Eina_Bool +elm_toolbar_homogenous_get(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + return wd->homogeneous; +} + /** * Set the parent object of the toolbar menu * @@ -690,6 +726,24 @@ elm_toolbar_menu_parent_set(Evas_Object *obj, Evas_Object *parent) } } +/** + * Get the parent object of the toolbar menu + * + * @param obj The toolbar object + * @return The parent of the menu object + * + * @ingroup Toolbar + */ +EAPI Evas_Object * +elm_toolbar_menu_parent_get(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + + return wd->menu_parent; +} + /** * Unselect all of the items in the toolbar. * @@ -805,3 +859,221 @@ elm_toolbar_item_menu_get(Elm_Toolbar_Item *item) elm_toolbar_item_menu_set(item, 1); return item->o_menu; } + +/** + * Return a list of all toolbar items. + * + * @param obj The toolbar object + * + * @return An Eina_List* of the toolbar items in @p obj + * + * @ingroup Toolbar + */ +EAPI Eina_List * +elm_toolbar_item_get_all(Evas_Object *obj) +{ + Eina_List *l; + Elm_Toolbar_Item *it; + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + + return wd->items; +} + +/** + * Return the first toolbar item in the list of toolbar items. + * + * @param obj The toolbar object + * + * @return The first toolbar item, or NULL on failure + * + * @ingroup Toolbar + */ +EAPI Elm_Toolbar_Item * +elm_toolbar_item_get_first(Evas_Object *obj) +{ + Eina_List *l; + Elm_Toolbar_Item *it; + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + if (!(it = eina_list_data_get(wd->items))) return NULL; + + return it; +} + +/** + * Return the last toolbar item in the list of toolbar items. + * + * @param obj The toolbar object + * + * @return The last toolbar item, or NULL on failure + * + * @ingroup Toolbar + */ +EAPI Elm_Toolbar_Item * +elm_toolbar_item_get_last(Evas_Object *obj) +{ + Eina_List *l, *last; + Elm_Toolbar_Item *it; + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + if (!(last = eina_list_last(wd->items))) return NULL; + it = eina_list_data_get(last); + + return it; +} + +/** + * Return the next toolbar item (relative to the currently selected + * toolbar item) in the list of toolbar items. + * + * @param obj The toolbar object + * + * @return The next toolbar item, or NULL on failure + * + * @ingroup Toolbar + */ +EAPI Elm_Toolbar_Item * +elm_toolbar_item_get_next(Evas_Object *obj) +{ + Eina_List *l, *l2; + Elm_Toolbar_Item *it, *next; + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return NULL; + EINA_LIST_FOREACH_SAFE(wd->items, l, l2, it) + { + if (it->selected) + { + if (!(next = eina_list_data_get(l2))) return NULL; + return next; + } + } + return NULL; +} + +/** + * Selects the next non-disabled, non-separator toolbar item in the list + * of toolbar items. + * + * @param obj The toolbar object + * + * @return The newly selected toolbar item, or NULL on failure + * + * @ingroup Toolbar + */ +EAPI Elm_Toolbar_Item * +elm_toolbar_item_select_next(Evas_Object *obj) +{ + Eina_List *l, *l2; + Elm_Toolbar_Item *it, *next; + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return NULL; + EINA_LIST_FOREACH(wd->items, l, it) + { + if (it->selected) + { + EINA_LIST_FOREACH(l, l2, next) + if ((!next->disabled) && (next->separator)) + { + _item_select(next); + return next; + } + } + } + return NULL; +} + +/** + * Selects the first non-disabled, non-separator toolbar item in the list + * of toolbar items. + * + * @param obj The toolbar object + * + * @return The newly selected toolbar item, or NULL on failure + * + * @ingroup Toolbar + */ +EAPI Elm_Toolbar_Item * +elm_toolbar_item_select_first(Evas_Object *obj) +{ + Eina_List *l; + Elm_Toolbar_Item *it; + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + EINA_LIST_FOREACH(wd->items, l, it) + { + if ((!it->disabled) && (!it->separator)) + { + _item_select(it); + return it; + } + } + + return NULL; +} + +/** + * Selects the last non-disabled, non-separator toolbar item in the list + * of toolbar items. + * + * @param obj The toolbar object + * + * @return The newly selected toolbar item, or NULL on failure + * + * @ingroup Toolbar + */ +EAPI Elm_Toolbar_Item * +elm_toolbar_item_select_last(Evas_Object *obj) +{ + Eina_List *l; + Elm_Toolbar_Item *it; + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + EINA_LIST_REVERSE_FOREACH(wd->items, l, it) + { + if ((!it->disabled) && (!it->separator)) + { + _item_select(it); + return it; + } + } + + return NULL; +} + +/** + * Returns a pointer to a toolbar item by its label + * + * @param obj The toolbar object + * @param label The label of the item to find + * + * @return The pointer to the toolbar item matching @p label + * Returns NULL on failure. + * + * @ingroup Toolbar + */ +EAPI Elm_Toolbar_Item * +elm_toolbar_item_find_by_label(Evas_Object *obj, const char *label) +{ + Eina_List *l; + Elm_Toolbar_Item *it; + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return NULL; + EINA_LIST_FOREACH(wd->items, l, it) + { + if (!strcmp(it->label, label)) return it; + } + + return NULL; +}