Elementary: colorselector documentation.

SVN revision: 61156
This commit is contained in:
Jonas M. Gastal 2011-07-08 14:37:16 +00:00
parent bccc2092f0
commit 4a9a934c30
6 changed files with 9639 additions and 44 deletions

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

View File

@ -32,6 +32,7 @@ SRCS = \
animator_example_01.c \
bubble_example_01.c \
button_example_01.c \
colorselector_example_01.c
transit_example_01.c \
transit_example_02.c \
transit_example_03.c \
@ -67,6 +68,7 @@ pkglib_PROGRAMS += \
animator_example_01 \
bubble_example_01 \
button_example_01 \
colorselector_example_01 \
transit_example_01 \
transit_example_02 \
transit_example_03 \
@ -89,6 +91,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 \
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 \
animator_example_01:animator_example_03.png:0.9 \

View File

@ -0,0 +1,55 @@
//Compile with:
//gcc -g `pkg-config --cflags --libs elementary` colorselector_example_01.c -o colorselector_example_01
#include <Elementary.h>
#ifdef HAVE_CONFIG_H
# include "elementary_config.h"
#endif
static void _change_color(void *data, Evas_Object *obj, void *event_info);
EAPI int
elm_main(int argc, char **argv)
{
Evas_Object *win, *bg, *cs, *frame, *rect;
Elm_Animator *animator;
char buf[256];
win = elm_win_add(NULL, "color selector", ELM_WIN_BASIC);
elm_win_title_set(win, "Color selector");
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_resize(rect, 50, 50);
evas_object_move(rect, 125, 325);
evas_object_color_set(rect, 0, 0, 255, 255);
evas_object_show(rect);
cs = elm_colorselector_add(win);
elm_colorselector_color_set(cs, 0, 0, 255, 255);
evas_object_resize(cs, 300, 300);
evas_object_show(cs);
evas_object_smart_callback_add(cs, "changed", _change_color, rect);
evas_object_resize(win, 300, 400);
evas_object_show(win);
elm_run();
evas_object_del(rect);
return 0;
}
ELM_MAIN()
static void
_change_color(void *data, Evas_Object *obj, void *event_info)
{
int r, g, b, a;
elm_colorselector_color_get(obj, &r, &g, &b, &a);
evas_object_color_set(data, r, g, b, a);
}

View File

@ -5717,12 +5717,81 @@ extern "C" {
* "selected" - when item is selected (scroller stops)
*/
/* colorselector */
/**
* @page tutorial_colorselector Color selector example
* @dontinclude colorselector_example_01.c
*
* This example shows how to change the color of a rectangle using a color
* selector. We aren't going to explain a lot of the code since it's the
* usual setup code:
* @until show(rect)
*
* Now that we have a window with background and a rectangle we can create
* our color_selector and set it's initial color to fully opaque blue:
* @until show
*
* Next we tell ask to be notified whenever the color changes:
* @until changed
*
* We follow that we some more run of the mill setup code:
* @until ELM_MAIN()
*
* And now get to the callback that sets the color of the rectangle:
* @until }
*
* This example will look like this:
* @image html screenshots/colorselector_example_01.png
* @image latex screenshots/colorselector_example_01.eps
*
* @example colorselector_example_01.c
*/
/**
* @defgroup Colorselector Colorselector
*
* @{
*
* @brief Widget for user to select a color.
*
* Signals that you can add callbacks for are:
* "changed" - When the color value changes(event_info is NULL).
*
* See @ref tutorial_colorselector.
*/
/**
* @brief Add a new colorselector to the parent
*
* @param parent The parent object
* @return The new object or NULL if it cannot be created
*
* @ingroup Colorselector
*/
EAPI Evas_Object *elm_colorselector_add(Evas_Object *parent) EINA_ARG_NONNULL(1);
/**
* Set a color for the colorselector
*
* @param obj Colorselector object
* @param r r-value of color
* @param g g-value of color
* @param b b-value of color
* @param a a-value of color
*
* @ingroup Colorselector
*/
EAPI void elm_colorselector_color_set(Evas_Object *obj, int r, int g , int b, int a) EINA_ARG_NONNULL(1);
/**
* Get a color from the colorselector
*
* @param obj Colorselector object
* @param r integer pointer for r-value of color
* @param g integer pointer for g-value of color
* @param b integer pointer for b-value of color
* @param a integer pointer for a-value of color
*
* @ingroup Colorselector
*/
EAPI void elm_colorselector_color_get(const Evas_Object *obj, int *r, int *g , int *b, int *a) EINA_ARG_NONNULL(1);
/* smart callbacks called:
* "changed" - when the color value changes
/**
* @}
*/
/* Contextual Popup */

View File

@ -1,17 +1,6 @@
#include <Elementary.h>
#include "elm_priv.h"
/**
* @addtogroup Colorselector Colorselector
*
* By using colorselector, you can select a color.
* Colorselector made a color using HSV/HSB mode.
*
* Signals that you can add callbacks for are:
*
* "changed" - when the color value changes
*/
#define BASE_STEP 360.0
#define HUE_STEP 360.0
#define SAT_STEP 128.0
@ -793,14 +782,6 @@ _set_color(Evas_Object *obj, int r, int g, int b, int a)
_draw_rects(wd->cp[3], x);
}
/**
* Add a new colorselector to the parent
*
* @param parent The parent object
* @return The new object or NULL if it cannot be created
*
* @ingroup Colorselector
*/
EAPI Evas_Object *
elm_colorselector_add(Evas_Object *parent)
{
@ -838,17 +819,6 @@ elm_colorselector_add(Evas_Object *parent)
return obj;
}
/**
* Set a color for the colorselector
*
* @param obj Colorselector object
* @param r r-value of color
* @param g g-value of color
* @param b b-value of color
* @param a a-value of color
*
* @ingroup Colorselector
*/
EAPI void
elm_colorselector_color_set(Evas_Object *obj, int r, int g, int b, int a)
{
@ -856,17 +826,6 @@ elm_colorselector_color_set(Evas_Object *obj, int r, int g, int b, int a)
_set_color(obj, r, g, b, a);
}
/**
* Get a color from the colorselector
*
* @param obj Colorselector object
* @param r integer pointer for r-value of color
* @param g integer pointer for g-value of color
* @param b integer pointer for b-value of color
* @param a integer pointer for a-value of color
*
* @ingroup Colorselector
*/
EAPI void
elm_colorselector_color_get(const Evas_Object *obj, int *r, int *g, int *b, int*a)
{