fix toolbar icon size property to actually work as expected.

fix toolbar select cb to only be callled if select always is on or
item WAS unselected before (as per docs).



SVN revision: 75512
This commit is contained in:
Carsten Haitzler 2012-08-22 03:11:23 +00:00
parent a538ef86f0
commit a4175ba928
2 changed files with 94 additions and 22 deletions

View File

@ -1,7 +1,7 @@
#define ITEM_STATE_ENABLED 0
#define ITEM_STATE_DISABLED 1
#define BUTTON_CONTROLBAR_ITEM_BUTTON_ICON_SIZE_INC 32 32
#define BUTTON_CONTROLBAR_ITEM_BUTTON_ICON_SIZE_INC 16 16
group { name: "elm/toolbar/base/default";
images {
@ -10,6 +10,8 @@ group { name: "elm/toolbar/base/default";
image: "bt_dis_shine.png" COMP;
image: "arrow_right.png" COMP;
image: "arrow_left.png" COMP;
image: "arrow_up.png" COMP;
image: "arrow_down.png" COMP;
}
parts {
part { name: "base";
@ -75,6 +77,13 @@ group { name: "elm/toolbar/base/default";
color: 255 255 255 128;
}
}
part { name: "event"; type: RECT;
mouse_events: 1;
repeat_events: 1;
description { state: "default" 0.0;
color: 0 0 0 0;
}
}
part { name: "left_arrow";
scale: 1;
description { state: "default" 0.0;
@ -103,11 +112,32 @@ group { name: "elm/toolbar/base/default";
visible: 1;
}
}
part { name: "event"; type: RECT;
mouse_events: 1;
repeat_events: 1;
part { name: "up_arrow";
scale: 1;
description { state: "default" 0.0;
color: 0 0 0 0;
image.normal: "arrow_up.png";
align: 0.5 0.0;
min: 22 22;
max: 22 22;
visible: 0;
}
description { state: "visible" 0.0;
inherit: "default" 0.0;
visible: 1;
}
}
part { name: "down_arrow";
scale: 1;
description { state: "default" 0.0;
image.normal: "arrow_down.png";
align: 0.5 1.0;
min: 22 22;
max: 22 22;
visible: 0;
}
description { state: "visible" 0.0;
inherit: "default" 0.0;
visible: 1;
}
}
}
@ -136,16 +166,50 @@ group { name: "elm/toolbar/base/default";
action: STATE_SET "default" 0.0;
target: "right_arrow";
}
program { name: "up_show";
signal: "elm,action,show,up";
source: "elm";
action: STATE_SET "visible" 0.0;
target: "up_arrow";
}
program { name: "up_hide";
signal: "elm,action,hide,up";
source: "elm";
action: STATE_SET "default" 0.0;
target: "up_arrow";
}
program { name: "down_show";
signal: "elm,action,show,down";
source: "elm";
action: STATE_SET "visible" 0.0;
target: "down_arrow";
}
program { name: "down_hide";
signal: "elm,action,hide,down";
source: "elm";
action: STATE_SET "default" 0.0;
target: "down_arrow";
}
program { name: "left_go";
signal: "mouse,down,1";
signal: "mouse,up,1";
source: "left_arrow";
action: SIGNAL_EMIT "elm,action,left" "elm";
}
program { name: "right_go";
signal: "mouse,down,1";
signal: "mouse,up,1";
source: "right_arrow";
action: SIGNAL_EMIT "elm,action,right" "elm";
}
program { name: "up_go";
signal: "mouse,up,1";
source: "up_arrow";
action: SIGNAL_EMIT "elm,action,up" "elm";
}
program { name: "down_go";
signal: "mouse,up,1";
source: "down_arrow";
action: SIGNAL_EMIT "elm,action,down" "elm";
}
}
}
@ -772,7 +836,7 @@ group { name: "elm/toolbar/item/item_horizontal";
parts {
part { name: "elm.swallow.icon";
description { state: "default" 0.0;
fixed: 1 1;
fixed: 0 0;
aspect: 1 1;
aspect_preference: VERTICAL;
align: 0.0 0.5;

View File

@ -15,7 +15,7 @@ struct _Widget_Data
Elm_Toolbar_Item *reorder_from, *reorder_to;
Elm_Toolbar_Shrink_Mode shrink_mode;
Elm_Icon_Lookup_Order lookup_order;
int icon_size;
int theme_icon_size, priv_icon_size, icon_size;
int standard_priority;
unsigned int item_count;
double align;
@ -135,10 +135,9 @@ end:
static int
_elm_toolbar_icon_size_get(Widget_Data *wd)
{
const char *icon_size = edje_object_data_get(
elm_smart_scroller_edje_object_get(wd->scr), "icon_size");
if (icon_size)
return atoi(icon_size);
const char *icon_size = edje_object_data_get
(elm_smart_scroller_edje_object_get(wd->scr), "icon_size");
if (icon_size) return atoi(icon_size);
return _elm_config->icon_size;
}
@ -245,7 +244,10 @@ _item_select(Elm_Toolbar_Item *it)
_menu_move_resize(it, NULL, NULL, NULL);
}
if (it->func) it->func((void *)(it->base.data), WIDGET(it), it);
if ((!sel) || (wd->select_mode == ELM_OBJECT_SELECT_MODE_ALWAYS))
{
if (it->func) it->func((void *)(it->base.data), WIDGET(it), it);
}
evas_object_smart_callback_call(obj2, SIG_CLICKED, it);
}
@ -433,7 +435,7 @@ _mirrored_set(Evas_Object *obj, Eina_Bool mirrored)
Elm_Toolbar_Item *it;
EINA_INLIST_FOREACH(wd->items, it)
_mirrored_set_item(obj, it, mirrored);
_mirrored_set_item(obj, it, mirrored);
if (wd->more_item)
_mirrored_set_item(obj, wd->more_item, mirrored);
}
@ -452,9 +454,11 @@ _theme_hook(Evas_Object *obj)
_mirrored_set(obj, elm_widget_mirrored_get(obj));
scale = (elm_widget_scale_get(obj) * _elm_config->scale);
edje_object_scale_set(wd->scr, scale);
wd->icon_size = _elm_toolbar_icon_size_get(wd);
wd->theme_icon_size = _elm_toolbar_icon_size_get(wd);
if (wd->priv_icon_size) wd->icon_size = wd->priv_icon_size;
else wd->icon_size = wd->theme_icon_size;
EINA_INLIST_FOREACH(wd->items, it)
_theme_hook_item(obj, it, scale, wd->icon_size);
_theme_hook_item(obj, it, scale, wd->icon_size);
if (wd->more_item)
_theme_hook_item(obj, wd->more_item, scale, wd->icon_size);
_sizing_eval(obj);
@ -1750,8 +1754,10 @@ elm_toolbar_add(Evas_Object *parent)
_elm_toolbar_action_down_cb, obj);
wd->shrink_mode = ELM_TOOLBAR_SHRINK_NONE;
wd->icon_size = _elm_toolbar_icon_size_get(wd);
wd->priv_icon_size = 0; // unset
wd->theme_icon_size = _elm_toolbar_icon_size_get(wd);
if (wd->priv_icon_size) wd->icon_size = wd->priv_icon_size;
else wd->icon_size = wd->theme_icon_size;
wd->homogeneous = EINA_TRUE;
wd->align = 0.5;
@ -1800,8 +1806,10 @@ elm_toolbar_icon_size_set(Evas_Object *obj, int icon_size)
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
if (wd->icon_size == icon_size) return;
wd->icon_size = icon_size;
if (wd->priv_icon_size == icon_size) return;
wd->priv_icon_size = icon_size;
if (wd->priv_icon_size) wd->icon_size = wd->priv_icon_size;
else wd->icon_size = wd->theme_icon_size;
_theme_hook(obj);
}
@ -1811,7 +1819,7 @@ elm_toolbar_icon_size_get(const Evas_Object *obj)
ELM_CHECK_WIDTYPE(obj, widtype) 0;
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return 0;
return wd->icon_size;
return wd->priv_icon_size;
}
EAPI Elm_Object_Item *