add "clicked" signal for elm_frame

SVN revision: 66818
This commit is contained in:
Mike Blumenkrantz 2012-01-04 00:41:37 +00:00
parent 49ace8dd7b
commit 091bde8aaa
3 changed files with 30 additions and 2 deletions

View File

@ -35,7 +35,6 @@ group { name: "elm/frame/base/default";
}
part { name: "elm.text";
type: TEXT;
mouse_events: 0;
scale: 1;
description { state: "default" 0.0;
align: 0.0 0.0;
@ -85,6 +84,13 @@ group { name: "elm/frame/base/default";
}
}
}
programs {
program { name: "click";
signal: "mouse,up,1";
source: "elm.text";
action: SIGNAL_EMIT "elm,action,click" "elm";
}
}
}
group { name: "elm/frame/base/pad_small";

View File

@ -10,6 +10,13 @@ struct _Widget_Data
const char *label;
};
static const char SIG_CLICKED[] = "clicked";
static const Evas_Smart_Cb_Description _signals[] = {
{SIG_CLICKED, ""},
{NULL, NULL}
};
static const char *widtype = NULL;
static void _del_hook(Evas_Object *obj);
static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl);
@ -178,6 +185,15 @@ _content_unset_hook(Evas_Object *obj, const char *part)
return content;
}
static void
_signal_click(void *data __UNUSED__, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
{
Widget_Data *wd;
wd = elm_widget_data_get(obj);
if (!wd) return;
evas_object_smart_callback_call(obj, SIG_CLICKED, NULL);
}
EAPI Evas_Object *
elm_frame_add(Evas_Object *parent)
{
@ -206,6 +222,9 @@ elm_frame_add(Evas_Object *parent)
elm_widget_resize_object_set(obj, wd->frm);
evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj);
edje_object_signal_callback_add(obj, "elm,action,click", "elm",
_signal_click, NULL);
evas_object_smart_callbacks_descriptions_set(obj, _signals);
_mirrored_set(obj, elm_widget_mirrored_get(obj));
_sizing_eval(obj);

View File

@ -16,7 +16,10 @@
* @li outdent_top
* @li outdent_bottom
*
* Of all this styles only default shows the title. Frame emits no signals.
* Of all this styles only default shows the title.
*
* Smart callbacks one can listen to:
* - @c "clicked" - The user has clicked the frame's label
*
* Default contents parts of the frame widget that you can use for are:
* @li "default" - A content of the frame