Segment control widget is a horizontal control made of multiple segment items, each segment item functioning similar to discrete two state button. A segment control groups the items together and provides compact single button with multiple equal size segments.
Segment item size is determined by base widget size and the number of items added. Only one segment item can be at selected state. A segment item can display combination of Text and any Evas_Object like Images or other widget.
Bases: efl.elementary.__init__.LayoutClass
This is the class that actually implements the widget.
Parameters: |
|
---|
When the user clicks on a segment item which is not previously selected and get selected. The event_info parameter is the segment item.
Append a new item to the segment control object.
A new item will be created and appended to the segment control, i.e., will be set as last item.
If it should be inserted at another position, item_insert_at() should be used instead.
Items created with this function can be deleted with function efl.elementary.object_item.ObjectItem.delete() or item_del_at().
Simple example:
sc = SegmentControl(win)
ic = Icon(win, file="path/to/image", resizable=(True, True))
sc.item_add(ic, "label")
sc.show()
Note
label set to None is different from empty string “”. If an item only has icon, it will be displayed bigger and centered. If it has icon and label, even that an empty string, icon will be smaller and positioned at left.
Parameters: |
|
---|---|
Returns: | The created item or None upon failure. |
Return type: |
Get the Segment items count from segment control.
It will just return the number of items added to the segment control.
Type: | int |
---|
Remove a segment control item at given index from its parent, deleting it.
Items can be added with item_add() or item_insert_at().
Parameters: | index (int) – The position of the segment control item to be deleted. |
---|
Get the item placed at specified index.
Index is the position of an item in segment control widget. Its range is from 0 to <tt> count - 1 </tt>. Count is the number of items, that can be get with item_count.
Parameters: | index (int) – The index of the segment item. |
---|---|
Returns: | The segment control item or None on failure. |
Return type: | SegmentControlItem |
Get the icon associated to the item.
The return value is the icon associated to the item when it was created, with function item_add(), or later with function part_content_set(). If no icon was passed as argument, it will return None.
Parameters: | index (int) – The index of the segment item. |
---|---|
Returns: | The left side icon associated to the item at index. |
Return type: | Object |
Insert a new item to the segment control object at specified position.
Index values must be between 0, when item will be prepended to segment control, and items count, that can be get with item_count, case when item will be appended to segment control, just like item_add().
Items created with this function can be deleted with function delete() or item_del_at().
Note
label set to None is different from empty string “”. If an item only has icon, it will be displayed bigger and centered. If it has icon and label, even that an empty string, icon will be smaller and positioned at left.
See also
item_add() item_count efl.elementary.object_item.ObjectItem.delete()
Parameters: |
|
---|---|
Returns: | The created item or None upon failure. |
Return type: |
Get the label of item.
The return value is the label associated to the item when it was created, with function item_add(), or later with function text. If no label was passed as argument, it will return None.
Parameters: | index (int) – The index of the segment item. |
---|---|
Returns: | The label of the item at index. |
Return type: | string |
The selected item.
The selected item always will be highlighted on segment control.
Type: | SegmentControlItem |
---|
Bases: efl.elementary.__init__.ObjectItem
An item for SegmentControl.
Append a new item to the segment control object.
A new item will be created and appended to the segment control, i.e., will be set as last item.
If it should be inserted at another position, item_insert_at() should be used instead.
Items created with this function can be deleted with function efl.elementary.object_item.ObjectItem.delete() or item_del_at().
Simple example:
sc = SegmentControl(win)
ic = Icon(win)
ic.file_set("path/to/image")
ic.resizable_set(True, True)
sc.item_add(ic, "label")
sc.show()
Note
label set to None is different from empty string “”. If an item only has icon, it will be displayed bigger and centered. If it has icon and label, even that an empty string, icon will be smaller and positioned at left.
Parameters: |
|
---|---|
Returns: | The created item or None upon failure. |
Return type: |
Get the index of an item.
Index is the position of an item in segment control widget. Its range is from 0 to <tt> count - 1 </tt>. Count is the number of items, that can be get with elm_segment_control_item_count_get().
Type: | int |
---|
Insert a new item to the segment control object at specified position.
Index values must be between 0, when item will be prepended to segment control, and items count, that can be get with item_count, case when item will be appended to segment control, just like item_add().
Items created with this function can be deleted with function delete() or item_del_at().
Note
label set to None is different from empty string “”. If an item only has icon, it will be displayed bigger and centered. If it has icon and label, even that an empty string, icon will be smaller and positioned at left.
See also
item_add() item_count efl.elementary.object_item.ObjectItem.delete()
Parameters: |
|
---|---|
Returns: | The created item or None upon failure. |
Return type: |
Get the base object of the item.
Type: | SegmentControl |
---|
Set the selected state of an 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.
The selected item always will be highlighted on segment control.
See also
Type: | bool |
---|