|
|
|
|
Etk_Iconbox
Detailed Description
An Etk_Iconbox is a widget that can display icons aligned on a grid.
The iconbox is based on a notion of "model". The icon view is describes by a model which is fully customizable: the model controls the position and the size of the cell, the icon image and the label of the iconbox's icons.
A default model is created when the iconbox is created, but you can add your own with etk_iconbox_model_new(), and enable it with etk_iconbox_current_model_set().
The model's settings can be changed with etk_iconbox_model_geometry_set(), etk_iconbox_model_icon_geometry_set() and etk_iconbox_model_label_geometry_set().
Once the model is defined, you can start adding and removing icons to the iconbox with etk_iconbox_append(), etk_iconbox_icon_del() and etk_iconbox_clear().
You can add an emblem to the icons using etk_iconbox_icon_emblem_file_set() or etk_iconbox_icon_emblem_set_from_stock(). And you can change the position of the emblems with etk_iconbox_emblem_position_set()
- Object Hierarchy:
-
- Signals:
- "icon-selected": Emitted when an icon of the iconbox has been selected. If several icons have been selected at the same time (with etk_iconbox_select_all(), or with the selection rectangle), the "icon-selected" signal will only be emitted once, on the last selected icon.
Callback: Etk_Bool callback(Etk_Iconbox *iconbox, Etk_Iconbox_Icon *icon, void *data)
iconbox: the iconbox connected to the callbackicon: the icon which has been selecteddata: the user data set when the callback has been connected to the signal
- "icon-unselected": Emitted when an icon of the iconbox has been unselected. If several icons have been unselected at the same time (with etk_iconbox_unselect_all(), or with the selection rectangle), the "icon-unselected" signal will only be emitted once, on the last unselected icon.
Callback: Etk_Bool callback(Etk_Iconbox *iconbox, Etk_Iconbox_Icon *icon, void *data)
iconbox: the iconbox connected to the callbackicon: the icon which has been unselecteddata: the user data set when the callback has been connected to the signal
- "all-selected": Emitted when all the icons of the iconbox have been selected with etk_iconbox_select_all()
Callback: Etk_Bool callback(Etk_Iconbox *iconbox, void *data)
iconbox: the iconbox connected to the callbackdata: the user data set when the callback has been connected to the signal
- "all-unselected": Emitted when all the icons of the iconbox have been unselected with etk_iconbox_select_all()
Callback: Etk_Bool callback(Etk_Iconbox *iconbox, void *data)
iconbox: the iconbox connected to the callbackdata: the user data set when the callback has been connected to the signal
|
Data Structures |
struct | Etk_Iconbox_Model |
| Describes the model of an iconbox: it includes the position and the size of the cell, of the icon and of the label. An iconbox can have several models, and, at any moment, you can change the current model to change the view. More...
|
struct | Etk_Iconbox_Icon |
| An icon of the iconbox. More...
|
struct | Etk_Iconbox |
| [Widget] A widget that can display icons aligned on a grid More...
|
Defines |
#define | ETK_ICONBOX_TYPE (etk_iconbox_type_get()) |
#define | ETK_ICONBOX(obj) (ETK_OBJECT_CAST((obj), ETK_ICONBOX_TYPE, Etk_Iconbox)) |
#define | ETK_IS_ICONBOX(obj) (ETK_OBJECT_CHECK_TYPE((obj), ETK_ICONBOX_TYPE)) |
Enumerations |
enum | Etk_Emblem_Position {
ETK_ICONBOX_EMBLEM_POSITION_TL,
ETK_ICONBOX_EMBLEM_POSITION_TR,
ETK_ICONBOX_EMBLEM_POSITION_TC,
ETK_ICONBOX_EMBLEM_POSITION_BL,
ETK_ICONBOX_EMBLEM_POSITION_BR,
ETK_ICONBOX_EMBLEM_POSITION_BC,
ETK_ICONBOX_EMBLEM_POSITION_CC,
ETK_ICONBOX_EMBLEM_POSITION_CL,
ETK_ICONBOX_EMBLEM_POSITION_CR,
ETK_ICONBOX_EMBLEM_POSITION_FULL
} |
| The different positions of the emblems. Default is top-left corner. More...
|
Functions |
Etk_Widget * | etk_iconbox_new (void) |
| Creates a new iconbox.
|
Etk_Iconbox_Model * | etk_iconbox_model_new (Etk_Iconbox *iconbox) |
| Creates a new model for the icons of the iconbox.
|
void | etk_iconbox_model_free (Etk_Iconbox_Model *model) |
| Frees the iconbox model.
|
void | etk_iconbox_current_model_set (Etk_Iconbox *iconbox, Etk_Iconbox_Model *model) |
| Sets the model used by the iconbox.
|
Etk_Iconbox_Model * | etk_iconbox_current_model_get (Etk_Iconbox *iconbox) |
| Gets the model currently used by the iconbox.
|
void | etk_iconbox_emblem_position_set (Etk_Iconbox *iconbox, Etk_Emblem_Position pos) |
| Set the position of the icon's emblem.
|
Etk_Emblem_Position | etk_iconbox_emblem_position_get (Etk_Iconbox *iconbox) |
| Get the position of the icon's emblem.
|
void | etk_iconbox_model_geometry_set (Etk_Iconbox_Model *model, int width, int height, int xpadding, int ypadding) |
| Sets the global geometry of the iconbox model.
|
void | etk_iconbox_model_geometry_get (Etk_Iconbox_Model *model, int *width, int *height, int *xpadding, int *ypadding) |
| Gets the global geometry of the iconbox model.
|
void | etk_iconbox_model_icon_geometry_set (Etk_Iconbox_Model *model, int x, int y, int width, int height, Etk_Bool fill, Etk_Bool keep_aspect) |
| Sets the icon geometry of the iconbox model.
|
void | etk_iconbox_model_icon_geometry_get (Etk_Iconbox_Model *model, int *x, int *y, int *width, int *height, Etk_Bool *fill, Etk_Bool *keep_aspect) |
| Gets the icon geometry of the iconbox model.
|
void | etk_iconbox_model_label_geometry_set (Etk_Iconbox_Model *model, int x, int y, int width, int height, float xalign, float yalign) |
| Sets the label geometry of the iconbox model.
|
void | etk_iconbox_model_label_geometry_get (Etk_Iconbox_Model *model, int *x, int *y, int *width, int *height, float *xalign, float *yalign) |
| Gets the label geometry of the iconbox model.
|
void | etk_iconbox_freeze (Etk_Iconbox *iconbox) |
| Freezes the iconbox: it will not be updated until it is thawed.
This function is useful when you want to add efficiently a lot of icons.
|
void | etk_iconbox_thaw (Etk_Iconbox *iconbox) |
| Thaws the iconbox: it will update the iconbox if it was frozen.
|
Etk_Iconbox_Icon * | etk_iconbox_append (Etk_Iconbox *iconbox, const char *filename, const char *edje_group, const char *label) |
| Appends a new icon to the iconbox.
|
void | etk_iconbox_icon_del (Etk_Iconbox_Icon *icon) |
| Removes the icon from the iconbox.
|
void | etk_iconbox_clear (Etk_Iconbox *iconbox) |
| Removes all the icons of the iconbox.
|
Etk_Iconbox_Icon * | etk_iconbox_icon_get_at_xy (Etk_Iconbox *iconbox, int x, int y, Etk_Bool over_cell, Etk_Bool over_icon, Etk_Bool over_label) |
| Gets the icon located below the position ( x, y ). The position should be relative to the canvas (TODO: relative to the icobox instead?).
|
Etk_Iconbox_Icon * | etk_iconbox_icon_get_by_label (Etk_Iconbox *iconbox, const char *label) |
| Get the first icon with the given label. If more than one icon has the same label only the first is returned.
|
Etk_Iconbox_Icon * | etk_iconbox_icon_get_by_data (Etk_Iconbox *iconbox, void *data) |
| Get the first icon with the given data attached. If more than one icon has the same data only the first is returned.
|
Eina_List * | etk_iconbox_icon_get_selected (Etk_Iconbox *iconbox) |
| Get all the selected icons.
|
Etk_Iconbox_Icon * | etk_iconbox_icon_get_first_selected (Etk_Iconbox *iconbox) |
| Get the first selected icon. If more than one icon is selected only the first one is returned.
|
void | etk_iconbox_icon_file_set (Etk_Iconbox_Icon *icon, const char *filename, const char *edje_group) |
| Sets the file path of the icon's image.
|
void | etk_iconbox_icon_file_get (Etk_Iconbox_Icon *icon, const char **filename, const char **edje_group) |
| Gets the file used by the icon's image.
|
void | etk_iconbox_icon_emblem_set_from_stock (Etk_Iconbox_Icon *icon, const char *stock_name) |
| Sets the emblem from the stock icons.
|
void | etk_iconbox_icon_emblem_file_set (Etk_Iconbox_Icon *icon, const char *filename, const char *edje_group) |
| Sets the file path of the emblem's image.
|
void | etk_iconbox_icon_emblem_file_get (Etk_Iconbox_Icon *icon, const char **filename, const char **edje_group) |
| Gets the file used by the emblem's image.
|
void | etk_iconbox_icon_label_set (Etk_Iconbox_Icon *icon, const char *label) |
| Sets the label of the icon.
|
const char * | etk_iconbox_icon_label_get (Etk_Iconbox_Icon *icon) |
| Gets the label used for the icon image.
|
void | etk_iconbox_icon_data_set (Etk_Iconbox_Icon *icon, void *data) |
| Sets a value to the data member of an icon.
The data could be retrieved with etk_iconbox_icon_row_data_get().
|
void | etk_iconbox_icon_data_set_full (Etk_Iconbox_Icon *icon, void *data, void(*free_cb)(void *data)) |
| Sets a value to the data member of an icon.
The data could be retrieved with etk_iconbox_icon_row_data_get().
|
void * | etk_iconbox_icon_data_get (Etk_Iconbox_Icon *icon) |
| Gets the value of the data member of the icon.
|
void | etk_iconbox_select_all (Etk_Iconbox *iconbox) |
| Selects all the icons of the iconbox.
|
void | etk_iconbox_unselect_all (Etk_Iconbox *iconbox) |
| Unselects all the icons of the iconbox.
|
void | etk_iconbox_icon_select (Etk_Iconbox_Icon *icon) |
| Selects the icon.
|
void | etk_iconbox_icon_unselect (Etk_Iconbox_Icon *icon) |
| Unselects the icon.
|
Etk_Bool | etk_iconbox_is_selected (Etk_Iconbox_Icon *icon) |
| Gets whether the icon is selected.
|
Etk_Scrolled_View * | etk_iconbox_scrolled_view_get (Etk_Iconbox *iconbox) |
| Gets the scrolled view of the iconbox. It can be used to change the scrollbars' policy, or to get the scroll-value.
|
Define Documentation
#define ETK_ICONBOX_TYPE (etk_iconbox_type_get()) |
Gets the type of an iconbox
#define ETK_ICONBOX |
( |
obj |
|
) |
(ETK_OBJECT_CAST((obj), ETK_ICONBOX_TYPE, Etk_Iconbox)) |
#define ETK_IS_ICONBOX |
( |
obj |
|
) |
(ETK_OBJECT_CHECK_TYPE((obj), ETK_ICONBOX_TYPE)) |
Check if the object is an Etk_Iconbobx
Enumeration Type Documentation
The different positions of the emblems. Default is top-left corner.
- Enumerator:
-
ETK_ICONBOX_EMBLEM_POSITION_TL |
Emblem in the top-left corner |
ETK_ICONBOX_EMBLEM_POSITION_TR |
Emblem in the top-right corner |
ETK_ICONBOX_EMBLEM_POSITION_TC |
Emblem in the top at the center |
ETK_ICONBOX_EMBLEM_POSITION_BL |
Emblem in the bottom-left corner |
ETK_ICONBOX_EMBLEM_POSITION_BR |
Emblem in the bottom-right corner |
ETK_ICONBOX_EMBLEM_POSITION_BC |
Emblem in the bottom at the center |
ETK_ICONBOX_EMBLEM_POSITION_CC |
Emblem is in the middle of the icon |
ETK_ICONBOX_EMBLEM_POSITION_CL |
Emblem is in the middle of the left side |
ETK_ICONBOX_EMBLEM_POSITION_CR |
Emblem is in the middle of the right side |
ETK_ICONBOX_EMBLEM_POSITION_FULL |
Emblem take the same size/position of the icon |
Function Documentation
Creates a new iconbox.
- Returns:
- Returns the new iconbox widget
Creates a new model for the icons of the iconbox.
- Parameters:
-
- Returns:
- Returns the new model
Frees the iconbox model.
- Parameters:
-
| model | the iconbox model to free |
- Note:
- You don't need to do it manually, the models are automatically freed when the iconbox is destroyed
Sets the model used by the iconbox.
- Parameters:
-
| iconbox | an iconbox |
| model | the model that the iconbox should use (if NULL, no icon will be displayed) |
Gets the model currently used by the iconbox.
- Parameters:
-
- Returns:
- Returns the model currently used by the iconbox
Set the position of the icon's emblem.
- Parameters:
-
| iconbox | an iconbox |
| pos | the position of the emblems |
Get the position of the icon's emblem.
- Parameters:
-
- Returns:
- the position of the emblems
void etk_iconbox_model_geometry_set |
( |
Etk_Iconbox_Model * |
model, |
|
|
int |
width, |
|
|
int |
height, |
|
|
int |
xpadding, |
|
|
int |
ypadding | |
|
) |
| | |
Sets the global geometry of the iconbox model.
- Parameters:
-
| model | an iconbox model |
| width | the width of the cells of the model (min = 10) |
| height | the height of the cells of the model (min = 10) |
| xpadding | the horizontal padding of the cells of the model (min = 0) |
| ypadding | the vertical padding of the cells of the model (min = 0) |
void etk_iconbox_model_geometry_get |
( |
Etk_Iconbox_Model * |
model, |
|
|
int * |
width, |
|
|
int * |
height, |
|
|
int * |
xpadding, |
|
|
int * |
ypadding | |
|
) |
| | |
Gets the global geometry of the iconbox model.
- Parameters:
-
| model | an iconbox model |
| width | the location where to store the width of the cells of the model |
| height | the location where to store the height of the cells of the model |
| xpadding | the location where to store the horizontal padding of the cells of the model |
| ypadding | the location where to store the vertical padding of the cells of the model |
void etk_iconbox_model_icon_geometry_set |
( |
Etk_Iconbox_Model * |
model, |
|
|
int |
x, |
|
|
int |
y, |
|
|
int |
width, |
|
|
int |
height, |
|
|
Etk_Bool |
fill, |
|
|
Etk_Bool |
keep_aspect | |
|
) |
| | |
Sets the icon geometry of the iconbox model.
- Parameters:
-
| model | an iconbox model |
| x | the x position of the icon image of the model (min = 0) |
| y | the y position of the icon image of the model (min = 0) |
| width | the width of the icon image of the model (min = 10) |
| height | the height of the icon image of the model (min = 10) |
| fill | if fill == ETK_TRUE, and if the icon image is smaller than the icon geometry, the image will fill the geometry |
| keep_aspect | if keep_aspect == ETK_TRUE, the icon image will keep its aspect ratio (no distortion) |
- Note:
- the x/y positions are relative to the inner top left corner of the icon model:
i.e. the icon image will be in fact put at (model->xpadding + model->icon_x, model->ypadding + model->icon_y)
void etk_iconbox_model_icon_geometry_get |
( |
Etk_Iconbox_Model * |
model, |
|
|
int * |
x, |
|
|
int * |
y, |
|
|
int * |
width, |
|
|
int * |
height, |
|
|
Etk_Bool * |
fill, |
|
|
Etk_Bool * |
keep_aspect | |
|
) |
| | |
Gets the icon geometry of the iconbox model.
- Parameters:
-
| model | an iconbox model |
| x | the location where to store x position of the icon image |
| y | the location where to store y position of the icon image |
| width | the location where to store the width of the icon image |
| height | the location where to store the height of the icon image |
| fill | the location where to store the fill property of the model (see etk_iconbox_model_icon_geometry_set()) |
| keep_aspect | the location where to store the "keep aspect ratio" property of the model (see etk_iconbox_model_icon_geometry_set()) |
- See also:
- etk_iconbox_model_icon_geometry_set()
void etk_iconbox_model_label_geometry_set |
( |
Etk_Iconbox_Model * |
model, |
|
|
int |
x, |
|
|
int |
y, |
|
|
int |
width, |
|
|
int |
height, |
|
|
float |
xalign, |
|
|
float |
yalign | |
|
) |
| | |
Sets the label geometry of the iconbox model.
- Parameters:
-
| model | an iconbox model |
| x | the x position of the label of the model (min = 0) |
| y | the y position of the label of the model (min = 0) |
| width | the width of the label of the model (min = 10) |
| height | the height of the label of the model (min = 5) |
| xalign | the horizontal alignment of the label (from 0.0 to 1.0) |
| yalign | the vertical alignment of the label |
- Note:
- the x/y positions are relative to the inner top left corner of the icon model:
i.e. the label will be in fact put at (model->xpadding + model->label_x, model->ypadding + model->label_y)
void etk_iconbox_model_label_geometry_get |
( |
Etk_Iconbox_Model * |
model, |
|
|
int * |
x, |
|
|
int * |
y, |
|
|
int * |
width, |
|
|
int * |
height, |
|
|
float * |
xalign, |
|
|
float * |
yalign | |
|
) |
| | |
Gets the label geometry of the iconbox model.
- Parameters:
-
| model | an iconbox model |
| x | the location where to store x position of the label |
| y | the location where to store y position of the label |
| width | the location where to store width of the label |
| height | the location where to store height of the label |
| xalign | the location where to store horizontal alignment of the label |
| yalign | the location where to store vertical alignment of the label |
Freezes the iconbox: it will not be updated until it is thawed.
This function is useful when you want to add efficiently a lot of icons.
- Parameters:
-
Thaws the iconbox: it will update the iconbox if it was frozen.
- Parameters:
-
Appends a new icon to the iconbox.
- Parameters:
-
| iconbox | a iconbox |
| filename | the filename of the image to use for the icon. It can be either an image or an edje file |
| edje_group | the edje group to use for the icon. If NULL, filename will be considerated as a normal image file |
| label | the label to associate to the icon |
- Returns:
- Returns the new icon
Removes the icon from the iconbox.
- Parameters:
-
Removes all the icons of the iconbox.
- Parameters:
-
Etk_Iconbox_Icon * etk_iconbox_icon_get_at_xy |
( |
Etk_Iconbox * |
iconbox, |
|
|
int |
x, |
|
|
int |
y, |
|
|
Etk_Bool |
over_cell, |
|
|
Etk_Bool |
over_icon, |
|
|
Etk_Bool |
over_label | |
|
) |
| | |
Gets the icon located below the position ( x, y ). The position should be relative to the canvas (TODO: relative to the icobox instead?).
- Parameters:
-
| iconbox | an iconbox |
| x | the x position |
| y | the y position |
| over_cell | if over_cell is ETK_TRUE, the function will return the icon if (x, y) is over the cell of the icon |
| over_icon | if over_icon == ETK_TRUE, the function will return the icon if (x, y) is over the image of the icon |
| over_label | if over_label == ETK_TRUE, the function will return the icon if (x, y) is over the label of the icon |
- Returns:
- Returns the icon located below the position (x, y), or NULL if none
Get the first icon with the given label. If more than one icon has the same label only the first is returned.
- Parameters:
-
| iconbox | an iconbox |
| label | the label to search for |
- Returns:
- Return the icon with the given label, or NULL if the string is not found.
Get the first icon with the given data attached. If more than one icon has the same data only the first is returned.
- Parameters:
-
| iconbox | an iconbox |
| data | the data to search for |
- Returns:
- Return the icon with the given data attached, or NULL if the data is not found.
Eina_List * etk_iconbox_icon_get_selected |
( |
Etk_Iconbox * |
iconbox |
) |
|
Get all the selected icons.
- Parameters:
-
- Returns:
- Return an Eina_List of Etk_Iconbox_Icon, or NULL if none is selected. You must use eina_list_free() to free the list when you don't need anymore.
Get the first selected icon. If more than one icon is selected only the first one is returned.
- Parameters:
-
- Returns:
- Return the first selected icon, or NULL if none is selected.
void etk_iconbox_icon_file_set |
( |
Etk_Iconbox_Icon * |
icon, |
|
|
const char * |
filename, |
|
|
const char * |
edje_group | |
|
) |
| | |
Sets the file path of the icon's image.
- Parameters:
-
| icon | an icon |
| filename | the filename of the icon's image |
| edje_group | the edje group of the icon's image. It has to be set to NULL for a "normal" image |
void etk_iconbox_icon_file_get |
( |
Etk_Iconbox_Icon * |
icon, |
|
|
const char ** |
filename, |
|
|
const char ** |
edje_group | |
|
) |
| | |
Gets the file used by the icon's image.
- Parameters:
-
| icon | an icon |
| filename | a location where to store the filename of the icon's image |
| edje_group | a location where to store the edje group of the icon's image |
void etk_iconbox_icon_emblem_set_from_stock |
( |
Etk_Iconbox_Icon * |
icon, |
|
|
const char * |
stock_name | |
|
) |
| | |
Sets the emblem from the stock icons.
- Parameters:
-
| icon | an icon |
| stock_name | the name of the stock image (ex."readonly", "system", "favorite", etc) |
void etk_iconbox_icon_emblem_file_set |
( |
Etk_Iconbox_Icon * |
icon, |
|
|
const char * |
filename, |
|
|
const char * |
edje_group | |
|
) |
| | |
Sets the file path of the emblem's image.
- Parameters:
-
| icon | an icon |
| filename | the filename of the emblem's image |
| edje_group | the edje group of the emblem's image. It has to be set to NULL for a "normal" image |
void etk_iconbox_icon_emblem_file_get |
( |
Etk_Iconbox_Icon * |
icon, |
|
|
const char ** |
filename, |
|
|
const char ** |
edje_group | |
|
) |
| | |
Gets the file used by the emblem's image.
- Parameters:
-
| icon | an icon |
| filename | a location where to store the filename of the emblem's image |
| edje_group | a location where to store the edje group of the emblem's image |
Sets the label of the icon.
- Parameters:
-
| icon | an icon |
| label | the label to set to the icon |
Gets the label used for the icon image.
- Parameters:
-
- Returns:
- Returns the label of the icon
Sets a value to the data member of an icon.
The data could be retrieved with etk_iconbox_icon_row_data_get().
- Parameters:
-
| icon | an icon |
| data | the data to set |
void etk_iconbox_icon_data_set_full |
( |
Etk_Iconbox_Icon * |
icon, |
|
|
void * |
data, |
|
|
void(*)(void *data) |
free_cb | |
|
) |
| | |
Sets a value to the data member of an icon.
The data could be retrieved with etk_iconbox_icon_row_data_get().
- Parameters:
-
| icon | an icon |
| data | the data to set |
| free_cb | the function to call to free the data |
Gets the value of the data member of the icon.
- Parameters:
-
- Returns:
- Returns the value of the data member of the icon
Selects all the icons of the iconbox.
- Parameters:
-
void etk_iconbox_unselect_all |
( |
Etk_Iconbox * |
iconbox |
) |
|
Unselects all the icons of the iconbox.
- Parameters:
-
Selects the icon.
- Parameters:
-
Unselects the icon.
- Parameters:
-
Gets whether the icon is selected.
- Parameters:
-
- Returns:
- Returns ETK_TRUE if the icon is selected, ETK_FALSE otherwise
Gets the scrolled view of the iconbox. It can be used to change the scrollbars' policy, or to get the scroll-value.
- Parameters:
-
- Returns:
- Returns the scrolled view of the iconbox
|
|
|
|
|
|