* CODE. THIS IS ELEMENTARY'S INTERNAL WIDGET API (for now) AND IS NOT
* FINAL. CALL elm_widget_api_check(ELM_INTERNAL_API_VERSION) TO CHECK IT
* AT RUNTIME
- *
+ *
* How to make your own widget? like this:
- *
+ *
* #include <Elementary.h>
* #include "elm_priv.h"
- *
+ *
* typedef struct _Widget_Data Widget_Data;
- *
+ *
* struct _Widget_Data
* {
* Evas_Object *sub;
* // add any other widget data here too
* };
- *
+ *
* static const char *widtype = NULL;
* static void _del_hook(Evas_Object *obj);
* static void _theme_hook(Evas_Object *obj);
* static void _disable_hook(Evas_Object *obj);
* static void _sizing_eval(Evas_Object *obj);
* static void _on_focus_hook(void *data, Evas_Object *obj);
- *
+ *
* static const char SIG_CLICKED[] = "clicked";
* static const Evas_Smart_Cb_Description _signals[] = {
* {SIG_CLICKED, ""},
* {NULL, NULL}
* };
- *
+ *
* static void
* _del_hook(Evas_Object *obj)
* {
* // delete hook - on delete of object delete object struct etc.
* free(wd);
* }
- *
+ *
* static void
* _on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
* {
* evas_object_focus_set(wd->sub, EINA_FALSE);
* }
* }
- *
+ *
* static void
* _theme_hook(Evas_Object *obj)
* {
* Widget_Data *wd = elm_widget_data_get(obj);
* if (!wd) return;
* // handle change in theme/scale etc.
- * elm_widget_theme_object_set(obj, wd->sub, "mywidget", "base",
+ * elm_widget_theme_object_set(obj, wd->sub, "mywidget", "base",
* elm_widget_style_get(obj));
* }
- *
+ *
* static void
* _disable_hook(Evas_Object *obj)
* {
* else
* edje_object_signal_emit(wd->sub, "elm,state,enabled", "elm");
* }
- *
+ *
* static void
* _sizing_eval(Evas_Object *obj)
* {
* evas_object_size_hint_min_set(obj, minw, minh);
* evas_object_size_hint_max_set(obj, maxw, maxh);
* }
- *
+ *
* // actual api to create your widget. add more to manipulate it as needed
* // mark your calls with EAPI to make them "external api" calls.
* EAPI Evas_Object *
* Evas_Object *obj;
* Evas *e;
* Widget_Data *wd;
- *
+ *
* // ALWAYS call this - this checks that your widget matches that of
* // elementary and that the api hasn't broken. if it has this returns
* // false and you need to handle this error gracefully
*
* // standard widget setup and allocate wd, create obj given parent etc.
* ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
- *
+ *
* // give it a type name and set up a mywidget type string if needed
* ELM_SET_WIDTYPE(widtype, "mywidget");
* elm_widget_type_set(obj, "mywidget");
* elm_widget_disable_hook_set(obj, _disable_hook);
* // this widget can focus (true means yes it can, false means it can't)
* elm_widget_can_focus_set(obj, EINA_TRUE);
- *
+ *
* // for this widget we will add 1 sub object that is an edje object
* wd->sub = edje_object_add(e);
* // set the theme. this follows a scheme for group name like this:
* // set this sub object as the "resize object". widgets get 1 resize
* // object that is resized along with the object wrapper.
* elm_widget_resize_object_set(obj, wd->sub);
- *
+ *
* // evaluate sizing of the widget (minimum size calc etc.). optional but
* // not a bad idea to do here. it will get queued for later anyway
* _sizing_eval(obj);
- *
+ *
* // register the smart callback descriptions so we can have some runtime
* // info as to what the smart callback strings mean
* evas_object_smart_callbacks_descriptions_set(obj, _signals);
* return obj;
* }
- *
+ *
* // example - do "whatever" to the widget (here just emit a signal)
* EAPI void
* elm_mywidget_whatever(Evas_Object *obj)
* // do whatever you like
* edje_object_signal_emit(wd->sub, "elm,state,action,whatever", "elm");
* }
- *
+ *
* // you can add more - you need to see elementary's code to know how to
* // handle all cases. remember this api is not stable and may change. it's
* // internal
- *
+ *
*/
#ifndef ELM_INTERNAL_API_ARGESFSDFEFC
/* ef1 ~~ efl, el3 ~~ elm */
#define ELM_WIDGET_ITEM_MAGIC 0xef1e1301
EINA_MAGIC;
-
+
Evas_Object *widget; /**< the owner widget that owns this item */
Evas_Object *view; /**< the base view object */
const void *data; /**< item specific data */