forked from enlightenment/efl
[elementary] Documenting/exemplyfing flip selector's API:
- elm_flipselector_add - elm_flipselector_first_item_get - elm_flipselector_flip_next - elm_flipselector_flip_prev - elm_flipselector_interval_get - elm_flipselector_interval_set - elm_flipselector_item_append - elm_flipselector_item_del - elm_flipselector_item_label_get - elm_flipselector_item_label_set - elm_flipselector_item_next_get - elm_flipselector_item_prepend - elm_flipselector_item_prev_get - elm_flipselector_item_selected_get - elm_flipselector_item_selected_set - elm_flipselector_items_get - elm_flipselector_last_item_get - elm_flipselector_selected_item_get SVN revision: 61256
This commit is contained in:
parent
f4e321fc12
commit
ee6c3bffca
|
@ -20,6 +20,8 @@
|
|||
* @ref general_functions_example_page
|
||||
*
|
||||
* @ref clock_example
|
||||
*
|
||||
* @ref flipselector_example
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -1145,6 +1147,63 @@
|
|||
* @example clock_example.c
|
||||
*/
|
||||
|
||||
/**
|
||||
* @page flipselector_example Flip selector widget example
|
||||
*
|
||||
* This code places an Elementary flip selector widget on a window,
|
||||
* along with two buttons trigerring actions on it (though its API).
|
||||
*
|
||||
* The selector is being populated with the following items:
|
||||
* @dontinclude flipselector_example.c
|
||||
* @skip lbl[]
|
||||
* @until ;
|
||||
*
|
||||
* Next, we create it, populating it with those items and registering
|
||||
* two (smart) callbacks on it:
|
||||
* @dontinclude flipselector_example.c
|
||||
* @skip fp = elm_flipselector_add
|
||||
* @until object_show
|
||||
*
|
||||
* Those two callbacks will take place whenever one of those smart
|
||||
* events occur, and they will just print something to @c stdout:
|
||||
* @dontinclude flipselector_example.c
|
||||
* @skip underflow callback
|
||||
* @until static void
|
||||
* Flip the sheets on the widget while looking at the items list, in
|
||||
* the source code, and you'll get the idea of those events.
|
||||
*
|
||||
* The two buttons below the flip selector will take the actions
|
||||
* described in their labels:
|
||||
* @dontinclude flipselector_example.c
|
||||
* @skip bt = elm_button_add
|
||||
* @until callback_add(win
|
||||
*
|
||||
* @dontinclude flipselector_example.c
|
||||
* @skip unselect the item
|
||||
* @until underflow
|
||||
*
|
||||
* Click on them to exercise those flip selector API calls. To
|
||||
* interact with the other parts of this API, there's a command line
|
||||
* interface, whose help string can be asked for with the 'h' key:
|
||||
* @dontinclude flipselector_example.c
|
||||
* @skip commands
|
||||
* @until ;
|
||||
*
|
||||
* The 'n' and 'p' keys will exemplify elm_flipselector_flip_next()
|
||||
* and elm_flipselector_flip_prev(), respectively. 'f' and 'l' account
|
||||
* for elm_flipselector_first_item_get() and
|
||||
* elm_flipselector_last_item_get(), respectively. Finally, 's' will
|
||||
* issue elm_flipselector_selected_item_get() on our example flip
|
||||
* selector widget.
|
||||
*
|
||||
* See the full @ref flipselector_example.c "example", whose window should
|
||||
* look like this picture:
|
||||
* @image html screenshots/flipselector_example.png
|
||||
* @image latex screenshots/flipselector_example.eps
|
||||
*
|
||||
* @example flipselector_example.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: 14 KiB |
|
@ -86,6 +86,7 @@ pkglib_PROGRAMS += \
|
|||
theme_example_01 \
|
||||
theme_example_02 \
|
||||
clock_example \
|
||||
flipselector_example \
|
||||
theme_example.edj
|
||||
|
||||
# This variable will hold the list of screenshots that will be made
|
||||
|
@ -104,7 +105,8 @@ SCREENSHOTS = \
|
|||
animator_example_01:animator_example_03.png:0.9 \
|
||||
frame_example_01:frame_example_01.png:0.0 \
|
||||
theme_example_01:theme_example_01.png:0.0 \
|
||||
clock_example:clock_example.png:0.5
|
||||
clock_example:clock_example.png:0.5 \
|
||||
flipselector_example:flipselector_example.png:0.0
|
||||
|
||||
screenshots: all
|
||||
@mkdir -p $(top_srcdir)/doc/img/screenshots
|
||||
|
|
|
@ -0,0 +1,209 @@
|
|||
/**
|
||||
* Simple Elementary's <b>flip selector widget</b> example, illustrating its
|
||||
* usage and API.
|
||||
*
|
||||
* See stdout/stderr for output. Compile with:
|
||||
*
|
||||
* @verbatim
|
||||
* gcc -g `pkg-config --cflags --libs elementary` flipselector_example.c -o flipselector_example
|
||||
* @endverbatim
|
||||
*/
|
||||
|
||||
#include <Elementary.h>
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "elementary_config.h"
|
||||
#else
|
||||
# define __UNUSED__
|
||||
#endif
|
||||
|
||||
static const char *commands = \
|
||||
"commands are:\n"
|
||||
"\tn - flip to next item\n"
|
||||
"\tp - flip to previous item\n"
|
||||
"\tf - print first item's label\n"
|
||||
"\tl - print last item's label\n"
|
||||
"\ts - print selected item's label\n"
|
||||
"\th - print help\n";
|
||||
|
||||
static void
|
||||
_on_done(void *data __UNUSED__,
|
||||
Evas_Object *obj __UNUSED__,
|
||||
void *event_info __UNUSED__)
|
||||
{
|
||||
elm_exit();
|
||||
}
|
||||
|
||||
void /* unselect the item shown in the flip selector */
|
||||
_unsel_cb(void *data,
|
||||
Evas_Object *obj __UNUSED__,
|
||||
void *event_info __UNUSED__)
|
||||
{
|
||||
Elm_Flipselector_Item *it;
|
||||
Evas_Object *fp = data;
|
||||
|
||||
it = elm_flipselector_selected_item_get(fp);
|
||||
elm_flipselector_item_selected_set(it, EINA_FALSE);
|
||||
}
|
||||
|
||||
void /* delete the item shown in the flip selector */
|
||||
_del_cb(void *data,
|
||||
Evas_Object *obj __UNUSED__,
|
||||
void *event_info __UNUSED__)
|
||||
{
|
||||
Elm_Flipselector_Item *it;
|
||||
Evas_Object *fp = data;
|
||||
|
||||
it = elm_flipselector_selected_item_get(fp);
|
||||
if (it) elm_flipselector_item_del(it);
|
||||
}
|
||||
|
||||
void /* underflow callback */
|
||||
_underflow_cb(void *data __UNUSED__,
|
||||
Evas_Object *obj __UNUSED__,
|
||||
void *event_info __UNUSED__)
|
||||
{
|
||||
fprintf(stdout, "Underflow!\n");
|
||||
}
|
||||
|
||||
void /* overflow callback */
|
||||
_overflow_cb(void *data __UNUSED__,
|
||||
Evas_Object *obj __UNUSED__,
|
||||
void *event_info __UNUSED__)
|
||||
{
|
||||
fprintf(stdout, "Overflow!\n");
|
||||
}
|
||||
|
||||
static void
|
||||
_on_keydown(void *data,
|
||||
Evas_Object *object __UNUSED__,
|
||||
Evas_Object *src __UNUSED__,
|
||||
Evas_Callback_Type type,
|
||||
void *event_info)
|
||||
{
|
||||
Evas_Object *fs = data;
|
||||
Evas_Event_Key_Down *ev = event_info;
|
||||
|
||||
if (type != EVAS_CALLBACK_KEY_DOWN) return;
|
||||
|
||||
if (strcmp(ev->keyname, "h") == 0) /* print help */
|
||||
{
|
||||
fprintf(stdout, commands);
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcmp(ev->keyname, "n") == 0) /* flip to next item */
|
||||
{
|
||||
elm_flipselector_flip_next(fs);
|
||||
|
||||
fprintf(stdout, "Flipping to next item\n");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcmp(ev->keyname, "p") == 0) /* flip to previous item */
|
||||
{
|
||||
elm_flipselector_flip_prev(fs);
|
||||
|
||||
fprintf(stdout, "Flipping to previous item\n");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcmp(ev->keyname, "f") == 0) /* print first item's label */
|
||||
{
|
||||
Elm_Flipselector_Item *it;
|
||||
|
||||
it = elm_flipselector_first_item_get(fs);
|
||||
|
||||
fprintf(stdout, "Flip selector's first item is: %s\n", it ?
|
||||
elm_flipselector_item_label_get(it) : "none");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcmp(ev->keyname, "l") == 0) /* print last item's label */
|
||||
{
|
||||
Elm_Flipselector_Item *it;
|
||||
|
||||
it = elm_flipselector_last_item_get(fs);
|
||||
|
||||
fprintf(stdout, "Flip selector's last item is: %s\n", it ?
|
||||
elm_flipselector_item_label_get(it) : "none");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcmp(ev->keyname, "s") == 0) /* print selected item's label */
|
||||
{
|
||||
Elm_Flipselector_Item *it;
|
||||
|
||||
it = elm_flipselector_selected_item_get(fs);
|
||||
|
||||
fprintf(stdout, "Flip selector's selected item is: %s\n", it ?
|
||||
elm_flipselector_item_label_get(it) : "none");
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
EAPI int
|
||||
elm_main(int argc __UNUSED__, char **argv __UNUSED__)
|
||||
{
|
||||
unsigned int i;
|
||||
Evas_Object *win, *bg, *bx, *fp, *bt;
|
||||
static const char *lbl[] =
|
||||
{
|
||||
"Elementary",
|
||||
"Evas",
|
||||
"Eina",
|
||||
"Edje",
|
||||
"Eet",
|
||||
"Ecore",
|
||||
"Efreet",
|
||||
"Edbus"
|
||||
};
|
||||
|
||||
win = elm_win_add(NULL, "flipselector", ELM_WIN_BASIC);
|
||||
elm_win_title_set(win, "Flip Selector Example");
|
||||
evas_object_smart_callback_add(win, "delete,request", _on_done, NULL);
|
||||
|
||||
bg = elm_bg_add(win);
|
||||
elm_win_resize_object_add(win, bg);
|
||||
evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
evas_object_show(bg);
|
||||
|
||||
bx = elm_box_add(win);
|
||||
evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
elm_win_resize_object_add(win, bx);
|
||||
evas_object_show(bx);
|
||||
|
||||
fp = elm_flipselector_add(win);
|
||||
evas_object_size_hint_weight_set(fp, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
evas_object_smart_callback_add(fp, "underflowed", _overflow_cb, NULL);
|
||||
evas_object_smart_callback_add(fp, "overflowed", _underflow_cb, NULL);
|
||||
for (i = 0; i < sizeof(lbl) / sizeof(lbl[0]); i++)
|
||||
elm_flipselector_item_append(fp, lbl[i], NULL, NULL);
|
||||
elm_box_pack_end(bx, fp);
|
||||
evas_object_show(fp);
|
||||
|
||||
bt = elm_button_add(win);
|
||||
elm_object_text_set(bt, "Unselect item");
|
||||
evas_object_smart_callback_add(bt, "clicked", _unsel_cb, fp);
|
||||
elm_box_pack_end(bx, bt);
|
||||
evas_object_show(bt);
|
||||
|
||||
bt = elm_button_add(win);
|
||||
elm_object_text_set(bt, "Delete item");
|
||||
evas_object_smart_callback_add(bt, "clicked", _del_cb, fp);
|
||||
elm_box_pack_end(bx, bt);
|
||||
evas_object_show(bt);
|
||||
|
||||
elm_object_event_callback_add(win, (Elm_Event_Cb)_on_keydown, fp);
|
||||
|
||||
evas_object_show(win);
|
||||
|
||||
fprintf(stdout, commands);
|
||||
elm_run();
|
||||
return 0;
|
||||
}
|
||||
ELM_MAIN()
|
|
@ -5895,36 +5895,336 @@ extern "C" {
|
|||
EAPI void elm_mapbuf_alpha_set(Evas_Object *obj, Eina_Bool alpha) EINA_ARG_NONNULL(1);
|
||||
EAPI Eina_Bool elm_mapbuf_alpha_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
|
||||
/* flipselector */
|
||||
typedef struct _Elm_Flipselector_Item Elm_Flipselector_Item;
|
||||
|
||||
EAPI Evas_Object *elm_flipselector_add(Evas_Object *parent) EINA_ARG_NONNULL(1);
|
||||
EAPI void elm_flipselector_flip_next(Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
EAPI void elm_flipselector_flip_prev(Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
EAPI Elm_Flipselector_Item *elm_flipselector_item_append(Evas_Object *obj, const char *label, void (*func)(void *data, Evas_Object *obj, void *event_info), void *data) EINA_ARG_NONNULL(1);
|
||||
EAPI Elm_Flipselector_Item *elm_flipselector_item_prepend(Evas_Object *obj, const char *label, void (*func)(void *data, Evas_Object *obj, void *event_info), void *data) EINA_ARG_NONNULL(1);
|
||||
EAPI const Eina_List *elm_flipselector_items_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
EAPI Elm_Flipselector_Item *elm_flipselector_first_item_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
EAPI Elm_Flipselector_Item *elm_flipselector_last_item_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
EAPI Elm_Flipselector_Item *elm_flipselector_selected_item_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
EAPI void elm_flipselector_item_selected_set(Elm_Flipselector_Item *item, Eina_Bool selected) EINA_ARG_NONNULL(1);
|
||||
EAPI Eina_Bool elm_flipselector_item_selected_get(const Elm_Flipselector_Item *item) EINA_ARG_NONNULL(1);
|
||||
EAPI void elm_flipselector_item_del(Elm_Flipselector_Item *item) EINA_ARG_NONNULL(1);
|
||||
EAPI const char *elm_flipselector_item_label_get(const Elm_Flipselector_Item *item) EINA_ARG_NONNULL(1);
|
||||
EAPI void elm_flipselector_item_label_set(Elm_Flipselector_Item *item, const char *label) EINA_ARG_NONNULL(1);
|
||||
EAPI Elm_Flipselector_Item *elm_flipselector_item_prev_get(Elm_Flipselector_Item *item) EINA_ARG_NONNULL(1);
|
||||
EAPI Elm_Flipselector_Item *elm_flipselector_item_next_get(Elm_Flipselector_Item *item) EINA_ARG_NONNULL(1);
|
||||
EAPI void elm_flipselector_interval_set(Evas_Object *obj, double interval) EINA_ARG_NONNULL(1);
|
||||
EAPI double elm_flipselector_interval_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
/* smart callbacks called:
|
||||
* "selected" - when flipselector selected item is changed
|
||||
* "overflowed" - when flipselector item is changed to first item
|
||||
* from last item
|
||||
* "underflowed" - when flipselector item is changed to last item
|
||||
* from first item.
|
||||
/**
|
||||
* @defgroup Flipselector Flip Selector
|
||||
*
|
||||
* A flip selector is a widget to show a set of @b text items, one
|
||||
* at a time, with the same sheet switching style as the @ref Clock
|
||||
* "clock" widget, when one changes the current displaying sheet
|
||||
* (thus, the "flip" in the name).
|
||||
*
|
||||
* User clicks to flip sheets which are @b held for some time will
|
||||
* make the flip selector to flip continuosly and automatically for
|
||||
* the user. The interval between flips will keep growing in time,
|
||||
* so that it helps the user to reach an item which is distant from
|
||||
* the current selection.
|
||||
*
|
||||
* Smart callbacks one can register to:
|
||||
* - @c "selected" - when the widget's selected text item is changed
|
||||
* - @c "overflowed" - when the widget's current selection is changed
|
||||
* from the first item in its list to the last
|
||||
* - @c "underflowed" - when the widget's current selection is changed
|
||||
* from the last item in its list to the first
|
||||
*
|
||||
* Available styles for it:
|
||||
* - @c "default"
|
||||
*
|
||||
* Here is an example on its usage:
|
||||
* @li @ref flipselector_example
|
||||
*/
|
||||
/* available styles:
|
||||
* default
|
||||
|
||||
/**
|
||||
* @addtogroup Flipselector
|
||||
* @{
|
||||
*/
|
||||
|
||||
typedef struct _Elm_Flipselector_Item Elm_Flipselector_Item; /**< Item handle for a flip selector widget. */
|
||||
|
||||
/**
|
||||
* Add a new flip selector widget to the given parent Elementary
|
||||
* (container) widget
|
||||
*
|
||||
* @param parent The parent object
|
||||
* @return a new flip selector widget handle or @c NULL, on errors
|
||||
*
|
||||
* This function inserts a new flip selector widget on the canvas.
|
||||
*
|
||||
* @ingroup Flipselector
|
||||
*/
|
||||
EAPI Evas_Object *elm_flipselector_add(Evas_Object *parent) EINA_ARG_NONNULL(1);
|
||||
|
||||
/**
|
||||
* Programmatically select the next item of a flip selector widget
|
||||
*
|
||||
* @param obj The flipselector object
|
||||
*
|
||||
* @note The selection will be animated. Also, if it reaches the
|
||||
* end of its list of member items, it will continue with the first
|
||||
* one onwards.
|
||||
*
|
||||
* @ingroup Flipselector
|
||||
*/
|
||||
EAPI void elm_flipselector_flip_next(Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
|
||||
/**
|
||||
* Programmatically select the previous item of a flip selector
|
||||
* widget
|
||||
*
|
||||
* @param obj The flipselector object
|
||||
*
|
||||
* @note The selection will be animated. Also, if it reaches the
|
||||
* beginning of its list of member items, it will continue with the
|
||||
* last one backwards.
|
||||
*
|
||||
* @ingroup Flipselector
|
||||
*/
|
||||
EAPI void elm_flipselector_flip_prev(Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
|
||||
/**
|
||||
* Append a (text) item to a flip selector widget
|
||||
*
|
||||
* @param obj The flipselector object
|
||||
* @param label The (text) label of the new item
|
||||
* @param func Convenience callback function to take place when
|
||||
* item is selected
|
||||
* @param data Data passed to @p func, above
|
||||
* @return A handle to the item added or @c NULL, on errors
|
||||
*
|
||||
* The widget's list of labels to show will be appended with the
|
||||
* given value. If the user wishes so, a callback function pointer
|
||||
* can be passed, which will get called when this same item is
|
||||
* selected.
|
||||
*
|
||||
* @note The current selection @b won't be modified by appending an
|
||||
* element to the list.
|
||||
*
|
||||
* @note The maximum length of the text label is going to be
|
||||
* determined <b>by the widget's theme</b>. Strings larger than
|
||||
* that value are going to be @b truncated.
|
||||
*
|
||||
* @ingroup Flipselector
|
||||
*/
|
||||
EAPI Elm_Flipselector_Item *elm_flipselector_item_append(Evas_Object *obj, const char *label, Evas_Smart_Cb func, void *data) EINA_ARG_NONNULL(1);
|
||||
|
||||
/**
|
||||
* Prepend a (text) item to a flip selector widget
|
||||
*
|
||||
* @param obj The flipselector object
|
||||
* @param label The (text) label of the new item
|
||||
* @param func Convenience callback function to take place when
|
||||
* item is selected
|
||||
* @param data Data passed to @p func, above
|
||||
* @return A handle to the item added or @c NULL, on errors
|
||||
*
|
||||
* The widget's list of labels to show will be prepended with the
|
||||
* given value. If the user wishes so, a callback function pointer
|
||||
* can be passed, which will get called when this same item is
|
||||
* selected.
|
||||
*
|
||||
* @note The current selection @b won't be modified by prepending
|
||||
* an element to the list.
|
||||
*
|
||||
* @note The maximum length of the text label is going to be
|
||||
* determined <b>by the widget's theme</b>. Strings larger than
|
||||
* that value are going to be @b truncated.
|
||||
*
|
||||
* @ingroup Flipselector
|
||||
*/
|
||||
EAPI Elm_Flipselector_Item *elm_flipselector_item_prepend(Evas_Object *obj, const char *label, Evas_Smart_Cb func, void *data) EINA_ARG_NONNULL(1);
|
||||
|
||||
/**
|
||||
* Get the internal list of items in a given flip selector widget.
|
||||
*
|
||||
* @param obj The flipselector object
|
||||
* @return The list of items (#Elm_Flipselector_Item as data) or @c
|
||||
* NULL on errors.
|
||||
*
|
||||
* This list is @b not to be modified in any way and must not be
|
||||
* freed. Use the list members with functions like
|
||||
* elm_flipselector_item_label_set(),
|
||||
* elm_flipselector_item_label_get(), elm_flipselector_item_del(),
|
||||
* elm_flipselector_item_del(),
|
||||
* elm_flipselector_item_selected_get(),
|
||||
* elm_flipselector_item_selected_set().
|
||||
*
|
||||
* @warning This list is only valid until @p obj object's internal
|
||||
* items list is changed. It should be fetched again with another
|
||||
* call to this function when changes happen.
|
||||
*
|
||||
* @ingroup Flipselector
|
||||
*/
|
||||
EAPI const Eina_List *elm_flipselector_items_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
|
||||
/**
|
||||
* Get the first item in the given flip selector widget's list of
|
||||
* items.
|
||||
*
|
||||
* @param obj The flipselector object
|
||||
* @return The first item or @c NULL, if it has no items (and on
|
||||
* errors)
|
||||
*
|
||||
* @see elm_flipselector_item_append()
|
||||
* @see elm_flipselector_last_item_get()
|
||||
*
|
||||
* @ingroup Flipselector
|
||||
*/
|
||||
EAPI Elm_Flipselector_Item *elm_flipselector_first_item_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
|
||||
/**
|
||||
* Get the last item in the given flip selector widget's list of
|
||||
* items.
|
||||
*
|
||||
* @param obj The flipselector object
|
||||
* @return The last item or @c NULL, if it has no items (and on
|
||||
* errors)
|
||||
*
|
||||
* @see elm_flipselector_item_prepend()
|
||||
* @see elm_flipselector_first_item_get()
|
||||
*
|
||||
* @ingroup Flipselector
|
||||
*/
|
||||
EAPI Elm_Flipselector_Item *elm_flipselector_last_item_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
|
||||
/**
|
||||
* Get the currently selected item in a flip selector widget.
|
||||
*
|
||||
* @param obj The flipselector object
|
||||
* @return The selected item or @c NULL, if the widget has no items
|
||||
* (and on erros)
|
||||
*
|
||||
* @ingroup Flipselector
|
||||
*/
|
||||
EAPI Elm_Flipselector_Item *elm_flipselector_selected_item_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
|
||||
/**
|
||||
* Set whether a given flip selector widget's item should be the
|
||||
* currently selected one.
|
||||
*
|
||||
* @param item The flip selector item
|
||||
* @param selected @c EINA_TRUE to select it, @c EINA_FALSE to unselect.
|
||||
*
|
||||
* This sets whether @p item is or not the selected (thus, under
|
||||
* display) one. If @p item is different than one under display,
|
||||
* the latter will be unselected. If the @p item is set to be
|
||||
* unselected, on the other hand, the @b first item in the widget's
|
||||
* internal members list will be the new selected one.
|
||||
*
|
||||
* @see elm_flipselector_item_selected_get()
|
||||
*
|
||||
* @ingroup Flipselector
|
||||
*/
|
||||
EAPI void elm_flipselector_item_selected_set(Elm_Flipselector_Item *item, Eina_Bool selected) EINA_ARG_NONNULL(1);
|
||||
|
||||
/**
|
||||
* Get whether a given flip selector widget's item is the currently
|
||||
* selected one.
|
||||
*
|
||||
* @param item The flip selector item
|
||||
* @return @c EINA_TRUE, if it's selected, @c EINA_FALSE otherwise
|
||||
* (or on errors).
|
||||
*
|
||||
* @see elm_flipselector_item_selected_set()
|
||||
*
|
||||
* @ingroup Flipselector
|
||||
*/
|
||||
EAPI Eina_Bool elm_flipselector_item_selected_get(const Elm_Flipselector_Item *item) EINA_ARG_NONNULL(1);
|
||||
|
||||
/**
|
||||
* Delete a given item from a flip selector widget.
|
||||
*
|
||||
* @param item The item to delete
|
||||
*
|
||||
* @ingroup Flipselector
|
||||
*/
|
||||
EAPI void elm_flipselector_item_del(Elm_Flipselector_Item *item) EINA_ARG_NONNULL(1);
|
||||
|
||||
/**
|
||||
* Get the label of a given flip selector widget's item.
|
||||
*
|
||||
* @param item The item to get label from
|
||||
* @return The text label of @p item or @c NULL, on errors
|
||||
*
|
||||
* @see elm_flipselector_item_label_set()
|
||||
*
|
||||
* @ingroup Flipselector
|
||||
*/
|
||||
EAPI const char *elm_flipselector_item_label_get(const Elm_Flipselector_Item *item) EINA_ARG_NONNULL(1);
|
||||
|
||||
/**
|
||||
* Set the label of a given flip selector widget's item.
|
||||
*
|
||||
* @param item The item to set label on
|
||||
* @param label The text label string, in UTF-8 encoding
|
||||
*
|
||||
* @see elm_flipselector_item_label_get()
|
||||
*
|
||||
* @ingroup Flipselector
|
||||
*/
|
||||
EAPI void elm_flipselector_item_label_set(Elm_Flipselector_Item *item, const char *label) EINA_ARG_NONNULL(1);
|
||||
|
||||
/**
|
||||
* Gets the item before @p item in a flip selector widget's
|
||||
* internal list of items.
|
||||
*
|
||||
* @param item The item to fetch previous from
|
||||
* @return The item before the @p item, in its parent's list. If
|
||||
* there is no previous item for @p item or there's an
|
||||
* error, @c NULL is returned.
|
||||
*
|
||||
* @see elm_flipselector_item_next_get()
|
||||
*
|
||||
* @ingroup Flipselector
|
||||
*/
|
||||
EAPI Elm_Flipselector_Item *elm_flipselector_item_prev_get(Elm_Flipselector_Item *item) EINA_ARG_NONNULL(1);
|
||||
|
||||
/**
|
||||
* Gets the item after @p item in a flip selector widget's
|
||||
* internal list of items.
|
||||
*
|
||||
* @param item The item to fetch next from
|
||||
* @return The item after the @p item, in its parent's list. If
|
||||
* there is no next item for @p item or there's an
|
||||
* error, @c NULL is returned.
|
||||
*
|
||||
* @see elm_flipselector_item_next_get()
|
||||
*
|
||||
* @ingroup Flipselector
|
||||
*/
|
||||
EAPI Elm_Flipselector_Item *elm_flipselector_item_next_get(Elm_Flipselector_Item *item) EINA_ARG_NONNULL(1);
|
||||
|
||||
/**
|
||||
* Set the interval on time updates for an user mouse button hold
|
||||
* on a flip selector widget.
|
||||
*
|
||||
* @param obj The flip selector object
|
||||
* @param interval The (first) interval value in seconds
|
||||
*
|
||||
* This interval value is @b decreased while the user holds the
|
||||
* mouse pointer either flipping up or flipping doww a given flip
|
||||
* selector.
|
||||
*
|
||||
* This helps the user to get to a given item distant from the
|
||||
* current one easier/faster, as it will start to flip quicker and
|
||||
* quicker on mouse button holds.
|
||||
*
|
||||
* The calculation for the next flip interval value, starting from
|
||||
* the one set with this call, is the previous interval divided by
|
||||
* 1.05, so it decreases a little bit.
|
||||
*
|
||||
* The default starting interval value for automatic flips is
|
||||
* @b 0.85 seconds.
|
||||
*
|
||||
* @see elm_flipselector_interval_get()
|
||||
*
|
||||
* @ingroup Flipselector
|
||||
*/
|
||||
EAPI void elm_flipselector_interval_set(Evas_Object *obj, double interval) EINA_ARG_NONNULL(1);
|
||||
|
||||
/**
|
||||
* Get the interval on time updates for an user mouse button hold
|
||||
* on a flip selector widget.
|
||||
*
|
||||
* @param obj The flip selector object
|
||||
* @return The (first) interval value, in seconds, set on it
|
||||
*
|
||||
* @see elm_flipselector_interval_set() for more details
|
||||
*
|
||||
* @ingroup Flipselector
|
||||
*/
|
||||
EAPI double elm_flipselector_interval_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,22 +1,6 @@
|
|||
#include <Elementary.h>
|
||||
#include "elm_priv.h"
|
||||
|
||||
/**
|
||||
* @addtogroup Flipselector Flipselector
|
||||
*
|
||||
* A flip selector is a widget to show a set of label items, one at a
|
||||
* time, with an animation when one changes the current selection
|
||||
* (like the flip of calendar sheets, in the default theme).
|
||||
*
|
||||
* Signals that you can add callbacks for are:
|
||||
*
|
||||
* "selected" - when flipselector selected item is changed
|
||||
* "overflowed" - when flipselector item is changed to first item
|
||||
* from last item
|
||||
* "underflowed" - when flipselector item is changed to last item
|
||||
* from first item.
|
||||
*/
|
||||
|
||||
/* TODO: ideally, the default theme would use map{} blocks on the TEXT
|
||||
parts to implement their fading in/out propertly (as in the clock
|
||||
widget) */
|
||||
|
@ -563,14 +547,6 @@ _callbacks_set(Evas_Object *obj)
|
|||
"", _signal_val_change_stop, obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new flipselector to the parent.
|
||||
*
|
||||
* @param parent The parent object
|
||||
* @return The new object or NULL, if it cannot be created
|
||||
*
|
||||
* @ingroup Flipselector
|
||||
*/
|
||||
EAPI Evas_Object *
|
||||
elm_flipselector_add(Evas_Object *parent)
|
||||
{
|
||||
|
@ -585,6 +561,7 @@ elm_flipselector_add(Evas_Object *parent)
|
|||
elm_widget_sub_object_add(parent, obj);
|
||||
elm_widget_data_set(obj, wd);
|
||||
|
||||
wd->self = obj;
|
||||
elm_widget_del_hook_set(obj, _del_hook);
|
||||
elm_widget_theme_hook_set(obj, _theme_hook);
|
||||
/* TODO: elm_widget_disable_hook_set(obj, _disable_hook); */
|
||||
|
@ -606,13 +583,6 @@ elm_flipselector_add(Evas_Object *parent)
|
|||
return obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Select next item of a flipselector.
|
||||
*
|
||||
* @param obj The flipselector object
|
||||
*
|
||||
* @ingroup Flipselector
|
||||
*/
|
||||
EAPI void
|
||||
elm_flipselector_flip_next(Evas_Object *obj)
|
||||
{
|
||||
|
@ -629,13 +599,6 @@ elm_flipselector_flip_next(Evas_Object *obj)
|
|||
_flipselector_unwalk(wd);
|
||||
}
|
||||
|
||||
/**
|
||||
* Select previous item of a flipselector.
|
||||
*
|
||||
* @param obj The flipselector object
|
||||
*
|
||||
* @ingroup Flipselector
|
||||
*/
|
||||
EAPI void
|
||||
elm_flipselector_flip_prev(Evas_Object *obj)
|
||||
{
|
||||
|
@ -652,21 +615,6 @@ elm_flipselector_flip_prev(Evas_Object *obj)
|
|||
_flipselector_unwalk(wd);
|
||||
}
|
||||
|
||||
/**
|
||||
* Append item to a flipselector.
|
||||
*
|
||||
* @param obj The flipselector object
|
||||
* @param label The label of new item
|
||||
* @param func Convenience function called when item selected
|
||||
* @param data Data passed to @p func above
|
||||
* @return A handle to the item added or NULL, on errors
|
||||
*
|
||||
* @note The maximum length of the label is going to be determined by
|
||||
* the widget's theme. Strings larger than that value are going to be
|
||||
* truncated.
|
||||
*
|
||||
* @ingroup Flipselector
|
||||
*/
|
||||
EAPI Elm_Flipselector_Item *
|
||||
elm_flipselector_item_append(Evas_Object *obj, const char *label, void (*func)(void *data, Evas_Object *obj, void *event_info), void *data)
|
||||
{
|
||||
|
@ -703,21 +651,6 @@ elm_flipselector_item_append(Evas_Object *obj, const char *label, void (*func)(v
|
|||
return item;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepend item to a flipselector.
|
||||
*
|
||||
* @param obj The flipselector object
|
||||
* @param label The label of new item
|
||||
* @param func Convenience function called when item selected
|
||||
* @param data Data passed to @p func above
|
||||
* @return A handle to the item added or NULL, on errors
|
||||
*
|
||||
* @note The maximum length of the label is going to be determined by
|
||||
* the widget's theme. Strings larger than that value are going to be
|
||||
* truncated.
|
||||
*
|
||||
* @ingroup Flipselector
|
||||
*/
|
||||
EAPI Elm_Flipselector_Item *
|
||||
elm_flipselector_item_prepend(Evas_Object *obj, const char *label, void (*func)(void *data, Evas_Object *obj, void *event_info), void *data)
|
||||
{
|
||||
|
@ -755,14 +688,6 @@ elm_flipselector_item_prepend(Evas_Object *obj, const char *label, void (*func)(
|
|||
}
|
||||
|
||||
/* TODO: account for deleted items? */
|
||||
/**
|
||||
* Get a list of items in the flipselector.
|
||||
*
|
||||
* @param obj The flipselector object
|
||||
* @return The list of items, or NULL on errors.
|
||||
*
|
||||
* @ingroup Flipselector
|
||||
*/
|
||||
EAPI const Eina_List *
|
||||
elm_flipselector_items_get(const Evas_Object *obj)
|
||||
{
|
||||
|
@ -775,14 +700,6 @@ elm_flipselector_items_get(const Evas_Object *obj)
|
|||
return wd->items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the first item in the flipselector
|
||||
*
|
||||
* @param obj The flipselector object
|
||||
* @return The first item, or NULL if none
|
||||
*
|
||||
* @ingroup Flipselector
|
||||
*/
|
||||
EAPI Elm_Flipselector_Item *
|
||||
elm_flipselector_first_item_get(const Evas_Object *obj)
|
||||
{
|
||||
|
@ -807,14 +724,6 @@ elm_flipselector_first_item_get(const Evas_Object *obj)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the last item in the flipselector
|
||||
*
|
||||
* @param obj The flipselector object
|
||||
* @return The last item, or NULL if none
|
||||
*
|
||||
* @ingroup Flipselector
|
||||
*/
|
||||
EAPI Elm_Flipselector_Item *
|
||||
elm_flipselector_last_item_get(const Evas_Object *obj)
|
||||
{
|
||||
|
@ -839,14 +748,6 @@ elm_flipselector_last_item_get(const Evas_Object *obj)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the selected item in a flipselector.
|
||||
*
|
||||
* @param obj The flipselector object
|
||||
* @return The selected item, or NULL if none
|
||||
*
|
||||
* @ingroup Flipselector
|
||||
*/
|
||||
EAPI Elm_Flipselector_Item *
|
||||
elm_flipselector_selected_item_get(const Evas_Object *obj)
|
||||
{
|
||||
|
@ -859,19 +760,6 @@ elm_flipselector_selected_item_get(const Evas_Object *obj)
|
|||
return DATA_GET(wd->current);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the selected state of an item
|
||||
*
|
||||
* This sets the selected state (EINA_TRUE selected, EINA_FALSE not selected)
|
||||
* of the given item @p item.
|
||||
* If a new item is selected the previosly selected will be unselected.
|
||||
* If the item @p item is unselected, the first item will be selected.
|
||||
*
|
||||
* @param item The item
|
||||
* @param selected The selected state
|
||||
*
|
||||
* @ingroup Flipselector
|
||||
*/
|
||||
EAPI void
|
||||
elm_flipselector_item_selected_set(Elm_Flipselector_Item *item, Eina_Bool selected)
|
||||
{
|
||||
|
@ -923,14 +811,6 @@ elm_flipselector_item_selected_set(Elm_Flipselector_Item *item, Eina_Bool select
|
|||
_flipselector_unwalk(wd);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the selected state of @p item.
|
||||
*
|
||||
* @param item The flipselector item
|
||||
* @return If true, the item is selected
|
||||
*
|
||||
* @ingroup Flipselector
|
||||
*/
|
||||
EAPI Eina_Bool
|
||||
elm_flipselector_item_selected_get(const Elm_Flipselector_Item *item)
|
||||
{
|
||||
|
@ -942,13 +822,6 @@ elm_flipselector_item_selected_get(const Elm_Flipselector_Item *item)
|
|||
return (eina_list_data_get(wd->current) == item);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a given item from a flipselector.
|
||||
*
|
||||
* @param item The item
|
||||
*
|
||||
* @ingroup Flipselector
|
||||
*/
|
||||
EAPI void
|
||||
elm_flipselector_item_del(Elm_Flipselector_Item *item)
|
||||
{
|
||||
|
@ -975,14 +848,6 @@ elm_flipselector_item_del(Elm_Flipselector_Item *item)
|
|||
_flipselector_unwalk(wd);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the label of a given flipselector item.
|
||||
*
|
||||
* @param item The item
|
||||
* @return The label of a given item, or NULL if none
|
||||
*
|
||||
* @ingroup Flipselector
|
||||
*/
|
||||
EAPI const char *
|
||||
elm_flipselector_item_label_get(const Elm_Flipselector_Item *item)
|
||||
{
|
||||
|
@ -1003,14 +868,6 @@ elm_flipselector_item_label_get(const Elm_Flipselector_Item *item)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the label of a given flipselector item.
|
||||
*
|
||||
* @param item The item
|
||||
* @param label The text label string in UTF-8
|
||||
*
|
||||
* @ingroup Flipselector
|
||||
*/
|
||||
EAPI void
|
||||
elm_flipselector_item_label_set(Elm_Flipselector_Item *item, const char *label)
|
||||
{
|
||||
|
@ -1046,14 +903,6 @@ elm_flipselector_item_label_set(Elm_Flipselector_Item *item, const char *label)
|
|||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the item before @p item in a flipselector.
|
||||
*
|
||||
* @param item The item
|
||||
* @return The item before the item @p item
|
||||
*
|
||||
* @ingroup Flipselector
|
||||
*/
|
||||
EAPI Elm_Flipselector_Item *
|
||||
elm_flipselector_item_prev_get(Elm_Flipselector_Item *item)
|
||||
{
|
||||
|
@ -1079,14 +928,6 @@ elm_flipselector_item_prev_get(Elm_Flipselector_Item *item)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the item after @p item in a flipselector.
|
||||
*
|
||||
* @param item The item
|
||||
* @return The item after the item @p item
|
||||
*
|
||||
* @ingroup Flipselector
|
||||
*/
|
||||
EAPI Elm_Flipselector_Item *
|
||||
elm_flipselector_item_next_get(Elm_Flipselector_Item *item)
|
||||
{
|
||||
|
@ -1112,19 +953,6 @@ elm_flipselector_item_next_get(Elm_Flipselector_Item *item)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the flipping interval for the flipselector.
|
||||
*
|
||||
* @param obj The flipselector object
|
||||
* @param interval The interval value in seconds
|
||||
*
|
||||
* The interval value is decreased while the user flips the widget up
|
||||
* or down repeatedly. The next interval value is the previous
|
||||
* interval / 1.05, so it speeds up a bit. Default value is 0.85
|
||||
* seconds.
|
||||
*
|
||||
* @ingroup Flipselector
|
||||
*/
|
||||
EAPI void
|
||||
elm_flipselector_interval_set(Evas_Object *obj, double interval)
|
||||
{
|
||||
|
@ -1137,19 +965,6 @@ elm_flipselector_interval_set(Evas_Object *obj, double interval)
|
|||
wd->first_interval = interval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the flipping interval of the flipselector.
|
||||
*
|
||||
* @param obj The flipselector object
|
||||
* @return The value of the first interval in seconds
|
||||
*
|
||||
* The interval value is decreased while the user flips the widget up
|
||||
* or down repeatedly. The next interval value is the previous
|
||||
* interval / 1.05, so it speeds up a bit. Default value is 0.85
|
||||
* seconds.
|
||||
*
|
||||
* @ingroup Flipselector
|
||||
*/
|
||||
EAPI double
|
||||
elm_flipselector_interval_get(const Evas_Object *obj)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue