forked from enlightenment/efl
parent
d20639dde2
commit
8231e7d76e
|
@ -1687,6 +1687,70 @@
|
|||
* @example image_example_01.c
|
||||
*/
|
||||
|
||||
/**
|
||||
* @page tutorial_hoversel Hoversel example
|
||||
* @dontinclude hoversel_example_01.c
|
||||
*
|
||||
* In this example we will create a hoversel with 3 items, one with a label but
|
||||
* no icon and two with both a label and an icon. Every item that is clicked
|
||||
* will be deleted, but everytime the hoversel is activated we will also add an
|
||||
* item. In addition our first item will print all items when clicked and our
|
||||
* third item will clear all items in the hoversel.
|
||||
*
|
||||
* We will start with the normal creation of window stuff:
|
||||
* @until show(bg)
|
||||
*
|
||||
* Next we will create a red rectangle to use as the icon of our hoversel:
|
||||
* @until show
|
||||
*
|
||||
* And now we create our hoversel and set some of it's properties. We set @p win
|
||||
* as its parent, ask it to not be horizontal(be vertical) and give it a label
|
||||
* and icon:
|
||||
* @until icon_set
|
||||
*
|
||||
* Next we will add our three items, setting a callback to be called for the
|
||||
* first and third:
|
||||
* @until _rm_items
|
||||
*
|
||||
* We also set a pair of callbacks to be called whenever any item is selected or
|
||||
* when the hoversel is activated:
|
||||
* @until clicked
|
||||
*
|
||||
* And then ask that our hoversel be shown and run the main loop:
|
||||
* @until ELM_MAIN
|
||||
*
|
||||
* We now have the callback for our first item which prints all items in the
|
||||
* hoversel:
|
||||
* @until }
|
||||
*
|
||||
* Next we have the callback for our third item which removes all items from the
|
||||
* hoversel:
|
||||
* @until }
|
||||
*
|
||||
* Next we have the callback that is called whenever an item is clicked and
|
||||
* deletes that item:
|
||||
* @until }
|
||||
*
|
||||
* And the callback that is called when the hoversel is activated and adds an
|
||||
* item to the hoversel. Note that since we allocate memory for the item we need
|
||||
* to know when the item dies so we can free that memory:
|
||||
* @until }
|
||||
*
|
||||
* And finally the callback that frees the memory we allocated for items created
|
||||
* in the @p _add_item callback:
|
||||
* @until }
|
||||
*
|
||||
* Our example will initially look like this:
|
||||
* @image html screenshots/hoversel_example_01.png
|
||||
* @image latex screenshots/hoversel_example_01.eps
|
||||
*
|
||||
* And when the hoversel is clicked it will look like this:
|
||||
* @image html screenshots/hoversel_example_01_a.png
|
||||
* @image latex screenshots/hoversel_example_01_a.eps
|
||||
*
|
||||
* @example hoversel_example_01.c
|
||||
*/
|
||||
|
||||
/**
|
||||
* @page bg_example_01_c bg_example_01.c
|
||||
* @include bg_example_01.c
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
After Width: | Height: | Size: 9.3 KiB |
File diff suppressed because it is too large
Load Diff
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
|
@ -46,6 +46,7 @@ SRCS = \
|
|||
flip_example_01.c \
|
||||
general_funcs_example.c \
|
||||
hover_example_01.c \
|
||||
hoversel_example_01.c \
|
||||
label_example_01.c \
|
||||
theme_example_01.c \
|
||||
theme_example_02.c \
|
||||
|
@ -95,6 +96,7 @@ pkglib_PROGRAMS += \
|
|||
flip_example_01 \
|
||||
general_funcs_example \
|
||||
hover_example_01 \
|
||||
hoversel_example_01 \
|
||||
label_example_01 \
|
||||
theme_example_01 \
|
||||
theme_example_02 \
|
||||
|
@ -126,6 +128,7 @@ SCREENSHOTS = \
|
|||
flip_example_01:flip_example_01.png:0.0 \
|
||||
frame_example_01:frame_example_01.png:0.0 \
|
||||
hover_example_01:hover_example_01.png:0.0 \
|
||||
hoversel_example_01:hoversel_example_01.png:0.0 \
|
||||
label_example_01:label_example_01.png:0.0 \
|
||||
theme_example_01:theme_example_01.png:0.0 \
|
||||
calendar_example_01:calendar_example_01.png:0.0 \
|
||||
|
|
Binary file not shown.
|
@ -0,0 +1,103 @@
|
|||
//Compile with:
|
||||
//gcc -g `pkg-config --cflags --libs elementary` hoversel_example_01.c -o hoversel_example_01
|
||||
|
||||
#include <Elementary.h>
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "elementary_config.h"
|
||||
#endif
|
||||
|
||||
static void _print_items(void *data, Evas_Object *obj, void *event_info);
|
||||
static void _rm_items(void *data, Evas_Object *obj, void *event_info);
|
||||
static void _sel(void *data, Evas_Object *obj, void *event_info);
|
||||
static void _free(void *data, Evas_Object *obj, void *event_info);
|
||||
static void _add_item(void *data, Evas_Object *obj, void *event_info);
|
||||
|
||||
EAPI int
|
||||
elm_main(int argc, char **argv)
|
||||
{
|
||||
Evas_Object *win, *bg, *rect, *hoversel;
|
||||
Elm_Hoversel_Item *it;
|
||||
|
||||
win = elm_win_add(NULL, "hoversel", ELM_WIN_BASIC);
|
||||
elm_win_title_set(win, "Hoversel");
|
||||
elm_win_autodel_set(win, EINA_TRUE);
|
||||
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
|
||||
|
||||
bg = elm_bg_add(win);
|
||||
elm_win_resize_object_add(win, bg);
|
||||
evas_object_show(bg);
|
||||
|
||||
rect = evas_object_rectangle_add(evas_object_evas_get(win));
|
||||
evas_object_color_set(rect, 255, 0, 0, 255);
|
||||
evas_object_show(rect);
|
||||
|
||||
hoversel = elm_hoversel_add(win);
|
||||
elm_hoversel_hover_parent_set(hoversel, win);
|
||||
elm_hoversel_horizontal_set(hoversel, EINA_FALSE);
|
||||
elm_object_text_set(hoversel, "Hoversel");
|
||||
elm_hoversel_icon_set(hoversel, rect);
|
||||
elm_hoversel_item_add(hoversel, "Print items", NULL, ELM_ICON_NONE,
|
||||
_print_items, NULL);
|
||||
elm_hoversel_item_add(hoversel, "Option 2", "home", ELM_ICON_STANDARD, NULL,
|
||||
NULL);
|
||||
it = elm_hoversel_item_add(hoversel, "Clear all items", "close",
|
||||
ELM_ICON_STANDARD, _rm_items, NULL);
|
||||
evas_object_smart_callback_add(hoversel, "selected", _sel, it);
|
||||
evas_object_smart_callback_add(hoversel, "clicked", _add_item, NULL);
|
||||
|
||||
evas_object_resize(hoversel, 180, 30);
|
||||
evas_object_move(hoversel, 10, 10);
|
||||
evas_object_show(hoversel);
|
||||
|
||||
evas_object_resize(win, 200, 300);
|
||||
evas_object_show(win);
|
||||
|
||||
elm_run();
|
||||
|
||||
return 0;
|
||||
}
|
||||
ELM_MAIN()
|
||||
|
||||
static void
|
||||
_print_items(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
const Eina_List *items = elm_hoversel_items_get(obj);
|
||||
const Eina_List *l;
|
||||
Elm_Hoversel_Item *it;
|
||||
|
||||
EINA_LIST_FOREACH(items, l, it)
|
||||
printf("%s\n", elm_hoversel_item_label_get(it));
|
||||
}
|
||||
|
||||
static void
|
||||
_rm_items(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
if(!elm_hoversel_expanded_get(obj))
|
||||
elm_hoversel_clear(obj);
|
||||
}
|
||||
|
||||
static void
|
||||
_sel(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
if(!elm_hoversel_expanded_get(obj) && event_info != data)
|
||||
elm_hoversel_item_del(event_info);
|
||||
}
|
||||
|
||||
static void
|
||||
_add_item(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
static int num = 0;
|
||||
char *str = malloc(sizeof(char) * 10);
|
||||
Elm_Hoversel_Item *it;
|
||||
|
||||
snprintf(str, 10, "item %d", ++num);
|
||||
|
||||
it = elm_hoversel_item_add(obj, str, NULL, ELM_ICON_NONE, NULL, str);
|
||||
elm_hoversel_item_del_cb_set(it, _free);
|
||||
}
|
||||
|
||||
static void
|
||||
_free(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
free(data);
|
||||
}
|
|
@ -2376,7 +2376,7 @@ extern "C" {
|
|||
* Get the horizontal orientation
|
||||
*
|
||||
* @param obj The box object
|
||||
* @return EINA_TRUE if the box is set to horizintal mode, EINA_FALSE otherwise
|
||||
* @return EINA_TRUE if the box is set to horizontal mode, EINA_FALSE otherwise
|
||||
*/
|
||||
EAPI Eina_Bool elm_box_horizontal_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
|
@ -4445,7 +4445,7 @@ extern "C" {
|
|||
*/
|
||||
/**
|
||||
* @page tutorial_anchorblock_example Anchorblock/Anchorview example
|
||||
* This exampel will show both Anchorblock and @ref Anchorview,
|
||||
* This example will show both Anchorblock and @ref Anchorview,
|
||||
* since both are very similar and it's easier to show them once and side
|
||||
* by side, so the difference is more clear.
|
||||
*
|
||||
|
@ -5220,33 +5220,275 @@ extern "C" {
|
|||
* "load,error" - The thumbnail image loading failed.
|
||||
*/
|
||||
|
||||
/* hoversel */
|
||||
EAPI Evas_Object *elm_hoversel_add(Evas_Object *parent) EINA_ARG_NONNULL(1);
|
||||
EAPI void elm_hoversel_horizontal_set(Evas_Object *obj, Eina_Bool horizontal) EINA_ARG_NONNULL(1);
|
||||
EAPI Eina_Bool elm_hoversel_horizontal_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
EAPI void elm_hoversel_hover_parent_set(Evas_Object *obj, Evas_Object *parent) EINA_ARG_NONNULL(1);
|
||||
EAPI Evas_Object *elm_hoversel_hover_parent_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
EINA_DEPRECATED EAPI void elm_hoversel_label_set(Evas_Object *obj, const char *label) EINA_ARG_NONNULL(1);
|
||||
EINA_DEPRECATED EAPI const char *elm_hoversel_label_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
EAPI void elm_hoversel_icon_set(Evas_Object *obj, Evas_Object *icon) EINA_ARG_NONNULL(1);
|
||||
EAPI Evas_Object *elm_hoversel_icon_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
EAPI Evas_Object *elm_hoversel_icon_unset(Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
EAPI void elm_hoversel_hover_begin(Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
EAPI void elm_hoversel_hover_end(Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
EAPI Eina_Bool elm_hoversel_expanded_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
EAPI void elm_hoversel_clear(Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
EAPI const Eina_List *elm_hoversel_items_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
EAPI Elm_Hoversel_Item *elm_hoversel_item_add(Evas_Object *obj, const char *label, const char *icon_file, Elm_Icon_Type icon_type, Evas_Smart_Cb func, const void *data) EINA_ARG_NONNULL(1);
|
||||
EAPI void elm_hoversel_item_del(Elm_Hoversel_Item *item) EINA_ARG_NONNULL(1);
|
||||
EAPI void elm_hoversel_item_del_cb_set(Elm_Hoversel_Item *it, Evas_Smart_Cb func) EINA_ARG_NONNULL(1);
|
||||
EAPI void *elm_hoversel_item_data_get(const Elm_Hoversel_Item *it) EINA_ARG_NONNULL(1);
|
||||
EAPI const char *elm_hoversel_item_label_get(const Elm_Hoversel_Item *it) EINA_ARG_NONNULL(1);
|
||||
EAPI void elm_hoversel_item_icon_set(Elm_Hoversel_Item *it, const char *icon_file, const char *icon_group, Elm_Icon_Type icon_type) EINA_ARG_NONNULL(1);
|
||||
EAPI void elm_hoversel_item_icon_get(const Elm_Hoversel_Item *it, const char **icon_file, const char **icon_group, Elm_Icon_Type *icon_type) EINA_ARG_NONNULL(1);
|
||||
/* smart callbacks called:
|
||||
/**
|
||||
* @defgroup Hoversel
|
||||
*
|
||||
* A hoversel is a button that pops up a list of items (automatically
|
||||
* choosing the direction to display) that have a label and, optionally, an
|
||||
* icon to select from. It is a convenience widget to avoid the need to do
|
||||
* all the piecing together yourself. It is intended for a small number of
|
||||
* items in the hoversel menu (no more than 8), though is capable of many
|
||||
* more.
|
||||
*
|
||||
* Signals that you can add callbacks for are:
|
||||
* "clicked" - the user clicked the hoversel button and popped up the sel
|
||||
* "selected" - an item in the hoversel list is selected
|
||||
* "selected" - an item in the hoversel list is selected. event_info is the item
|
||||
* "dismissed" - the hover is dismissed
|
||||
*
|
||||
* See @ref tutorial_hoversel for an example.
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @brief Add a new Hoversel object
|
||||
*
|
||||
* @param parent The parent object
|
||||
* @return The new object or NULL if it cannot be created
|
||||
*/
|
||||
EAPI Evas_Object *elm_hoversel_add(Evas_Object *parent) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* @brief This sets the hoversel to expand horizontally.
|
||||
*
|
||||
* @param obj The hoversel object
|
||||
* @param horizontal If true, the hover will expand horizontally to the
|
||||
* right.
|
||||
*
|
||||
* @note The initial button will display horizontally regardless of this
|
||||
* setting.
|
||||
*/
|
||||
EAPI void elm_hoversel_horizontal_set(Evas_Object *obj, Eina_Bool horizontal) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* @brief This returns whether the hoversel is set to expand horizontally.
|
||||
*
|
||||
* @param obj The hoversel object
|
||||
* @return If true, the hover will expand horizontally to the right.
|
||||
*
|
||||
* @see elm_hoversel_horizontal_set()
|
||||
*/
|
||||
EAPI Eina_Bool elm_hoversel_horizontal_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* @brief Set the Hover parent
|
||||
*
|
||||
* @param obj The hoversel object
|
||||
* @param parent The parent to use
|
||||
*
|
||||
* Sets the hover parent object, the area that will be darkened when the
|
||||
* hoversel is clicked. Should probably be the window that the hoversel is
|
||||
* in. See @ref Hover objects for more information.
|
||||
*/
|
||||
EAPI void elm_hoversel_hover_parent_set(Evas_Object *obj, Evas_Object *parent) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* @brief Get the Hover parent
|
||||
*
|
||||
* @param obj The hoversel object
|
||||
* @return The used parent
|
||||
*
|
||||
* Gets the hover parent object.
|
||||
*
|
||||
* @see elm_hoversel_hover_parent_set()
|
||||
*/
|
||||
EAPI Evas_Object *elm_hoversel_hover_parent_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* @brief Set the hoversel button label
|
||||
*
|
||||
* @param obj The hoversel object
|
||||
* @param label The label text.
|
||||
*
|
||||
* This sets the label of the button that is always visible (before it is
|
||||
* clicked and expanded).
|
||||
*
|
||||
* @deprecated elm_object_text_set()
|
||||
*/
|
||||
EINA_DEPRECATED EAPI void elm_hoversel_label_set(Evas_Object *obj, const char *label) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* @brief Get the hoversel button label
|
||||
*
|
||||
* @param obj The hoversel object
|
||||
* @return The label text.
|
||||
*
|
||||
* @deprecated elm_object_text_get()
|
||||
*/
|
||||
EINA_DEPRECATED EAPI const char *elm_hoversel_label_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* @brief Set the icon of the hoversel button
|
||||
*
|
||||
* @param obj The hoversel object
|
||||
* @param icon The icon object
|
||||
*
|
||||
* Sets the icon of the button that is always visible (before it is clicked
|
||||
* and expanded). Once the icon object is set, a previously set one will be
|
||||
* deleted, if you want to keep that old content object, use the
|
||||
* elm_hoversel_icon_unset() function.
|
||||
*
|
||||
* @see elm_button_icon_set()
|
||||
*/
|
||||
EAPI void elm_hoversel_icon_set(Evas_Object *obj, Evas_Object *icon) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* @brief Get the icon of the hoversel button
|
||||
*
|
||||
* @param obj The hoversel object
|
||||
* @return The icon object
|
||||
*
|
||||
* Get the icon of the button that is always visible (before it is clicked
|
||||
* and expanded). Also see elm_button_icon_get().
|
||||
*
|
||||
* @see elm_hoversel_icon_set()
|
||||
*/
|
||||
EAPI Evas_Object *elm_hoversel_icon_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* @brief Get and unparent the icon of the hoversel button
|
||||
*
|
||||
* @param obj The hoversel object
|
||||
* @return The icon object that was being used
|
||||
*
|
||||
* Unparent and return the icon of the button that is always visible
|
||||
* (before it is clicked and expanded).
|
||||
*
|
||||
* @see elm_hoversel_icon_set()
|
||||
* @see elm_button_icon_unset()
|
||||
*/
|
||||
EAPI Evas_Object *elm_hoversel_icon_unset(Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* @brief This triggers the hoversel popup from code, the same as if the user
|
||||
* had clicked the button.
|
||||
*
|
||||
* @param obj The hoversel object
|
||||
*/
|
||||
EAPI void elm_hoversel_hover_begin(Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* @brief This dismisses the hoversel popup as if the user had clicked
|
||||
* outside the hover.
|
||||
*
|
||||
* @param obj The hoversel object
|
||||
*/
|
||||
EAPI void elm_hoversel_hover_end(Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* @brief Returns whether the hoversel is expanded.
|
||||
*
|
||||
* @param obj The hoversel object
|
||||
* @return This will return EINA_TRUE if the hoversel is expanded or
|
||||
* EINA_FALSE if it is not expanded.
|
||||
*/
|
||||
EAPI Eina_Bool elm_hoversel_expanded_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* @brief This will remove all the children items from the hoversel.
|
||||
*
|
||||
* @param obj The hoversel object
|
||||
*
|
||||
* @warning Should @b not be called while the hoversel is active; use
|
||||
* elm_hoversel_expanded_get() to check first.
|
||||
*
|
||||
* @see elm_hoversel_item_del_cb_set()
|
||||
* @see elm_hoversel_item_del()
|
||||
*/
|
||||
EAPI void elm_hoversel_clear(Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* @brief Get the list of items within the given hoversel.
|
||||
*
|
||||
* @param obj The hoversel object
|
||||
* @return Returns a list of Elm_Hoversel_Item*
|
||||
*
|
||||
* @see elm_hoversel_item_add()
|
||||
*/
|
||||
EAPI const Eina_List *elm_hoversel_items_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* @brief Add an item to the hoversel button
|
||||
*
|
||||
* @param obj The hoversel object
|
||||
* @param label The text label to use for the item (NULL if not desired)
|
||||
* @param icon_file An image file path on disk to use for the icon or standard
|
||||
* icon name (NULL if not desired)
|
||||
* @param icon_type The icon type if relevant
|
||||
* @param func Convenience function to call when this item is selected
|
||||
* @param data Data to pass to item-related functions
|
||||
* @return A handle to the item added.
|
||||
*
|
||||
* This adds an item to the hoversel to show when it is clicked. Note: if you
|
||||
* need to use an icon from an edje file then use
|
||||
* elm_hoversel_item_icon_set() right after the this function, and set
|
||||
* icon_file to NULL here.
|
||||
*
|
||||
* For more information on what @p icon_file and @p icon_type are see the
|
||||
* @ref Icon "icon documentation".
|
||||
*/
|
||||
EAPI Elm_Hoversel_Item *elm_hoversel_item_add(Evas_Object *obj, const char *label, const char *icon_file, Elm_Icon_Type icon_type, Evas_Smart_Cb func, const void *data) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* @brief Delete an item from the hoversel
|
||||
*
|
||||
* @param item The item to delete
|
||||
*
|
||||
* This deletes the item from the hoversel (should not be called while the
|
||||
* hoversel is active; use elm_hoversel_expanded_get() to check first).
|
||||
*
|
||||
* @see elm_hoversel_item_add()
|
||||
* @see elm_hoversel_item_del_cb_set()
|
||||
*/
|
||||
EAPI void elm_hoversel_item_del(Elm_Hoversel_Item *item) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* @brief Set the function to be called when an item from the hoversel is
|
||||
* freed.
|
||||
*
|
||||
* @param item The item to set the callback on
|
||||
* @param func The function called
|
||||
*
|
||||
* That function will receive these parameters:
|
||||
* @li void *item_data
|
||||
* @li Evas_Object *the_item_object
|
||||
* @li Elm_Hoversel_Item *the_object_struct
|
||||
*
|
||||
* @see elm_hoversel_item_add()
|
||||
*/
|
||||
EAPI void elm_hoversel_item_del_cb_set(Elm_Hoversel_Item *it, Evas_Smart_Cb func) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* @brief This returns the data pointer supplied with elm_hoversel_item_add()
|
||||
* that will be passed to associated function callbacks.
|
||||
*
|
||||
* @param item The item to get the data from
|
||||
* @return The data pointer set with elm_hoversel_item_add()
|
||||
*
|
||||
* @see elm_hoversel_item_add()
|
||||
*/
|
||||
EAPI void *elm_hoversel_item_data_get(const Elm_Hoversel_Item *it) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* @brief This returns the label text of the given hoversel item.
|
||||
*
|
||||
* @param item The item to get the label
|
||||
* @return The label text of the hoversel item
|
||||
*
|
||||
* @see elm_hoversel_item_add()
|
||||
*/
|
||||
EAPI const char *elm_hoversel_item_label_get(const Elm_Hoversel_Item *it) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* @brief This sets the icon for the given hoversel item.
|
||||
*
|
||||
* @param item The item to set the icon
|
||||
* @param icon_file An image file path on disk to use for the icon or standard
|
||||
* icon name
|
||||
* @param icon_group The edje group to use if @p icon_file is an edje file. Set this
|
||||
* to NULL if the icon is not an edje file
|
||||
* @param icon_type The icon type
|
||||
*
|
||||
* The icon can be loaded from the standard set, from an image file, or from
|
||||
* an edje file.
|
||||
*
|
||||
* @see elm_hoversel_item_add()
|
||||
*/
|
||||
EAPI void elm_hoversel_item_icon_set(Elm_Hoversel_Item *it, const char *icon_file, const char *icon_group, Elm_Icon_Type icon_type) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* @brief Get the icon object of the hoversel item
|
||||
*
|
||||
* @param item The item to get the icon from
|
||||
* @param icon_file The image file path on disk used for the icon or standard
|
||||
* icon name
|
||||
* @param icon_group The edje group used if @p icon_file is an edje file. NULL
|
||||
* if the icon is not an edje file
|
||||
* @param icon_type The icon type
|
||||
*
|
||||
* @see elm_hoversel_item_icon_set()
|
||||
* @see elm_hoversel_item_add()
|
||||
*/
|
||||
EAPI void elm_hoversel_item_icon_get(const Elm_Hoversel_Item *it, const char **icon_file, const char **icon_group, Elm_Icon_Type *icon_type) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* toolbar */
|
||||
|
|
|
@ -1,21 +1,6 @@
|
|||
#include <Elementary.h>
|
||||
#include "elm_priv.h"
|
||||
|
||||
/**
|
||||
* @defgroup Hoversel
|
||||
*
|
||||
* A hoversel is a button that pops up a list of items (automatically
|
||||
* choosing the direction to display) that have a lable and/or an icon to
|
||||
* select from. It is a convenience widget to avoid the need to do all the
|
||||
* piecing together yourself. It is intended for a small number of items in
|
||||
* the hoversel menu (no more than 8), though is capable of many more.
|
||||
*
|
||||
* Signals that you can add callbacks for are:
|
||||
*
|
||||
* "clicked" - the user clicked the hoversel button and popped up the sel
|
||||
* "selected" - an item in the hoversel list is selected. event_info is the item
|
||||
* "dismissed" - the hover is dismissed
|
||||
*/
|
||||
typedef struct _Widget_Data Widget_Data;
|
||||
|
||||
struct _Widget_Data
|
||||
|
@ -287,14 +272,6 @@ _elm_hoversel_label_get(const Evas_Object *obj, const char *item)
|
|||
return elm_object_text_get(wd->btn);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new Hoversel object
|
||||
*
|
||||
* @param parent The parent object
|
||||
* @return The new object or NULL if it cannot be created
|
||||
*
|
||||
* @ingroup Hoversel
|
||||
*/
|
||||
EAPI Evas_Object *
|
||||
elm_hoversel_add(Evas_Object *parent)
|
||||
{
|
||||
|
@ -335,17 +312,6 @@ elm_hoversel_add(Evas_Object *parent)
|
|||
return obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Hover parent
|
||||
*
|
||||
* Sets the hover parent object. Should probably be the window that the hoversel
|
||||
* is in. See Hover objects for more information.
|
||||
*
|
||||
* @param obj The hoversel object
|
||||
* @param parent The parent to use
|
||||
*
|
||||
* @ingroup Hoversel
|
||||
*/
|
||||
EAPI void
|
||||
elm_hoversel_hover_parent_set(Evas_Object *obj, Evas_Object *parent)
|
||||
{
|
||||
|
@ -361,17 +327,6 @@ elm_hoversel_hover_parent_set(Evas_Object *obj, Evas_Object *parent)
|
|||
_parent_del, obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Hover parent
|
||||
*
|
||||
* Gets the hover parent object. Should probably be the window that the hoversel
|
||||
* is in. See Hover objects for more information.
|
||||
*
|
||||
* @param obj The hoversel object
|
||||
* @return The used parent
|
||||
*
|
||||
* @ingroup Hoversel
|
||||
*/
|
||||
EAPI Evas_Object *
|
||||
elm_hoversel_hover_parent_get(const Evas_Object *obj)
|
||||
{
|
||||
|
@ -381,46 +336,18 @@ elm_hoversel_hover_parent_get(const Evas_Object *obj)
|
|||
return wd->hover_parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the hoversel button label
|
||||
*
|
||||
* This sets the label of the button that is always visible (before it is
|
||||
* clicked and expanded). Also see elm_object_text_set().
|
||||
*
|
||||
* @param obj The hoversel object
|
||||
* @param label The label text.
|
||||
*
|
||||
* @ingroup Hoversel
|
||||
*/
|
||||
EAPI void
|
||||
elm_hoversel_label_set(Evas_Object *obj, const char *label)
|
||||
{
|
||||
_elm_hoversel_label_set(obj, NULL, label);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the hoversel button label
|
||||
*
|
||||
* @param obj The hoversel object
|
||||
* @return The label text.
|
||||
*
|
||||
* @ingroup Hoversel
|
||||
*/
|
||||
EAPI const char *
|
||||
elm_hoversel_label_get(const Evas_Object *obj)
|
||||
{
|
||||
return _elm_hoversel_label_get(obj, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* This sets the hoversel to expand horizontally. The initial button
|
||||
* will display horizontally regardless of this setting.
|
||||
*
|
||||
* @param obj The hoversel object
|
||||
* @param horizontal If true, the hover will expand horizontally to the right.
|
||||
*
|
||||
* @ingroup Hoversel
|
||||
*/
|
||||
EAPI void
|
||||
elm_hoversel_horizontal_set(Evas_Object *obj, Eina_Bool horizontal)
|
||||
{
|
||||
|
@ -430,15 +357,6 @@ elm_hoversel_horizontal_set(Evas_Object *obj, Eina_Bool horizontal)
|
|||
wd->horizontal = !!horizontal;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This returns whether the hoversel is set to expand horizontally.
|
||||
*
|
||||
* @param obj The hoversel object
|
||||
* @return If true, the hover will expand horizontally to the right.
|
||||
*
|
||||
* @ingroup Hoversel
|
||||
*/
|
||||
EAPI Eina_Bool
|
||||
elm_hoversel_horizontal_get(const Evas_Object *obj)
|
||||
{
|
||||
|
@ -448,20 +366,6 @@ elm_hoversel_horizontal_get(const Evas_Object *obj)
|
|||
return wd->horizontal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the icon of the hoversel button
|
||||
*
|
||||
* Sets the icon of the button that is always visible (before it is clicked
|
||||
* and expanded). Also see elm_button_icon_set().
|
||||
* Once the icon object is set, a previously set one will be deleted
|
||||
* If you want to keep that old content object, use the
|
||||
* elm_hoversel_icon_unset() function.
|
||||
*
|
||||
* @param obj The hoversel object
|
||||
* @param icon The icon object
|
||||
*
|
||||
* @ingroup Hoversel
|
||||
*/
|
||||
EAPI void
|
||||
elm_hoversel_icon_set(Evas_Object *obj, Evas_Object *icon)
|
||||
{
|
||||
|
@ -471,17 +375,6 @@ elm_hoversel_icon_set(Evas_Object *obj, Evas_Object *icon)
|
|||
elm_button_icon_set(wd->btn, icon);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the icon of the hoversel button
|
||||
*
|
||||
* Get the icon of the button that is always visible (before it is clicked
|
||||
* and expanded). Also see elm_button_icon_get().
|
||||
*
|
||||
* @param obj The hoversel object
|
||||
* @return The icon object
|
||||
*
|
||||
* @ingroup Hoversel
|
||||
*/
|
||||
EAPI Evas_Object *
|
||||
elm_hoversel_icon_get(const Evas_Object *obj)
|
||||
{
|
||||
|
@ -491,17 +384,6 @@ elm_hoversel_icon_get(const Evas_Object *obj)
|
|||
return elm_button_icon_get(wd->btn);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the icon of the hoversel button
|
||||
*
|
||||
* Unparent and return the icon of the button that is always visible
|
||||
* (before it is clicked and expanded). Also see elm_button_icon_unset().
|
||||
*
|
||||
* @param obj The hoversel object
|
||||
* @return The icon object that was being used
|
||||
*
|
||||
* @ingroup Hoversel
|
||||
*/
|
||||
EAPI Evas_Object *
|
||||
elm_hoversel_icon_unset(Evas_Object *obj)
|
||||
{
|
||||
|
@ -511,14 +393,6 @@ elm_hoversel_icon_unset(Evas_Object *obj)
|
|||
return elm_button_icon_unset(wd->btn);
|
||||
}
|
||||
|
||||
/**
|
||||
* This triggers the hoversel popup from code, the same as though the
|
||||
* user clicked the button.
|
||||
*
|
||||
* @param obj The hoversel object
|
||||
*
|
||||
* @ingroup Hoversel
|
||||
*/
|
||||
EAPI void
|
||||
elm_hoversel_hover_begin(Evas_Object *obj)
|
||||
{
|
||||
|
@ -529,13 +403,6 @@ elm_hoversel_hover_begin(Evas_Object *obj)
|
|||
_activate(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* This ends the hoversel popup as though the user clicked outside the hover.
|
||||
*
|
||||
* @param obj The hoversel object
|
||||
*
|
||||
* @ingroup Hoversel
|
||||
*/
|
||||
EAPI void
|
||||
elm_hoversel_hover_end(Evas_Object *obj)
|
||||
{
|
||||
|
@ -549,15 +416,6 @@ elm_hoversel_hover_end(Evas_Object *obj)
|
|||
evas_object_smart_callback_call(obj, SIG_DISMISSED, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the hoversel is expanded.
|
||||
*
|
||||
* @param obj The hoversel object
|
||||
* @return This will return EINA_TRUE if the hoversel
|
||||
* is expanded or EINA_FALSE if it is not expanded.
|
||||
*
|
||||
* @ingroup Hoversel
|
||||
*/
|
||||
EAPI Eina_Bool
|
||||
elm_hoversel_expanded_get(const Evas_Object *obj)
|
||||
{
|
||||
|
@ -567,15 +425,6 @@ elm_hoversel_expanded_get(const Evas_Object *obj)
|
|||
return (wd->hover) ? EINA_TRUE : EINA_FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* This will remove all the children items from the hoversel. (should not be
|
||||
* called while the hoversel is active; use elm_hoversel_expanded_get()
|
||||
* to check first).
|
||||
*
|
||||
* @param obj The hoversel object
|
||||
*
|
||||
* @ingroup Hoversel
|
||||
*/
|
||||
EAPI void
|
||||
elm_hoversel_clear(Evas_Object *obj)
|
||||
{
|
||||
|
@ -587,14 +436,6 @@ elm_hoversel_clear(Evas_Object *obj)
|
|||
EINA_LIST_FOREACH_SAFE(wd->items, l, ll, item) elm_hoversel_item_del(item);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of items within the given hoversel.
|
||||
*
|
||||
* @param obj The hoversel object
|
||||
* @return Returns a list of Elm_Hoversel_Item*
|
||||
*
|
||||
* @ingroup Hoversel
|
||||
*/
|
||||
EAPI const Eina_List *
|
||||
elm_hoversel_items_get(const Evas_Object *obj)
|
||||
{
|
||||
|
@ -604,24 +445,6 @@ elm_hoversel_items_get(const Evas_Object *obj)
|
|||
return wd->items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an item to the hoversel button
|
||||
*
|
||||
* This adds an item to the hoversel to show when it is clicked. Note: if you
|
||||
* need to use an icon from an edje file then use elm_hoversel_item_icon_set()
|
||||
* right after the this function, and set icon_file to NULL here.
|
||||
*
|
||||
* @param obj The hoversel object
|
||||
* @param label The text label to use for the item (NULL if not desired)
|
||||
* @param icon_file An image file path on disk to use for the icon or standard
|
||||
* icon name (NULL if not desired)
|
||||
* @param icon_type The icon type if relevant
|
||||
* @param func Convenience function to call when this item is selected
|
||||
* @param data Data to pass to item-related functions
|
||||
* @return A handle to the item added.
|
||||
*
|
||||
* @ingroup Hoversel
|
||||
*/
|
||||
EAPI Elm_Hoversel_Item *
|
||||
elm_hoversel_item_add(Evas_Object *obj, const char *label, const char *icon_file, Elm_Icon_Type icon_type, Evas_Smart_Cb func, const void *data)
|
||||
{
|
||||
|
@ -639,17 +462,6 @@ elm_hoversel_item_add(Evas_Object *obj, const char *label, const char *icon_file
|
|||
return item;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete an item from the hoversel
|
||||
*
|
||||
* This deletes the item from the hoversel (should not be called while the
|
||||
* hoversel is active; use elm_hoversel_expanded_get()
|
||||
* to check first).
|
||||
*
|
||||
* @param item The item to delete
|
||||
*
|
||||
* @ingroup Hoversel
|
||||
*/
|
||||
EAPI void
|
||||
elm_hoversel_item_del(Elm_Hoversel_Item *item)
|
||||
{
|
||||
|
@ -665,19 +477,6 @@ elm_hoversel_item_del(Elm_Hoversel_Item *item)
|
|||
elm_widget_item_del(item);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the function called when an item within the hoversel
|
||||
* is freed. That function will receive these parameters:
|
||||
*
|
||||
* void *item_data
|
||||
* Evas_Object *the_item_object
|
||||
* Elm_Hoversel_Item *the_object_struct
|
||||
*
|
||||
* @param item The item to set the callback on
|
||||
* @param func The function called
|
||||
*
|
||||
* @ingroup Hoversel
|
||||
*/
|
||||
EAPI void
|
||||
elm_hoversel_item_del_cb_set(Elm_Hoversel_Item *item, Evas_Smart_Cb func)
|
||||
{
|
||||
|
@ -685,15 +484,6 @@ elm_hoversel_item_del_cb_set(Elm_Hoversel_Item *item, Evas_Smart_Cb func)
|
|||
elm_widget_item_del_cb_set(item, func);
|
||||
}
|
||||
|
||||
/**
|
||||
* This returns the data pointer supplied with elm_hoversel_item_add() that
|
||||
* will be passed to associated function callbacks.
|
||||
*
|
||||
* @param item The item to get the data from
|
||||
* @return The data pointer set with elm_hoversel_item_add()
|
||||
*
|
||||
* @ingroup Hoversel
|
||||
*/
|
||||
EAPI void *
|
||||
elm_hoversel_item_data_get(const Elm_Hoversel_Item *item)
|
||||
{
|
||||
|
@ -701,14 +491,6 @@ elm_hoversel_item_data_get(const Elm_Hoversel_Item *item)
|
|||
return elm_widget_item_data_get(item);
|
||||
}
|
||||
|
||||
/**
|
||||
* This returns the label text of the given hoversel item.
|
||||
*
|
||||
* @param item The item to get the label
|
||||
* @return The label text of the hoversel item
|
||||
*
|
||||
* @ingroup Hoversel
|
||||
*/
|
||||
EAPI const char *
|
||||
elm_hoversel_item_label_get(const Elm_Hoversel_Item *item)
|
||||
{
|
||||
|
@ -716,19 +498,6 @@ elm_hoversel_item_label_get(const Elm_Hoversel_Item *item)
|
|||
return item->label;
|
||||
}
|
||||
|
||||
/**
|
||||
* This sets the icon for the given hoversel item. The icon can be loaded from
|
||||
* the standard set, from an image file, or from an edje file.
|
||||
*
|
||||
* @param item The item to set the icon
|
||||
* @param icon_file An image file path on disk to use for the icon or standard
|
||||
* icon name
|
||||
* @param icon_group The edje group to use if @p icon_file is an edje file. Set this
|
||||
* to NULL if the icon is not an edje file
|
||||
* @param icon_type The icon type
|
||||
*
|
||||
* @ingroup Hoversel
|
||||
*/
|
||||
EAPI void
|
||||
elm_hoversel_item_icon_set(Elm_Hoversel_Item *item, const char *icon_file, const char *icon_group, Elm_Icon_Type icon_type)
|
||||
{
|
||||
|
@ -738,18 +507,6 @@ elm_hoversel_item_icon_set(Elm_Hoversel_Item *item, const char *icon_file, const
|
|||
item->icon_type = icon_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the icon object of the hoversel item
|
||||
*
|
||||
* @param item The item to get the icon from
|
||||
* @param icon_file The image file path on disk used for the icon or standard
|
||||
* icon name
|
||||
* @param icon_group The edje group used if @p icon_file is an edje file. NULL
|
||||
* if the icon is not an edje file
|
||||
* @param icon_type The icon type
|
||||
*
|
||||
* @ingroup Hoversel
|
||||
*/
|
||||
EAPI void
|
||||
elm_hoversel_item_icon_get(const Elm_Hoversel_Item *item, const char **icon_file, const char **icon_group, Elm_Icon_Type *icon_type)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue