Languages

Menu
Sites
Language
[Widget]How a widget get it's smart class

Actually I was reading the source code of Elementary currently.

I found some problems ,could you Please help me:

when I trace an widget about how it is created(Elm_layout, For example). It's marvelous that I cannot find out how a widget's Smart Class was created!

-----------------------------------------------elementary-1.7.1-------------------------------------------------------------

------------Elm_layout.c

  EAPI Evas_Object * elm_layout_add(Evas_Object *parent)

The detail is:

EAPI Evas_Object *
elm_layout_add(Evas_Object *parent)
{
   Evas_Object *obj;

   EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);

   obj = elm_widget_add( _elm_layout_widget_smart_class_new() , parent);
   if (!obj) return NULL;

   .......

}

I tried all I could do to find out the implementation of the new fuction(in bold) :

                   _elm_layout_widget_smart_class_new()

But failed!

And , I have noticed that many widgets(Maybe all) get its Smart class by this function.

Waiting for your answer!

 

Responses

2 Replies
liao

OK.

I found it , it is a macro;

 

/* Elementary smart class for all widgets having an Edje layout as a
 * building block */
EVAS_SMART_SUBCLASS_NEW
  (ELM_LAYOUT_SMART_NAME, _elm_layout, Elm_Layout_Smart_Class,
  Elm_Container_Smart_Class, elm_container_smart_class_get, _smart_callbacks);

 

This would spread out function:

_elm_layout_widget_smart_class_new()

!!!!!

liao

fix:

    It is defined in macro. So SourceInsight cannot reach it.