New 1.16 API: Hoversel.label_auto_changed

...what a bad name for this prop
This commit is contained in:
Davide Andreoli 2015-10-07 22:05:28 +02:00
parent b82ed6f029
commit a7c8b2d40d
3 changed files with 31 additions and 1 deletions

View File

@ -250,6 +250,24 @@ cdef class Hoversel(Button):
def expanded_get(self):
return bool(elm_hoversel_expanded_get(self.obj))
property label_auto_changed:
"""Change the label of hoversel to that of selected item automatically.
:type: bool
..versionadded:: 1.16
"""
def __get__(self):
return bool(elm_hoversel_label_auto_changed_get(self.obj))
def __set__(self, bint enable):
elm_hoversel_label_auto_changed_set(self.obj, enable)
def elabel_auto_changed_get(self):
return bool(elm_hoversel_label_auto_changed_get(self.obj))
def elabel_auto_changed_set(self, bint enable):
elm_hoversel_label_auto_changed_set(self.obj, enable)
def clear(self):
"""This will remove all the children items from the hoversel.

View File

@ -20,3 +20,5 @@ cdef extern from "Elementary.h":
Elm_Object_Item *elm_hoversel_item_add(Evas_Object *obj, const char *label, const char *icon_file, Elm_Icon_Type icon_type, Evas_Smart_Cb func, void *data)
void elm_hoversel_item_icon_set(Elm_Object_Item *it, const char *icon_file, const char *icon_group, Elm_Icon_Type icon_type)
void elm_hoversel_item_icon_get(const Elm_Object_Item *it, const char **icon_file, const char **icon_group, Elm_Icon_Type *icon_type)
void elm_hoversel_label_auto_changed_set(Evas_Object *obj, Eina_Bool enable)
Eina_Bool elm_hoversel_label_auto_changed_get(Evas_Object *obj)

View File

@ -77,7 +77,6 @@ def hoversel_clicked(obj):
bx.pack_end(bt)
bt.show()
ic = Icon(win, file=os.path.join(img_path, "sky_03.jpg"))
bt = Hoversel(win, hover_parent=win, text="Icon + Label", content=ic,
size_hint_weight=WEIGHT_ZERO, size_hint_align=ALIGN_CENTER)
@ -90,6 +89,17 @@ def hoversel_clicked(obj):
bx.pack_end(bt)
bt.show()
bt = Hoversel(win, hover_parent=win, text="Label auto changed",
label_auto_changed=True,
size_hint_weight=WEIGHT_ZERO, size_hint_align=ALIGN_CENTER)
bt.item_add("Item 1", "apps", ELM_ICON_STANDARD)
bt.item_add("Item 2", "arrow_down", ELM_ICON_STANDARD)
bt.item_add("Item 3", "home", ELM_ICON_STANDARD)
bt.item_add("Item 4", "close", ELM_ICON_STANDARD)
bx.pack_end(bt)
bt.show()
win.show()