Functions
SegmentControl

Functions

EOAPI int elm_obj_segment_control_item_count_get (void)
 Get the Segment items count from segment control. More...
 
EOAPI Elm_Object_Itemelm_obj_segment_control_item_selected_get (void)
 Get the selected item. More...
 
EOAPI const char * elm_obj_segment_control_item_label_get (int idx)
 Get the label of item. More...
 
EOAPI Elm_Object_Itemelm_obj_segment_control_item_insert_at (Evas_Object *icon, const char *label, int idx)
 Insert a new item to the segment control object at specified position. More...
 
EOAPI Elm_Object_Itemelm_obj_segment_control_item_get (int idx)
 Get the item placed at specified index. More...
 
EOAPI void elm_obj_segment_control_item_del_at (int idx)
 Remove a segment control item at given index from its parent, deleting it. More...
 
EOAPI Elm_Object_Itemelm_obj_segment_control_item_add (Evas_Object *icon, const char *label)
 Append a new item to the segment control object. More...
 
EOAPI Evas_Object * elm_obj_segment_control_item_icon_get (int idx)
 Get the icon associated to the item. More...
 
std::string elm_segment_control::item_label_get (int idx_) const
 Get the label of item. More...
 
Elm_Object_Itemelm_segment_control::item_insert_at (evas::object icon_, std::string label_, int idx_) const
 Insert a new item to the segment control object at specified position. More...
 
Elm_Object_Itemelm_segment_control::item_get (int idx_) const
 Get the item placed at specified index. More...
 
void elm_segment_control::item_del_at (int idx_) const
 Remove a segment control item at given index from its parent, deleting it. More...
 
Elm_Object_Itemelm_segment_control::item_add (evas::object icon_, std::string label_) const
 Append a new item to the segment control object. More...
 
evas::object elm_segment_control::item_icon_get (int idx_) const
 Get the icon associated to the item. More...
 
int elm_segment_control::item_count_get () const
 Get the Segment items count from segment control. More...
 
Elm_Object_Itemelm_segment_control::item_selected_get () const
 Get the selected item. More...
 
int elm_segment_control_item_count_get (const Elm_Segment_Control *obj)
 Get the Segment items count from segment control. More...
 
Elm_Object_Itemelm_segment_control_item_selected_get (const Elm_Segment_Control *obj)
 Get the selected item. More...
 
const char * elm_segment_control_item_label_get (const Elm_Segment_Control *obj, int idx)
 Get the label of item. More...
 
Elm_Object_Itemelm_segment_control_item_insert_at (Elm_Segment_Control *obj, Evas_Object *icon, const char *label, int idx)
 Insert a new item to the segment control object at specified position. More...
 
Elm_Object_Itemelm_segment_control_item_get (const Elm_Segment_Control *obj, int idx)
 Get the item placed at specified index. More...
 
void elm_segment_control_item_del_at (Elm_Segment_Control *obj, int idx)
 Remove a segment control item at given index from its parent, deleting it. More...
 
Elm_Object_Itemelm_segment_control_item_add (Elm_Segment_Control *obj, Evas_Object *icon, const char *label)
 Append a new item to the segment control object. More...
 
Evas_Object * elm_segment_control_item_icon_get (const Elm_Segment_Control *obj, int idx)
 Get the icon associated to the item. More...
 
EOAPI int elm_obj_segment_control_item_index_get (void)
 Get the index of an item. More...
 
EOAPI Evas_Object * elm_obj_segment_control_item_object_get (void)
 Get the real Evas(Edje) object created to implement the view of a given segment_control item. More...
 
EOAPI void elm_obj_segment_control_item_selected_set (Eina_Bool selected)
 Set the selected state of an item. More...
 
int elm_segment_control_item_index_get (const Elm_Segment_Control_Item *obj)
 Get the index of an item. More...
 
Evas_Object * elm_segment_control_item_object_get (const Elm_Segment_Control_Item *obj)
 Get the real Evas(Edje) object created to implement the view of a given segment_control item. More...
 
void elm_segment_control_item_selected_set (Elm_Segment_Control_Item *obj, Eina_Bool selected)
 Set the selected state of an item. More...
 
Evas_Object * elm_segment_control_add (Evas_Object *parent)
 Add a new segment control widget to the given parent Elementary (container) object. More...
 

Detailed Description

segment_control_inheritance_tree.png
preview-00.png
segment_control.png

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.

This widget inherits from the Layout one, so that all the functions acting on it also work for segment control objects.

This widget emits the following signals, besides the ones sent from Layout:

Available styles for it:

Default content parts of the segment control items that you can use for are:

Default text parts of the segment control items that you can use for are:

Supported elm_object common APIs.

Supported elm_object_item common APIs.

Here is an example on its usage:

Function Documentation

EOAPI Elm_Object_Item* elm_obj_segment_control_item_add ( Evas_Object *  icon,
const char *  label 
)

Append a new item to the segment control object.

Returns
The created item or NULL upon failure.

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, elm_segment_control_item_insert_at() should be used instead.

Items created with this function can be deleted with function elm_object_item_del() or elm_object_item_del_at().

Note
label set to NULL 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.

Simple example:

1 sc = elm_segment_control_add(win);
2 ic = elm_icon_add(win);
3 elm_image_file_set(ic, "path/to/image", NULL);
4 elm_icon_resizable_set(ic, EINA_TRUE, EINA_TRUE);
5 elm_segment_control_item_add(sc, ic, "label");
6 evas_object_show(sc);
See also
elm_segment_control_item_insert_at()
elm_object_item_del()
Parameters
[in]iconThe icon object to use for the left side of the item. An icon can be any Evas object, but usually it is an icon created with elm_icon_add().
[in]labelThe label of the item. Note that, NULL is different from empty string "".

Referenced by elm_segment_control_item_add(), and elm_segment_control::item_add().

EOAPI int elm_obj_segment_control_item_count_get ( void  )

Get the Segment items count from segment control.

Returns
Segment items count.

It will just return the number of items added to segment control obj.

Referenced by elm_segment_control_item_count_get(), and elm_segment_control::item_count_get().

EOAPI void elm_obj_segment_control_item_del_at ( int  idx)

Remove a segment control item at given index from its parent, deleting it.

Items can be added with elm_segment_control_item_add() or elm_segment_control_item_insert_at().

Parameters
[in]idxThe position of the segment control item to be deleted.

Referenced by elm_segment_control_item_del_at(), and elm_segment_control::item_del_at().

EOAPI Elm_Object_Item* elm_obj_segment_control_item_get ( int  idx)

Get the item placed at specified index.

Returns
The segment control item or NULL on failure.

Index is the position of an item in segment control widget. Its range is from 0 to count - 1 . Count is the number of items, that can be get with elm_segment_control_item_count_get().

Parameters
[in]idxThe index of the segment item.

Referenced by elm_segment_control_item_get(), and elm_segment_control::item_get().

EOAPI Evas_Object* elm_obj_segment_control_item_icon_get ( int  idx)

Get the icon associated to the item.

Returns
The left side icon associated to the item at index.

The return value is a pointer to the icon associated to the item when it was created, with function elm_segment_control_item_add(), or later with function elm_object_item_part_content_set(). If no icon was passed as argument, it will return NULL.

See also
elm_segment_control_item_add()
elm_object_item_part_content_set()
Parameters
[in]idxThe index of the segment item.

Referenced by elm_segment_control_item_icon_get(), and elm_segment_control::item_icon_get().

EOAPI int elm_obj_segment_control_item_index_get ( void  )

Get the index of an item.

Index is the position of an item in segment control widget. Its range is from 0 to count - 1 . Count is the number of items, that can be get with elm_segment_control_item_count_get().

Returns
The position of item in segment control widget.

Referenced by elm_segment_control_item_index_get().

EOAPI Elm_Object_Item* elm_obj_segment_control_item_insert_at ( Evas_Object *  icon,
const char *  label,
int  idx 
)

Insert a new item to the segment control object at specified position.

Returns
The created item or NULL upon failure.

Index values must be between 0, when item will be prepended to segment control, and items count, that can be get with elm_segment_control_item_count_get(), case when item will be appended to segment control, just like elm_segment_control_item_add().

Items created with this function can be deleted with function elm_object_item_del() or elm_segment_control_item_del_at().

Note
label set to NULL 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
elm_segment_control_item_add()
elm_segment_control_item_count_get()
elm_object_item_del()
Parameters
[in]iconThe icon object to use for the left side of the item. An icon can be any Evas object, but usually it is an icon created with elm_icon_add().
[in]labelThe label of the item.
[in]idxItem position. Value should be between 0 and items count.

Referenced by elm_segment_control_item_insert_at(), and elm_segment_control::item_insert_at().

EOAPI const char* elm_obj_segment_control_item_label_get ( int  idx)

Get the label of item.

Returns
The label of the item at index.

The return value is a pointer to the label associated to the item when it was created, with function elm_segment_control_item_add(), or later with function elm_object_item_text_set. If no label was passed as argument, it will return NULL.

See also
elm_object_item_text_set() for more details.
elm_segment_control_item_add()
Parameters
[in]idxThe index of the segment item.

Referenced by elm_segment_control_item_label_get(), and elm_segment_control::item_label_get().

EOAPI Evas_Object* elm_obj_segment_control_item_object_get ( void  )

Get the real Evas(Edje) object created to implement the view of a given segment_control item.

Base object is the Evas_Object that represents that item.

Returns
The base Edje object associated with it.

Referenced by elm_segment_control_item_object_get().

EOAPI Elm_Object_Item* elm_obj_segment_control_item_selected_get ( void  )

Get the selected item.

Returns
The selected item or NULL if none of segment items is selected.

The selected item can be unselected with function elm_segment_control_item_selected_set().

The selected item always will be highlighted on segment control.

Referenced by elm_segment_control_item_selected_get(), and elm_segment_control::item_selected_get().

EOAPI void elm_obj_segment_control_item_selected_set ( Eina_Bool  selected)

Set the selected state of an item.

This sets the selected state of the given item it. EINA_TRUE for selected, EINA_FALSE for not selected.

If a new item is selected the previously selected will be unselected. Selected item can be got with function elm_segment_control_item_selected_get().

The selected item always will be highlighted on segment control.

See also
elm_segment_control_item_selected_get()
Parameters
[in]selectedThe selected state.

Referenced by elm_segment_control_item_selected_set().

Evas_Object* elm_segment_control_add ( Evas_Object *  parent)

Add a new segment control widget to the given parent Elementary (container) object.

Parameters
parentThe parent object.
Returns
a new segment control widget handle or NULL, on errors.

This function inserts a new segment control widget on the canvas.

Elm_Object_Item* elm_segment_control_item_add ( Elm_Segment_Control *  obj,
Evas_Object *  icon,
const char *  label 
)

Append a new item to the segment control object.

Returns
The created item or NULL upon failure.

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, elm_segment_control_item_insert_at() should be used instead.

Items created with this function can be deleted with function elm_object_item_del() or elm_object_item_del_at().

Note
label set to NULL 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.

Simple example:

1 sc = elm_segment_control_add(win);
2 ic = elm_icon_add(win);
3 elm_image_file_set(ic, "path/to/image", NULL);
4 elm_icon_resizable_set(ic, EINA_TRUE, EINA_TRUE);
5 elm_segment_control_item_add(sc, ic, "label");
6 evas_object_show(sc);
See also
elm_segment_control_item_insert_at()
elm_object_item_del()
Parameters
[in]iconThe icon object to use for the left side of the item. An icon can be any Evas object, but usually it is an icon created with elm_icon_add().
[in]labelThe label of the item. Note that, NULL is different from empty string "".

References elm_obj_segment_control_item_add().

int elm_segment_control_item_count_get ( const Elm_Segment_Control *  obj)

Get the Segment items count from segment control.

Returns
Segment items count.

It will just return the number of items added to segment control obj.

References elm_obj_segment_control_item_count_get().

void elm_segment_control_item_del_at ( Elm_Segment_Control *  obj,
int  idx 
)

Remove a segment control item at given index from its parent, deleting it.

Items can be added with elm_segment_control_item_add() or elm_segment_control_item_insert_at().

Parameters
[in]idxThe position of the segment control item to be deleted.

References elm_obj_segment_control_item_del_at().

Elm_Object_Item* elm_segment_control_item_get ( const Elm_Segment_Control *  obj,
int  idx 
)

Get the item placed at specified index.

Returns
The segment control item or NULL on failure.

Index is the position of an item in segment control widget. Its range is from 0 to count - 1 . Count is the number of items, that can be get with elm_segment_control_item_count_get().

Parameters
[in]idxThe index of the segment item.

References elm_obj_segment_control_item_get().

Evas_Object* elm_segment_control_item_icon_get ( const Elm_Segment_Control *  obj,
int  idx 
)

Get the icon associated to the item.

Returns
The left side icon associated to the item at index.

The return value is a pointer to the icon associated to the item when it was created, with function elm_segment_control_item_add(), or later with function elm_object_item_part_content_set(). If no icon was passed as argument, it will return NULL.

See also
elm_segment_control_item_add()
elm_object_item_part_content_set()
Parameters
[in]idxThe index of the segment item.

References elm_obj_segment_control_item_icon_get().

int elm_segment_control_item_index_get ( const Elm_Segment_Control_Item *  obj)

Get the index of an item.

Index is the position of an item in segment control widget. Its range is from 0 to count - 1 . Count is the number of items, that can be get with elm_segment_control_item_count_get().

Returns
The position of item in segment control widget.

References elm_obj_segment_control_item_index_get().

Elm_Object_Item* elm_segment_control_item_insert_at ( Elm_Segment_Control *  obj,
Evas_Object *  icon,
const char *  label,
int  idx 
)

Insert a new item to the segment control object at specified position.

Returns
The created item or NULL upon failure.

Index values must be between 0, when item will be prepended to segment control, and items count, that can be get with elm_segment_control_item_count_get(), case when item will be appended to segment control, just like elm_segment_control_item_add().

Items created with this function can be deleted with function elm_object_item_del() or elm_segment_control_item_del_at().

Note
label set to NULL 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
elm_segment_control_item_add()
elm_segment_control_item_count_get()
elm_object_item_del()
Parameters
[in]iconThe icon object to use for the left side of the item. An icon can be any Evas object, but usually it is an icon created with elm_icon_add().
[in]labelThe label of the item.
[in]idxItem position. Value should be between 0 and items count.

References elm_obj_segment_control_item_insert_at().

const char* elm_segment_control_item_label_get ( const Elm_Segment_Control *  obj,
int  idx 
)

Get the label of item.

Returns
The label of the item at index.

The return value is a pointer to the label associated to the item when it was created, with function elm_segment_control_item_add(), or later with function elm_object_item_text_set. If no label was passed as argument, it will return NULL.

See also
elm_object_item_text_set() for more details.
elm_segment_control_item_add()
Parameters
[in]idxThe index of the segment item.

References elm_obj_segment_control_item_label_get().

Evas_Object* elm_segment_control_item_object_get ( const Elm_Segment_Control_Item *  obj)

Get the real Evas(Edje) object created to implement the view of a given segment_control item.

Base object is the Evas_Object that represents that item.

Returns
The base Edje object associated with it.

References elm_obj_segment_control_item_object_get().

Elm_Object_Item* elm_segment_control_item_selected_get ( const Elm_Segment_Control *  obj)

Get the selected item.

Returns
The selected item or NULL if none of segment items is selected.

The selected item can be unselected with function elm_segment_control_item_selected_set().

The selected item always will be highlighted on segment control.

References elm_obj_segment_control_item_selected_get().

void elm_segment_control_item_selected_set ( Elm_Segment_Control_Item *  obj,
Eina_Bool  selected 
)

Set the selected state of an item.

This sets the selected state of the given item it. EINA_TRUE for selected, EINA_FALSE for not selected.

If a new item is selected the previously selected will be unselected. Selected item can be got with function elm_segment_control_item_selected_get().

The selected item always will be highlighted on segment control.

See also
elm_segment_control_item_selected_get()
Parameters
[in]selectedThe selected state.

References elm_obj_segment_control_item_selected_set().

Elm_Object_Item* elm_segment_control::item_add ( evas::object  icon_,
std::string  label_ 
) const
inline

Append a new item to the segment control object.

Returns
The created item or NULL upon failure.

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, elm_segment_control_item_insert_at() should be used instead.

Items created with this function can be deleted with function elm_object_item_del() or elm_object_item_del_at().

Note
label set to NULL 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.

Simple example:

ic = elm_icon_add(win);
elm_image_file_set(ic, "path/to/image", NULL);
elm_icon_resizable_set(ic, EINA_TRUE, EINA_TRUE);
evas_object_show(sc);
See also
elm_segment_control_item_insert_at()
elm_object_item_del()
Parameters
iconThe icon object to use for the left side of the item. An icon can be any Evas object, but usually it is an icon created with elm_icon_add().
labelThe label of the item. Note that, NULL is different from empty string "".

References elm_obj_segment_control_item_add().

int elm_segment_control::item_count_get ( ) const
inline

Get the Segment items count from segment control.

Returns
Segment items count.

It will just return the number of items added to segment control obj.

References elm_obj_segment_control_item_count_get().

void elm_segment_control::item_del_at ( int  idx_) const
inline

Remove a segment control item at given index from its parent, deleting it.

Items can be added with elm_segment_control_item_add() or elm_segment_control_item_insert_at().

Parameters
idxThe position of the segment control item to be deleted.

References elm_obj_segment_control_item_del_at().

Elm_Object_Item* elm_segment_control::item_get ( int  idx_) const
inline

Get the item placed at specified index.

Returns
The segment control item or NULL on failure.

Index is the position of an item in segment control widget. Its range is from 0 to count - 1 . Count is the number of items, that can be get with elm_segment_control_item_count_get().

Parameters
idxThe index of the segment item.

References elm_obj_segment_control_item_get().

evas::object elm_segment_control::item_icon_get ( int  idx_) const
inline

Get the icon associated to the item.

Returns
The left side icon associated to the item at index.

The return value is a pointer to the icon associated to the item when it was created, with function elm_segment_control_item_add(), or later with function elm_object_item_part_content_set(). If no icon was passed as argument, it will return NULL.

See also
elm_segment_control_item_add()
elm_object_item_part_content_set()
Parameters
idxThe index of the segment item.

References elm_obj_segment_control_item_icon_get().

Elm_Object_Item* elm_segment_control::item_insert_at ( evas::object  icon_,
std::string  label_,
int  idx_ 
) const
inline

Insert a new item to the segment control object at specified position.

Returns
The created item or NULL upon failure.

Index values must be between 0, when item will be prepended to segment control, and items count, that can be get with elm_segment_control_item_count_get(), case when item will be appended to segment control, just like elm_segment_control_item_add().

Items created with this function can be deleted with function elm_object_item_del() or elm_segment_control_item_del_at().

Note
label set to NULL 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
elm_segment_control_item_add()
elm_segment_control_item_count_get()
elm_object_item_del()
Parameters
iconThe icon object to use for the left side of the item. An icon can be any Evas object, but usually it is an icon created with elm_icon_add().
labelThe label of the item.
idxItem position. Value should be between 0 and items count.

References elm_obj_segment_control_item_insert_at().

std::string elm_segment_control::item_label_get ( int  idx_) const
inline

Get the label of item.

Returns
The label of the item at index.

The return value is a pointer to the label associated to the item when it was created, with function elm_segment_control_item_add(), or later with function elm_object_item_text_set. If no label was passed as argument, it will return NULL.

See also
elm_object_item_text_set() for more details.
elm_segment_control_item_add()
Parameters
idxThe index of the segment item.

References elm_obj_segment_control_item_label_get().

Elm_Object_Item* elm_segment_control::item_selected_get ( ) const
inline

Get the selected item.

Returns
The selected item or NULL if none of segment items is selected.

The selected item can be unselected with function elm_segment_control_item_selected_set().

The selected item always will be highlighted on segment control.

References elm_obj_segment_control_item_selected_get().