Elementary: Color Selector header split.

This commit is contained in:
Daniel Zaoui 2013-04-28 09:56:42 +03:00
parent 33ce377c11
commit 052c1fb386
4 changed files with 314 additions and 293 deletions

View File

@ -33,299 +33,13 @@
* @{
*/
#define ELM_OBJ_COLORSELECTOR_CLASS elm_obj_colorselector_class_get()
const Eo_Class *elm_obj_colorselector_class_get(void) EINA_CONST;
extern EAPI Eo_Op ELM_OBJ_COLORSELECTOR_BASE_ID;
enum
{
ELM_OBJ_COLORSELECTOR_SUB_ID_COLOR_SET,
ELM_OBJ_COLORSELECTOR_SUB_ID_COLOR_GET,
ELM_OBJ_COLORSELECTOR_SUB_ID_MODE_SET,
ELM_OBJ_COLORSELECTOR_SUB_ID_MODE_GET,
ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_COLOR_ADD,
ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_CLEAR,
ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_NAME_SET,
ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_NAME_GET,
ELM_OBJ_COLORSELECTOR_SUB_ID_LAST
};
#define ELM_OBJ_COLORSELECTOR_ID(sub_id) (ELM_OBJ_COLORSELECTOR_BASE_ID + sub_id)
/**
* @def elm_obj_colorselector_color_set
* @since 1.8
*
* Set color to colorselector
*
* @param[in] r
* @param[in] g
* @param[in] b
* @param[in] a
*
* @see elm_colorselector_color_set
*/
#define elm_obj_colorselector_color_set(r, g, b, a) ELM_OBJ_COLORSELECTOR_ID(ELM_OBJ_COLORSELECTOR_SUB_ID_COLOR_SET), EO_TYPECHECK(int, r), EO_TYPECHECK(int, g), EO_TYPECHECK(int, b), EO_TYPECHECK(int, a)
/**
* @def elm_obj_colorselector_color_get
* @since 1.8
*
* Get current color from colorselector
*
* @param[out] r
* @param[out] g
* @param[out] b
* @param[out] a
*
* @see elm_colorselector_color_get
*/
#define elm_obj_colorselector_color_get(r, g, b, a) ELM_OBJ_COLORSELECTOR_ID(ELM_OBJ_COLORSELECTOR_SUB_ID_COLOR_GET), EO_TYPECHECK(int *, r), EO_TYPECHECK(int *, g), EO_TYPECHECK(int *, b), EO_TYPECHECK(int *, a)
/**
* @def elm_obj_colorselector_mode_set
* @since 1.8
*
* Set Colorselector's mode.
*
* @param[in] mode
*
* @see elm_colorselector_mode_set
*/
#define elm_obj_colorselector_mode_set(mode) ELM_OBJ_COLORSELECTOR_ID(ELM_OBJ_COLORSELECTOR_SUB_ID_MODE_SET), EO_TYPECHECK(Elm_Colorselector_Mode, mode)
/**
* @def elm_obj_colorselector_mode_get
* @since 1.8
*
* Get Colorselector's mode.
*
* @param[out] ret
*
* @see elm_colorselector_mode_get
*/
#define elm_obj_colorselector_mode_get(ret) ELM_OBJ_COLORSELECTOR_ID(ELM_OBJ_COLORSELECTOR_SUB_ID_MODE_GET), EO_TYPECHECK(Elm_Colorselector_Mode *, ret)
/**
* @def elm_obj_colorselector_palette_color_add
* @since 1.8
*
* Add a new color item to palette.
*
* @param[in] r
* @param[in] g
* @param[in] b
* @param[in] a
* @param[out] ret
*
* @see elm_colorselector_palette_color_add
*/
#define elm_obj_colorselector_palette_color_add(r, g, b, a, ret) ELM_OBJ_COLORSELECTOR_ID(ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_COLOR_ADD), EO_TYPECHECK(int, r), EO_TYPECHECK(int, g), EO_TYPECHECK(int, b), EO_TYPECHECK(int, a), EO_TYPECHECK(Elm_Object_Item **, ret)
/**
* @def elm_obj_colorselector_palette_clear
* @since 1.8
*
* Clear the palette items.
*
*
* @see elm_colorselector_palette_clear
*/
#define elm_obj_colorselector_palette_clear() ELM_OBJ_COLORSELECTOR_ID(ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_CLEAR)
/**
* @def elm_obj_colorselector_palette_name_set
* @since 1.8
*
* Set current palette's name
*
* @param[in] palette_name
*
* @see elm_colorselector_palette_name_set
*/
#define elm_obj_colorselector_palette_name_set(palette_name) ELM_OBJ_COLORSELECTOR_ID(ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_NAME_SET), EO_TYPECHECK(const char *, palette_name)
/**
* @def elm_obj_colorselector_palette_name_get
* @since 1.8
*
* Get current palette's name
*
* @param[out] ret
*
* @see elm_colorselector_palette_name_get
*/
#define elm_obj_colorselector_palette_name_get(ret) ELM_OBJ_COLORSELECTOR_ID(ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_NAME_GET), EO_TYPECHECK(const char **, ret)
typedef struct _Elm_Color_RGBA
{
unsigned int r;
unsigned int g;
unsigned int b;
unsigned int a;
} Elm_Color_RGBA;
typedef struct _Elm_Custom_Palette
{
const char *palette_name;
Eina_List *color_list;
} Elm_Custom_Palette;
/**
* @enum Elm_Colorselector_Mode
* @typedef Elm_Colorselector_Mode
*
* Different modes supported by Colorselector
*
* @see elm_colorselector_mode_set()
* @see elm_colorselector_mode_get()
*/
typedef enum
{
ELM_COLORSELECTOR_PALETTE = 0, /**< only color palette is displayed */
ELM_COLORSELECTOR_COMPONENTS, /**< only color selector is displayed */
ELM_COLORSELECTOR_BOTH, /**< Both Palette and selector is displayed, default */
ELM_COLORSELECTOR_PICKER, /**< only color picker is displayed */
ELM_COLORSELECTOR_ALL /**< all possible color selector is displayed */
} Elm_Colorselector_Mode;
/**
* @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);
/**
* Set color to 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);
/**
* Get current color from 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);
/**
* Set Colorselector's mode.
*
* @param obj Colorselector object
* @param mode Elm_Colorselector_Mode
*
* Colorselector supports three modes palette only, selector only and both.
*
* @ingroup Colorselector
*/
EAPI void elm_colorselector_mode_set(Evas_Object *obj, Elm_Colorselector_Mode mode);
/**
* Get Colorselector's mode.
*
* @param obj Colorselector object
* @return mode The current mode of colorselector
*
* @ingroup Colorselector
*/
EAPI Elm_Colorselector_Mode elm_colorselector_mode_get(const Evas_Object *obj);
/**
* Get Palette item's color.
*
* @param it The color palette item.
* @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_palette_item_color_get(const Elm_Object_Item *it, int *r, int *g, int *b, int *a);
/**
* Set palette item's color.
*
* @param it The color palette item.
* @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_palette_item_color_set(Elm_Object_Item *it, int r, int g, int b, int a);
/**
* Add a new color item to palette.
*
* @param obj The 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
* @return A new color palette Item.
*
* @ingroup Colorselector
*/
EAPI Elm_Object_Item *elm_colorselector_palette_color_add(Evas_Object *obj, int r, int g, int b, int a);
/**
* Clear the palette items.
*
* @param obj The Colorselector object
*
* @ingroup Colorselector
*/
EAPI void elm_colorselector_palette_clear(Evas_Object *obj);
/**
* Set current palette's name
*
* @param obj The Colorselector object
* @param palette_name Name of palette
*
* When colorpalette name is set, colors will be loaded from and saved to config
* using the set name. If no name is set then colors will be loaded from or
* saved to "default" config.
*
* @ingroup Colorselector
*/
EAPI void elm_colorselector_palette_name_set(Evas_Object *obj, const char *palette_name);
/**
* Get current palette's name
*
* @param obj The Colorselector object
* @return Name of palette
*
* Returns the currently set palette name using which colors will be
* saved/loaded in to config.
*
* @ingroup Colorselector
*/
EAPI const char *elm_colorselector_palette_name_get(const Evas_Object *obj);
#include "elm_colorselector_common.h"
#ifdef EFL_EO_API_SUPPORT
#include "elm_colorselector_eo.h"
#endif
#ifndef EFL_NOLEGACY_API_SUPPORT
#include "elm_colorselector_legacy.h"
#endif
/**
* @}
*/

View File

@ -0,0 +1,58 @@
typedef struct _Elm_Color_RGBA
{
unsigned int r;
unsigned int g;
unsigned int b;
unsigned int a;
} Elm_Color_RGBA;
typedef struct _Elm_Custom_Palette
{
const char *palette_name;
Eina_List *color_list;
} Elm_Custom_Palette;
/**
* @enum Elm_Colorselector_Mode
* @typedef Elm_Colorselector_Mode
*
* Different modes supported by Colorselector
*
* @see elm_colorselector_mode_set()
* @see elm_colorselector_mode_get()
*/
typedef enum
{
ELM_COLORSELECTOR_PALETTE = 0, /**< only color palette is displayed */
ELM_COLORSELECTOR_COMPONENTS, /**< only color selector is displayed */
ELM_COLORSELECTOR_BOTH, /**< Both Palette and selector is displayed, default */
ELM_COLORSELECTOR_PICKER, /**< only color picker is displayed */
ELM_COLORSELECTOR_ALL /**< all possible color selector is displayed */
} Elm_Colorselector_Mode;
/**
* Get Palette item's color.
*
* @param it The color palette item.
* @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_palette_item_color_get(const Elm_Object_Item *it, int *r, int *g, int *b, int *a);
/**
* Set palette item's color.
*
* @param it The color palette item.
* @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_palette_item_color_set(Elm_Object_Item *it, int r, int g, int b, int a);

View File

@ -0,0 +1,142 @@
#define ELM_OBJ_COLORSELECTOR_CLASS elm_obj_colorselector_class_get()
const Eo_Class *elm_obj_colorselector_class_get(void) EINA_CONST;
extern EAPI Eo_Op ELM_OBJ_COLORSELECTOR_BASE_ID;
enum
{
ELM_OBJ_COLORSELECTOR_SUB_ID_COLOR_SET,
ELM_OBJ_COLORSELECTOR_SUB_ID_COLOR_GET,
ELM_OBJ_COLORSELECTOR_SUB_ID_MODE_SET,
ELM_OBJ_COLORSELECTOR_SUB_ID_MODE_GET,
ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_COLOR_ADD,
ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_CLEAR,
ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_NAME_SET,
ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_NAME_GET,
ELM_OBJ_COLORSELECTOR_SUB_ID_LAST
};
#define ELM_OBJ_COLORSELECTOR_ID(sub_id) (ELM_OBJ_COLORSELECTOR_BASE_ID + sub_id)
/**
* @def elm_obj_colorselector_color_set
* @since 1.8
*
* Set color to colorselector
*
* @param[in] r
* @param[in] g
* @param[in] b
* @param[in] a
*
* @see elm_colorselector_color_set
*
* @ingroup Colorselector
*/
#define elm_obj_colorselector_color_set(r, g, b, a) ELM_OBJ_COLORSELECTOR_ID(ELM_OBJ_COLORSELECTOR_SUB_ID_COLOR_SET), EO_TYPECHECK(int, r), EO_TYPECHECK(int, g), EO_TYPECHECK(int, b), EO_TYPECHECK(int, a)
/**
* @def elm_obj_colorselector_color_get
* @since 1.8
*
* Get current color from colorselector
*
* @param[out] r
* @param[out] g
* @param[out] b
* @param[out] a
*
* @see elm_colorselector_color_get
*
* @ingroup Colorselector
*/
#define elm_obj_colorselector_color_get(r, g, b, a) ELM_OBJ_COLORSELECTOR_ID(ELM_OBJ_COLORSELECTOR_SUB_ID_COLOR_GET), EO_TYPECHECK(int *, r), EO_TYPECHECK(int *, g), EO_TYPECHECK(int *, b), EO_TYPECHECK(int *, a)
/**
* @def elm_obj_colorselector_mode_set
* @since 1.8
*
* Set Colorselector's mode.
*
* @param[in] mode
*
* @see elm_colorselector_mode_set
*
* @ingroup Colorselector
*/
#define elm_obj_colorselector_mode_set(mode) ELM_OBJ_COLORSELECTOR_ID(ELM_OBJ_COLORSELECTOR_SUB_ID_MODE_SET), EO_TYPECHECK(Elm_Colorselector_Mode, mode)
/**
* @def elm_obj_colorselector_mode_get
* @since 1.8
*
* Get Colorselector's mode.
*
* @param[out] ret
*
* @see elm_colorselector_mode_get
*
* @ingroup Colorselector
*/
#define elm_obj_colorselector_mode_get(ret) ELM_OBJ_COLORSELECTOR_ID(ELM_OBJ_COLORSELECTOR_SUB_ID_MODE_GET), EO_TYPECHECK(Elm_Colorselector_Mode *, ret)
/**
* @def elm_obj_colorselector_palette_color_add
* @since 1.8
*
* Add a new color item to palette.
*
* @param[in] r
* @param[in] g
* @param[in] b
* @param[in] a
* @param[out] ret
*
* @see elm_colorselector_palette_color_add
*
* @ingroup Colorselector
*/
#define elm_obj_colorselector_palette_color_add(r, g, b, a, ret) ELM_OBJ_COLORSELECTOR_ID(ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_COLOR_ADD), EO_TYPECHECK(int, r), EO_TYPECHECK(int, g), EO_TYPECHECK(int, b), EO_TYPECHECK(int, a), EO_TYPECHECK(Elm_Object_Item **, ret)
/**
* @def elm_obj_colorselector_palette_clear
* @since 1.8
*
* Clear the palette items.
*
*
* @see elm_colorselector_palette_clear
*
* @ingroup Colorselector
*/
#define elm_obj_colorselector_palette_clear() ELM_OBJ_COLORSELECTOR_ID(ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_CLEAR)
/**
* @def elm_obj_colorselector_palette_name_set
* @since 1.8
*
* Set current palette's name
*
* @param[in] palette_name
*
* @see elm_colorselector_palette_name_set
*
* @ingroup Colorselector
*/
#define elm_obj_colorselector_palette_name_set(palette_name) ELM_OBJ_COLORSELECTOR_ID(ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_NAME_SET), EO_TYPECHECK(const char *, palette_name)
/**
* @def elm_obj_colorselector_palette_name_get
* @since 1.8
*
* Get current palette's name
*
* @param[out] ret
*
* @see elm_colorselector_palette_name_get
*
* @ingroup Colorselector
*/
#define elm_obj_colorselector_palette_name_get(ret) ELM_OBJ_COLORSELECTOR_ID(ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_NAME_GET), EO_TYPECHECK(const char **, ret)

View File

@ -0,0 +1,107 @@
/**
* @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);
/**
* Set color to 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);
/**
* Get current color from 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);
/**
* Set Colorselector's mode.
*
* @param obj Colorselector object
* @param mode Elm_Colorselector_Mode
*
* Colorselector supports three modes palette only, selector only and both.
*
* @ingroup Colorselector
*/
EAPI void elm_colorselector_mode_set(Evas_Object *obj, Elm_Colorselector_Mode mode);
/**
* Get Colorselector's mode.
*
* @param obj Colorselector object
* @return mode The current mode of colorselector
*
* @ingroup Colorselector
*/
EAPI Elm_Colorselector_Mode elm_colorselector_mode_get(const Evas_Object *obj);
/**
* Add a new color item to palette.
*
* @param obj The 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
* @return A new color palette Item.
*
* @ingroup Colorselector
*/
EAPI Elm_Object_Item *elm_colorselector_palette_color_add(Evas_Object *obj, int r, int g, int b, int a);
/**
* Clear the palette items.
*
* @param obj The Colorselector object
*
* @ingroup Colorselector
*/
EAPI void elm_colorselector_palette_clear(Evas_Object *obj);
/**
* Set current palette's name
*
* @param obj The Colorselector object
* @param palette_name Name of palette
*
* When colorpalette name is set, colors will be loaded from and saved to config
* using the set name. If no name is set then colors will be loaded from or
* saved to "default" config.
*
* @ingroup Colorselector
*/
EAPI void elm_colorselector_palette_name_set(Evas_Object *obj, const char *palette_name);
/**
* Get current palette's name
*
* @param obj The Colorselector object
* @return Name of palette
*
* Returns the currently set palette name using which colors will be
* saved/loaded in to config.
*
* @ingroup Colorselector
*/
EAPI const char *elm_colorselector_palette_name_get(const Evas_Object *obj);