working on nuts and bolts to do a multi-sel widget (hoversel).

SVN revision: 38012
This commit is contained in:
Carsten Haitzler 2008-12-08 09:24:46 +00:00
parent 5277ddf68c
commit 614421e098
13 changed files with 859 additions and 17 deletions

View File

@ -62,7 +62,12 @@ shelf_inset.png \
tog_base.png \
shad_circ.png \
bt_dis_base.png \
bt_dis_hilight.png
bt_dis_hilight.png \
outdent-top.png \
outdent-bottom.png \
updown.png \
leftright.png \
hoversel_entry_bg.png
default.edj: Makefile $(EXTRA_DIST)
$(EDJE_CC) $(EDJE_FLAGS) \

View File

@ -633,6 +633,390 @@ collections {
}
}
group { name: "elm/button/base/hoversel_vertical";
images {
image: "bt_base1.png" COMP;
image: "bt_base2.png" COMP;
image: "bt_hilight.png" COMP;
image: "bt_shine.png" COMP;
image: "bt_glow.png" COMP;
image: "updown.png" COMP;
}
parts {
part { name: "button_image";
mouse_events: 1;
description { state: "default" 0.0;
image {
normal: "bt_base2.png";
border: 7 7 7 7;
}
}
description { state: "clicked" 0.0;
inherit: "default" 0.0;
image.normal: "bt_base1.png";
}
}
part { name: "arrow";
mouse_events: 0;
description { state: "default" 0.0;
image.normal: "updown.png";
aspect: 0.6666666666 0.6666666666;
aspect_preference: VERTICAL;
rel1.offset: 6 7;
rel2.offset: 6 -7;
rel2.relative: 0.0 1.0;
align: 0.0 0.5;
}
}
part { name: "elm.swallow.content";
type: SWALLOW;
description { state: "default" 0.0;
visible: 0;
align: 0.0 0.5;
rel1 {
to_x: "arrow";
offset: 2 4;
relative: 1.0 0.0;
}
rel2 {
to_x: "arrow";
offset: 1 -5;
relative: 1.0 1.0;
}
}
description { state: "visible" 0.0;
inherit: "default" 0.0;
visible: 1;
aspect: 1.0 1.0;
aspect_preference: VERTICAL;
rel2.offset: 2 -5;
}
description { state: "icononly" 0.0;
inherit: "default" 0.0;
visible: 1;
align: 0.5 0.5;
aspect: 1.0 1.0;
rel1 {
to_x: "button_image";
offset: -5 -5;
relative: 1.0 1.0;
}
aspect_preference: VERTICAL;
}
}
part {
name: "elm.text";
type: TEXT;
effect: SOFT_SHADOW;
mouse_events: 0;
scale: 1;
description { state: "default" 0.0;
visible: 0;
rel1.to_x: "elm.swallow.content";
rel1.relative: 1.0 0.0;
rel1.offset: 0 4;
rel2.offset: -5 -5;
color: 224 224 224 255;
color3: 0 0 0 64;
text {
font: "Sans,Edje-Vera";
size: 10;
min: 0 0;
align: 0.5 0.5;
}
}
description { state: "visible" 0.0;
inherit: "default" 0.0;
visible: 1;
text.min: 1 1;
}
}
part { name: "over1";
mouse_events: 0;
description { state: "default" 0.0;
rel2.relative: 1.0 0.5;
image {
normal: "bt_hilight.png";
border: 7 7 7 0;
}
}
}
part { name: "over2";
mouse_events: 1;
repeat_events: 1;
ignore_flags: ON_HOLD;
description { state: "default" 0.0;
image {
normal: "bt_shine.png";
border: 7 7 7 7;
}
}
}
part { name: "over3";
mouse_events: 1;
repeat_events: 1;
description { state: "default" 0.0;
color: 255 255 255 0;
image {
normal: "bt_glow.png";
border: 12 12 12 12;
middle: 0;
}
}
description { state: "clicked" 0.0;
inherit: "default" 0.0;
visible: 1;
color: 255 255 255 255;
}
}
}
programs {
program {
name: "button_click";
signal: "mouse,down,1";
source: "over2";
action: STATE_SET "clicked" 0.0;
target: "button_image";
}
program {
name: "button_unclick";
signal: "mouse,up,1";
source: "over2";
action: STATE_SET "default" 0.0;
target: "button_image";
}
program {
name: "button_click2";
signal: "mouse,down,1";
source: "over3";
action: STATE_SET "clicked" 0.0;
target: "over3";
}
program {
name: "button_unclick2";
signal: "mouse,up,1";
source: "over3";
action: STATE_SET "default" 0.0;
transition: DECELERATE 0.5;
target: "over3";
}
program {
name: "button_unclick3";
signal: "mouse,up,1";
source: "over2";
action: SIGNAL_EMIT "elm,action,click" "";
}
program { name: "text_show";
signal: "elm,state,text,visible";
source: "elm";
script {
new st[31];
new Float:vl;
get_state(PART:"elm.swallow.content", st, 30, vl);
if (!strcmp(st, "icononly"))
set_state(PART:"elm.swallow.content", "visible", 0.0);
set_state(PART:"elm.text", "visible", 0.0);
}
}
program { name: "text_hide";
signal: "elm,state,text,hidden";
source: "elm";
script {
new st[31];
new Float:vl;
get_state(PART:"elm.swallow.content", st, 30, vl);
if (!strcmp(st, "visible"))
set_state(PART:"elm.swallow.content", "icononly", 0.0);
set_state(PART:"elm.text", "default", 0.0);
}
}
program { name: "icon_show";
signal: "elm,state,icon,visible";
source: "elm";
script {
new st[31];
new Float:vl;
get_state(PART:"elm.text", st, 30, vl);
if (!strcmp(st, "visible"))
set_state(PART:"elm.swallow.content", "visible", 0.0);
else
set_state(PART:"elm.swallow.content", "icononly", 0.0);
}
}
program { name: "icon_hide";
signal: "elm,state,icon,hidden";
source: "elm";
action: STATE_SET "default" 0.0;
target: "elm.swallow.content";
}
}
}
group { name: "elm/button/base/hoversel_vertical_entry";
images {
image: "hoversel_entry_bg.png" COMP;
}
parts {
part { name: "button_image";
mouse_events: 1;
description { state: "default" 0.0;
color: 255 255 255 0;
image.normal: "hoversel_entry_bg.png";
image.border: 0 0 2 2;
fill.smooth: 0;
}
description { state: "clicked" 0.0;
inherit: "default" 0.0;
color: 255 255 255 255;
}
}
part { name: "elm.swallow.content";
type: SWALLOW;
description { state: "default" 0.0;
visible: 0;
align: 0.0 0.5;
rel1.offset: 4 4;
rel2.offset: 3 -5;
rel2.relative: 0.0 1.0;
}
description { state: "visible" 0.0;
inherit: "default" 0.0;
visible: 1;
aspect: 1.0 1.0;
aspect_preference: VERTICAL;
rel2.offset: 4 -5;
}
description { state: "icononly" 0.0;
inherit: "default" 0.0;
visible: 1;
align: 0.5 0.5;
aspect: 1.0 1.0;
rel2.offset: -5 -5;
rel2.relative: 1.0 1.0;
aspect_preference: VERTICAL;
}
}
part { name: "textvis";
type: RECT;
mouse_events: 0;
description { state: "default" 0.0;
visible: 0;
}
description { state: "visible" 0.0;
visible: 1;
}
}
part {
name: "elm.text";
type: TEXT;
effect: SOFT_SHADOW;
mouse_events: 0;
scale: 1;
clip_to: "textvis";
description { state: "default" 0.0;
rel1.to_x: "elm.swallow.content";
rel1.relative: 1.0 0.0;
rel1.offset: 0 4;
rel2.offset: -5 -5;
color: 224 224 224 255;
color3: 0 0 0 64;
text {
font: "Sans,Edje-Vera";
size: 10;
min: 0 0;
align: 0.5 0.5;
}
}
description { state: "visible" 0.0;
inherit: "default" 0.0;
text.min: 1 1;
}
description { state: "clicked" 0.0;
inherit: "default" 0.0;
text.min: 1 1;
color: 0 0 0 255;
color3: 0 0 0 0;
}
}
part { name: "over2";
type: RECT;
mouse_events: 1;
description { state: "default" 0.0;
color: 0 0 0 0;
}
}
}
programs {
program {
name: "button_click";
signal: "mouse,down,1";
source: "over2";
action: STATE_SET "clicked" 0.0;
target: "button_image";
target: "elm.text";
}
program {
name: "button_unclick";
signal: "mouse,up,1";
source: "over2";
action: STATE_SET "default" 0.0;
target: "button_image";
target: "elm.text";
}
program {
name: "button_unclick3";
signal: "mouse,up,1";
source: "over2";
action: SIGNAL_EMIT "elm,action,click" "";
}
program { name: "text_show";
signal: "elm,state,text,visible";
source: "elm";
script {
new st[31];
new Float:vl;
get_state(PART:"elm.swallow.content", st, 30, vl);
if (!strcmp(st, "icononly"))
set_state(PART:"elm.swallow.content", "visible", 0.0);
set_state(PART:"textvis", "visible", 0.0);
set_state(PART:"elm.text", "visible", 0.0);
}
}
program { name: "text_hide";
signal: "elm,state,text,hidden";
source: "elm";
script {
new st[31];
new Float:vl;
get_state(PART:"elm.swallow.content", st, 30, vl);
if (!strcmp(st, "visible"))
set_state(PART:"elm.swallow.content", "icononly", 0.0);
set_state(PART:"textvis", "default", 0.0);
set_state(PART:"elm.text", "default", 0.0);
}
}
program { name: "icon_show";
signal: "elm,state,icon,visible";
source: "elm";
script {
new st[31];
new Float:vl;
get_state(PART:"textvis", st, 30, vl);
if (!strcmp(st, "visible"))
set_state(PART:"elm.swallow.content", "visible", 0.0);
else
set_state(PART:"elm.swallow.content", "icononly", 0.0);
}
}
program { name: "icon_hide";
signal: "elm,state,icon,hidden";
source: "elm";
action: STATE_SET "default" 0.0;
target: "elm.swallow.content";
}
}
}
///////////////////////////////////////////////////////////////////////////////
group { name: "elm/toggle/base/default";
images {
@ -2216,6 +2600,52 @@ collections {
}
}
group { name: "elm/frame/base/outdent_top";
images {
image: "outdent-top.png" COMP;
}
parts {
part { name: "base0";
mouse_events: 0;
description { state: "default" 0.0;
image.normal: "outdent-top.png";
image.border: 0 0 0 13;
fill.smooth: 0;
}
}
part { name: "elm.swallow.content";
type: SWALLOW;
description { state: "default" 0.0;
rel1.offset: 2 2;
rel2.offset: -3 -13;
}
}
}
}
group { name: "elm/frame/base/outdent_bottom";
images {
image: "outdent-bottom.png" COMP;
}
parts {
part { name: "base0";
mouse_events: 0;
description { state: "default" 0.0;
image.normal: "outdent-bottom.png";
image.border: 0 0 13 0;
fill.smooth: 0;
}
}
part { name: "elm.swallow.content";
type: SWALLOW;
description { state: "default" 0.0;
rel1.offset: 2 12;
rel2.offset: -3 -3;
}
}
}
}
///////////////////////////////////////////////////////////////////////////////
group { name: "elm/hover/base/default";
images {
@ -2334,7 +2764,6 @@ collections {
}
}
///////////////////////////////////////////////////////////////////////////////
group { name: "elm/hover/base/popout";
images {
image: "shad_circ.png" COMP;
@ -2723,7 +3152,6 @@ collections {
source: "elm";
action: STATE_SET "visible" 0.0;
transition: DECELERATE 0.5;
target: "bottom";
target: "elm.swallow.slot.bottom";
}
program { name: "bottomhide";
@ -2731,12 +3159,279 @@ collections {
source: "elm";
action: STATE_SET "default" 0.0;
transition: DECELERATE 0.5;
target: "bottom";
target: "elm.swallow.slot.bottom";
}
}
}
group { name: "elm/hover/base/hoversel_vertical";
images {
image: "shad_circ.png" COMP;
image: "bt_base2.png" COMP;
image: "bt_hilight.png" COMP;
image: "bt_shine.png" COMP;
image: "outdent-top.png" COMP;
image: "outdent-bottom.png" COMP;
}
parts {
part { name: "elm.swallow.offset";
type: SWALLOW;
description { state: "default" 0.0;
align: 0.0 0.0;
rel1.relative: 0.0 0.0;
rel2.relative: 0.0 0.0;
}
}
part { name: "elm.swallow.size";
type: SWALLOW;
description { state: "default" 0.0;
align: 0.0 0.0;
rel1.to: "elm.swallow.offset";
rel1.relative: 1.0 1.0;
rel2.to: "elm.swallow.offset";
rel2.relative: 1.0 1.0;
}
}
part { name: "shad";
mouse_events: 0;
description { state: "default" 0.0;
image.normal: "shad_circ.png";
rel1.to: "button_image";
rel1.offset: -64 -64;
rel2.to: "button_image";
rel2.offset: 63 63;
fill.smooth: 0;
}
}
part { name: "button_image";
mouse_events: 1;
description { state: "default" 0.0;
rel1.to: "elm.swallow.slot.top";
rel1.offset: -2 -6;
rel2.to: "elm.swallow.slot.bottom";
rel2.offset: 1 5;
image {
normal: "bt_base2.png";
border: 7 7 7 7;
}
}
}
part { name: "base";
type: RECT;
mouse_events: 1;
description { state: "default" 0.0;
color: 0 0 0 0;
}
description { state: "visible" 0.0;
inherit: "default" 1.0;
color: 0 0 0 64;
}
}
part { name: "topclip";
type: RECT;
description { state: "default" 0.0;
rel2.to_y: "edge_top";
rel2.relative: 1.0 0.0;
rel2.offset: -1 7;
}
}
part { name: "elm.swallow.slot.top";
type: SWALLOW;
clip_to: "topclip";
description { state: "default" 0.0;
visible: 1;
align: 0.5 0.0;
rel1.to: "elm.swallow.slot.middle";
rel1.relative: 0.0 0.0;
rel1.offset: 0 -1;
rel2.to: "elm.swallow.slot.middle";
rel2.relative: 1.0 0.0;
rel2.offset: -1 -1;
}
description { state: "visible" 0.0;
inherit: "default" 0.0;
rel1.offset: 0 -7;
rel2.offset: -1 -7;
align: 0.5 1.0;
}
}
part { name: "bottomclip";
type: RECT;
description { state: "default" 0.0;
rel1.to_y: "edge_bottom";
rel1.relative: 0.0 1.0;
rel1.offset: -1 -8;
}
}
part { name: "elm.swallow.slot.bottom";
type: SWALLOW;
clip_to: "bottomclip";
description { state: "default" 0.0;
align: 0.5 1.0;
rel1.to: "elm.swallow.slot.middle";
rel1.relative: 0.0 1.0;
rel1.offset: 0 0;
rel2.to: "elm.swallow.slot.middle";
rel2.relative: 1.0 1.0;
rel2.offset: -1 0;
}
description { state: "visible" 0.0;
inherit: "default" 0.0;
rel1.offset: 0 6;
rel2.offset: -1 6;
align: 0.5 0.0;
}
}
part { name: "over1";
mouse_events: 0;
description { state: "default" 0.0;
rel1.to: "button_image";
rel2.to: "button_image";
rel2.relative: 1.0 0.5;
image {
normal: "bt_hilight.png";
border: 7 7 7 0;
}
}
}
part { name: "over2";
mouse_events: 1;
repeat_events: 1;
ignore_flags: ON_HOLD;
description { state: "default" 0.0;
rel1.to: "button_image";
rel2.to: "button_image";
image {
normal: "bt_shine.png";
border: 7 7 7 7;
}
}
}
part { name: "edge_top";
mouse_events: 0;
description { state: "default" 0.0;
visible: 0;
rel1 {
to: "elm.swallow.size";
offset: 0 -10;
}
rel2 {
to: "elm.swallow.size";
}
image.normal: "outdent-bottom.png";
image.border: 0 0 13 0;
fill.smooth: 0;
}
description { state: "visible" 0.0;
inherit: "default" 0.0;
visible: 1;
}
}
part { name: "edge_bottom";
mouse_events: 0;
description { state: "default" 0.0;
visible: 0;
rel1 {
to: "elm.swallow.size";
}
rel2 {
to: "elm.swallow.size";
offset: -1 9;
}
image.normal: "outdent-top.png";
image.border: 0 0 0 13;
fill.smooth: 0;
}
description { state: "visible" 0.0;
inherit: "default" 0.0;
visible: 1;
}
}
part { name: "elm.swallow.slot.middle";
type: SWALLOW;
description { state: "default" 0.0;
rel1.to: "elm.swallow.size";
rel2.to: "elm.swallow.size";
}
}
}
programs {
program { name: "end";
signal: "mouse,down,1";
source: "base";
action: SIGNAL_EMIT "elm,action,dismiss" "";
}
program { name: "show";
signal: "elm,action,show";
source: "elm";
action: STATE_SET "visible" 0.0;
// transition: DECELERATE 0.5;
target: "base";
}
program { name: "hide";
signal: "elm,action,hide";
source: "elm";
action: STATE_SET "default" 0.0;
// transition: DECELERATE 0.5;
target: "base";
}
program { name: "topshow";
signal: "elm,action,slot,top,show";
source: "elm";
action: STATE_SET "visible" 0.0;
target: "edge_top";
after: "topshow2";
}
program { name: "topshow2";
action: STATE_SET "visible" 0.0;
transition: DECELERATE 0.5;
target: "elm.swallow.slot.top";
}
program { name: "tophide";
signal: "elm,action,slot,top,hide";
source: "elm";
action: STATE_SET "default" 0.0;
transition: DECELERATE 0.5;
target: "elm.swallow.slot.top";
after: "tophide2";
}
program { name: "tophide2";
action: STATE_SET "default" 0.0;
target: "edge_top";
}
program { name: "bottomshow";
signal: "elm,action,slot,bottom,show";
source: "elm";
action: STATE_SET "visible" 0.0;
target: "edge_bottom";
after: "bottomshow2";
}
program { name: "bottomshow2";
action: STATE_SET "visible" 0.0;
transition: DECELERATE 0.5;
target: "elm.swallow.slot.bottom";
}
program { name: "bottomhide";
signal: "elm,action,slot,bottom,hide";
source: "elm";
action: STATE_SET "default" 0.0;
transition: DECELERATE 0.5;
target: "elm.swallow.slot.bottom";
after: "bottomhide2";
}
program { name: "bottomhide2";
action: STATE_SET "default" 0.0;
target: "edge_bottom";
}
}
}
///////////////////////////////////////////////////////////////////////////////
group { name: "elm/entry/base/default";
styles

Binary file not shown.

After

Width:  |  Height:  |  Size: 782 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -138,6 +138,7 @@ extern "C" {
EAPI Evas_Object *elm_button_add(Evas_Object *parent);
EAPI void elm_button_label_set(Evas_Object *obj, const char *label);
EAPI void elm_button_icon_set(Evas_Object *obj, Evas_Object *icon);
EAPI void elm_button_style_set(Evas_Object *obj, const char *style);
/* smart callbacks called:
* "clicked" - the user clicked the button
*/
@ -166,6 +167,7 @@ extern "C" {
EAPI Evas_Object *elm_frame_add(Evas_Object *parent);
EAPI void elm_frame_label_set(Evas_Object *obj, const char *label);
EAPI void elm_frame_content_set(Evas_Object *obj, Evas_Object *content);
EAPI void elm_frame_style_set(Evas_Object *obj, const char *style);
/* smart callbacks called:
*/

View File

@ -35,12 +35,11 @@ elm_hover.c \
elm_entry.c \
elm_bubble.c \
elm_photo.c \
elm_contact.c \
elm_contactlist.c \
\
elc_notepad.c \
elc_anchorview.c \
elc_anchorblock.c \
elc_hoversel.c \
\
els_pan.c \
els_pan.h \

View File

@ -0,0 +1,115 @@
#include <Elementary.h>
#include "elm_priv.h"
typedef struct _Widget_Data Widget_Data;
struct _Widget_Data
{
Evas_Object *pop, *hover;
Evas_Object *hover_parent;
const char *hover_style;
};
static void _del_pre_hook(Evas_Object *obj);
static void _del_hook(Evas_Object *obj);
static void _sizing_eval(Evas_Object *obj);
static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _parent_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void
_del_pre_hook(Evas_Object *obj)
{
elm_hoversel_hover_end(obj);
elm_hoversel_hover_parent_set(obj, NULL);
}
static void
_del_hook(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
if (wd->hover_style) eina_stringshare_del(wd->hover_style);
free(wd);
}
static void
_sizing_eval(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1;
evas_object_size_hint_min_set(obj, minw, minh);
evas_object_size_hint_max_set(obj, maxw, maxh);
}
static void
_changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
_sizing_eval(data);
}
static void
_hover_clicked(void *data, Evas_Object *obj, void *event_info)
{
elm_hoversel_hover_end(data);
}
static void
_parent_del(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Widget_Data *wd = elm_widget_data_get(data);
wd->hover_parent = NULL;
}
EAPI Evas_Object *
elm_hoversel_add(Evas_Object *parent)
{
Evas_Object *obj;
Evas *e;
Widget_Data *wd;
wd = ELM_NEW(Widget_Data);
e = evas_object_evas_get(parent);
obj = elm_widget_add(e);
elm_widget_data_set(obj, wd);
elm_widget_del_pre_hook_set(obj, _del_pre_hook);
elm_widget_del_hook_set(obj, _del_hook);
// wd->scroller = elm_scroller_add(parent);
// elm_widget_resize_object_set(obj, wd->scroller);
// evas_object_event_callback_add(wd->entry, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
// _changed_size_hints, obj);
_sizing_eval(obj);
return obj;
}
EAPI void
elm_hoversel_hover_parent_set(Evas_Object *obj, Evas_Object *parent)
{
Widget_Data *wd = elm_widget_data_get(obj);
if (wd->hover_parent)
evas_object_event_callback_del(wd->hover_parent, EVAS_CALLBACK_DEL, _parent_del);
wd->hover_parent = parent;
if (wd->hover_parent)
evas_object_event_callback_add(wd->hover_parent, EVAS_CALLBACK_DEL, _parent_del, obj);
}
EAPI void
elm_hoversel_hover_style_set(Evas_Object *obj, const char *style)
{
Widget_Data *wd = elm_widget_data_get(obj);
if (wd->hover_style) eina_stringshare_del(wd->hover_style);
wd->hover_style = NULL;
if (style) wd->hover_style = eina_stringshare_add(style);
}
EAPI void
elm_hoversel_hover_end(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
if (wd->hover) evas_object_del(wd->hover);
if (wd->pop) evas_object_del(wd->pop);
wd->hover = NULL;
wd->pop = NULL;
}

View File

@ -8,6 +8,7 @@ struct _Widget_Data
Evas_Object *btn;
Evas_Object *icon;
const char *label;
const char *style;
};
static void _del_hook(Evas_Object *obj);
@ -22,6 +23,7 @@ _del_hook(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
if (wd->label) eina_stringshare_del(wd->label);
if (wd->style) eina_stringshare_del(wd->style);
free(wd);
}
@ -29,7 +31,10 @@ static void
_theme_hook(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
_elm_theme_set(wd->btn, "button", "base", "default");
if (wd->style) _elm_theme_set(wd->btn, "button", "base", wd->style);
else _elm_theme_set(wd->btn, "button", "base", "default");
if (wd->icon)
edje_object_part_swallow(wd->btn, "elm.swallow.content", wd->icon);
if (wd->label)
edje_object_signal_emit(wd->btn, "elm,state,text,visible", "elm");
else
@ -154,3 +159,13 @@ elm_button_icon_set(Evas_Object *obj, Evas_Object *icon)
else
wd->icon = icon;
}
EAPI void
elm_button_style_set(Evas_Object *obj, const char *style)
{
Widget_Data *wd = elm_widget_data_get(obj);
if (wd->style) eina_stringshare_del(wd->style);
if (style) wd->style = eina_stringshare_add(style);
else wd->style = NULL;
_theme_hook(obj);
}

View File

@ -1,2 +0,0 @@
#include <Elementary.h>
#include "elm_priv.h"

View File

@ -1,2 +0,0 @@
#include <Elementary.h>
#include "elm_priv.h"

View File

@ -7,6 +7,7 @@ struct _Widget_Data
{
Evas_Object *frm;
Evas_Object *content;
const char *style;
};
static void _del_hook(Evas_Object *obj);
@ -19,12 +20,18 @@ static void
_del_hook(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
if (wd->style) eina_stringshare_del(wd->style);
free(wd);
}
static void
_theme_hook(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
if (wd->style) _elm_theme_set(wd->frm, "frame", "base", wd->style);
else _elm_theme_set(wd->frm, "frame", "base", "default");
if (wd->content)
edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->content);
_sizing_eval(obj);
}
@ -109,3 +116,13 @@ elm_frame_content_set(Evas_Object *obj, Evas_Object *content)
_sizing_eval(obj);
}
}
EAPI void
elm_frame_style_set(Evas_Object *obj, const char *style)
{
Widget_Data *wd = elm_widget_data_get(obj);
if (wd->style) eina_stringshare_del(wd->style);
if (style) wd->style = eina_stringshare_add(style);
else wd->style = NULL;
_theme_hook(obj);
}

View File

@ -67,11 +67,8 @@ _theme_hook(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
// FIXME: hover contents doesnt seem to propagate resizes properly
if (wd->style)
_elm_theme_set(wd->cov, "hover", "base", wd->style);
else
_elm_theme_set(wd->cov, "hover", "base", "default");
edje_object_message_signal_process(wd->cov);
if (wd->style) _elm_theme_set(wd->cov, "hover", "base", wd->style);
else _elm_theme_set(wd->cov, "hover", "base", "default");
_reval_content(obj);
_sizing_eval(obj);
if (evas_object_visible_get(wd->cov)) _hov_show_do(obj);
@ -386,7 +383,8 @@ elm_hover_style_set(Evas_Object *obj, const char *style)
if (wd->style) eina_stringshare_del(wd->style);
if (style) wd->style = eina_stringshare_add(style);
else wd->style = NULL;
_elm_theme_set(wd->cov, "hover", "base", style);
if (wd->style) _elm_theme_set(wd->cov, "hover", "base", wd->style);
else _elm_theme_set(wd->cov, "hover", "base", "default");
_reval_content(obj);
_sizing_eval(obj);
}