edje color classes can now have text descriptions
@feature
This commit is contained in:
parent
54fa8c7e42
commit
1cf630f2bd
|
@ -205,6 +205,7 @@ static void st_color_class_name(void);
|
|||
static void st_color_class_color(void);
|
||||
static void st_color_class_color2(void);
|
||||
static void st_color_class_color3(void);
|
||||
static void st_color_class_desc(void);
|
||||
|
||||
static void ob_collections(void);
|
||||
static void st_collections_base_scale(void);
|
||||
|
@ -498,7 +499,8 @@ static void st_collections_group_nobroadcast(void);
|
|||
{PREFIX"color_classes.color_class.name", st_color_class_name}, /* dup */ \
|
||||
{PREFIX"color_classes.color_class.color", st_color_class_color}, /* dup */ \
|
||||
{PREFIX"color_classes.color_class.color2", st_color_class_color2}, /* dup */ \
|
||||
{PREFIX"color_classes.color_class.color3", st_color_class_color3}, /* dup */
|
||||
{PREFIX"color_classes.color_class.color3", st_color_class_color3}, /* dup */ \
|
||||
{PREFIX"color_classes.color_class.description", st_color_class_desc}, /* dup */
|
||||
|
||||
#define PROGRAM_SEQUENCE(PREFIX, NAME, FN) \
|
||||
{PREFIX".program."NAME, FN}, /* dup */ \
|
||||
|
@ -2460,6 +2462,28 @@ st_color_class_color3(void)
|
|||
cc->a3 = parse_int_range(3, 0, 255);
|
||||
}
|
||||
|
||||
/**
|
||||
@page edcref
|
||||
@property
|
||||
description
|
||||
@parameters
|
||||
[color class description]
|
||||
@effect
|
||||
Provides a descriptive name for the effect of the color class
|
||||
@since 1.14
|
||||
@endproperty
|
||||
*/
|
||||
static void
|
||||
st_color_class_desc(void)
|
||||
{
|
||||
Edje_Color_Class *cc;
|
||||
|
||||
check_arg_count(1);
|
||||
|
||||
cc = eina_list_data_get(eina_list_last(edje_file->color_classes));
|
||||
cc->desc = parse_str(0);
|
||||
}
|
||||
|
||||
/** @edcsubsection{toplevel_styles,
|
||||
* Styles} */
|
||||
|
||||
|
|
|
@ -813,6 +813,26 @@ EAPI Eina_Bool edje_edit_color_class_colors_set(Evas_Object *obj, const char *cl
|
|||
*/
|
||||
EAPI Eina_Bool edje_edit_color_class_name_set(Evas_Object *obj, const char *name, const char *newname);
|
||||
|
||||
/** Get the description of a color class.
|
||||
*
|
||||
* @param obj Object being edited.
|
||||
* @param name Color class to get the description of.
|
||||
*
|
||||
* @return The description of the color class or @c NULL if not found
|
||||
* @since 1.14
|
||||
*/
|
||||
EAPI Eina_Stringshare *edje_edit_color_class_description_get(Evas_Object *obj, const char *class_name);
|
||||
|
||||
/** Change the description of a color class.
|
||||
*
|
||||
* @param obj Object being edited.
|
||||
* @param name Color class to edit.
|
||||
* @param desc New description for the color class
|
||||
*
|
||||
* @return @c EINA_TRUE in case of success, @c EINA_FALSE otherwise.
|
||||
* @since 1.14
|
||||
*/
|
||||
EAPI Eina_Bool edje_edit_color_class_description_set(Evas_Object *obj, const char *class_name, const char *desc);
|
||||
//@}
|
||||
|
||||
|
||||
|
|
|
@ -418,6 +418,7 @@ _edje_edd_init(void)
|
|||
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_color_class, Edje_Color_Class, "g3", g3, EET_T_UCHAR);
|
||||
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_color_class, Edje_Color_Class, "b3", b3, EET_T_UCHAR);
|
||||
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_color_class, Edje_Color_Class, "a3", a3, EET_T_UCHAR);
|
||||
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_color_class, Edje_Color_Class, "desc", desc, EET_T_STRING);
|
||||
|
||||
/* the main file directory */
|
||||
EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_File);
|
||||
|
|
|
@ -2519,6 +2519,43 @@ edje_edit_color_class_colors_set(Evas_Object *obj, const char *class_name, int r
|
|||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
EAPI Eina_Stringshare *
|
||||
edje_edit_color_class_description_get(Evas_Object *obj, const char *class_name)
|
||||
{
|
||||
Eina_List *l;
|
||||
Edje_Color_Class *cc;
|
||||
|
||||
GET_ED_OR_RETURN(NULL);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(class_name, NULL);
|
||||
|
||||
if (!ed->file || !ed->file->color_classes)
|
||||
return NULL;
|
||||
EINA_LIST_FOREACH(ed->file->color_classes, l, cc)
|
||||
if (eina_streq(cc->name, class_name))
|
||||
return cc->desc;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
edje_edit_color_class_description_set(Evas_Object *obj, const char *class_name, const char *desc)
|
||||
{
|
||||
Eina_List *l;
|
||||
Edje_Color_Class *cc;
|
||||
|
||||
GET_ED_OR_RETURN(EINA_FALSE);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(class_name, EINA_FALSE);
|
||||
|
||||
if (!ed->file || !ed->file->color_classes)
|
||||
return EINA_FALSE;
|
||||
EINA_LIST_FOREACH(ed->file->color_classes, l, cc)
|
||||
if (eina_streq(cc->name, class_name))
|
||||
{
|
||||
eina_stringshare_replace(&cc->desc, desc);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
edje_edit_color_class_add(Evas_Object *obj, const char *name)
|
||||
{
|
||||
|
|
|
@ -1545,6 +1545,7 @@ _edje_file_free(Edje_File *edf)
|
|||
EINA_LIST_FREE(edf->color_classes, ecc)
|
||||
{
|
||||
if (edf->free_strings && ecc->name) eina_stringshare_del(ecc->name);
|
||||
if (edf->free_strings) eina_stringshare_del(ecc->desc);
|
||||
free(ecc);
|
||||
}
|
||||
|
||||
|
|
|
@ -2146,6 +2146,18 @@ class Edje.Object (Evas.Smart_Clipped, Efl.File)
|
|||
@out int a3; /*@ Shadow Alpha value */
|
||||
}
|
||||
}
|
||||
color_class_description_get @const {
|
||||
/*@
|
||||
@brief Gets the description of an object color class.
|
||||
|
||||
@return The description of the target color class or @c NULL if not found
|
||||
|
||||
This function gets the description of a color class in use by an object. */
|
||||
return: const(char)*;
|
||||
params {
|
||||
@in const(char)* color_class;
|
||||
}
|
||||
}
|
||||
part_drag_step {
|
||||
/*@
|
||||
@brief Steps the dragable x,y steps.
|
||||
|
|
|
@ -1867,6 +1867,7 @@ struct _Edje_Color_Class
|
|||
unsigned char r, g, b, a;
|
||||
unsigned char r2, g2, b2, a2;
|
||||
unsigned char r3, g3, b3, a3;
|
||||
Eina_Stringshare *desc;
|
||||
};
|
||||
|
||||
struct _Edje_Text_Class
|
||||
|
|
|
@ -66,6 +66,7 @@ _edje_color_class_free(void *data)
|
|||
Edje_Color_Class *cc = data;
|
||||
|
||||
if (cc->name) eina_stringshare_del(cc->name);
|
||||
eina_stringshare_del(cc->desc);
|
||||
free(cc);
|
||||
}
|
||||
|
||||
|
|
|
@ -774,6 +774,13 @@ _edje_object_color_class_get(Eo *obj EINA_UNUSED, Edje *ed, const char *color_cl
|
|||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
EOLIAN Eina_Stringshare *
|
||||
_edje_object_color_class_description_get(Eo *obj EINA_UNUSED, Edje *ed, const char *color_class)
|
||||
{
|
||||
Edje_Color_Class *cc = _edje_color_class_find(ed, color_class);
|
||||
return cc ? cc->desc : NULL;
|
||||
}
|
||||
|
||||
void
|
||||
edje_object_color_class_del(Evas_Object *obj, const char *color_class)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue