typedef struct _Colorpalette_Item Colorpalette_Item;
struct _Colorpalette_Item
{
- Evas_Object *parent;
- Evas_Object *lo;
- Evas_Object *cr;
- unsigned int r, g, b;
+ Evas_Object *parent;
+ Evas_Object *lo;
+ Evas_Object *cr;
+ unsigned int r, g, b;
};
typedef struct _Widget_Data Widget_Data;
struct _Widget_Data
{
- Evas_Object *parent;
- Evas_Object *lay;
- Evas_Object *tab;
+ Evas_Object *parent;
+ Evas_Object *lay;
+ Evas_Object *tab;
- Evas_Coord x, y, w, h;
- Evas_Coord tab_w, tab_h;
- Evas_Coord rect_w, rect_h;
+ Evas_Coord x, y, w, h;
+ Evas_Coord tab_w, tab_h;
+ Evas_Coord rect_w, rect_h;
- unsigned int row, col;
- Elm_Colorpalette_Color *color;
+ unsigned int row, col;
+ Elm_Colorpalette_Color *color;
- Eina_List *items;
+ Eina_List *items;
- unsigned int num;
+ unsigned int num;
};
static void _del_hook(Evas_Object *obj);
static void
_del_hook(Evas_Object *obj)
{
- Widget_Data *wd = elm_widget_data_get(obj);
+ Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
+ if (!wd) return;
- _color_table_delete(obj);
+ _color_table_delete(obj);
- if (wd->color){
- free(wd->color);
- }
+ if (wd->color){
+ free(wd->color);
+ }
- if (wd->lay){
- evas_object_smart_member_del(wd->lay);
- evas_object_del(wd->lay);
- wd->lay = NULL;
- }
- free(wd);
+ if (wd->lay){
+ evas_object_smart_member_del(wd->lay);
+ evas_object_del(wd->lay);
+ wd->lay = NULL;
+ }
+ free(wd);
}
static void
_theme_hook(Evas_Object *obj)
{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd)
- return;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd)
+ return;
- _elm_theme_object_set(obj, wd->lay, "colorpalette", "bg", elm_widget_style_get(obj));
- _color_table_update(obj, wd->row, wd->col, wd->num, wd->color);
- _sizing_eval(obj);
-
- // FIXME : add more codes
- //
+ _elm_theme_object_set(obj, wd->lay, "colorpalette", "bg", elm_widget_style_get(obj));
+ _color_table_update(obj, wd->row, wd->col, wd->num, wd->color);
+ _sizing_eval(obj);
}
static void
_sub_del(void *data, Evas_Object *obj, void *event_info)
{
- Widget_Data *wd = elm_widget_data_get(obj);
- //Evas_Object *sub = event_info;
- if (!wd)
- return;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd)
+ return;
}
static void
_sizing_eval(Evas_Object *obj)
{
- Widget_Data *wd = elm_widget_data_get(obj);
-
- if (!wd)
- return;
+ Widget_Data *wd = elm_widget_data_get(obj);
- DBG("[%s]\n", __func__);
+ if (!wd)
+ return;
- _colorpalette_object_move(obj, NULL, obj, NULL);
- _colorpalette_object_resize(obj, NULL, obj, NULL);
+ _colorpalette_object_move(obj, NULL, obj, NULL);
+ _colorpalette_object_resize(obj, NULL, obj, NULL);
}
static void _colorpalette_object_move(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
- DBG("%s", __func__);
+ DBG("%s", __func__);
- Widget_Data *wd;
- Evas_Coord x, y;
+ Widget_Data *wd;
+ Evas_Coord x, y;
- if(!data)
- return;
+ if(!data)
+ return;
- wd = elm_widget_data_get((Evas_Object *)data);
+ wd = elm_widget_data_get((Evas_Object *)data);
- if(!wd)
- return;
+ if(!wd)
+ return;
- evas_object_geometry_get(wd->lay, &x, &y, NULL, NULL);
+ evas_object_geometry_get(wd->lay, &x, &y, NULL, NULL);
- wd->x = x;
- wd->y = y;
+ wd->x = x;
+ wd->y = y;
- evas_object_move(wd->lay, x, y);
+ evas_object_move(wd->lay, x, y);
}
static void _colorpalette_object_resize(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
- DBG("%s", __func__);
-
- Widget_Data *wd;
- Colorpalette_Item *item = NULL;
- Evas_Coord w, h;
- Evas_Coord tab_w, tab_h;
- double pad_x, pad_y;
+ Widget_Data *wd;
+ Colorpalette_Item *item = NULL;
+ Evas_Coord w, h;
+ Evas_Coord tab_w, tab_h;
+ double pad_x, pad_y;
- if(!data)
- return;
+ if(!data)
+ return;
- wd = elm_widget_data_get((Evas_Object *)data);
+ wd = elm_widget_data_get((Evas_Object *)data);
- if(!wd)
- return;
+ if(!wd)
+ return;
- evas_object_geometry_get(wd->lay, NULL, NULL, &w, &h);
- wd->w = w;
- wd->h = h;
+ evas_object_geometry_get(wd->lay, NULL, NULL, &w, &h);
+ wd->w = w;
+ wd->h = h;
- evas_object_geometry_get(wd->tab, NULL, NULL, &tab_w, &tab_h);
- if (tab_w > 0 && tab_h > 0) {
- wd->tab_w = tab_w;
- wd->tab_h = tab_h;
- }
+ evas_object_geometry_get(wd->tab, NULL, NULL, &tab_w, &tab_h);
+ if (tab_w > 0 && tab_h > 0) {
+ wd->tab_w = tab_w;
+ wd->tab_h = tab_h;
+ }
- if (wd->items)
- item = wd->items->data;
+ if (wd->items)
+ item = wd->items->data;
- edje_object_part_geometry_get(elm_layout_edje_get(item->lo),"bg" ,NULL, NULL, &wd->rect_w, &wd->rect_h);
+ edje_object_part_geometry_get(elm_layout_edje_get(item->lo),"bg" ,NULL, NULL, &wd->rect_w, &wd->rect_h);
- pad_x = ((double)wd->tab_w - (double)wd->rect_w * (double)wd->col) / (double)(wd->col - 1);
- pad_y = ((double)wd->tab_h - (double)wd->rect_h * (double)wd->row) / (double)(wd->row - 1);
+ pad_x = ((double)wd->tab_w - (double)wd->rect_w * (double)wd->col) / (double)(wd->col - 1);
+ pad_y = ((double)wd->tab_h - (double)wd->rect_h * (double)wd->row) / (double)(wd->row - 1);
- if (pad_x < 0.0 )
- pad_x = 0;
- if (pad_y < 0.0 )
- pad_y = 0;
+ if (pad_x < 0.0 )
+ pad_x = 0;
+ if (pad_y < 0.0 )
+ pad_y = 0;
- elm_table_padding_set(wd->tab, (int)pad_x , (int)pad_y);
+ elm_table_padding_set(wd->tab, (int)pad_x , (int)pad_y);
- if(!wd->lay)
- return;
+ if(!wd->lay)
+ return;
- evas_object_resize(wd->lay, w, h);
+ evas_object_resize(wd->lay, w, h);
}
static void _colorpalette_object_show(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
- DBG("%s", __func__);
+ DBG("%s", __func__);
- Widget_Data *wd = NULL;
+ Widget_Data *wd = NULL;
- if(data == NULL)
- return;
+ if(data == NULL)
+ return;
- wd = elm_widget_data_get((Evas_Object *)data);
+ wd = elm_widget_data_get((Evas_Object *)data);
- if(wd == NULL)
- return;
+ if(wd == NULL)
+ return;
- if (wd->lay) {
- evas_object_show(wd->lay);
- }
+ if (wd->lay) {
+ evas_object_show(wd->lay);
+ }
}
static void _colorpalette_object_hide(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
- DBG("%s", __func__);
+ DBG("%s", __func__);
- Widget_Data *wd = NULL;
+ Widget_Data *wd = NULL;
- if(data == NULL)
- return;
+ if(data == NULL)
+ return;
- wd = elm_widget_data_get((Evas_Object *)data);
+ wd = elm_widget_data_get((Evas_Object *)data);
- if(wd == NULL)
- return;
+ if(wd == NULL)
+ return;
- if (wd->lay) {
- evas_object_hide(wd->lay);
- }
+ if (wd->lay) {
+ evas_object_hide(wd->lay);
+ }
}
static void _color_select_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
- Colorpalette_Item *item = (Colorpalette_Item *) data;
- Elm_Colorpalette_Color *color;
+ Colorpalette_Item *item = (Colorpalette_Item *) data;
+ Elm_Colorpalette_Color *color;
- color = ELM_NEW(Elm_Colorpalette_Color);
+ color = ELM_NEW(Elm_Colorpalette_Color);
- color->r = item->r;
- color->g = item->g;
- color->b = item->b;
+ color->r = item->r;
+ color->g = item->g;
+ color->b = item->b;
- evas_object_smart_callback_call(item->parent, "clicked", color);
+ evas_object_smart_callback_call(item->parent, "clicked", color);
- edje_object_signal_emit(elm_layout_edje_get(item->lo), "focus_visible", "elm");
+ edje_object_signal_emit(elm_layout_edje_get(item->lo), "focus_visible", "elm");
}
static void _color_release_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
- Colorpalette_Item *item = (Colorpalette_Item *) data;
- edje_object_signal_emit(elm_layout_edje_get(item->lo), "focus_invisible", "elm");
+ Colorpalette_Item *item = (Colorpalette_Item *) data;
+ edje_object_signal_emit(elm_layout_edje_get(item->lo), "focus_invisible", "elm");
}
static void _color_table_delete(Evas_Object *obj)
{
- Widget_Data *wd = NULL;
- Colorpalette_Item *item;
- wd = elm_widget_data_get(obj);
-
- if (!wd) return;
-
- if (wd->items) {
- EINA_LIST_FREE(wd->items, item) {
- if (item->lo){
- evas_object_del(item->lo);
- item->lo = NULL;
- }
- if (item->cr){
- evas_object_del(item->cr);
- item->cr = NULL;
- }
- free(item);
- }
- }
-
- if (wd->tab) {
- edje_object_part_unswallow(wd->lay, wd->tab);
- evas_object_del(wd->tab);
- }
+ Widget_Data *wd = NULL;
+ Colorpalette_Item *item;
+ wd = elm_widget_data_get(obj);
+
+ if (!wd) return;
+
+ if (wd->items) {
+ EINA_LIST_FREE(wd->items, item) {
+ if (item->lo){
+ evas_object_del(item->lo);
+ item->lo = NULL;
+ }
+ if (item->cr){
+ evas_object_del(item->cr);
+ item->cr = NULL;
+ }
+ free(item);
+ }
+ }
+
+ if (wd->tab) {
+ edje_object_part_unswallow(wd->lay, wd->tab);
+ evas_object_del(wd->tab);
+ }
}
static void _color_table_update(Evas_Object *obj, int row, int col, int color_num, Elm_Colorpalette_Color *color)
{
- Widget_Data *wd = elm_widget_data_get(obj);
- Colorpalette_Item *item;
- Evas_Object *lo;
- Evas_Object *cr;
- Evas *e;
- int i, j, count;
-
- count = 0;
-
- if ( !wd )
- return;
-
- e = evas_object_evas_get(wd->parent);
-
- _color_table_delete(obj);
-
- wd->row = row;
- wd->col = col;
- wd->num = color_num;
-
- wd->tab = elm_table_add(obj);
-
- evas_object_size_hint_weight_set(wd->tab, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(wd->tab, EVAS_HINT_FILL, EVAS_HINT_FILL);
-
- edje_object_part_swallow(wd->lay, "palette", wd->tab);
- evas_object_show(wd->tab);
-
- for ( i = 0 ; i < row ; i++) {
- for ( j = 0 ; j < col ; j++ ) {
- item = ELM_NEW(Colorpalette_Item);
- if (item){
- lo = elm_layout_add(obj);
- elm_layout_theme_set(lo, "colorpalette", "base", "bg");
- evas_object_size_hint_weight_set(lo, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(lo, EVAS_HINT_FILL, EVAS_HINT_FILL);
- evas_object_show(lo);
- elm_table_pack(wd->tab, lo, j, i, 1, 1);
-
- item->parent = obj;
- item->lo = lo;
-
- if (count < color_num){
- cr = edje_object_add(e);
- _elm_theme_object_set(obj, cr, "colorpalette", "base", "color");
- evas_object_color_set(cr, color[count].r, color[count].g, color[count].b, 255);
- evas_object_size_hint_weight_set(cr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(cr, EVAS_HINT_FILL, EVAS_HINT_FILL);
-
- evas_object_event_callback_add(cr, EVAS_CALLBACK_MOUSE_DOWN, _color_select_cb, item);
- evas_object_event_callback_add(cr, EVAS_CALLBACK_MOUSE_UP, _color_release_cb, item);
-
- evas_object_show(cr);
- edje_object_part_swallow(elm_layout_edje_get(lo), "color_rect", cr);
-
- item->cr = cr;
- item->r = color[count].r;
- item->g = color[count].g;
- item->b = color[count].b;
- }
- wd->items = eina_list_append(wd->items, item);
- count ++;
- }
- }
- }
+ Widget_Data *wd = elm_widget_data_get(obj);
+ Colorpalette_Item *item;
+ Evas_Object *lo;
+ Evas_Object *cr;
+ Evas *e;
+ int i, j, count;
+
+ if ( !wd )
+ return;
+
+ count = 0;
+
+ e = evas_object_evas_get(wd->parent);
+
+ _color_table_delete(obj);
+
+ wd->row = row;
+ wd->col = col;
+ wd->num = color_num;
+
+ wd->tab = elm_table_add(obj);
+
+ evas_object_size_hint_weight_set(wd->tab, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(wd->tab, EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+ edje_object_part_swallow(wd->lay, "palette", wd->tab);
+ evas_object_show(wd->tab);
+
+ for ( i = 0 ; i < row ; i++) {
+ for ( j = 0 ; j < col ; j++ ) {
+ item = ELM_NEW(Colorpalette_Item);
+ if (item){
+ lo = elm_layout_add(obj);
+ elm_layout_theme_set(lo, "colorpalette", "base", "bg");
+ evas_object_size_hint_weight_set(lo, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(lo, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(lo);
+ elm_table_pack(wd->tab, lo, j, i, 1, 1);
+
+ item->parent = obj;
+ item->lo = lo;
+
+ if (count < color_num){
+ cr = edje_object_add(e);
+ _elm_theme_object_set(obj, cr, "colorpalette", "base", "color");
+ evas_object_color_set(cr, color[count].r, color[count].g, color[count].b, 255);
+ evas_object_size_hint_weight_set(cr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(cr, EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+ evas_object_event_callback_add(cr, EVAS_CALLBACK_MOUSE_DOWN, _color_select_cb, item);
+ evas_object_event_callback_add(cr, EVAS_CALLBACK_MOUSE_UP, _color_release_cb, item);
+
+ evas_object_show(cr);
+ edje_object_part_swallow(elm_layout_edje_get(lo), "color_rect", cr);
+
+ item->cr = cr;
+ item->r = color[count].r;
+ item->g = color[count].g;
+ item->b = color[count].b;
+ }
+ wd->items = eina_list_append(wd->items, item);
+ count ++;
+ }
+ }
+ }
}
*/
EAPI Evas_Object *elm_colorpalette_add(Evas_Object *parent)
{
- Evas_Object *obj = NULL;
- Widget_Data *wd = NULL;
- Evas *e;
-
- e = evas_object_evas_get(parent);
- if (e == NULL) return NULL;
- wd = ELM_NEW(Widget_Data);
- obj = elm_widget_add(e);
- elm_widget_type_set(obj, "colorpalette");
- elm_widget_sub_object_add(parent, obj);
- elm_widget_data_set(obj, wd);
- elm_widget_del_hook_set(obj, _del_hook);
- elm_widget_theme_hook_set(obj, _theme_hook);
-
- wd->parent = parent;
- /* load background edj */
- wd->lay = edje_object_add(e);
- _elm_theme_object_set(obj, wd->lay, "colorpalette", "bg", "default");
-
- evas_object_size_hint_weight_set(wd->lay, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- if(wd->lay == NULL) {
- printf("Cannot load bg edj\n");
- return NULL;
- }
-
- wd->color = (Elm_Colorpalette_Color*) calloc (10, sizeof(Elm_Colorpalette_Color));
-
- wd->color[0].r = 55; wd->color[0].g = 90; wd->color[0].b = 18;
- wd->color[1].r = 255; wd->color[1].g = 213; wd->color[1].b = 0;
- wd->color[2].r = 146; wd->color[2].g = 255; wd->color[2].b = 11;
- wd->color[3].r = 9; wd->color[3].g = 186; wd->color[3].b = 10;
- wd->color[4].r = 86; wd->color[4].g = 201; wd->color[4].b = 242;
- wd->color[5].r = 18; wd->color[5].g = 83; wd->color[5].b = 128;
- wd->color[6].r = 140; wd->color[6].g = 53; wd->color[6].b = 238;
- wd->color[7].r = 255; wd->color[7].g = 145; wd->color[7].b = 145;
- wd->color[8].r = 255; wd->color[8].g = 59; wd->color[8].b = 119;
- wd->color[9].r = 133; wd->color[9].g = 100; wd->color[9].b = 69;
-
- _color_table_update(obj, 2, 5, 10, wd->color);
-
- elm_widget_resize_object_set(obj, wd->lay);
-// evas_object_smart_member_add(wd->lay, obj);
- evas_object_event_callback_add(wd->lay, EVAS_CALLBACK_RESIZE, _colorpalette_object_resize, obj);
- evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE, _colorpalette_object_move, obj);
- evas_object_event_callback_add(obj, EVAS_CALLBACK_SHOW, _colorpalette_object_show, obj);
- evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE, _colorpalette_object_hide, obj);
-
- // FIXME
- // evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj);
- // _sizing_eval(obj);
-
- return obj;
+ Evas_Object *obj = NULL;
+ Widget_Data *wd = NULL;
+ Evas *e;
+
+ e = evas_object_evas_get(parent);
+ if (e == NULL) return NULL;
+ wd = ELM_NEW(Widget_Data);
+ obj = elm_widget_add(e);
+ elm_widget_type_set(obj, "colorpalette");
+ elm_widget_sub_object_add(parent, obj);
+ elm_widget_data_set(obj, wd);
+ elm_widget_del_hook_set(obj, _del_hook);
+ elm_widget_theme_hook_set(obj, _theme_hook);
+
+ wd->parent = parent;
+ wd->lay = edje_object_add(e);
+ _elm_theme_object_set(obj, wd->lay, "colorpalette", "bg", "default");
+
+ evas_object_size_hint_weight_set(wd->lay, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ if(wd->lay == NULL) {
+ printf("Cannot load bg edj\n");
+ return NULL;
+ }
+
+ wd->color = (Elm_Colorpalette_Color*) calloc (10, sizeof(Elm_Colorpalette_Color));
+
+ wd->color[0].r = 55; wd->color[0].g = 90; wd->color[0].b = 18;
+ wd->color[1].r = 255; wd->color[1].g = 213; wd->color[1].b = 0;
+ wd->color[2].r = 146; wd->color[2].g = 255; wd->color[2].b = 11;
+ wd->color[3].r = 9; wd->color[3].g = 186; wd->color[3].b = 10;
+ wd->color[4].r = 86; wd->color[4].g = 201; wd->color[4].b = 242;
+ wd->color[5].r = 18; wd->color[5].g = 83; wd->color[5].b = 128;
+ wd->color[6].r = 140; wd->color[6].g = 53; wd->color[6].b = 238;
+ wd->color[7].r = 255; wd->color[7].g = 145; wd->color[7].b = 145;
+ wd->color[8].r = 255; wd->color[8].g = 59; wd->color[8].b = 119;
+ wd->color[9].r = 133; wd->color[9].g = 100; wd->color[9].b = 69;
+
+ _color_table_update(obj, 2, 5, 10, wd->color);
+
+ elm_widget_resize_object_set(obj, wd->lay);
+ evas_object_event_callback_add(wd->lay, EVAS_CALLBACK_RESIZE, _colorpalette_object_resize, obj);
+ evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE, _colorpalette_object_move, obj);
+ evas_object_event_callback_add(obj, EVAS_CALLBACK_SHOW, _colorpalette_object_show, obj);
+ evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE, _colorpalette_object_hide, obj);
+
+ return obj;
}
*/
EAPI void elm_colorpalette_color_set(Evas_Object *obj, int color_num, Elm_Colorpalette_Color *color)
{
- Widget_Data *wd = elm_widget_data_get(obj);
- int i;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ int i;
- if (color_num > MAX_NUM_COLORS) return;
+ if (color_num > MAX_NUM_COLORS) return;
- if (!wd) return;
+ if (!wd) return;
- if (wd->color) {
- free(wd->color);
- wd->color = NULL;
- }
+ if (wd->color) {
+ free(wd->color);
+ wd->color = NULL;
+ }
- wd->color = (Elm_Colorpalette_Color*) calloc (color_num, sizeof(Elm_Colorpalette_Color));
+ wd->color = (Elm_Colorpalette_Color*) calloc (color_num, sizeof(Elm_Colorpalette_Color));
- for ( i = 0 ; i < color_num ; i++) {
- wd->color[i].r = color[i].r;
- wd->color[i].g = color[i].g;
- wd->color[i].b = color[i].b;
- }
+ for ( i = 0 ; i < color_num ; i++) {
+ wd->color[i].r = color[i].r;
+ wd->color[i].g = color[i].g;
+ wd->color[i].b = color[i].b;
+ }
- _color_table_update(obj, wd->row, wd->col, color_num, wd->color);
- _sizing_eval(obj);
+ _color_table_update(obj, wd->row, wd->col, color_num, wd->color);
+ _sizing_eval(obj);
}
/**
*/
EAPI void elm_colorpalette_row_column_set(Evas_Object *obj, int row, int col)
{
- Widget_Data *wd = elm_widget_data_get(obj);
+ Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return ;
+ if (!wd) return ;
- _color_table_update(obj, row, col, wd->num, wd->color);
- _sizing_eval(obj);
+ _color_table_update(obj, row, col, wd->num, wd->color);
+ _sizing_eval(obj);
}
+/* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/
static void _theme_hook(Evas_Object * obj);
static void _sizing_eval(Evas_Object * obj);
static void _colorpicker_object_move(void *data, Evas * e, Evas_Object * obj,
- void *event_info);
+ void *event_info);
static void _colorpicker_object_resize(void *data, Evas * e, Evas_Object * obj,
- void *event_info);
+ void *event_info);
static void _colorpicker_object_show(void *data, Evas * e, Evas_Object * obj,
- void *event_info);
+ void *event_info);
static void _colorpicker_object_hide(void *data, Evas * e, Evas_Object * obj,
- void *event_info);
+ void *event_info);
static void _rgb_to_hsl(void *data);
static void _hsl_to_rgb(void *data);
static void _color_with_saturation(void *data);
static void _color_with_lightness(void *data);
static void _draw_rects(void *data, double x);
static void _arrow_cb(void *data, Evas_Object * obj, const char *emission,
- const char *source);
+ const char *source);
static void _drag_start(void *data, Evas_Object *obj, const char *emission,
- const char *source);
+ const char *source);
static void _drag_stop(void *data, Evas_Object *obj, const char *emission,
- const char *source);
+ const char *source);
static void _colorbar_cb(void *data, Evas * e, Evas_Object * obj,
- void *event_info);
+ void *event_info);
static void _arrow_resize_cb(void *data, Evas * e, Evas_Object * obj,
- void *event_info);
+ void *event_info);
static Eina_Bool _mv_timer(void *data);
static Eina_Bool _long_press_timer(void *data);
static void _left_button_down_cb(void *data, Evas * e, Evas_Object * obj,
- void *event_info);
+ void *event_info);
static void _right_button_down_cb(void *data, Evas * e, Evas_Object * obj,
- void *event_info);
+ void *event_info);
static void _left_button_up_cb(void *data, Evas * e, Evas_Object * obj,
- void *event_info);
+ void *event_info);
static void _right_button_up_cb(void *data, Evas * e, Evas_Object * obj,
- void *event_info);
+ void *event_info);
static void _add_colorbar(Evas_Object * obj);
static void _set_color(Evas_Object * obj, int r, int g, int b);
for (i = 0; i < 3; i++)
{
- evas_object_del(wd->cp[i]->colorbar);
- wd->cp[i]->colorbar = NULL;
- evas_object_del(wd->cp[i]->bar);
- wd->cp[i]->bar = NULL;
- evas_object_del(wd->cp[i]->lbt);
- wd->cp[i]->lbt = NULL;
- evas_object_del(wd->cp[i]->rbt);
- wd->cp[i]->rbt = NULL;
- if (i == 1 || i == 2)
- {
- evas_object_del(wd->cp[i]->bg_rect);
- wd->cp[i]->bg_rect = NULL;
- }
- evas_object_del(wd->cp[i]->arrow);
- wd->cp[i]->arrow = NULL;
- evas_object_del(wd->cp[i]->touch_area);
- wd->cp[i]->touch_area = NULL;
+ evas_object_del(wd->cp[i]->colorbar);
+ wd->cp[i]->colorbar = NULL;
+ evas_object_del(wd->cp[i]->bar);
+ wd->cp[i]->bar = NULL;
+ evas_object_del(wd->cp[i]->lbt);
+ wd->cp[i]->lbt = NULL;
+ evas_object_del(wd->cp[i]->rbt);
+ wd->cp[i]->rbt = NULL;
+ if (i == 1 || i == 2)
+ {
+ evas_object_del(wd->cp[i]->bg_rect);
+ wd->cp[i]->bg_rect = NULL;
+ }
+ evas_object_del(wd->cp[i]->arrow);
+ wd->cp[i]->arrow = NULL;
+ evas_object_del(wd->cp[i]->touch_area);
+ wd->cp[i]->touch_area = NULL;
}
_add_colorbar(obj);
static void
_colorpicker_object_move(void *data, Evas * e, Evas_Object * obj,
- void *event_info)
+ void *event_info)
{
Widget_Data *wd;
Evas_Coord x, y;
static void
_colorpicker_object_resize(void *data, Evas * e, Evas_Object * obj,
- void *event_info)
+ void *event_info)
{
Widget_Data *wd;
Evas_Coord w, h;
for (i = 0; i < 3; i++)
{
- evas_object_geometry_get(wd->cp[i]->touch_area, NULL, NULL, NULL,
- &arrow_h);
- evas_object_geometry_get(wd->cp[0]->arrow, NULL, NULL, &arrow_w, NULL);
+ evas_object_geometry_get(wd->cp[i]->touch_area, NULL, NULL, NULL,
+ &arrow_h);
+ evas_object_geometry_get(wd->cp[0]->arrow, NULL, NULL, &arrow_w, NULL);
- evas_object_size_hint_min_set(wd->cp[i]->arrow, arrow_w, arrow_h);
- evas_object_size_hint_max_set(wd->cp[i]->arrow, arrow_w, arrow_h);
+ evas_object_size_hint_min_set(wd->cp[i]->arrow, arrow_w, arrow_h);
+ evas_object_size_hint_max_set(wd->cp[i]->arrow, arrow_w, arrow_h);
}
evas_object_resize(obj, w, h);
static void
_colorpicker_object_show(void *data, Evas * e, Evas_Object * obj,
- void *event_info)
+ void *event_info)
{
Widget_Data *wd = NULL;
static void
_colorpicker_object_hide(void *data, Evas * e, Evas_Object * obj,
- void *event_info)
+ void *event_info)
{
Widget_Data *wd = NULL;
_l = wd->l;
if (_s == 0.0)
- r = g = b = _l;
+ r = g = b = _l;
else
{
- if (_h == 360.0)
- _h = 0.0;
- _h /= 60.0;
-
- v = (_l <= 0.5) ? (_l * (1.0 + _s)) : (_l + _s - (_l * _s));
- p = _l + _l - v;
-
- if (v != 0)
- sv = (v - p) / v;
- else
- sv = 0;
-
- i = (int)_h;
- f = _h - i;
-
- vsf = v * sv * f;
-
- t = p + vsf;
- q = v - vsf;
-
- switch (i)
- {
- case 0:
- r = v;
- g = t;
- b = p;
- break;
- case 1:
- r = q;
- g = v;
- b = p;
- break;
- case 2:
- r = p;
- g = v;
- b = t;
- break;
- case 3:
- r = p;
- g = q;
- b = v;
- break;
- case 4:
- r = t;
- g = p;
- b = v;
- break;
- case 5:
- r = v;
- g = p;
- b = q;
- break;
- }
+ if (_h == 360.0)
+ _h = 0.0;
+ _h /= 60.0;
+
+ v = (_l <= 0.5) ? (_l * (1.0 + _s)) : (_l + _s - (_l * _s));
+ p = _l + _l - v;
+
+ if (v != 0)
+ sv = (v - p) / v;
+ else
+ sv = 0;
+
+ i = (int)_h;
+ f = _h - i;
+
+ vsf = v * sv * f;
+
+ t = p + vsf;
+ q = v - vsf;
+
+ switch (i)
+ {
+ case 0:
+ r = v;
+ g = t;
+ b = p;
+ break;
+ case 1:
+ r = q;
+ g = v;
+ b = p;
+ break;
+ case 2:
+ r = p;
+ g = v;
+ b = t;
+ break;
+ case 3:
+ r = p;
+ g = q;
+ b = v;
+ break;
+ case 4:
+ r = t;
+ g = p;
+ b = v;
+ break;
+ case 5:
+ r = v;
+ g = p;
+ b = q;
+ break;
+ }
}
i = (int)(r * 255.0);
f = (r * 255.0) - i;
if (wd->l > 0.5)
{
- wd->lr =
- wd->er +
- (int)((double)(255 - wd->er) * (double)(wd->l - 0.5) * (double)2);
- wd->lg =
- wd->eg +
- (int)((double)(255 - wd->eg) * (double)(wd->l - 0.5) * (double)2);
- wd->lb =
- wd->eb +
- (int)((double)(255 - wd->eb) * (double)(wd->l - 0.5) * (double)2);
+ wd->lr =
+ wd->er +
+ (int)((double)(255 - wd->er) * (double)(wd->l - 0.5) * (double)2);
+ wd->lg =
+ wd->eg +
+ (int)((double)(255 - wd->eg) * (double)(wd->l - 0.5) * (double)2);
+ wd->lb =
+ wd->eb +
+ (int)((double)(255 - wd->eb) * (double)(wd->l - 0.5) * (double)2);
}
else if (wd->l < 0.5)
{
- wd->lr = (int)((double)wd->er * (double)wd->l * (double)2);
- wd->lg = (int)((double)wd->eg * (double)wd->l * (double)2);
- wd->lb = (int)((double)wd->eb * (double)wd->l * (double)2);
+ wd->lr = (int)((double)wd->er * (double)wd->l * (double)2);
+ wd->lg = (int)((double)wd->eg * (double)wd->l * (double)2);
+ wd->lb = (int)((double)wd->eb * (double)wd->l * (double)2);
}
else
{
- wd->lr = wd->er;
- wd->lg = wd->eg;
- wd->lb = wd->eb;
+ wd->lr = wd->er;
+ wd->lg = wd->eg;
+ wd->lb = wd->eb;
}
}
switch (cp->colorpicker_num)
{
- case 0:
- wd->h = 360.0 * x;
-
- if (x < one_six)
- {
- wd->er = 255;
- wd->eg = (int)((double)255 * x * (double)6);
- wd->eb = 0;
- }
- else if (x < (double)2 * one_six)
- {
- wd->er = 255 - (int)((double)255 * (x - one_six) * (double)6);
- wd->eg = 255;
- wd->eb = 0;
- }
- else if (x < (double)3 * one_six)
- {
- wd->er = 0;
- wd->eg = 255;
- wd->eb =
- (int)((double)255 * (x - (double)2 * one_six) * (double)6);
- }
- else if (x < (double)4 * one_six)
- {
- wd->er = 0;
- wd->eg =
- 255 -
- (int)((double)255 * (x - (double)3 * one_six) * (double)6);
- wd->eb = 255;
- }
- else if (x < (double)5 * one_six)
- {
- wd->er =
- (int)((double)255 * (x - (double)4 * one_six) * (double)6);
- wd->eg = 0;
- wd->eb = 255;
- }
- else
- {
- wd->er = 255;
- wd->eg = 0;
- wd->eb =
- 255 -
- (int)((double)255 * (x - (double)5 * one_six) * (double)6);
- }
-
- evas_object_color_set(wd->cp[0]->arrow, wd->er, wd->eg, wd->eb, 255);
- evas_object_color_set(wd->cp[1]->bg_rect, wd->er, wd->eg, wd->eb, 255);
- evas_object_color_set(wd->cp[2]->bg_rect, wd->er, wd->eg, wd->eb, 255);
-
- _color_with_saturation(wd);
- evas_object_color_set(wd->cp[1]->arrow, wd->sr, wd->sg, wd->sb, 255);
-
- _color_with_lightness(wd);
- evas_object_color_set(wd->cp[2]->arrow, wd->lr, wd->lg, wd->lb, 255);
- break;
-
- case 1:
- wd->s = (double)1 - x;
- _color_with_saturation(wd);
- evas_object_color_set(wd->cp[1]->arrow, wd->sr, wd->sg, wd->sb, 255);
- break;
-
- case 2:
- wd->l = x;
- _color_with_lightness(wd);
- evas_object_color_set(wd->cp[2]->arrow, wd->lr, wd->lg, wd->lb, 255);
- break;
-
- default:
- break;
+ case 0:
+ wd->h = 360.0 * x;
+
+ if (x < one_six)
+ {
+ wd->er = 255;
+ wd->eg = (int)((double)255 * x * (double)6);
+ wd->eb = 0;
+ }
+ else if (x < (double)2 * one_six)
+ {
+ wd->er = 255 - (int)((double)255 * (x - one_six) * (double)6);
+ wd->eg = 255;
+ wd->eb = 0;
+ }
+ else if (x < (double)3 * one_six)
+ {
+ wd->er = 0;
+ wd->eg = 255;
+ wd->eb =
+ (int)((double)255 * (x - (double)2 * one_six) * (double)6);
+ }
+ else if (x < (double)4 * one_six)
+ {
+ wd->er = 0;
+ wd->eg =
+ 255 -
+ (int)((double)255 * (x - (double)3 * one_six) * (double)6);
+ wd->eb = 255;
+ }
+ else if (x < (double)5 * one_six)
+ {
+ wd->er =
+ (int)((double)255 * (x - (double)4 * one_six) * (double)6);
+ wd->eg = 0;
+ wd->eb = 255;
+ }
+ else
+ {
+ wd->er = 255;
+ wd->eg = 0;
+ wd->eb =
+ 255 -
+ (int)((double)255 * (x - (double)5 * one_six) * (double)6);
+ }
+
+ evas_object_color_set(wd->cp[0]->arrow, wd->er, wd->eg, wd->eb, 255);
+ evas_object_color_set(wd->cp[1]->bg_rect, wd->er, wd->eg, wd->eb, 255);
+ evas_object_color_set(wd->cp[2]->bg_rect, wd->er, wd->eg, wd->eb, 255);
+
+ _color_with_saturation(wd);
+ evas_object_color_set(wd->cp[1]->arrow, wd->sr, wd->sg, wd->sb, 255);
+
+ _color_with_lightness(wd);
+ evas_object_color_set(wd->cp[2]->arrow, wd->lr, wd->lg, wd->lb, 255);
+ break;
+
+ case 1:
+ wd->s = (double)1 - x;
+ _color_with_saturation(wd);
+ evas_object_color_set(wd->cp[1]->arrow, wd->sr, wd->sg, wd->sb, 255);
+ break;
+
+ case 2:
+ wd->l = x;
+ _color_with_lightness(wd);
+ evas_object_color_set(wd->cp[2]->arrow, wd->lr, wd->lg, wd->lb, 255);
+ break;
+
+ default:
+ break;
}
static void
_arrow_cb(void *data, Evas_Object * obj, const char *emission,
- const char *source)
+ const char *source)
{
Colorpicker_Data *cp = (Colorpicker_Data *) data;
double x, y;
{
elm_widget_scroll_hold_pop(data);
}
-
+
static void
_colorbar_cb(void *data, Evas * e, Evas_Object * obj, void *event_info)
{
evas_event_feed_mouse_cancel(e, 0, NULL);
cp->feed_cnt ++;
if(cp->feed_cnt < 3)
- evas_event_feed_mouse_down(e, 1, EVAS_BUTTON_NONE, 0, NULL);
+ evas_event_feed_mouse_down(e, 1, EVAS_BUTTON_NONE, 0, NULL);
cp->feed_cnt = 0;
}
edje_object_part_drag_value_get(cp->colorbar, "arrow", &x, &y);
if (cp->button_state == L_BUTTON_PRESSED)
{
- x -= (double)1 / (double)BASE_STEP;
- if (x < 0)
- x = 0;
- edje_object_part_drag_value_set(cp->colorbar, "arrow", x, y);
- _draw_rects(data, x);
- evas_object_smart_callback_call(cp->parent, "changed", NULL);
- return 1;
+ x -= (double)1 / (double)BASE_STEP;
+ if (x < 0)
+ x = 0;
+ edje_object_part_drag_value_set(cp->colorbar, "arrow", x, y);
+ _draw_rects(data, x);
+ evas_object_smart_callback_call(cp->parent, "changed", NULL);
+ return 1;
}
else if (cp->button_state == R_BUTTON_PRESSED)
{
- x += (double)1 / (double)BASE_STEP;
- if (x > 1)
- x = 1;
- edje_object_part_drag_value_set(cp->colorbar, "arrow", x, y);
- _draw_rects(data, x);
- evas_object_smart_callback_call(cp->parent, "changed", NULL);
- return 1;
+ x += (double)1 / (double)BASE_STEP;
+ if (x > 1)
+ x = 1;
+ edje_object_part_drag_value_set(cp->colorbar, "arrow", x, y);
+ _draw_rects(data, x);
+ evas_object_smart_callback_call(cp->parent, "changed", NULL);
+ return 1;
}
else
{
- if (wd->mv_timer)
- {
- ecore_timer_del(wd->mv_timer);
- wd->mv_timer = NULL;
- }
- return EINA_FALSE;
+ if (wd->mv_timer)
+ {
+ ecore_timer_del(wd->mv_timer);
+ wd->mv_timer = NULL;
+ }
+ return EINA_FALSE;
}
}
if (wd->lp_timer)
{
- ecore_timer_del(wd->lp_timer);
- wd->lp_timer = NULL;
+ ecore_timer_del(wd->lp_timer);
+ wd->lp_timer = NULL;
}
wd->mv_timer = ecore_timer_add(0.01, _mv_timer, cp);
double x, y;
edje_object_signal_emit(cp->lbt, "elm,state,left,button,down",
- "left_button");
+ "left_button");
edje_object_part_drag_value_get(cp->colorbar, "arrow", &x, &y);
if (cp->colorpicker_num == 0)
double x, y;
edje_object_signal_emit(cp->rbt, "elm,state,right,button,down",
- "right_button");
+ "right_button");
edje_object_part_drag_value_get(cp->colorbar, "arrow", &x, &y);
if (cp->colorpicker_num == 0)
if (wd->lp_timer)
{
- ecore_timer_del(wd->lp_timer);
- wd->lp_timer = NULL;
+ ecore_timer_del(wd->lp_timer);
+ wd->lp_timer = NULL;
}
if (wd->mv_timer)
{
- ecore_timer_del(wd->mv_timer);
- wd->mv_timer = NULL;
+ ecore_timer_del(wd->mv_timer);
+ wd->mv_timer = NULL;
}
cp->button_state = BUTTON_RELEASED;
if (wd->lp_timer)
{
- ecore_timer_del(wd->lp_timer);
- wd->lp_timer = NULL;
+ ecore_timer_del(wd->lp_timer);
+ wd->lp_timer = NULL;
}
if (wd->mv_timer)
{
- ecore_timer_del(wd->mv_timer);
- wd->mv_timer = NULL;
+ ecore_timer_del(wd->mv_timer);
+ wd->mv_timer = NULL;
}
cp->button_state = BUTTON_RELEASED;
edje_object_signal_emit(cp->rbt, "elm,state,right,button,up",
- "right_button");
+ "right_button");
}
static void
for (i = 0; i < 3; i++)
{
- wd->cp[i] = ELM_NEW(Colorpicker_Data);
-
- wd->cp[i]->parent = obj;
- wd->cp[i]->colorpicker_num = i;
- wd->cp[i]->feed_cnt = 0;
-
- /* load colorbar area */
- wd->cp[i]->colorbar = edje_object_add(e);
- _elm_theme_object_set(obj, wd->cp[i]->colorbar, "colorpicker", "base", "default");
- snprintf(colorbar_name, sizeof(colorbar_name), "colorbar_%d", i);
- edje_object_signal_callback_add(wd->cp[i]->colorbar, "drag", "*",
- _arrow_cb, wd->cp[i]);
- edje_object_signal_callback_add( wd->cp[i]->colorbar, "drag,start", "*",
- _drag_start, obj);
- edje_object_signal_callback_add( wd->cp[i]->colorbar, "drag,stop", "*",
- _drag_stop, obj);
- edje_object_part_swallow(wd->lay, colorbar_name, wd->cp[i]->colorbar);
- evas_object_show(wd->cp[i]->colorbar);
- elm_widget_sub_object_add(obj, wd->cp[i]->colorbar);
-
- /* load colorbar image */
- wd->cp[i]->bar = edje_object_add(e);
- _elm_theme_object_set(obj, wd->cp[i]->bar, "colorpicker", "image", colorbar_name);
- evas_object_show(wd->cp[i]->bar);
- edje_object_part_swallow(wd->cp[i]->colorbar, "bar", wd->cp[i]->bar);
- elm_widget_sub_object_add(obj, wd->cp[i]->bar);
-
- /* provide expanded touch area */
- wd->cp[i]->touch_area = evas_object_rectangle_add(e);
- evas_object_color_set(wd->cp[i]->touch_area, 0, 0, 0, 0);
- edje_object_part_swallow(wd->cp[i]->colorbar, "arrow_bg",
- wd->cp[i]->touch_area);
- evas_object_event_callback_add(wd->cp[i]->touch_area,
- EVAS_CALLBACK_MOUSE_DOWN, _colorbar_cb,
- wd->cp[i]);
- evas_object_event_callback_add(wd->cp[i]->touch_area,
- EVAS_CALLBACK_RESIZE, _arrow_resize_cb,
- wd->cp[i]);
- evas_object_show(wd->cp[i]->touch_area);
- elm_widget_sub_object_add(obj, wd->cp[i]->touch_area);
-
- /* load background rectangle of the colorbar. used for changing color of the opacity bar */
- if (i == 1 || i == 2)
- {
- wd->cp[i]->bg_rect = evas_object_rectangle_add(e);
- evas_object_color_set(wd->cp[i]->bg_rect, wd->er, wd->eg, wd->eb,
- 255);
- evas_object_show(wd->cp[i]->bg_rect);
- edje_object_part_swallow(wd->cp[i]->colorbar, "bar_bg",
- wd->cp[i]->bg_rect);
-
- elm_widget_sub_object_add(obj, wd->cp[i]->bg_rect);
- }
- /* load arrow image, pointing the colorbar */
- wd->cp[i]->arrow = edje_object_add(e);
- _elm_theme_object_set(obj, wd->cp[i]->arrow, "colorpicker", "image", "updown");
- evas_object_show(wd->cp[i]->arrow);
- edje_object_part_swallow(wd->cp[i]->colorbar, "arrow",
- wd->cp[i]->arrow);
- evas_object_event_callback_add(wd->cp[i]->arrow, EVAS_CALLBACK_RESIZE,
- _arrow_resize_cb, wd->cp[i]);
- elm_widget_sub_object_add(obj, wd->cp[i]->arrow);
- if (i == 2)
- evas_object_color_set(wd->cp[i]->arrow, 0, 0, 0, 255);
- else
- evas_object_color_set(wd->cp[i]->arrow, wd->er, wd->eg, wd->eb, 255);
-
- /* load left button */
- wd->cp[i]->lbt = edje_object_add(e);
- _elm_theme_object_set(obj, wd->cp[i]->lbt, "colorpicker", "button", "left");
- evas_object_event_callback_add(wd->cp[i]->lbt, EVAS_CALLBACK_MOUSE_DOWN,
- _left_button_down_cb, wd->cp[i]);
- evas_object_event_callback_add(wd->cp[i]->lbt, EVAS_CALLBACK_MOUSE_UP,
- _left_button_up_cb, wd->cp[i]);
- evas_object_show(wd->cp[i]->lbt);
- edje_object_part_swallow(wd->cp[i]->colorbar, "l_button",
- wd->cp[i]->lbt);
- elm_widget_sub_object_add(obj, wd->cp[i]->lbt);
-
- /* load right button */
- wd->cp[i]->rbt = edje_object_add(e);
- _elm_theme_object_set(obj, wd->cp[i]->rbt, "colorpicker", "button", "right");
- evas_object_event_callback_add(wd->cp[i]->rbt, EVAS_CALLBACK_MOUSE_DOWN,
- _right_button_down_cb, wd->cp[i]);
- evas_object_event_callback_add(wd->cp[i]->rbt, EVAS_CALLBACK_MOUSE_UP,
- _right_button_up_cb, wd->cp[i]);
- evas_object_show(wd->cp[i]->rbt);
- edje_object_part_swallow(wd->cp[i]->colorbar, "r_button",
- wd->cp[i]->rbt);
- elm_widget_sub_object_add(obj, wd->cp[i]->rbt);
+ wd->cp[i] = ELM_NEW(Colorpicker_Data);
+
+ wd->cp[i]->parent = obj;
+ wd->cp[i]->colorpicker_num = i;
+ wd->cp[i]->feed_cnt = 0;
+
+ /* load colorbar area */
+ wd->cp[i]->colorbar = edje_object_add(e);
+ _elm_theme_object_set(obj, wd->cp[i]->colorbar, "colorpicker", "base", "default");
+ snprintf(colorbar_name, sizeof(colorbar_name), "colorbar_%d", i);
+ edje_object_signal_callback_add(wd->cp[i]->colorbar, "drag", "*",
+ _arrow_cb, wd->cp[i]);
+ edje_object_signal_callback_add( wd->cp[i]->colorbar, "drag,start", "*",
+ _drag_start, obj);
+ edje_object_signal_callback_add( wd->cp[i]->colorbar, "drag,stop", "*",
+ _drag_stop, obj);
+ edje_object_part_swallow(wd->lay, colorbar_name, wd->cp[i]->colorbar);
+ evas_object_show(wd->cp[i]->colorbar);
+ elm_widget_sub_object_add(obj, wd->cp[i]->colorbar);
+
+ /* load colorbar image */
+ wd->cp[i]->bar = edje_object_add(e);
+ _elm_theme_object_set(obj, wd->cp[i]->bar, "colorpicker", "image", colorbar_name);
+ evas_object_show(wd->cp[i]->bar);
+ edje_object_part_swallow(wd->cp[i]->colorbar, "bar", wd->cp[i]->bar);
+ elm_widget_sub_object_add(obj, wd->cp[i]->bar);
+
+ /* provide expanded touch area */
+ wd->cp[i]->touch_area = evas_object_rectangle_add(e);
+ evas_object_color_set(wd->cp[i]->touch_area, 0, 0, 0, 0);
+ edje_object_part_swallow(wd->cp[i]->colorbar, "arrow_bg",
+ wd->cp[i]->touch_area);
+ evas_object_event_callback_add(wd->cp[i]->touch_area,
+ EVAS_CALLBACK_MOUSE_DOWN, _colorbar_cb,
+ wd->cp[i]);
+ evas_object_event_callback_add(wd->cp[i]->touch_area,
+ EVAS_CALLBACK_RESIZE, _arrow_resize_cb,
+ wd->cp[i]);
+ evas_object_show(wd->cp[i]->touch_area);
+ elm_widget_sub_object_add(obj, wd->cp[i]->touch_area);
+
+ /* load background rectangle of the colorbar. used for changing color of the opacity bar */
+ if (i == 1 || i == 2)
+ {
+ wd->cp[i]->bg_rect = evas_object_rectangle_add(e);
+ evas_object_color_set(wd->cp[i]->bg_rect, wd->er, wd->eg, wd->eb,
+ 255);
+ evas_object_show(wd->cp[i]->bg_rect);
+ edje_object_part_swallow(wd->cp[i]->colorbar, "bar_bg",
+ wd->cp[i]->bg_rect);
+
+ elm_widget_sub_object_add(obj, wd->cp[i]->bg_rect);
+ }
+ /* load arrow image, pointing the colorbar */
+ wd->cp[i]->arrow = edje_object_add(e);
+ _elm_theme_object_set(obj, wd->cp[i]->arrow, "colorpicker", "image", "updown");
+ evas_object_show(wd->cp[i]->arrow);
+ edje_object_part_swallow(wd->cp[i]->colorbar, "arrow",
+ wd->cp[i]->arrow);
+ evas_object_event_callback_add(wd->cp[i]->arrow, EVAS_CALLBACK_RESIZE,
+ _arrow_resize_cb, wd->cp[i]);
+ elm_widget_sub_object_add(obj, wd->cp[i]->arrow);
+ if (i == 2)
+ evas_object_color_set(wd->cp[i]->arrow, 0, 0, 0, 255);
+ else
+ evas_object_color_set(wd->cp[i]->arrow, wd->er, wd->eg, wd->eb, 255);
+
+ /* load left button */
+ wd->cp[i]->lbt = edje_object_add(e);
+ _elm_theme_object_set(obj, wd->cp[i]->lbt, "colorpicker", "button", "left");
+ evas_object_event_callback_add(wd->cp[i]->lbt, EVAS_CALLBACK_MOUSE_DOWN,
+ _left_button_down_cb, wd->cp[i]);
+ evas_object_event_callback_add(wd->cp[i]->lbt, EVAS_CALLBACK_MOUSE_UP,
+ _left_button_up_cb, wd->cp[i]);
+ evas_object_show(wd->cp[i]->lbt);
+ edje_object_part_swallow(wd->cp[i]->colorbar, "l_button",
+ wd->cp[i]->lbt);
+ elm_widget_sub_object_add(obj, wd->cp[i]->lbt);
+
+ /* load right button */
+ wd->cp[i]->rbt = edje_object_add(e);
+ _elm_theme_object_set(obj, wd->cp[i]->rbt, "colorpicker", "button", "right");
+ evas_object_event_callback_add(wd->cp[i]->rbt, EVAS_CALLBACK_MOUSE_DOWN,
+ _right_button_down_cb, wd->cp[i]);
+ evas_object_event_callback_add(wd->cp[i]->rbt, EVAS_CALLBACK_MOUSE_UP,
+ _right_button_up_cb, wd->cp[i]);
+ evas_object_show(wd->cp[i]->rbt);
+ edje_object_part_swallow(wd->cp[i]->colorbar, "r_button",
+ wd->cp[i]->rbt);
+ elm_widget_sub_object_add(obj, wd->cp[i]->rbt);
}
}
_add_colorbar(obj);
evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
- _colorpicker_object_resize, obj);
+ _colorpicker_object_resize, obj);
evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE,
- _colorpicker_object_move, obj);
+ _colorpicker_object_move, obj);
evas_object_event_callback_add(obj, EVAS_CALLBACK_SHOW,
- _colorpicker_object_show, obj);
+ _colorpicker_object_show, obj);
evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE,
- _colorpicker_object_hide, obj);
+ _colorpicker_object_hide, obj);
_sizing_eval(obj);
return obj;
if (b)
*b = wd->b;
}
+
+/* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/
struct _Dialogue_Item
{
- Evas_Object *parent;
- Evas_Object *bg_layout;
- Evas_Object *content;
- Elm_Dialoguegroup_Item_Style style;
- const char *location;
- Eina_Bool press;
-// Eina_Bool line_show;
+ Evas_Object *parent;
+ Evas_Object *bg_layout;
+ Evas_Object *content;
+ Elm_Dialoguegroup_Item_Style style;
+ const char *location;
+ Eina_Bool press;
+ // Eina_Bool line_show;
};
typedef struct _Widget_Data Widget_Data;
struct _Widget_Data
{
- Evas_Object *parent;
- Evas_Object *box;
- Evas_Object *title_layout;
- const char *title;
- unsigned int num;
- Eina_List *items;
+ Evas_Object *parent;
+ Evas_Object *box;
+ Evas_Object *title_layout;
+ const char *title;
+ unsigned int num;
+ Eina_List *items;
};
static const char*widtype = NULL;
static void _change_item_bg(Dialogue_Item *item, const char *location);
static Dialogue_Item* _create_item(Evas_Object *obj, Evas_Object *subobj, Elm_Dialoguegroup_Item_Style style, const char *location);
-
+
static void
_del_hook(Evas_Object *obj)
{
- Widget_Data *wd = elm_widget_data_get(obj);
-
- if (!wd) return;
- if (wd->title) eina_stringshare_del(wd->title);
-
- _remove_all(obj);
-
- if (wd->box){
- evas_object_del(wd->box);
- wd->box = NULL;
- }
-
- free(wd);
+ Widget_Data *wd = elm_widget_data_get(obj);
+
+ if (!wd) return;
+ if (wd->title) eina_stringshare_del(wd->title);
+
+ _remove_all(obj);
+
+ if (wd->box){
+ evas_object_del(wd->box);
+ wd->box = NULL;
+ }
+
+ free(wd);
}
static void
_theme_hook(Evas_Object *obj)
{
- Widget_Data *wd = elm_widget_data_get(obj);
- Eina_List *l;
- Dialogue_Item *item;
-
- if (!wd) return;
- if (wd->title) {
- elm_layout_theme_set(wd->title_layout, "dialoguegroup", "title", elm_widget_style_get(obj));
- edje_object_part_text_set(elm_layout_edje_get(wd->title_layout), "text", wd->title);
- }
- EINA_LIST_FOREACH(wd->items, l, item)
- _change_item_bg( item, item->location );
- _sizing_eval(obj);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ Eina_List *l;
+ Dialogue_Item *item;
+
+ if (!wd) return;
+ if (wd->title) {
+ elm_layout_theme_set(wd->title_layout, "dialoguegroup", "title", elm_widget_style_get(obj));
+ edje_object_part_text_set(elm_layout_edje_get(wd->title_layout), "text", wd->title);
+ }
+ EINA_LIST_FOREACH(wd->items, l, item)
+ _change_item_bg( item, item->location );
+ _sizing_eval(obj);
}
static void
static void
_sizing_eval(Evas_Object *obj)
{
- Widget_Data *wd = elm_widget_data_get(obj);
- Evas_Coord minw, minh, maxw, maxh;
-
- if (!wd) return;
- evas_object_size_hint_min_get(wd->box, &minw, &minh);
- evas_object_size_hint_max_get(wd->box, &maxw, &maxh);
- evas_object_size_hint_min_set(obj, minw, minh);
- evas_object_size_hint_max_set(obj, maxw, maxh);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ Evas_Coord minw, minh, maxw, maxh;
+
+ if (!wd) return;
+ evas_object_size_hint_min_get(wd->box, &minw, &minh);
+ evas_object_size_hint_max_get(wd->box, &maxw, &maxh);
+ evas_object_size_hint_min_set(obj, minw, minh);
+ evas_object_size_hint_max_set(obj, maxw, maxh);
}
static void _remove_all(Evas_Object *obj)
{
- Widget_Data *wd = elm_widget_data_get(obj);
- Dialogue_Item *item;
-
- if (!wd) return;
-
- wd->num = 0;
-
- if (wd->items) {
- EINA_LIST_FREE(wd->items, item) {
- if (item->content){
- evas_object_del(item->content);
- item->content = NULL;
- }
- if (item->bg_layout){
- evas_object_del(item->bg_layout);
- item->bg_layout = NULL;
- }
- if (item->location)
- eina_stringshare_del(item->location);
- free(item);
- }
- }
+ Widget_Data *wd = elm_widget_data_get(obj);
+ Dialogue_Item *item;
+
+ if (!wd) return;
+
+ wd->num = 0;
+
+ if (wd->items) {
+ EINA_LIST_FREE(wd->items, item) {
+ if (item->content){
+ evas_object_del(item->content);
+ item->content = NULL;
+ }
+ if (item->bg_layout){
+ evas_object_del(item->bg_layout);
+ item->bg_layout = NULL;
+ }
+ if (item->location)
+ eina_stringshare_del(item->location);
+ free(item);
+ }
+ }
}
static void _set_item_theme(Dialogue_Item *item, const char *location)
{
- if (!item) return;
- char buf[30];
-
- if (item->style == ELM_DIALOGUEGROUP_ITEM_STYLE_DEFAULT)
- snprintf(buf, sizeof(buf), "bg_%s", location);
- else if (item->style == ELM_DIALOGUEGROUP_ITEM_STYLE_EDITFIELD)
- snprintf(buf, sizeof(buf), "editfield_%s", location);
- else if (item->style == ELM_DIALOGUEGROUP_ITEM_STYLE_EDITFIELD_WITH_TITLE)
- snprintf(buf, sizeof(buf), "editfield_with_title_%s", location);
- else if (item->style == ELM_DIALOGUEGROUP_ITEM_STYLE_EDIT_TITLE)
- snprintf(buf, sizeof(buf), "edit_title_%s", location);
- else if (item->style == ELM_DIALOGUEGROUP_ITEM_STYLE_HIDDEN)
- snprintf(buf, sizeof(buf), "hidden_%s", location);
- else if (item->style == ELM_DIALOGUEGROUP_ITEM_STYLE_DATAVIEW)
- snprintf(buf, sizeof(buf), "dataview_%s", location);
- else if (item->style == ELM_DIALOGUEGROUP_ITEM_STYLE_NO_BG)
- snprintf(buf, sizeof(buf), "no_bg_%s", location);
- elm_layout_theme_set(item->bg_layout, "dialoguegroup", buf, elm_widget_style_get(item->parent));
+ if (!item) return;
+ char buf[30];
+
+ if (item->style == ELM_DIALOGUEGROUP_ITEM_STYLE_DEFAULT)
+ snprintf(buf, sizeof(buf), "bg_%s", location);
+ else if (item->style == ELM_DIALOGUEGROUP_ITEM_STYLE_EDITFIELD)
+ snprintf(buf, sizeof(buf), "editfield_%s", location);
+ else if (item->style == ELM_DIALOGUEGROUP_ITEM_STYLE_EDITFIELD_WITH_TITLE)
+ snprintf(buf, sizeof(buf), "editfield_with_title_%s", location);
+ else if (item->style == ELM_DIALOGUEGROUP_ITEM_STYLE_EDIT_TITLE)
+ snprintf(buf, sizeof(buf), "edit_title_%s", location);
+ else if (item->style == ELM_DIALOGUEGROUP_ITEM_STYLE_HIDDEN)
+ snprintf(buf, sizeof(buf), "hidden_%s", location);
+ else if (item->style == ELM_DIALOGUEGROUP_ITEM_STYLE_DATAVIEW)
+ snprintf(buf, sizeof(buf), "dataview_%s", location);
+ else if (item->style == ELM_DIALOGUEGROUP_ITEM_STYLE_NO_BG)
+ snprintf(buf, sizeof(buf), "no_bg_%s", location);
+ elm_layout_theme_set(item->bg_layout, "dialoguegroup", buf, elm_widget_style_get(item->parent));
}
/*
-static void _set_line_show(Dialogue_Item *item, Dialogue_Item *after)
-{
- if(!item || !after) return;
-
- if (item->style == ELM_DIALOGUEGROUP_ITEM_STYLE_DEFAULT) {
- if (after->style == ELM_DIALOGUEGROUP_ITEM_STYLE_DEFAULT) {
- item->line_show = EINA_TRUE;
- edje_object_signal_emit(elm_layout_edje_get(item->bg_layout), "elm,state,line,show", "elm");
- }
- else if (after->style == ELM_DIALOGUEGROUP_ITEM_STYLE_EDITFIELD) {
- item->line_show = EINA_FALSE;
- edje_object_signal_emit(elm_layout_edje_get(item->bg_layout), "elm,state,line,hide", "elm");
- }
- }
- else if (item->style == ELM_DIALOGUEGROUP_ITEM_STYLE_EDITFIELD)
- item->line_show = EINA_TRUE;
-}
+ static void _set_line_show(Dialogue_Item *item, Dialogue_Item *after)
+ {
+ if(!item || !after) return;
+
+ if (item->style == ELM_DIALOGUEGROUP_ITEM_STYLE_DEFAULT) {
+ if (after->style == ELM_DIALOGUEGROUP_ITEM_STYLE_DEFAULT) {
+ item->line_show = EINA_TRUE;
+ edje_object_signal_emit(elm_layout_edje_get(item->bg_layout), "elm,state,line,show", "elm");
+ }
+ else if (after->style == ELM_DIALOGUEGROUP_ITEM_STYLE_EDITFIELD) {
+ item->line_show = EINA_FALSE;
+ edje_object_signal_emit(elm_layout_edje_get(item->bg_layout), "elm,state,line,hide", "elm");
+ }
+ }
+ else if (item->style == ELM_DIALOGUEGROUP_ITEM_STYLE_EDITFIELD)
+ item->line_show = EINA_TRUE;
+ }
*/
static void _change_item_bg(Dialogue_Item *item, const char *location)
{
- if (!item) return;
-
- eina_stringshare_replace(&item->location, location);
- _set_item_theme(item, location);
- elm_layout_content_set(item->bg_layout, "swallow", item->content);
- if(item->press == EINA_TRUE)
- edje_object_signal_emit(elm_layout_edje_get(item->bg_layout), "elm,state,press,on", "elm");
- else
- edje_object_signal_emit(elm_layout_edje_get(item->bg_layout), "elm,state,press,off", "elm");
-
-/* if(item->line_show == EINA_FALSE)
- edje_object_signal_emit(elm_layout_edje_get(item->bg_layout), "elm,state,line,hide", "elm");*/
-
+ if (!item) return;
+
+ eina_stringshare_replace(&item->location, location);
+ _set_item_theme(item, location);
+ elm_layout_content_set(item->bg_layout, "swallow", item->content);
+ if(item->press == EINA_TRUE)
+ edje_object_signal_emit(elm_layout_edje_get(item->bg_layout), "elm,state,press,on", "elm");
+ else
+ edje_object_signal_emit(elm_layout_edje_get(item->bg_layout), "elm,state,press,off", "elm");
+
+ /* if(item->line_show == EINA_FALSE)
+ edje_object_signal_emit(elm_layout_edje_get(item->bg_layout), "elm,state,line,hide", "elm");*/
+
}
static Dialogue_Item* _create_item(Evas_Object *obj, Evas_Object *subobj, Elm_Dialoguegroup_Item_Style style, const char *location)
{
- Widget_Data *wd = elm_widget_data_get(obj);
- Dialogue_Item *item;
-
- if (!wd) return NULL;
-
- item = ELM_NEW(Dialogue_Item);
- item->parent = obj;
- item->content = subobj;
- item->press = EINA_TRUE;
- item->style = style;
-// item->line_show = EINA_TRUE;
- eina_stringshare_replace(&item->location, location);
-
- item->bg_layout = elm_layout_add(wd->box);
- _set_item_theme(item, location);
- evas_object_size_hint_weight_set(item->bg_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(item->bg_layout, EVAS_HINT_FILL, 0.0);
- evas_object_show(item->bg_layout);
-
- elm_layout_content_set(item->bg_layout, "swallow", item->content);
-
- return item;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ Dialogue_Item *item;
+
+ if (!wd) return NULL;
+
+ item = ELM_NEW(Dialogue_Item);
+ item->parent = obj;
+ item->content = subobj;
+ item->press = EINA_TRUE;
+ item->style = style;
+ // item->line_show = EINA_TRUE;
+ eina_stringshare_replace(&item->location, location);
+
+ item->bg_layout = elm_layout_add(wd->box);
+ _set_item_theme(item, location);
+ evas_object_size_hint_weight_set(item->bg_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(item->bg_layout, EVAS_HINT_FILL, 0.0);
+ evas_object_show(item->bg_layout);
+
+ elm_layout_content_set(item->bg_layout, "swallow", item->content);
+
+ return item;
}
static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
- _sizing_eval(data);
+ _sizing_eval(data);
}
/**
*/
EAPI Evas_Object *elm_dialoguegroup_add(Evas_Object *parent)
{
- Evas_Object *obj = NULL;
- Widget_Data *wd = NULL;
- Evas *e = NULL;
-
- e = evas_object_evas_get(parent);
- if (e == NULL) return NULL;
- wd = ELM_NEW(Widget_Data);
- obj = elm_widget_add(e);
- ELM_SET_WIDTYPE(widtype, "dialoguegroup");
- elm_widget_type_set(obj, "dialoguegroup");
- elm_widget_sub_object_add(parent, obj);
- elm_widget_data_set(obj, wd);
- elm_widget_del_hook_set(obj, _del_hook);
- elm_widget_theme_hook_set(obj, _theme_hook);
-
- wd->parent = parent;
- wd->num = 0;
-
- wd->box = elm_box_add(obj);
- evas_object_event_callback_add(wd->box, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
- evas_object_show(wd->box);
- elm_widget_resize_object_set(obj, wd->box);
-
- _sizing_eval(obj);
- return obj;
+ Evas_Object *obj = NULL;
+ Widget_Data *wd = NULL;
+ Evas *e = NULL;
+
+ e = evas_object_evas_get(parent);
+ if (e == NULL) return NULL;
+ wd = ELM_NEW(Widget_Data);
+ obj = elm_widget_add(e);
+ ELM_SET_WIDTYPE(widtype, "dialoguegroup");
+ elm_widget_type_set(obj, "dialoguegroup");
+ elm_widget_sub_object_add(parent, obj);
+ elm_widget_data_set(obj, wd);
+ elm_widget_del_hook_set(obj, _del_hook);
+ elm_widget_theme_hook_set(obj, _theme_hook);
+
+ wd->parent = parent;
+ wd->num = 0;
+
+ wd->box = elm_box_add(obj);
+ evas_object_event_callback_add(wd->box, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
+ evas_object_show(wd->box);
+ elm_widget_resize_object_set(obj, wd->box);
+
+ _sizing_eval(obj);
+ return obj;
}
/**
EAPI Dialogue_Item *
elm_dialoguegroup_append(Evas_Object *obj, Evas_Object *subobj, Elm_Dialoguegroup_Item_Style style)
{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- Dialogue_Item *item = NULL, *new_item = NULL;
-
- if (!wd || !subobj) return NULL;
-
- if (!wd->items)
- new_item = _create_item(obj, subobj, style, "default");
- else {
- if (wd->num == 1) {
- item = eina_list_data_get(wd->items);
- _change_item_bg(item, "top");
- }
- else {
- item = eina_list_data_get( eina_list_last(wd->items) );
- _change_item_bg(item, "middle");
- }
- new_item = _create_item(obj, subobj, style, "bottom");
-// _set_line_show(item, new_item);
- }
- elm_box_pack_end(wd->box, new_item->bg_layout);
- wd->items = eina_list_append(wd->items, new_item);
- wd->num++;
- _sizing_eval(obj);
- return new_item;
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ Dialogue_Item *item = NULL, *new_item = NULL;
+
+ if (!wd || !subobj) return NULL;
+
+ if (!wd->items)
+ new_item = _create_item(obj, subobj, style, "default");
+ else {
+ if (wd->num == 1) {
+ item = eina_list_data_get(wd->items);
+ _change_item_bg(item, "top");
+ }
+ else {
+ item = eina_list_data_get( eina_list_last(wd->items) );
+ _change_item_bg(item, "middle");
+ }
+ new_item = _create_item(obj, subobj, style, "bottom");
+ // _set_line_show(item, new_item);
+ }
+ elm_box_pack_end(wd->box, new_item->bg_layout);
+ wd->items = eina_list_append(wd->items, new_item);
+ wd->num++;
+ _sizing_eval(obj);
+ return new_item;
}
EAPI Dialogue_Item *
elm_dialoguegroup_prepend(Evas_Object *obj, Evas_Object *subobj, Elm_Dialoguegroup_Item_Style style)
{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- Dialogue_Item *item = NULL, *new_item = NULL;
-
- if (!wd || !subobj) return NULL;
-
- if (!wd->items)
- new_item = _create_item(obj, subobj, style, "default");
- else {
- if (wd->num == 1) {
- item = eina_list_data_get(wd->items);
- _change_item_bg(item, "bottom");
- }
- else {
- item = eina_list_data_get(wd->items);
- _change_item_bg(item, "middle");
- }
- new_item = _create_item(obj, subobj, style, "top");
-// _set_line_show(new_item, item);
- }
- if(wd->title_layout)
- elm_box_pack_after(wd->box, new_item->bg_layout, wd->title_layout);
- else
- elm_box_pack_start(wd->box, new_item->bg_layout);
- wd->items = eina_list_prepend(wd->items, new_item);
- wd->num++;
- _sizing_eval(obj);
- return new_item;
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ Dialogue_Item *item = NULL, *new_item = NULL;
+
+ if (!wd || !subobj) return NULL;
+
+ if (!wd->items)
+ new_item = _create_item(obj, subobj, style, "default");
+ else {
+ if (wd->num == 1) {
+ item = eina_list_data_get(wd->items);
+ _change_item_bg(item, "bottom");
+ }
+ else {
+ item = eina_list_data_get(wd->items);
+ _change_item_bg(item, "middle");
+ }
+ new_item = _create_item(obj, subobj, style, "top");
+ // _set_line_show(new_item, item);
+ }
+ if(wd->title_layout)
+ elm_box_pack_after(wd->box, new_item->bg_layout, wd->title_layout);
+ else
+ elm_box_pack_start(wd->box, new_item->bg_layout);
+ wd->items = eina_list_prepend(wd->items, new_item);
+ wd->num++;
+ _sizing_eval(obj);
+ return new_item;
}
/**
EAPI Dialogue_Item *
elm_dialoguegroup_insert_after(Evas_Object *obj, Evas_Object *subobj, Dialogue_Item *after, Elm_Dialoguegroup_Item_Style style)
{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- Dialogue_Item *after_item = NULL, *item = NULL;
- Eina_List *l;
-
- if (!wd || !subobj || !after || !wd->items) return NULL;
-
- EINA_LIST_FOREACH(wd->items, l, after_item) {
- if(after == after_item) {
- if( !strcmp(after_item->location, "default") ) {
- _change_item_bg(after_item, "top");
- item = _create_item(obj, subobj, style, "bottom");
- }
- else if( !strcmp(after_item->location, "top") || !strcmp(after_item->location, "middle") )
- item = _create_item(obj, subobj, style, "middle");
- else if( !strcmp(after_item->location, "bottom") ) {
- _change_item_bg(after_item, "middle");
- item = _create_item(obj, subobj, style, "bottom");
- }
-
- elm_box_pack_after(wd->box, item->bg_layout, after_item->bg_layout);
- wd->items = eina_list_append_relative(wd->items, item, after_item);
- // _set_line_show(after, item);
- }
- }
-
- wd->num++;
- _sizing_eval(obj);
- return item;
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ Dialogue_Item *after_item = NULL, *item = NULL;
+ Eina_List *l;
+
+ if (!wd || !subobj || !after || !wd->items) return NULL;
+
+ EINA_LIST_FOREACH(wd->items, l, after_item) {
+ if(after == after_item) {
+ if( !strcmp(after_item->location, "default") ) {
+ _change_item_bg(after_item, "top");
+ item = _create_item(obj, subobj, style, "bottom");
+ }
+ else if( !strcmp(after_item->location, "top") || !strcmp(after_item->location, "middle") )
+ item = _create_item(obj, subobj, style, "middle");
+ else if( !strcmp(after_item->location, "bottom") ) {
+ _change_item_bg(after_item, "middle");
+ item = _create_item(obj, subobj, style, "bottom");
+ }
+
+ elm_box_pack_after(wd->box, item->bg_layout, after_item->bg_layout);
+ wd->items = eina_list_append_relative(wd->items, item, after_item);
+ // _set_line_show(after, item);
+ }
+ }
+
+ wd->num++;
+ _sizing_eval(obj);
+ return item;
}
/**
EAPI Dialogue_Item *
elm_dialoguegroup_insert_before(Evas_Object *obj, Evas_Object *subobj, Dialogue_Item *before, Elm_Dialoguegroup_Item_Style style)
{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- Dialogue_Item *before_item = NULL, *item = NULL;
- Eina_List *l;
- Eina_List *prev;
-
- if (!wd || !subobj || !before || !wd->items) return NULL;
-
- EINA_LIST_FOREACH(wd->items, l, before_item) {
- if(before == before_item) {
- if( !strcmp(before_item->location, "default") ) {
- _change_item_bg(before_item, "bottom");
- item = _create_item(obj, subobj, style, "top");
- }
-
- else if( !strcmp(before_item->location, "top") ) {
- _change_item_bg(before_item, "middle");
- item = _create_item(obj, subobj, style, "top");
- }
-
- else if( !strcmp(before_item->location, "middle") || !strcmp(before_item->location, "bottom") ) {
- item = _create_item(obj, subobj, style, "middle");
- prev = eina_list_prev(l);
- // _set_line_show(prev->data, item);
- }
- elm_box_pack_before(wd->box, item->bg_layout, before_item->bg_layout);
- wd->items = eina_list_prepend_relative(wd->items, item, before_item);
- }
- }
-
- wd->num++;
- _sizing_eval(obj);
- return item;
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ Dialogue_Item *before_item = NULL, *item = NULL;
+ Eina_List *l;
+ Eina_List *prev;
+
+ if (!wd || !subobj || !before || !wd->items) return NULL;
+
+ EINA_LIST_FOREACH(wd->items, l, before_item) {
+ if(before == before_item) {
+ if( !strcmp(before_item->location, "default") ) {
+ _change_item_bg(before_item, "bottom");
+ item = _create_item(obj, subobj, style, "top");
+ }
+
+ else if( !strcmp(before_item->location, "top") ) {
+ _change_item_bg(before_item, "middle");
+ item = _create_item(obj, subobj, style, "top");
+ }
+
+ else if( !strcmp(before_item->location, "middle") || !strcmp(before_item->location, "bottom") ) {
+ item = _create_item(obj, subobj, style, "middle");
+ prev = eina_list_prev(l);
+ // _set_line_show(prev->data, item);
+ }
+ elm_box_pack_before(wd->box, item->bg_layout, before_item->bg_layout);
+ wd->items = eina_list_prepend_relative(wd->items, item, before_item);
+ }
+ }
+
+ wd->num++;
+ _sizing_eval(obj);
+ return item;
}
/**
EAPI void
elm_dialoguegroup_remove(Dialogue_Item *item)
{
- if (!item) return;
- ELM_CHECK_WIDTYPE(item->parent, widtype) ;
- Dialogue_Item *current_item;
- Widget_Data *wd = elm_widget_data_get(item->parent);
- Eina_List *l;
-
- if (!wd || !wd->items || !item) return ;
-
- EINA_LIST_FOREACH(wd->items, l, current_item) {
- if (current_item == item) {
- if (current_item->content){
- evas_object_del(current_item->content);
- current_item->content = NULL;
- }
- if (current_item->bg_layout){
- evas_object_del(current_item->bg_layout);
- current_item->bg_layout = NULL;
- }
- elm_box_unpack(wd->box, current_item->bg_layout);
- wd->items = eina_list_remove(wd->items, current_item);
- }
- }
-
- wd->num--;
-
- if (wd->num == 0) return;
-
- if (wd->num == 1) {
- current_item = eina_list_data_get(wd->items);
- _change_item_bg(current_item, "default");
- }
-
- else {
- current_item = eina_list_data_get(wd->items);
- _change_item_bg(current_item, "top");
- current_item = eina_list_data_get( eina_list_last(wd->items) );
- _change_item_bg(current_item, "bottom");
- }
-
- _sizing_eval(item->parent);
+ if (!item) return;
+ ELM_CHECK_WIDTYPE(item->parent, widtype) ;
+ Dialogue_Item *current_item;
+ Widget_Data *wd = elm_widget_data_get(item->parent);
+ Eina_List *l;
+
+ if (!wd || !wd->items || !item) return ;
+
+ EINA_LIST_FOREACH(wd->items, l, current_item) {
+ if (current_item == item) {
+ if (current_item->content){
+ evas_object_del(current_item->content);
+ current_item->content = NULL;
+ }
+ if (current_item->bg_layout){
+ evas_object_del(current_item->bg_layout);
+ current_item->bg_layout = NULL;
+ }
+ elm_box_unpack(wd->box, current_item->bg_layout);
+ wd->items = eina_list_remove(wd->items, current_item);
+ }
+ }
+
+ wd->num--;
+
+ if (wd->num == 0) return;
+
+ if (wd->num == 1) {
+ current_item = eina_list_data_get(wd->items);
+ _change_item_bg(current_item, "default");
+ }
+
+ else {
+ current_item = eina_list_data_get(wd->items);
+ _change_item_bg(current_item, "top");
+ current_item = eina_list_data_get( eina_list_last(wd->items) );
+ _change_item_bg(current_item, "bottom");
+ }
+
+ _sizing_eval(item->parent);
}
/**
EAPI void
elm_dialoguegroup_remove_all(Evas_Object *obj)
{
- ELM_CHECK_WIDTYPE(obj, widtype);
- _remove_all(obj);
- _sizing_eval(obj);
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ _remove_all(obj);
+ _sizing_eval(obj);
}
EAPI void
elm_dialoguegroup_title_set(Evas_Object *obj, const char *title)
{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
-
- if (!wd) return ;
- eina_stringshare_replace(&wd->title, title);
- if (!title) {
- wd->title = NULL;
- elm_box_unpack(wd->box, wd->title_layout);
- }
- if (!wd->title_layout) {
- wd->title_layout = elm_layout_add(wd->box);
- elm_layout_theme_set(wd->title_layout, "dialoguegroup", "title", elm_widget_style_get(obj));
- evas_object_size_hint_weight_set(wd->title_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(wd->title_layout, EVAS_HINT_FILL, 0.0);
- evas_object_show(wd->title_layout);
- edje_object_part_text_set(elm_layout_edje_get(wd->title_layout), "text", title);
- elm_box_pack_start(wd->box, wd->title_layout);
- }
- edje_object_part_text_set(elm_layout_edje_get(wd->title_layout), "text", title);
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+
+ if (!wd) return ;
+ eina_stringshare_replace(&wd->title, title);
+ if (!title) {
+ wd->title = NULL;
+ elm_box_unpack(wd->box, wd->title_layout);
+ }
+ if (!wd->title_layout) {
+ wd->title_layout = elm_layout_add(wd->box);
+ elm_layout_theme_set(wd->title_layout, "dialoguegroup", "title", elm_widget_style_get(obj));
+ evas_object_size_hint_weight_set(wd->title_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(wd->title_layout, EVAS_HINT_FILL, 0.0);
+ evas_object_show(wd->title_layout);
+ edje_object_part_text_set(elm_layout_edje_get(wd->title_layout), "text", title);
+ elm_box_pack_start(wd->box, wd->title_layout);
+ }
+ edje_object_part_text_set(elm_layout_edje_get(wd->title_layout), "text", title);
}
/**
EAPI const char *
elm_dialoguegroup_title_get(Evas_Object *obj)
{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return NULL;
- return wd->title;
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return NULL;
+ return wd->title;
}
/**
{
if(!item) return;
ELM_CHECK_WIDTYPE(item->parent, widtype) ;
-
+
item->press = press;
if(press == EINA_TRUE)
- edje_object_signal_emit(elm_layout_edje_get(item->bg_layout), "elm,state,press,on", "elm");
+ edje_object_signal_emit(elm_layout_edje_get(item->bg_layout), "elm,state,press,on", "elm");
else
- edje_object_signal_emit(elm_layout_edje_get(item->bg_layout), "elm,state,press,off", "elm");
+ edje_object_signal_emit(elm_layout_edje_get(item->bg_layout), "elm,state,press,off", "elm");
}
/**
{
if(!item) return EINA_FALSE;
ELM_CHECK_WIDTYPE(item->parent, widtype) EINA_FALSE;
-
+
return item->press;
}
{
if(!item) return NULL;
ELM_CHECK_WIDTYPE(item->parent, widtype) EINA_FALSE;
-
+
return item->content;
}
EAPI void
elm_dialoguegroup_item_style_set(Dialogue_Item *item, Elm_Dialoguegroup_Item_Style style)
{
- if(!item) return;
- ELM_CHECK_WIDTYPE(item->parent, widtype);
- Widget_Data *wd = elm_widget_data_get(item->parent);
-
- item->style = style;
- _change_item_bg(item, item->location);
-
- if (!wd) return ;
+ if(!item) return;
+ ELM_CHECK_WIDTYPE(item->parent, widtype);
+ Widget_Data *wd = elm_widget_data_get(item->parent);
+
+ item->style = style;
+ _change_item_bg(item, item->location);
+
+ if (!wd) return ;
}
/**
EAPI Elm_Dialoguegroup_Item_Style
elm_dialoguegroup_item_style_get(Dialogue_Item *item)
{
- if(!item) return ELM_DIALOGUEGROUP_ITEM_STYLE_LAST;
- ELM_CHECK_WIDTYPE(item->parent, widtype);
- Widget_Data *wd = elm_widget_data_get(item->parent);
-
- if (!wd) return ELM_DIALOGUEGROUP_ITEM_STYLE_LAST;
+ if(!item) return ELM_DIALOGUEGROUP_ITEM_STYLE_LAST;
+ ELM_CHECK_WIDTYPE(item->parent, widtype);
+ Widget_Data *wd = elm_widget_data_get(item->parent);
+
+ if (!wd) return ELM_DIALOGUEGROUP_ITEM_STYLE_LAST;
- return item->style;
+ return item->style;
}
+
+/* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/
{
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd || !wd->base)
- return ;
+ return ;
if (!elm_widget_focus_get(obj) && !(elm_widget_disabled_get(obj)) )
{
- evas_object_smart_callback_call(obj, "unfocused", NULL);
- wd->editing = EINA_FALSE;
- edje_object_signal_emit(wd->base, "elm,state,over,show", "elm");
- edje_object_signal_emit(wd->base, "elm,state,eraser,hidden", "elm");
- if(_empty_entry(wd->entry))
- {
- if(wd->guide_text)
- {
- edje_object_part_text_set(wd->base, "elm.guidetext", wd->guide_text);
- edje_object_signal_emit(wd->base, "elm,state,guidetext,visible", "elm");
- wd->show_guide_text = EINA_TRUE;
- }
- }
+ evas_object_smart_callback_call(obj, "unfocused", NULL);
+ wd->editing = EINA_FALSE;
+ edje_object_signal_emit(wd->base, "elm,state,over,show", "elm");
+ edje_object_signal_emit(wd->base, "elm,state,eraser,hidden", "elm");
+ if(_empty_entry(wd->entry))
+ {
+ if(wd->guide_text)
+ {
+ edje_object_part_text_set(wd->base, "elm.guidetext", wd->guide_text);
+ edje_object_signal_emit(wd->base, "elm,state,guidetext,visible", "elm");
+ wd->show_guide_text = EINA_TRUE;
+ }
+ }
}
}
{
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd || !wd->base)
- return;
+ return;
_elm_theme_object_set(obj, wd->base, "editfield", "base", elm_widget_style_get(obj));
if(wd->single_line)
- edje_object_part_swallow(wd->base, "elm.swallow.content", wd->scroller);
+ edje_object_part_swallow(wd->base, "elm.swallow.content", wd->scroller);
else
- edje_object_part_swallow(wd->base, "elm.swallow.content", wd->entry);
+ edje_object_part_swallow(wd->base, "elm.swallow.content", wd->entry);
if(!wd->editing)
- edje_object_signal_emit(wd->base, "elm,state,over,show", "elm");
+ edje_object_signal_emit(wd->base, "elm,state,over,show", "elm");
if(wd->show_guide_text)
{
- if(_empty_entry(wd->entry))
- {
- if(wd->guide_text)
- {
- edje_object_part_text_set(wd->base, "elm.guidetext", wd->guide_text);
- edje_object_signal_emit(wd->base, "elm,state,guidetext,visible", "elm");
- }
- }
+ if(_empty_entry(wd->entry))
+ {
+ if(wd->guide_text)
+ {
+ edje_object_part_text_set(wd->base, "elm.guidetext", wd->guide_text);
+ edje_object_signal_emit(wd->base, "elm,state,guidetext,visible", "elm");
+ }
+ }
}
if(wd->ricon)
- edje_object_part_swallow(wd->base, "right_icon", wd->ricon);
+ edje_object_part_swallow(wd->base, "right_icon", wd->ricon);
if(wd->licon)
- edje_object_part_swallow(wd->base, "left_icon", wd->licon);
+ edje_object_part_swallow(wd->base, "left_icon", wd->licon);
_sizing_eval(obj);
}
Widget_Data *wd = elm_widget_data_get(obj);
if (wd->needs_size_calc)
{
- _sizing_eval(obj);
- wd->needs_size_calc = EINA_FALSE;
+ _sizing_eval(obj);
+ wd->needs_size_calc = EINA_FALSE;
}
}
static void
_sizing_eval(Evas_Object *obj)
{
- Widget_Data *wd = elm_widget_data_get(obj);
- Evas_Coord minw = -1, minh = -1;
- edje_object_size_min_calc(wd->base, &minw, &minh);
- evas_object_size_hint_min_set(obj, minw, minh);
- evas_object_size_hint_max_set(obj, -1, -1);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ Evas_Coord minw = -1, minh = -1;
+ edje_object_size_min_calc(wd->base, &minw, &minh);
+ evas_object_size_hint_min_set(obj, minw, minh);
+ evas_object_size_hint_max_set(obj, -1, -1);
}
static void
{
Widget_Data *wd = elm_widget_data_get(obj);
if(!wd || !wd->base)
- return;
+ return;
if (wd->needs_size_calc)
- return;
+ return;
wd->needs_size_calc = EINA_TRUE;
evas_object_smart_changed(obj);
}
double weight_x;
evas_object_size_hint_weight_get(data, &weight_x, NULL);
if (weight_x == EVAS_HINT_EXPAND)
- _request_sizing_eval(data);
+ _request_sizing_eval(data);
}
static Eina_Bool
if(!text) return EINA_FALSE;
strip_text = elm_entry_markup_to_utf8(text);
if (strip_text) {
- len = strlen(strip_text);
- free(strip_text);
+ len = strlen(strip_text);
+ free(strip_text);
}
if(len == 0)
- return EINA_TRUE;
+ return EINA_TRUE;
else
- return EINA_FALSE;
+ return EINA_FALSE;
}
static void
if(!_empty_entry(wd->entry))
{
- if(wd->eraser_show)
- edje_object_signal_emit(wd->base, "elm,state,eraser,show", "elm");
+ if(wd->eraser_show)
+ edje_object_signal_emit(wd->base, "elm,state,eraser,show", "elm");
}
else
{
- if(wd->eraser_show)
- edje_object_signal_emit(wd->base, "elm,state,eraser,hidden", "elm");
+ if(wd->eraser_show)
+ edje_object_signal_emit(wd->base, "elm,state,eraser,hidden", "elm");
}
}
if(!wd || !wd->base) return;
if(!strcmp(source, "eraser"))
- {
- elm_entry_entry_set(wd->entry, "");
- edje_object_signal_emit(wd->base, "elm,state,eraser,hidden", "elm");
- }
+ {
+ elm_entry_entry_set(wd->entry, "");
+ edje_object_signal_emit(wd->base, "elm,state,eraser,hidden", "elm");
+ }
else if(strcmp(source, "left_icon") && strcmp(source, "right_icon") && strcmp(source, "eraser"))
{
- edje_object_signal_emit(wd->base, "elm,state,over,hide", "elm");
-
- elm_object_focus(wd->entry);
-
- if(wd->editing == EINA_FALSE)
- elm_entry_cursor_end_set(wd->entry);
-
- if(!(_empty_entry(wd->entry)) && (wd->eraser_show))
- edje_object_signal_emit(wd->base, "elm,state,eraser,show", "elm");
-
- if(wd->guide_text)
- {
- edje_object_signal_emit(wd->base, "elm,state,guidetext,hidden", "elm");
- wd->show_guide_text = EINA_FALSE;
- }
- evas_object_smart_callback_call(data, "clicked", NULL);
- wd->editing = EINA_TRUE;
+ edje_object_signal_emit(wd->base, "elm,state,over,hide", "elm");
+
+ elm_object_focus(wd->entry);
+
+ if(wd->editing == EINA_FALSE)
+ elm_entry_cursor_end_set(wd->entry);
+
+ if(!(_empty_entry(wd->entry)) && (wd->eraser_show))
+ edje_object_signal_emit(wd->base, "elm,state,eraser,show", "elm");
+
+ if(wd->guide_text)
+ {
+ edje_object_signal_emit(wd->base, "elm,state,guidetext,hidden", "elm");
+ wd->show_guide_text = EINA_FALSE;
+ }
+ evas_object_smart_callback_call(data, "clicked", NULL);
+ wd->editing = EINA_TRUE;
}
}
e = evas_object_evas_get(parent);
if (e == NULL)
- return NULL;
+ return NULL;
wd = ELM_NEW(Widget_Data);
obj = elm_widget_add(e);
ELM_SET_WIDTYPE(widtype, "editfield");
_elm_theme_object_set(obj, wd->base, "editfield", "base", "default");
elm_widget_resize_object_set(obj, wd->base);
edje_object_signal_callback_add(wd->base, "mouse,clicked,1", "*",
- _signal_mouse_clicked, obj);
+ _signal_mouse_clicked, obj);
edje_object_signal_callback_add(wd->base, "clicked", "*",
- _signal_mouse_clicked, obj);
+ _signal_mouse_clicked, obj);
evas_object_event_callback_add(wd->base, EVAS_CALLBACK_RESIZE, _resize_cb, obj);
evas_object_size_hint_weight_set(wd->entry, 0, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(wd->entry, 0, EVAS_HINT_FILL);
evas_object_event_callback_add(wd->entry,
- EVAS_CALLBACK_CHANGED_SIZE_HINTS,
- _changed_size_hints, obj);
+ EVAS_CALLBACK_CHANGED_SIZE_HINTS,
+ _changed_size_hints, obj);
edje_object_part_swallow(wd->base, "elm.swallow.content", wd->entry);
evas_object_smart_callback_add(wd->entry, "changed", _entry_changed_cb, obj);
elm_widget_sub_object_add(obj, wd->entry);
Widget_Data *wd = elm_widget_data_get(obj);
ELM_CHECK_WIDTYPE(obj, widtype);
if (!wd || !wd->base)
- return;
+ return;
if (wd->label)
- eina_stringshare_del(wd->label);
+ eina_stringshare_del(wd->label);
if (label)
{
- wd->label = eina_stringshare_add(label);
- edje_object_signal_emit(wd->base, "elm,state,text,visible", "elm");
- edje_object_signal_emit(wd->base, "elm,state,left,icon,hide", "elm");
+ wd->label = eina_stringshare_add(label);
+ edje_object_signal_emit(wd->base, "elm,state,text,visible", "elm");
+ edje_object_signal_emit(wd->base, "elm,state,left,icon,hide", "elm");
}
else
{
- wd->label = NULL;
- edje_object_signal_emit(wd->base, "elm,state,text,hidden", "elm");
- edje_object_signal_emit(wd->base, "elm,state,left,icon,show", "elm");
+ wd->label = NULL;
+ edje_object_signal_emit(wd->base, "elm,state,text,hidden", "elm");
+ edje_object_signal_emit(wd->base, "elm,state,left,icon,show", "elm");
}
edje_object_message_signal_process(wd->base);
edje_object_part_text_set(wd->base, "elm.text", label);
Widget_Data *wd = elm_widget_data_get(obj);
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
if (!wd || !wd->base)
- return NULL;
- return wd->label;
+ return NULL;
+ return wd->label;
}
/**
Widget_Data *wd = elm_widget_data_get(obj);
ELM_CHECK_WIDTYPE(obj, widtype);
if (!wd || !wd->base)
- return;
+ return;
if (wd->guide_text)
- eina_stringshare_del(wd->guide_text);
+ eina_stringshare_del(wd->guide_text);
if (text)
{
- wd->guide_text = eina_stringshare_add(text);
- edje_object_part_text_set(wd->base, "elm.guidetext", wd->guide_text);
- wd->show_guide_text = EINA_TRUE;
+ wd->guide_text = eina_stringshare_add(text);
+ edje_object_part_text_set(wd->base, "elm.guidetext", wd->guide_text);
+ wd->show_guide_text = EINA_TRUE;
}
else
- wd->guide_text = NULL;
+ wd->guide_text = NULL;
}
/**
Widget_Data *wd = elm_widget_data_get(obj);
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
if (!wd || !wd->base)
- return NULL;
+ return NULL;
return wd->guide_text;
}
Widget_Data *wd = elm_widget_data_get(obj);
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
if (!wd)
- return NULL;
+ return NULL;
return wd->entry;
}
Widget_Data *wd = elm_widget_data_get(obj);
ELM_CHECK_WIDTYPE(obj, widtype) ;
if (!wd || !wd->base || !icon)
- return;
+ return;
if ((wd->licon != icon) && (wd->licon))
- elm_widget_sub_object_del(obj, wd->licon);
+ elm_widget_sub_object_del(obj, wd->licon);
if (icon)
{
- if (!(edje_object_part_swallow(wd->base, "left_icon", icon)))
- return;
- wd->licon = icon;
- elm_widget_sub_object_add(obj, icon);
- evas_object_event_callback_add(icon, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
- _changed_size_hints, obj);
- edje_object_signal_emit(wd->base, "elm,state,left,icon,show", "elm");
- edje_object_signal_emit(wd->base, "elm,state,text,hidden", "elm");
- _sizing_eval(obj);
+ if (!(edje_object_part_swallow(wd->base, "left_icon", icon)))
+ return;
+ wd->licon = icon;
+ elm_widget_sub_object_add(obj, icon);
+ evas_object_event_callback_add(icon, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
+ _changed_size_hints, obj);
+ edje_object_signal_emit(wd->base, "elm,state,left,icon,show", "elm");
+ edje_object_signal_emit(wd->base, "elm,state,text,hidden", "elm");
+ _sizing_eval(obj);
}
return;
}
Widget_Data *wd = elm_widget_data_get(obj);
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
if (!wd || !wd->base || !wd->licon)
- return NULL;
+ return NULL;
return wd->licon;
}
Widget_Data *wd = elm_widget_data_get(obj);
ELM_CHECK_WIDTYPE(obj, widtype) ;
if (!wd || !wd->base || !icon)
- return;
+ return;
if ((wd->ricon != icon) && (wd->ricon))
- elm_widget_sub_object_del(obj, wd->ricon);
+ elm_widget_sub_object_del(obj, wd->ricon);
if (icon)
{
- if ( !(edje_object_part_swallow(wd->base, "right_icon", icon)) )
- return;
- wd->ricon = icon;
- elm_widget_sub_object_add(obj, icon);
- evas_object_event_callback_add(icon, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
- _changed_size_hints, obj);
- edje_object_signal_emit(wd->base, "elm,state,right,icon,show", "elm");
- _sizing_eval(obj);
+ if ( !(edje_object_part_swallow(wd->base, "right_icon", icon)) )
+ return;
+ wd->ricon = icon;
+ elm_widget_sub_object_add(obj, icon);
+ evas_object_event_callback_add(icon, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
+ _changed_size_hints, obj);
+ edje_object_signal_emit(wd->base, "elm,state,right,icon,show", "elm");
+ _sizing_eval(obj);
}
return;
}
Widget_Data *wd = elm_widget_data_get(obj);
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
if (!wd || !wd->base || !wd->ricon)
- return NULL;
+ return NULL;
return wd->ricon;
}
Evas_Object *entry;
ELM_CHECK_WIDTYPE(obj, widtype);
if (!wd || !wd->base || wd->single_line == single_line)
- return;
+ return;
wd->single_line = single_line;
elm_entry_single_line_set(wd->entry, single_line);
if(single_line) {
- if(!wd->scroller){
- wd->scroller = elm_scroller_add(obj);
- elm_scroller_bounce_set(wd->scroller, 0, 0);
- elm_scroller_policy_set(wd->scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
- elm_widget_sub_object_add(obj, wd->scroller);
- elm_scroller_content_min_limit(wd->scroller, 0, 1);
- }
- edje_object_part_unswallow(wd->base, wd->entry);
- edje_object_part_swallow(wd->base, "elm.swallow.content", wd->scroller);
- evas_object_size_hint_weight_set(wd->entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(wd->entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
-
- elm_scroller_content_set(wd->scroller, wd->entry);
+ if(!wd->scroller){
+ wd->scroller = elm_scroller_add(obj);
+ elm_scroller_bounce_set(wd->scroller, 0, 0);
+ elm_scroller_policy_set(wd->scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
+ elm_widget_sub_object_add(obj, wd->scroller);
+ elm_scroller_content_min_limit(wd->scroller, 0, 1);
+ }
+ edje_object_part_unswallow(wd->base, wd->entry);
+ edje_object_part_swallow(wd->base, "elm.swallow.content", wd->scroller);
+ evas_object_size_hint_weight_set(wd->entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(wd->entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+ elm_scroller_content_set(wd->scroller, wd->entry);
}
else {
- entry = elm_entry_add(obj);
- elm_object_style_set(entry, "editfield");
- evas_object_size_hint_weight_set(entry, 0, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(entry, 0, EVAS_HINT_FILL);
- evas_object_event_callback_add(entry,
- EVAS_CALLBACK_CHANGED_SIZE_HINTS,
- _changed_size_hints, obj);
- edje_object_part_swallow(wd->base, "elm.swallow.content", entry);
- evas_object_smart_callback_add(entry, "changed", _entry_changed_cb, obj);
- elm_widget_sub_object_add(obj, entry);
- elm_entry_entry_set(entry, elm_entry_entry_get(wd->entry));
- if(wd->scroller)
- edje_object_part_unswallow(wd->base, wd->scroller);
- evas_object_del(wd->entry);
- wd->entry = entry;
- edje_object_part_swallow(wd->base, "elm.swallow.content", wd->entry);
+ entry = elm_entry_add(obj);
+ elm_object_style_set(entry, "editfield");
+ evas_object_size_hint_weight_set(entry, 0, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(entry, 0, EVAS_HINT_FILL);
+ evas_object_event_callback_add(entry,
+ EVAS_CALLBACK_CHANGED_SIZE_HINTS,
+ _changed_size_hints, obj);
+ edje_object_part_swallow(wd->base, "elm.swallow.content", entry);
+ evas_object_smart_callback_add(entry, "changed", _entry_changed_cb, obj);
+ elm_widget_sub_object_add(obj, entry);
+ elm_entry_entry_set(entry, elm_entry_entry_get(wd->entry));
+ if(wd->scroller)
+ edje_object_part_unswallow(wd->base, wd->scroller);
+ evas_object_del(wd->entry);
+ wd->entry = entry;
+ edje_object_part_swallow(wd->base, "elm.swallow.content", wd->entry);
}
}
Widget_Data *wd = elm_widget_data_get(obj);
ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
if (!wd || !wd->base)
- return EINA_FALSE;
+ return EINA_FALSE;
return wd->single_line;
}
Widget_Data *wd = elm_widget_data_get(obj);
ELM_CHECK_WIDTYPE(obj, widtype);
if (!wd || !wd->base)
- return;
-
+ return;
+
wd->eraser_show = visible;
if (!visible)
- edje_object_signal_emit(wd->base, "elm,state,eraser,hidden", "elm");
-
+ edje_object_signal_emit(wd->base, "elm,state,eraser,hidden", "elm");
+
return;
}
Widget_Data *wd = elm_widget_data_get(obj);
ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
if (!wd || !wd->base)
- return EINA_FALSE;
+ return EINA_FALSE;
return wd->eraser_show;
}
+
+/* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/