diff --git a/src/Makefile_Elementary.am b/src/Makefile_Elementary.am index d7552509a4..d6a4141652 100644 --- a/src/Makefile_Elementary.am +++ b/src/Makefile_Elementary.am @@ -217,7 +217,6 @@ elm_legacy_eolian_files = \ lib/elementary/elm_sys_notify.eo \ lib/elementary/elm_sys_notify_dbus.eo \ lib/elementary/elm_systray.eo \ - lib/elementary/elm_color_item.eo \ lib/elementary/elm_dayselector_item.eo \ lib/elementary/elm_flipselector_item.eo \ lib/elementary/elm_menu_item.eo \ @@ -338,6 +337,8 @@ lib/elementary/elm_clock_eo.c \ lib/elementary/elm_clock_eo.legacy.c \ lib/elementary/elm_code_widget_eo.legacy.c \ lib/elementary/elm_code_widget_legacy_eo.c \ +lib/elementary/elm_color_item_eo.legacy.c \ +lib/elementary/elm_color_item_eo.c \ lib/elementary/elm_hoversel_eo.c \ lib/elementary/elm_hoversel_item_eo.c \ lib/elementary/elm_hoversel_item_eo.legacy.c @@ -403,6 +404,8 @@ lib/elementary/elm_clock_eo.legacy.h \ lib/elementary/elm_code_widget_eo.legacy.h \ lib/elementary/elm_code_widget_legacy_eo.h \ lib/elementary/elm_code_widget_legacy_eo.legacy.h \ +lib/elementary/elm_color_item_eo.h \ +lib/elementary/elm_color_item_eo.legacy.h \ lib/elementary/elm_hoversel_eo.h \ lib/elementary/elm_hoversel_eo.legacy.h \ lib/elementary/elm_hoversel_item_eo.h \ diff --git a/src/lib/elementary/elm_color_item.eo b/src/lib/elementary/elm_color_item.eo deleted file mode 100644 index a801d8c715..0000000000 --- a/src/lib/elementary/elm_color_item.eo +++ /dev/null @@ -1,53 +0,0 @@ -class Elm.Color.Item extends Elm.Widget.Item implements Efl.Ui.Focus.Object, Efl.Access.Widget.Action -{ - [[Elementary color item class]] - legacy_prefix: elm_color_item; - eo_prefix: elm_obj_color_item; - methods { - @property color { - get { - [[Get Palette item's color.]] - } - set { - [[Set Palette item's color.]] - } - values { - r: int; [[Red-value of color]] - g: int; [[Green-value of color]] - b: int; [[Blue-value of color]] - a: int; [[Alpha-value of color]] - } - } - @property selected { - get { - [[Get the selected state of color palette item - - @since 1.9 - ]] - } - set { - [[Set the selected state of color palette item - - @since 1.9 - ]] - } - values { - selected: bool; [[$true if selected $false otherwise]] - } - } - } - implements { - Efl.Object.constructor; - Efl.Object.destructor; - Elm.Widget.Item.access_register; - Elm.Widget.Item.signal_emit; - Elm.Widget.Item.item_focus { get; set; } - Efl.Ui.Focus.Object.focus { set; } - Efl.Ui.Focus.Object.focus_geometry { get; } - Efl.Ui.Focus.Object.focus_parent { get; } - Efl.Ui.Focus.Object.focus_manager { get; } - Efl.Access.Object.state_set { get; } - Efl.Access.Object.i18n_name { get; } - Efl.Access.Widget.Action.elm_actions { get; } - } -} diff --git a/src/lib/elementary/elm_color_item_eo.c b/src/lib/elementary/elm_color_item_eo.c new file mode 100644 index 0000000000..64c6bf6763 --- /dev/null +++ b/src/lib/elementary/elm_color_item_eo.c @@ -0,0 +1,137 @@ + +void _elm_color_item_color_set(Eo *obj, Elm_Color_Item_Data *pd, int r, int g, int b, int a); + +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_color_item_color_set, EFL_FUNC_CALL(r, g, b, a), int r, int g, int b, int a); + +void _elm_color_item_color_get(const Eo *obj, Elm_Color_Item_Data *pd, int *r, int *g, int *b, int *a); + +EOAPI EFL_VOID_FUNC_BODYV_CONST(elm_obj_color_item_color_get, EFL_FUNC_CALL(r, g, b, a), int *r, int *g, int *b, int *a); + +void _elm_color_item_selected_set(Eo *obj, Elm_Color_Item_Data *pd, Eina_Bool selected); + + +static Eina_Error +__eolian_elm_color_item_selected_set_reflect(Eo *obj, Eina_Value val) +{ + Eina_Error r = 0; Eina_Bool cval; + if (!eina_value_bool_convert(&val, &cval)) + { + r = EINA_ERROR_VALUE_FAILED; + goto end; + } + elm_obj_color_item_selected_set(obj, cval); + end: + eina_value_flush(&val); + return r; +} + +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_color_item_selected_set, EFL_FUNC_CALL(selected), Eina_Bool selected); + +Eina_Bool _elm_color_item_selected_get(const Eo *obj, Elm_Color_Item_Data *pd); + + +static Eina_Value +__eolian_elm_color_item_selected_get_reflect(Eo *obj) +{ + Eina_Bool val = elm_obj_color_item_selected_get(obj); + return eina_value_bool_init(val); +} + +EOAPI EFL_FUNC_BODY_CONST(elm_obj_color_item_selected_get, Eina_Bool, 0); + +Efl_Object *_elm_color_item_efl_object_constructor(Eo *obj, Elm_Color_Item_Data *pd); + + +void _elm_color_item_efl_object_destructor(Eo *obj, Elm_Color_Item_Data *pd); + + +Efl_Canvas_Object *_elm_color_item_elm_widget_item_access_register(Eo *obj, Elm_Color_Item_Data *pd); + + +void _elm_color_item_elm_widget_item_signal_emit(Eo *obj, Elm_Color_Item_Data *pd, const char *emission, const char *source); + + +void _elm_color_item_elm_widget_item_item_focus_set(Eo *obj, Elm_Color_Item_Data *pd, Eina_Bool focused); + + +Eina_Bool _elm_color_item_elm_widget_item_item_focus_get(const Eo *obj, Elm_Color_Item_Data *pd); + + +void _elm_color_item_efl_ui_focus_object_focus_set(Eo *obj, Elm_Color_Item_Data *pd, Eina_Bool focus); + + +Eina_Rect _elm_color_item_efl_ui_focus_object_focus_geometry_get(const Eo *obj, Elm_Color_Item_Data *pd); + + +Efl_Ui_Focus_Object *_elm_color_item_efl_ui_focus_object_focus_parent_get(const Eo *obj, Elm_Color_Item_Data *pd); + + +Efl_Ui_Focus_Manager *_elm_color_item_efl_ui_focus_object_focus_manager_get(const Eo *obj, Elm_Color_Item_Data *pd); + + +Efl_Access_State_Set _elm_color_item_efl_access_object_state_set_get(const Eo *obj, Elm_Color_Item_Data *pd); + + +const char *_elm_color_item_efl_access_object_i18n_name_get(const Eo *obj, Elm_Color_Item_Data *pd); + + +const Efl_Access_Action_Data *_elm_color_item_efl_access_widget_action_elm_actions_get(const Eo *obj, Elm_Color_Item_Data *pd); + + +static Eina_Bool +_elm_color_item_class_initializer(Efl_Class *klass) +{ + const Efl_Object_Ops *opsp = NULL; + + const Efl_Object_Property_Reflection_Ops *ropsp = NULL; + +#ifndef ELM_COLOR_ITEM_EXTRA_OPS +#define ELM_COLOR_ITEM_EXTRA_OPS +#endif + + EFL_OPS_DEFINE(ops, + EFL_OBJECT_OP_FUNC(elm_obj_color_item_color_set, _elm_color_item_color_set), + EFL_OBJECT_OP_FUNC(elm_obj_color_item_color_get, _elm_color_item_color_get), + EFL_OBJECT_OP_FUNC(elm_obj_color_item_selected_set, _elm_color_item_selected_set), + EFL_OBJECT_OP_FUNC(elm_obj_color_item_selected_get, _elm_color_item_selected_get), + EFL_OBJECT_OP_FUNC(efl_constructor, _elm_color_item_efl_object_constructor), + EFL_OBJECT_OP_FUNC(efl_destructor, _elm_color_item_efl_object_destructor), + EFL_OBJECT_OP_FUNC(elm_wdg_item_access_register, _elm_color_item_elm_widget_item_access_register), + EFL_OBJECT_OP_FUNC(elm_wdg_item_signal_emit, _elm_color_item_elm_widget_item_signal_emit), + EFL_OBJECT_OP_FUNC(elm_wdg_item_focus_set, _elm_color_item_elm_widget_item_item_focus_set), + EFL_OBJECT_OP_FUNC(elm_wdg_item_focus_get, _elm_color_item_elm_widget_item_item_focus_get), + EFL_OBJECT_OP_FUNC(efl_ui_focus_object_focus_set, _elm_color_item_efl_ui_focus_object_focus_set), + EFL_OBJECT_OP_FUNC(efl_ui_focus_object_focus_geometry_get, _elm_color_item_efl_ui_focus_object_focus_geometry_get), + EFL_OBJECT_OP_FUNC(efl_ui_focus_object_focus_parent_get, _elm_color_item_efl_ui_focus_object_focus_parent_get), + EFL_OBJECT_OP_FUNC(efl_ui_focus_object_focus_manager_get, _elm_color_item_efl_ui_focus_object_focus_manager_get), + EFL_OBJECT_OP_FUNC(efl_access_object_state_set_get, _elm_color_item_efl_access_object_state_set_get), + EFL_OBJECT_OP_FUNC(efl_access_object_i18n_name_get, _elm_color_item_efl_access_object_i18n_name_get), + EFL_OBJECT_OP_FUNC(efl_access_widget_action_elm_actions_get, _elm_color_item_efl_access_widget_action_elm_actions_get), + ELM_COLOR_ITEM_EXTRA_OPS + ); + opsp = &ops; + + static const Efl_Object_Property_Reflection refl_table[] = { + {"selected", __eolian_elm_color_item_selected_set_reflect, __eolian_elm_color_item_selected_get_reflect}, + }; + static const Efl_Object_Property_Reflection_Ops rops = { + refl_table, EINA_C_ARRAY_LENGTH(refl_table) + }; + ropsp = &rops; + + return efl_class_functions_set(klass, opsp, ropsp); +} + +static const Efl_Class_Description _elm_color_item_class_desc = { + EO_VERSION, + "Elm.Color.Item", + EFL_CLASS_TYPE_REGULAR, + sizeof(Elm_Color_Item_Data), + _elm_color_item_class_initializer, + NULL, + NULL +}; + +EFL_DEFINE_CLASS(elm_color_item_class_get, &_elm_color_item_class_desc, ELM_WIDGET_ITEM_CLASS, EFL_UI_FOCUS_OBJECT_MIXIN, EFL_ACCESS_WIDGET_ACTION_MIXIN, NULL); + +#include "elm_color_item_eo.legacy.c" diff --git a/src/lib/elementary/elm_color_item_eo.h b/src/lib/elementary/elm_color_item_eo.h new file mode 100644 index 0000000000..6fa8f14786 --- /dev/null +++ b/src/lib/elementary/elm_color_item_eo.h @@ -0,0 +1,75 @@ +#ifndef _ELM_COLOR_ITEM_EO_H_ +#define _ELM_COLOR_ITEM_EO_H_ + +#ifndef _ELM_COLOR_ITEM_EO_CLASS_TYPE +#define _ELM_COLOR_ITEM_EO_CLASS_TYPE + +typedef Eo Elm_Color_Item; + +#endif + +#ifndef _ELM_COLOR_ITEM_EO_TYPES +#define _ELM_COLOR_ITEM_EO_TYPES + + +#endif +/** Elementary color item class + * + * @ingroup Elm_Color_Item + */ +#define ELM_COLOR_ITEM_CLASS elm_color_item_class_get() + +EWAPI const Efl_Class *elm_color_item_class_get(void); + +/** + * @brief Set Palette item's color. + * + * @param[in] obj The object. + * @param[in] r Red-value of color + * @param[in] g Green-value of color + * @param[in] b Blue-value of color + * @param[in] a Alpha-value of color + * + * @ingroup Elm_Color_Item + */ +EOAPI void elm_obj_color_item_color_set(Eo *obj, int r, int g, int b, int a); + +/** + * @brief Get Palette item's color. + * + * @param[in] obj The object. + * @param[out] r Red-value of color + * @param[out] g Green-value of color + * @param[out] b Blue-value of color + * @param[out] a Alpha-value of color + * + * @ingroup Elm_Color_Item + */ +EOAPI void elm_obj_color_item_color_get(const Eo *obj, int *r, int *g, int *b, int *a); + +/** + * @brief Set the selected state of color palette item + * + * @param[in] obj The object. + * @param[in] selected @c true if selected @c false otherwise + * + * @since 1.9 + * + * @ingroup Elm_Color_Item + */ +EOAPI void elm_obj_color_item_selected_set(Eo *obj, Eina_Bool selected); + +/** + * @brief Get the selected state of color palette item + * + * @param[in] obj The object. + * + * @return @c true if selected @c false otherwise + * + * @since 1.9 + * + * @ingroup Elm_Color_Item + */ +EOAPI Eina_Bool elm_obj_color_item_selected_get(const Eo *obj); + +#endif diff --git a/src/lib/elementary/elm_color_item_eo.legacy.c b/src/lib/elementary/elm_color_item_eo.legacy.c new file mode 100644 index 0000000000..3bd5aaddeb --- /dev/null +++ b/src/lib/elementary/elm_color_item_eo.legacy.c @@ -0,0 +1,24 @@ + +EAPI void +elm_color_item_color_set(Elm_Color_Item *obj, int r, int g, int b, int a) +{ + elm_obj_color_item_color_set(obj, r, g, b, a); +} + +EAPI void +elm_color_item_color_get(const Elm_Color_Item *obj, int *r, int *g, int *b, int *a) +{ + elm_obj_color_item_color_get(obj, r, g, b, a); +} + +EAPI void +elm_color_item_selected_set(Elm_Color_Item *obj, Eina_Bool selected) +{ + elm_obj_color_item_selected_set(obj, selected); +} + +EAPI Eina_Bool +elm_color_item_selected_get(const Elm_Color_Item *obj) +{ + return elm_obj_color_item_selected_get(obj); +} diff --git a/src/lib/elementary/elm_color_item_eo.legacy.h b/src/lib/elementary/elm_color_item_eo.legacy.h new file mode 100644 index 0000000000..a91f728203 --- /dev/null +++ b/src/lib/elementary/elm_color_item_eo.legacy.h @@ -0,0 +1,68 @@ +#ifndef _ELM_COLOR_ITEM_EO_LEGACY_H_ +#define _ELM_COLOR_ITEM_EO_LEGACY_H_ + +#ifndef _ELM_COLOR_ITEM_EO_CLASS_TYPE +#define _ELM_COLOR_ITEM_EO_CLASS_TYPE + +typedef Eo Elm_Color_Item; + +#endif + +#ifndef _ELM_COLOR_ITEM_EO_TYPES +#define _ELM_COLOR_ITEM_EO_TYPES + + +#endif + +/** + * @brief Set Palette item's color. + * + * @param[in] obj The object. + * @param[in] r Red-value of color + * @param[in] g Green-value of color + * @param[in] b Blue-value of color + * @param[in] a Alpha-value of color + * + * @ingroup Elm_Color_Item_Group + */ +EAPI void elm_color_item_color_set(Elm_Color_Item *obj, int r, int g, int b, int a); + +/** + * @brief Get Palette item's color. + * + * @param[in] obj The object. + * @param[out] r Red-value of color + * @param[out] g Green-value of color + * @param[out] b Blue-value of color + * @param[out] a Alpha-value of color + * + * @ingroup Elm_Color_Item_Group + */ +EAPI void elm_color_item_color_get(const Elm_Color_Item *obj, int *r, int *g, int *b, int *a); + +/** + * @brief Set the selected state of color palette item + * + * @param[in] obj The object. + * @param[in] selected @c true if selected @c false otherwise + * + * @since 1.9 + * + * @ingroup Elm_Color_Item_Group + */ +EAPI void elm_color_item_selected_set(Elm_Color_Item *obj, Eina_Bool selected); + +/** + * @brief Get the selected state of color palette item + * + * @param[in] obj The object. + * + * @return @c true if selected @c false otherwise + * + * @since 1.9 + * + * @ingroup Elm_Color_Item_Group + */ +EAPI Eina_Bool elm_color_item_selected_get(const Elm_Color_Item *obj); + +#endif diff --git a/src/lib/elementary/elm_colorselector.c b/src/lib/elementary/elm_colorselector.c index b39d69cbb0..c101fd3c5d 100644 --- a/src/lib/elementary/elm_colorselector.c +++ b/src/lib/elementary/elm_colorselector.c @@ -2750,4 +2750,4 @@ ELM_WIDGET_KEY_DOWN_DEFAULT_IMPLEMENT(elm_colorselector, Elm_Colorselector_Data) EFL_CANVAS_GROUP_ADD_DEL_OPS(elm_colorselector) #include "elm_colorselector.eo.c" -#include "elm_color_item.eo.c" +#include "elm_color_item_eo.c" diff --git a/src/lib/elementary/elm_colorselector.eo b/src/lib/elementary/elm_colorselector.eo deleted file mode 100644 index d40672c52f..0000000000 --- a/src/lib/elementary/elm_colorselector.eo +++ /dev/null @@ -1,126 +0,0 @@ -enum Elm.Colorselector.Mode -{ - [[Different modes supported by Colorselector - - See also @Elm.Colorselector.mode.set, @Elm.Colorselector.mode.get. - ]] - legacy: elm_colorselector; - palette = 0, [[Only color palette is displayed.]] - components, [[Only color selector is displayed.]] - both, [[Both Palette and selector is displayed, default.]] - picker, [[Only color picker is displayed.]] - all [[All possible color selector is displayed.]] -} - -class Elm.Colorselector extends Efl.Ui.Layout_Base implements Efl.Ui.Focus.Composition, - Efl.Access.Widget.Action, Efl.Ui.Clickable, Efl.Ui.Legacy -{ - [[Elementary colorselector class]] - legacy_prefix: elm_colorselector; - eo_prefix: elm_obj_colorselector; - event_prefix: elm_colorselector; - methods { - @property picked_color { - set { - [[Set color to colorselector.]] - legacy: elm_colorselector_color_set; - - } - get { - [[Get current color from colorselector.]] - legacy: elm_colorselector_color_get; - } - values { - r: int; [[Red value of color]] - g: int; [[Green value of color]] - b: int; [[Blue value of color]] - a: int; [[Alpha value of color]] - } - } - @property palette_name { - set { - [[Set current palette's name - - 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. - ]] - } - get { - [[Get current palette's name - - Returns the currently set palette name using which colors will be - saved/loaded in to config. - ]] - } - values { - palette_name: string; [[Name of palette]] - } - } - @property mode { - set { - [[Set Colorselector's mode. - - Colorselector supports three modes palette only, selector only and both. - ]] - } - get { - [[Get Colorselector's mode.]] - } - values { - mode: Elm.Colorselector.Mode; [[Elm_Colorselector_Mode]] - } - } - @property palette_items { - get { - [[Get list of palette items. - - Note That palette item list is internally managed by colorselector widget and - it should not be freed/modified by application. - - @since 1.9 - ]] - return: const(list); [[The list of color palette items.]] - } - } - @property palette_selected_item { - get { - [[Get the selected item in colorselector palette. - - @since 1.9]] - - return: Elm.Widget.Item; [[The selected item, or $null if none selected.]] - } - } - palette_color_add { - [[Add a new color item to palette.]] - - return: Elm.Widget.Item; [[A new color palette Item.]] - params { - @in r: int; [[Red value of color]] - @in g: int; [[Green value of color]] - @in b: int; [[Blue value of color]] - @in a: int; [[Alpha value of color]] - } - } - palette_clear { - [[Clear the palette items.]] - } - } - implements { - class.constructor; - Efl.Object.constructor; - Efl.Ui.Widget.theme_apply; - Efl.Ui.Widget.focus_highlight_geometry { get; } - Efl.Ui.Widget.on_access_update; - Efl.Ui.Widget.widget_input_event_handler; - Efl.Access.Widget.Action.elm_actions { get; } - Efl.Access.Object.access_children { get; } - } - events { - color,item,selected: Efl.Object; [[Called when color item was selected]] - color,item,longpressed: Efl.Object; [[Called when color item got a long press]] - changed: void; [[Called when colorselector changed]] - changed,user: void; [[Called when the object changed due to user interaction]] - } -} diff --git a/src/lib/elementary/elm_colorselector_eo.c b/src/lib/elementary/elm_colorselector_eo.c new file mode 100644 index 0000000000..543a9a4ab4 --- /dev/null +++ b/src/lib/elementary/elm_colorselector_eo.c @@ -0,0 +1,151 @@ +EWAPI const Efl_Event_Description _ELM_COLORSELECTOR_EVENT_COLOR_ITEM_SELECTED = + EFL_EVENT_DESCRIPTION("color,item,selected"); +EWAPI const Efl_Event_Description _ELM_COLORSELECTOR_EVENT_COLOR_ITEM_LONGPRESSED = + EFL_EVENT_DESCRIPTION("color,item,longpressed"); +EWAPI const Efl_Event_Description _ELM_COLORSELECTOR_EVENT_CHANGED = + EFL_EVENT_DESCRIPTION("changed"); +EWAPI const Efl_Event_Description _ELM_COLORSELECTOR_EVENT_CHANGED_USER = + EFL_EVENT_DESCRIPTION("changed,user"); + +void _elm_colorselector_picked_color_set(Eo *obj, Elm_Colorselector_Data *pd, int r, int g, int b, int a); + +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_colorselector_picked_color_set, EFL_FUNC_CALL(r, g, b, a), int r, int g, int b, int a); + +void _elm_colorselector_picked_color_get(const Eo *obj, Elm_Colorselector_Data *pd, int *r, int *g, int *b, int *a); + +EOAPI EFL_VOID_FUNC_BODYV_CONST(elm_obj_colorselector_picked_color_get, EFL_FUNC_CALL(r, g, b, a), int *r, int *g, int *b, int *a); + +void _elm_colorselector_palette_name_set(Eo *obj, Elm_Colorselector_Data *pd, const char *palette_name); + + +static Eina_Error +__eolian_elm_colorselector_palette_name_set_reflect(Eo *obj, Eina_Value val) +{ + Eina_Error r = 0; const char *cval; + if (!eina_value_string_convert(&val, &cval)) + { + r = EINA_ERROR_VALUE_FAILED; + goto end; + } + elm_obj_colorselector_palette_name_set(obj, cval); + end: + eina_value_flush(&val); + return r; +} + +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_colorselector_palette_name_set, EFL_FUNC_CALL(palette_name), const char *palette_name); + +const char *_elm_colorselector_palette_name_get(const Eo *obj, Elm_Colorselector_Data *pd); + + +static Eina_Value +__eolian_elm_colorselector_palette_name_get_reflect(Eo *obj) +{ + const char *val = elm_obj_colorselector_palette_name_get(obj); + return eina_value_string_init(val); +} + +EOAPI EFL_FUNC_BODY_CONST(elm_obj_colorselector_palette_name_get, const char *, NULL); + +void _elm_colorselector_mode_set(Eo *obj, Elm_Colorselector_Data *pd, Elm_Colorselector_Mode mode); + +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_colorselector_mode_set, EFL_FUNC_CALL(mode), Elm_Colorselector_Mode mode); + +Elm_Colorselector_Mode _elm_colorselector_mode_get(const Eo *obj, Elm_Colorselector_Data *pd); + +EOAPI EFL_FUNC_BODY_CONST(elm_obj_colorselector_mode_get, Elm_Colorselector_Mode, 0); + +const Eina_List *_elm_colorselector_palette_items_get(const Eo *obj, Elm_Colorselector_Data *pd); + +EOAPI EFL_FUNC_BODY_CONST(elm_obj_colorselector_palette_items_get, const Eina_List *, NULL); + +Elm_Widget_Item *_elm_colorselector_palette_selected_item_get(const Eo *obj, Elm_Colorselector_Data *pd); + +EOAPI EFL_FUNC_BODY_CONST(elm_obj_colorselector_palette_selected_item_get, Elm_Widget_Item *, NULL); + +Elm_Widget_Item *_elm_colorselector_palette_color_add(Eo *obj, Elm_Colorselector_Data *pd, int r, int g, int b, int a); + +EOAPI EFL_FUNC_BODYV(elm_obj_colorselector_palette_color_add, Elm_Widget_Item *, NULL, EFL_FUNC_CALL(r, g, b, a), int r, int g, int b, int a); + +void _elm_colorselector_palette_clear(Eo *obj, Elm_Colorselector_Data *pd); + +EOAPI EFL_VOID_FUNC_BODY(elm_obj_colorselector_palette_clear); + +Efl_Object *_elm_colorselector_efl_object_constructor(Eo *obj, Elm_Colorselector_Data *pd); + + +Eina_Error _elm_colorselector_efl_ui_widget_theme_apply(Eo *obj, Elm_Colorselector_Data *pd); + + +Eina_Rect _elm_colorselector_efl_ui_widget_focus_highlight_geometry_get(const Eo *obj, Elm_Colorselector_Data *pd); + + +void _elm_colorselector_efl_ui_widget_on_access_update(Eo *obj, Elm_Colorselector_Data *pd, Eina_Bool enable); + + +Eina_Bool _elm_colorselector_efl_ui_widget_widget_input_event_handler(Eo *obj, Elm_Colorselector_Data *pd, const Efl_Event *eo_event, Efl_Canvas_Object *source); + + +const Efl_Access_Action_Data *_elm_colorselector_efl_access_widget_action_elm_actions_get(const Eo *obj, Elm_Colorselector_Data *pd); + + +Eina_List *_elm_colorselector_efl_access_object_access_children_get(const Eo *obj, Elm_Colorselector_Data *pd); + + +static Eina_Bool +_elm_colorselector_class_initializer(Efl_Class *klass) +{ + const Efl_Object_Ops *opsp = NULL; + + const Efl_Object_Property_Reflection_Ops *ropsp = NULL; + +#ifndef ELM_COLORSELECTOR_EXTRA_OPS +#define ELM_COLORSELECTOR_EXTRA_OPS +#endif + + EFL_OPS_DEFINE(ops, + EFL_OBJECT_OP_FUNC(elm_obj_colorselector_picked_color_set, _elm_colorselector_picked_color_set), + EFL_OBJECT_OP_FUNC(elm_obj_colorselector_picked_color_get, _elm_colorselector_picked_color_get), + EFL_OBJECT_OP_FUNC(elm_obj_colorselector_palette_name_set, _elm_colorselector_palette_name_set), + EFL_OBJECT_OP_FUNC(elm_obj_colorselector_palette_name_get, _elm_colorselector_palette_name_get), + EFL_OBJECT_OP_FUNC(elm_obj_colorselector_mode_set, _elm_colorselector_mode_set), + EFL_OBJECT_OP_FUNC(elm_obj_colorselector_mode_get, _elm_colorselector_mode_get), + EFL_OBJECT_OP_FUNC(elm_obj_colorselector_palette_items_get, _elm_colorselector_palette_items_get), + EFL_OBJECT_OP_FUNC(elm_obj_colorselector_palette_selected_item_get, _elm_colorselector_palette_selected_item_get), + EFL_OBJECT_OP_FUNC(elm_obj_colorselector_palette_color_add, _elm_colorselector_palette_color_add), + EFL_OBJECT_OP_FUNC(elm_obj_colorselector_palette_clear, _elm_colorselector_palette_clear), + EFL_OBJECT_OP_FUNC(efl_constructor, _elm_colorselector_efl_object_constructor), + EFL_OBJECT_OP_FUNC(efl_ui_widget_theme_apply, _elm_colorselector_efl_ui_widget_theme_apply), + EFL_OBJECT_OP_FUNC(efl_ui_widget_focus_highlight_geometry_get, _elm_colorselector_efl_ui_widget_focus_highlight_geometry_get), + EFL_OBJECT_OP_FUNC(efl_ui_widget_on_access_update, _elm_colorselector_efl_ui_widget_on_access_update), + EFL_OBJECT_OP_FUNC(efl_ui_widget_input_event_handler, _elm_colorselector_efl_ui_widget_widget_input_event_handler), + EFL_OBJECT_OP_FUNC(efl_access_widget_action_elm_actions_get, _elm_colorselector_efl_access_widget_action_elm_actions_get), + EFL_OBJECT_OP_FUNC(efl_access_object_access_children_get, _elm_colorselector_efl_access_object_access_children_get), + ELM_COLORSELECTOR_EXTRA_OPS + ); + opsp = &ops; + + static const Efl_Object_Property_Reflection refl_table[] = { + {"palette_name", __eolian_elm_colorselector_palette_name_set_reflect, __eolian_elm_colorselector_palette_name_get_reflect}, + }; + static const Efl_Object_Property_Reflection_Ops rops = { + refl_table, EINA_C_ARRAY_LENGTH(refl_table) + }; + ropsp = &rops; + + return efl_class_functions_set(klass, opsp, ropsp); +} + +static const Efl_Class_Description _elm_colorselector_class_desc = { + EO_VERSION, + "Elm.Colorselector", + EFL_CLASS_TYPE_REGULAR, + sizeof(Elm_Colorselector_Data), + _elm_colorselector_class_initializer, + _elm_colorselector_class_constructor, + NULL +}; + +EFL_DEFINE_CLASS(elm_colorselector_class_get, &_elm_colorselector_class_desc, EFL_UI_LAYOUT_BASE_CLASS, EFL_UI_FOCUS_COMPOSITION_MIXIN, EFL_ACCESS_WIDGET_ACTION_MIXIN, EFL_UI_CLICKABLE_INTERFACE, EFL_UI_LEGACY_INTERFACE, NULL); + +#include "elm_colorselector.eo.legacy.c" diff --git a/src/lib/elementary/elm_colorselector_eo.h b/src/lib/elementary/elm_colorselector_eo.h new file mode 100644 index 0000000000..84fe60a94a --- /dev/null +++ b/src/lib/elementary/elm_colorselector_eo.h @@ -0,0 +1,203 @@ +#ifndef _ELM_COLORSELECTOR_EO_H_ +#define _ELM_COLORSELECTOR_EO_H_ + +#ifndef _ELM_COLORSELECTOR_EO_CLASS_TYPE +#define _ELM_COLORSELECTOR_EO_CLASS_TYPE + +typedef Eo Elm_Colorselector; + +#endif + +#ifndef _ELM_COLORSELECTOR_EO_TYPES +#define _ELM_COLORSELECTOR_EO_TYPES + +/** + * @brief Different modes supported by Colorselector + * + * See also @ref elm_obj_colorselector_mode_set, + * @ref elm_obj_colorselector_mode_get. + * + * @ingroup Elm_Colorselector + */ +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; + + +#endif +/** Elementary colorselector class + * + * @ingroup Elm_Colorselector + */ +#define ELM_COLORSELECTOR_CLASS elm_colorselector_class_get() + +EWAPI const Efl_Class *elm_colorselector_class_get(void); + +/** + * @brief Set color to colorselector. + * + * @param[in] obj The object. + * @param[in] r Red value of color + * @param[in] g Green value of color + * @param[in] b Blue value of color + * @param[in] a Alpha value of color + * + * @ingroup Elm_Colorselector + */ +EOAPI void elm_obj_colorselector_picked_color_set(Eo *obj, int r, int g, int b, int a); + +/** + * @brief Get current color from colorselector. + * + * @param[in] obj The object. + * @param[out] r Red value of color + * @param[out] g Green value of color + * @param[out] b Blue value of color + * @param[out] a Alpha value of color + * + * @ingroup Elm_Colorselector + */ +EOAPI void elm_obj_colorselector_picked_color_get(const Eo *obj, int *r, int *g, int *b, int *a); + +/** + * @brief Set current palette's name + * + * 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. + * + * @param[in] obj The object. + * @param[in] palette_name Name of palette + * + * @ingroup Elm_Colorselector + */ +EOAPI void elm_obj_colorselector_palette_name_set(Eo *obj, const char *palette_name); + +/** + * @brief Get current palette's name + * + * Returns the currently set palette name using which colors will be + * saved/loaded in to config. + * + * @param[in] obj The object. + * + * @return Name of palette + * + * @ingroup Elm_Colorselector + */ +EOAPI const char *elm_obj_colorselector_palette_name_get(const Eo *obj); + +/** + * @brief Set Colorselector's mode. + * + * Colorselector supports three modes palette only, selector only and both. + * + * @param[in] obj The object. + * @param[in] mode Elm_Colorselector_Mode + * + * @ingroup Elm_Colorselector + */ +EOAPI void elm_obj_colorselector_mode_set(Eo *obj, Elm_Colorselector_Mode mode); + +/** + * @brief Get Colorselector's mode. + * + * @param[in] obj The object. + * + * @return Elm_Colorselector_Mode + * + * @ingroup Elm_Colorselector + */ +EOAPI Elm_Colorselector_Mode elm_obj_colorselector_mode_get(const Eo *obj); + +/** + * @brief Get list of palette items. + * + * Note That palette item list is internally managed by colorselector widget + * and it should not be freed/modified by application. + * + * @param[in] obj The object. + * + * @return The list of color palette items. + * + * @since 1.9 + * + * @ingroup Elm_Colorselector + */ +EOAPI const Eina_List *elm_obj_colorselector_palette_items_get(const Eo *obj); + +/** + * @brief Get the selected item in colorselector palette. + * + * @param[in] obj The object. + * + * @return The selected item, or @c null if none selected. + * + * @since 1.9 + * + * @ingroup Elm_Colorselector + */ +EOAPI Elm_Widget_Item *elm_obj_colorselector_palette_selected_item_get(const Eo *obj); + +/** + * @brief Add a new color item to palette. + * + * @param[in] obj The object. + * @param[in] r Red value of color + * @param[in] g Green value of color + * @param[in] b Blue value of color + * @param[in] a Alpha value of color + * + * @return A new color palette Item. + * + * @ingroup Elm_Colorselector + */ +EOAPI Elm_Widget_Item *elm_obj_colorselector_palette_color_add(Eo *obj, int r, int g, int b, int a); + +/** Clear the palette items. + * + * @ingroup Elm_Colorselector + */ +EOAPI void elm_obj_colorselector_palette_clear(Eo *obj); + +EWAPI extern const Efl_Event_Description _ELM_COLORSELECTOR_EVENT_COLOR_ITEM_SELECTED; + +/** Called when color item was selected + * @return Efl_Object * + * + * @ingroup Elm_Colorselector + */ +#define ELM_COLORSELECTOR_EVENT_COLOR_ITEM_SELECTED (&(_ELM_COLORSELECTOR_EVENT_COLOR_ITEM_SELECTED)) + +EWAPI extern const Efl_Event_Description _ELM_COLORSELECTOR_EVENT_COLOR_ITEM_LONGPRESSED; + +/** Called when color item got a long press + * @return Efl_Object * + * + * @ingroup Elm_Colorselector + */ +#define ELM_COLORSELECTOR_EVENT_COLOR_ITEM_LONGPRESSED (&(_ELM_COLORSELECTOR_EVENT_COLOR_ITEM_LONGPRESSED)) + +EWAPI extern const Efl_Event_Description _ELM_COLORSELECTOR_EVENT_CHANGED; + +/** Called when colorselector changed + * + * @ingroup Elm_Colorselector + */ +#define ELM_COLORSELECTOR_EVENT_CHANGED (&(_ELM_COLORSELECTOR_EVENT_CHANGED)) + +EWAPI extern const Efl_Event_Description _ELM_COLORSELECTOR_EVENT_CHANGED_USER; + +/** Called when the object changed due to user interaction + * + * @ingroup Elm_Colorselector + */ +#define ELM_COLORSELECTOR_EVENT_CHANGED_USER (&(_ELM_COLORSELECTOR_EVENT_CHANGED_USER)) + +#endif diff --git a/src/lib/elementary/elm_colorselector_eo.legacy.c b/src/lib/elementary/elm_colorselector_eo.legacy.c new file mode 100644 index 0000000000..c3d7225dee --- /dev/null +++ b/src/lib/elementary/elm_colorselector_eo.legacy.c @@ -0,0 +1,60 @@ + +EAPI void +elm_colorselector_color_set(Elm_Colorselector *obj, int r, int g, int b, int a) +{ + elm_obj_colorselector_picked_color_set(obj, r, g, b, a); +} + +EAPI void +elm_colorselector_color_get(const Elm_Colorselector *obj, int *r, int *g, int *b, int *a) +{ + elm_obj_colorselector_picked_color_get(obj, r, g, b, a); +} + +EAPI void +elm_colorselector_palette_name_set(Elm_Colorselector *obj, const char *palette_name) +{ + elm_obj_colorselector_palette_name_set(obj, palette_name); +} + +EAPI const char * +elm_colorselector_palette_name_get(const Elm_Colorselector *obj) +{ + return elm_obj_colorselector_palette_name_get(obj); +} + +EAPI void +elm_colorselector_mode_set(Elm_Colorselector *obj, Elm_Colorselector_Mode mode) +{ + elm_obj_colorselector_mode_set(obj, mode); +} + +EAPI Elm_Colorselector_Mode +elm_colorselector_mode_get(const Elm_Colorselector *obj) +{ + return elm_obj_colorselector_mode_get(obj); +} + +EAPI const Eina_List * +elm_colorselector_palette_items_get(const Elm_Colorselector *obj) +{ + return elm_obj_colorselector_palette_items_get(obj); +} + +EAPI Elm_Widget_Item * +elm_colorselector_palette_selected_item_get(const Elm_Colorselector *obj) +{ + return elm_obj_colorselector_palette_selected_item_get(obj); +} + +EAPI Elm_Widget_Item * +elm_colorselector_palette_color_add(Elm_Colorselector *obj, int r, int g, int b, int a) +{ + return elm_obj_colorselector_palette_color_add(obj, r, g, b, a); +} + +EAPI void +elm_colorselector_palette_clear(Elm_Colorselector *obj) +{ + elm_obj_colorselector_palette_clear(obj); +} diff --git a/src/lib/elementary/elm_colorselector_eo.legacy.h b/src/lib/elementary/elm_colorselector_eo.legacy.h new file mode 100644 index 0000000000..3b22f22e4a --- /dev/null +++ b/src/lib/elementary/elm_colorselector_eo.legacy.h @@ -0,0 +1,161 @@ +#ifndef _ELM_COLORSELECTOR_EO_LEGACY_H_ +#define _ELM_COLORSELECTOR_EO_LEGACY_H_ + +#ifndef _ELM_COLORSELECTOR_EO_CLASS_TYPE +#define _ELM_COLORSELECTOR_EO_CLASS_TYPE + +typedef Eo Elm_Colorselector; + +#endif + +#ifndef _ELM_COLORSELECTOR_EO_TYPES +#define _ELM_COLORSELECTOR_EO_TYPES + +/** + * @brief Different modes supported by Colorselector + * + * See also @ref elm_colorselector_mode_set, @ref elm_colorselector_mode_get. + * + * @ingroup Elm_Colorselector + */ +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; + + +#endif + +/** + * @brief Set color to colorselector. + * + * @param[in] obj The object. + * @param[in] r Red value of color + * @param[in] g Green value of color + * @param[in] b Blue value of color + * @param[in] a Alpha value of color + * + * @ingroup Elm_Colorselector_Group + */ +EAPI void elm_colorselector_color_set(Elm_Colorselector *obj, int r, int g, int b, int a); + +/** + * @brief Get current color from colorselector. + * + * @param[in] obj The object. + * @param[out] r Red value of color + * @param[out] g Green value of color + * @param[out] b Blue value of color + * @param[out] a Alpha value of color + * + * @ingroup Elm_Colorselector_Group + */ +EAPI void elm_colorselector_color_get(const Elm_Colorselector *obj, int *r, int *g, int *b, int *a); + +/** + * @brief Set current palette's name + * + * 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. + * + * @param[in] obj The object. + * @param[in] palette_name Name of palette + * + * @ingroup Elm_Colorselector_Group + */ +EAPI void elm_colorselector_palette_name_set(Elm_Colorselector *obj, const char *palette_name); + +/** + * @brief Get current palette's name + * + * Returns the currently set palette name using which colors will be + * saved/loaded in to config. + * + * @param[in] obj The object. + * + * @return Name of palette + * + * @ingroup Elm_Colorselector_Group + */ +EAPI const char *elm_colorselector_palette_name_get(const Elm_Colorselector *obj); + +/** + * @brief Set Colorselector's mode. + * + * Colorselector supports three modes palette only, selector only and both. + * + * @param[in] obj The object. + * @param[in] mode Elm_Colorselector_Mode + * + * @ingroup Elm_Colorselector_Group + */ +EAPI void elm_colorselector_mode_set(Elm_Colorselector *obj, Elm_Colorselector_Mode mode); + +/** + * @brief Get Colorselector's mode. + * + * @param[in] obj The object. + * + * @return Elm_Colorselector_Mode + * + * @ingroup Elm_Colorselector_Group + */ +EAPI Elm_Colorselector_Mode elm_colorselector_mode_get(const Elm_Colorselector *obj); + +/** + * @brief Get list of palette items. + * + * Note That palette item list is internally managed by colorselector widget + * and it should not be freed/modified by application. + * + * @param[in] obj The object. + * + * @return The list of color palette items. + * + * @since 1.9 + * + * @ingroup Elm_Colorselector_Group + */ +EAPI const Eina_List *elm_colorselector_palette_items_get(const Elm_Colorselector *obj); + +/** + * @brief Get the selected item in colorselector palette. + * + * @param[in] obj The object. + * + * @return The selected item, or @c null if none selected. + * + * @since 1.9 + * + * @ingroup Elm_Colorselector_Group + */ +EAPI Elm_Widget_Item *elm_colorselector_palette_selected_item_get(const Elm_Colorselector *obj); + +/** + * @brief Add a new color item to palette. + * + * @param[in] obj The object. + * @param[in] r Red value of color + * @param[in] g Green value of color + * @param[in] b Blue value of color + * @param[in] a Alpha value of color + * + * @return A new color palette Item. + * + * @ingroup Elm_Colorselector_Group + */ +EAPI Elm_Widget_Item *elm_colorselector_palette_color_add(Elm_Colorselector *obj, int r, int g, int b, int a); + +/** Clear the palette items. + * + * @ingroup Elm_Colorselector_Group + */ +EAPI void elm_colorselector_palette_clear(Elm_Colorselector *obj); + +#endif diff --git a/src/lib/elementary/elm_widget_colorselector.h b/src/lib/elementary/elm_widget_colorselector.h index d4f95f8d2e..6e7223aacd 100644 --- a/src/lib/elementary/elm_widget_colorselector.h +++ b/src/lib/elementary/elm_widget_colorselector.h @@ -2,7 +2,7 @@ #define ELM_WIDGET_COLORSELECTOR_H #include "Elementary.h" -#include "elm_color_item.eo.h" +#include "elm_color_item_eo.h" #include "elm_colorselector.eo.h" /* DO NOT USE THIS HEADER UNLESS YOU ARE PREPARED FOR BREAKING OF YOUR diff --git a/src/lib/elementary/meson.build b/src/lib/elementary/meson.build index bad033e4df..0b370d7d33 100644 --- a/src/lib/elementary/meson.build +++ b/src/lib/elementary/meson.build @@ -31,7 +31,6 @@ pub_legacy_eo_files = [ 'elm_sys_notify.eo', 'elm_sys_notify_dbus.eo', 'elm_systray.eo', - 'elm_color_item.eo', 'elm_dayselector_item.eo', 'elm_flipselector_item.eo', 'elm_menu_item.eo', @@ -731,6 +730,8 @@ elementary_pub_headers = [ 'elm_code_widget_eo.legacy.h', 'elm_code_widget_legacy_eo.h', 'elm_code_widget_legacy_eo.legacy.h', + 'elm_color_item_eo.h', + 'elm_color_item_eo.legacy.h', 'elm_hoversel_eo.h', 'elm_hoversel_eo.legacy.h', 'elm_hoversel_item_eo.h',