forked from enlightenment/efl
Elementary: documentation for checkbox.
SVN revision: 61247
This commit is contained in:
parent
49b65bfc62
commit
694f02f666
File diff suppressed because it is too large
Load Diff
Binary file not shown.
After Width: | Height: | Size: 7.5 KiB |
|
@ -32,6 +32,7 @@ SRCS = \
|
|||
animator_example_01.c \
|
||||
bubble_example_01.c \
|
||||
button_example_01.c \
|
||||
check_example_01.c \
|
||||
colorselector_example_01.c
|
||||
frame_example_01.c \
|
||||
transit_example_01.c \
|
||||
|
@ -70,6 +71,7 @@ pkglib_PROGRAMS += \
|
|||
animator_example_01 \
|
||||
bubble_example_01 \
|
||||
button_example_01 \
|
||||
check_example_01 \
|
||||
colorselector_example_01 \
|
||||
frame_example_01 \
|
||||
transit_example_01 \
|
||||
|
@ -95,6 +97,7 @@ SCREENSHOTS = \
|
|||
box_example_02:box_example_02.png:1.3 \
|
||||
bubble_example_01:bubble_example_01.png:0.0 \
|
||||
button_example_01:button_01.png:0.0 \
|
||||
check_example_01:check_example_01.png:0.0 \
|
||||
colorselector_example_01:colorselector_example_01.png:0.0 \
|
||||
animator_example_01:animator_example_01.png:0.2 \
|
||||
animator_example_01:animator_example_02.png:0.5 \
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
//Compile with:
|
||||
//gcc -g `pkg-config --cflags --libs elementary` check_example_01.c -o check_example_01
|
||||
|
||||
#include <Elementary.h>
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "elementary_config.h"
|
||||
#endif
|
||||
|
||||
static void _print(void *data, Evas_Object *obj, void *event_info);
|
||||
|
||||
EAPI int
|
||||
elm_main(int argc, char **argv)
|
||||
{
|
||||
Evas_Object *win, *bg, *cb, *cb2, *icon;
|
||||
Eina_Bool value;
|
||||
char buf[256];
|
||||
|
||||
win = elm_win_add(NULL, "check", ELM_WIN_BASIC);
|
||||
elm_win_title_set(win, "Check");
|
||||
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);
|
||||
|
||||
cb = elm_check_add(win);
|
||||
elm_object_text_set(cb, "checkbox");
|
||||
elm_check_state_pointer_set(cb, &value);
|
||||
evas_object_smart_callback_add(cb, "changed", _print, &value);
|
||||
evas_object_move(cb, 10, 10);
|
||||
evas_object_resize(cb, 200, 30);
|
||||
evas_object_show(cb);
|
||||
|
||||
icon = evas_object_rectangle_add(evas_object_evas_get(win));
|
||||
evas_object_color_set(icon, 0, 255, 0, 255);
|
||||
evas_object_resize(icon, 20, 20);
|
||||
evas_object_show(icon);
|
||||
|
||||
cb2 = elm_check_add(win);
|
||||
elm_object_text_set(cb2, "another checkbox");
|
||||
elm_check_state_set(cb2, EINA_TRUE);
|
||||
elm_check_icon_set(cb2, icon);
|
||||
evas_object_move(cb2, 10, 50);
|
||||
evas_object_resize(cb2, 200, 30);
|
||||
evas_object_show(cb2);
|
||||
|
||||
evas_object_resize(win, 200, 100);
|
||||
evas_object_show(win);
|
||||
|
||||
elm_run();
|
||||
evas_object_del(icon);
|
||||
|
||||
return 0;
|
||||
}
|
||||
ELM_MAIN()
|
||||
|
||||
static void
|
||||
_print(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
printf("check %smarked\n", *((Eina_Bool*)data) ? "" : "un");
|
||||
}
|
|
@ -5085,7 +5085,7 @@ extern "C" {
|
|||
EAPI const Elm_Genlist_Item *elm_genlist_mode_item_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
EAPI void elm_genlist_reorder_mode_set(Evas_Object *obj, Eina_Bool reorder_mode) EINA_ARG_NONNULL(1);
|
||||
EAPI Eina_Bool elm_genlist_reorder_mode_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
/** Signals that you can add callbacks for are:
|
||||
/* Signals that you can add callbacks for are:
|
||||
* "clicked,double" - This is called when a user has double-clicked an item.
|
||||
* The event_info parameter is the genlist item that was
|
||||
* double-clicked.
|
||||
|
@ -5162,18 +5162,155 @@ extern "C" {
|
|||
* "swipe" - This is called when the genlist is swiped.
|
||||
*/
|
||||
|
||||
/* check */
|
||||
/**
|
||||
* @page tutorial_check Check example
|
||||
* @dontinclude check_example_01.c
|
||||
*
|
||||
* This example will show 2 checkboxes, one with just a label and the second
|
||||
* one with both a label and an icon. This example also ilustrates how to
|
||||
* have the checkbox change the value of a variable and how to react to those
|
||||
* changes.
|
||||
*
|
||||
* We will start with the usual setup code:
|
||||
* @until show(bg)
|
||||
*
|
||||
* And now we create our first checkbox, set its label, tell it to change
|
||||
* the value of @p value when the checkbox stats is changed and ask to be
|
||||
* notified of state changes:
|
||||
* @until show
|
||||
*
|
||||
* For our second checkbox we are going to set an icon so we need to create
|
||||
* and icon:
|
||||
* @until show
|
||||
* @note For simplicity we are using a rectangle as icon, but any evas object
|
||||
* can be used.
|
||||
*
|
||||
* And for our second checkbox we set the label, icon and state to true:
|
||||
* @until show
|
||||
*
|
||||
* We now do some more setup:
|
||||
* @until ELM_MAIN
|
||||
*
|
||||
* And finally implement the callback that will be called when the first
|
||||
* checkbox's state changes. This callback will use @p data to print a
|
||||
* message:
|
||||
* @until }
|
||||
* @note This work because @p data is @p value(from the main function) and @p
|
||||
* value is changed when the checkbox is changed.
|
||||
*
|
||||
* Our example will look like this:
|
||||
* @image html screenshots/check_example_01.png
|
||||
* @image latex screenshots/check_example_01.eps
|
||||
*
|
||||
* @example check_example_01.c
|
||||
*/
|
||||
/**
|
||||
* @defgroup Check Check
|
||||
*
|
||||
* @brief The check widget allows for toggling a value between true and
|
||||
* false.
|
||||
*
|
||||
* Check objects are a lot like radio objects in layout and functionality
|
||||
* except they do not work as a group, but independently and only toggle the
|
||||
* value of a boolean from false to true (0 or 1). elm_check_state_set() sets
|
||||
* the boolean state (1 for true, 0 for false), and elm_check_state_get()
|
||||
* returns the current state. For convenience, like the radio objects, you
|
||||
* can set a pointer to a boolean directly with elm_check_state_pointer_set()
|
||||
* for it to modify.
|
||||
*
|
||||
* Signals that you can add callbacks for are:
|
||||
* "changed" - This is called whenever the user changes the state of one of
|
||||
* the check object(event_info is NULL).
|
||||
*
|
||||
* @ref tutorial_check should give you a firm grasp of how to use this widget.
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @brief Add a new Check object
|
||||
*
|
||||
* @param parent The parent object
|
||||
* @return The new object or NULL if it cannot be created
|
||||
*/
|
||||
EAPI Evas_Object *elm_check_add(Evas_Object *parent) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* @brief Set the text label of the check object
|
||||
*
|
||||
* @param obj The check object
|
||||
* @param label The text label string in UTF-8
|
||||
*
|
||||
* @deprecated use elm_object_text_set() instead.
|
||||
*/
|
||||
EINA_DEPRECATED EAPI void elm_check_label_set(Evas_Object *obj, const char *label) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* @brief Get the text label of the check object
|
||||
*
|
||||
* @param obj The check object
|
||||
* @return The text label string in UTF-8
|
||||
*
|
||||
* @deprecated use elm_object_text_get() instead.
|
||||
*/
|
||||
EINA_DEPRECATED EAPI const char *elm_check_label_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* @brief Set the icon object of the check object
|
||||
*
|
||||
* @param obj The check object
|
||||
* @param icon The icon object
|
||||
*
|
||||
* 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_check_icon_unset() function.
|
||||
*/
|
||||
EAPI void elm_check_icon_set(Evas_Object *obj, Evas_Object *icon) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* @brief Get the icon object of the check object
|
||||
*
|
||||
* @param obj The check object
|
||||
* @return The icon object
|
||||
*/
|
||||
EAPI Evas_Object *elm_check_icon_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* @brief Unset the icon used for the check object
|
||||
*
|
||||
* @param obj The check object
|
||||
* @return The icon object that was being used
|
||||
*
|
||||
* Unparent and return the icon object which was set for this widget.
|
||||
*/
|
||||
EAPI Evas_Object *elm_check_icon_unset(Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* @brief Set the on/off state of the check object
|
||||
*
|
||||
* @param obj The check object
|
||||
* @param state The state to use (1 == on, 0 == off)
|
||||
*
|
||||
* This sets the state of the check and, if set, the state of the pointed to
|
||||
* Eina_Bool, calling this @b doesn't cause the "changed" signal to be
|
||||
* emited.
|
||||
*/
|
||||
EAPI void elm_check_state_set(Evas_Object *obj, Eina_Bool state) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* @brief Get the state of the check object
|
||||
*
|
||||
* @param obj The check object
|
||||
* @return The boolean state
|
||||
*/
|
||||
EAPI Eina_Bool elm_check_state_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* @brief Set a convenience pointer to a boolean to change
|
||||
*
|
||||
* @param obj The check object
|
||||
* @param statep Pointer to the boolean to modify
|
||||
*
|
||||
* This sets a pointer to a boolean, that, in addition to the check objects
|
||||
* state will also be modified directly. To stop setting the object pointed
|
||||
* to simply use NULL as the @p statep parameter. If @p statep is not NULL,
|
||||
* then when this is called, the check objects state will also be modified to
|
||||
* reflect the value of the boolean @p statep points to, just like calling
|
||||
* elm_check_state_set().
|
||||
*/
|
||||
EAPI void elm_check_state_pointer_set(Evas_Object *obj, Eina_Bool *statep) EINA_ARG_NONNULL(1);
|
||||
/* smart callbacks called:
|
||||
* "changed" - This is called whenever the user changes the state of one of the check object.
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* radio */
|
||||
|
|
|
@ -1,24 +1,6 @@
|
|||
#include <Elementary.h>
|
||||
#include "elm_priv.h"
|
||||
|
||||
/**
|
||||
* @defgroup Check Check
|
||||
*
|
||||
* The check widget allows for toggling a value between true or false (1 or 0).
|
||||
*
|
||||
* Check objects are a lot like radio objects in layout and functionality
|
||||
* except they do not work as a group, but independently and only toggle the
|
||||
* value of a boolean from false to true (0 or 1). elm_check_state_set() sets
|
||||
* the boolean state (1 for true, 0 for false), and elm_check_state_get()
|
||||
* returns the current state. For convenience, like the radio objects, you
|
||||
* can set a pointer to a boolean directly with elm_check_state_pointer_set()
|
||||
* for it to modify.
|
||||
*
|
||||
* Signals that you can add callbacks for are:
|
||||
*
|
||||
* "changed" - This is called whenever the user changes the state of one of the
|
||||
* check object.
|
||||
*/
|
||||
typedef struct _Widget_Data Widget_Data;
|
||||
|
||||
struct _Widget_Data
|
||||
|
@ -258,14 +240,6 @@ _elm_check_label_get(const Evas_Object *obj, const char *item)
|
|||
return wd->label;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new Check object
|
||||
*
|
||||
* @param parent The parent object
|
||||
* @return The new object or NULL if it cannot be created
|
||||
*
|
||||
* @ingroup Check
|
||||
*/
|
||||
EAPI Evas_Object *
|
||||
elm_check_add(Evas_Object *parent)
|
||||
{
|
||||
|
@ -310,48 +284,18 @@ elm_check_add(Evas_Object *parent)
|
|||
return obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the text label of the check object
|
||||
*
|
||||
* @param obj The check object
|
||||
* @param label The text label string in UTF-8
|
||||
*
|
||||
* @ingroup Check
|
||||
* @deprecated use elm_object_text_set() instead.
|
||||
*/
|
||||
EAPI void
|
||||
elm_check_label_set(Evas_Object *obj, const char *label)
|
||||
{
|
||||
_elm_check_label_set(obj, NULL, label);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the text label of the check object
|
||||
*
|
||||
* @param obj The check object
|
||||
* @return The text label string in UTF-8
|
||||
*
|
||||
* @ingroup Check
|
||||
* @deprecated use elm_object_text_set() instead.
|
||||
*/
|
||||
EAPI const char *
|
||||
elm_check_label_get(const Evas_Object *obj)
|
||||
{
|
||||
return _elm_check_label_get(obj, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the icon object of the check object
|
||||
*
|
||||
* 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_check_icon_unset() function.
|
||||
*
|
||||
* @param obj The check object
|
||||
* @param icon The icon object
|
||||
*
|
||||
* @ingroup Check
|
||||
*/
|
||||
EAPI void
|
||||
elm_check_icon_set(Evas_Object *obj, Evas_Object *icon)
|
||||
{
|
||||
|
@ -373,14 +317,6 @@ elm_check_icon_set(Evas_Object *obj, Evas_Object *icon)
|
|||
_sizing_eval(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the icon object of the check object
|
||||
*
|
||||
* @param obj The check object
|
||||
* @return The icon object
|
||||
*
|
||||
* @ingroup Check
|
||||
*/
|
||||
EAPI Evas_Object *
|
||||
elm_check_icon_get(const Evas_Object *obj)
|
||||
{
|
||||
|
@ -390,16 +326,6 @@ elm_check_icon_get(const Evas_Object *obj)
|
|||
return wd->icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unset the icon used for the check object
|
||||
*
|
||||
* Unparent and return the icon object which was set for this widget.
|
||||
*
|
||||
* @param obj The check object
|
||||
* @return The icon object that was being used
|
||||
*
|
||||
* @ingroup Check
|
||||
*/
|
||||
EAPI Evas_Object *
|
||||
elm_check_icon_unset(Evas_Object *obj)
|
||||
{
|
||||
|
@ -414,17 +340,6 @@ elm_check_icon_unset(Evas_Object *obj)
|
|||
return icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the on/off state of the check object
|
||||
*
|
||||
* This sets the state of the check and will also set the value if pointed to
|
||||
* to the state supplied, but will not call any callbacks.
|
||||
*
|
||||
* @param obj The check object
|
||||
* @param state The state to use (1 == on, 0 == off)
|
||||
*
|
||||
* @ingroup Check
|
||||
*/
|
||||
EAPI void
|
||||
elm_check_state_set(Evas_Object *obj, Eina_Bool state)
|
||||
{
|
||||
|
@ -442,14 +357,6 @@ elm_check_state_set(Evas_Object *obj, Eina_Bool state)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the state of the check object
|
||||
*
|
||||
* @param obj The check object
|
||||
* @return The boolean state
|
||||
*
|
||||
* @ingroup Check
|
||||
*/
|
||||
EAPI Eina_Bool
|
||||
elm_check_state_get(const Evas_Object *obj)
|
||||
{
|
||||
|
@ -459,21 +366,6 @@ elm_check_state_get(const Evas_Object *obj)
|
|||
return wd->state;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a convenience pointer to a boolean to change
|
||||
*
|
||||
* This sets a pointer to a boolean, that, in addition to the check objects
|
||||
* state will also be modified directly. To stop setting the object pointed
|
||||
* to simply use NULL as the statep parameter. If statep is not NULL, then
|
||||
* when this is called, the check objects state will also be modified to
|
||||
* reflect the value of the boolean statep points to, just like calling
|
||||
* elm_check_state_set().
|
||||
*
|
||||
* @param obj The check object
|
||||
* @param statep Pointer to the boolean to modify
|
||||
*
|
||||
* @ingroup Check
|
||||
*/
|
||||
EAPI void
|
||||
elm_check_state_pointer_set(Evas_Object *obj, Eina_Bool *statep)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue