src/lib/edje_container.h

Go to the documentation of this file.
00001 #include "edje_private.h"
00002 
00003 
00004 #define E_SMART_OBJ_GET(smart, o, type) \
00005      { \
00006     char *_e_smart_str; \
00007     \
00008     if (!o) return; \
00009     smart = evas_object_smart_data_get(o); \
00010     if (!smart) return; \
00011     _e_smart_str = (char *)evas_object_type_get(o); \
00012     if (!_e_smart_str) return; \
00013     if (strcmp(_e_smart_str, type)) return; \
00014      }
00015 
00016 #define E_SMART_OBJ_GET_RETURN(smart, o, type, ret) \
00017    { \
00018       char *_e_smart_str; \
00019       \
00020       if (!o) return ret; \
00021       smart = evas_object_smart_data_get(o); \
00022       if (!smart) return ret; \
00023       _e_smart_str = (char *)evas_object_type_get(o); \
00024       if (!_e_smart_str) return ret; \
00025       if (strcmp(_e_smart_str, type)) return ret; \
00026    }
00027 
00028 #define E_OBJ_NAME "edje_container_object"
00029 
00030 typedef struct _Smart_Data         Smart_Data;
00031 typedef struct _Smart_Data_Colinfo Smart_Data_Colinfo;
00032 
00033 struct _Smart_Data
00034 {
00035    Evas_Coord     x, y, w, h;
00036    Eina_List     *children;
00037    Evas_Object   *smart_obj;
00038    int            cols, rows;
00039 
00040    Evas_Coord     contents_w, contents_h;
00041    Evas_Coord     min_row_h, max_row_h;
00042    Evas_Coord     min_w, max_w, min_h, max_h;
00043 
00044    Smart_Data_Colinfo *colinfo;
00045 
00046    int            freeze;
00047 
00048    double         scroll_x, scroll_y;
00049    double         align_x, align_y;
00050 
00051    unsigned char  changed : 1;
00052    unsigned char  change_child : 1;
00053    unsigned char  change_child_list : 1;
00054    unsigned char  change_cols : 1;
00055    unsigned char  change_scroll : 1;
00056 
00057    unsigned char  need_layout : 1;
00058 
00059    unsigned char  homogenous : 1;
00060 };
00061 
00062 struct _Smart_Data_Colinfo
00063 {
00064    Evas_Coord minw, maxw;
00065 };
00066 
00067 /* All items are virtual constructs that provide Evas_Objects at some point.
00068  * Edje may move, resize, show, hide, clip, unclip, raise, lower etc. this
00069  * item AFTER it calls the item's add() method and before it calls the del()
00070  * method. Edje may call add() and del() at any time as often items may not
00071  * be visible and so may not need to exist at all - they are merely information
00072  * used for layout, and nothing more. this helps save cpu and memory keeping
00073  * things responsive for BIG lists of items. you create an item from an item
00074  * class then ask that item to be appended/prepended etc. to the container.
00075  */
00076 typedef struct _Edje_Item       Edje_Item;
00077 typedef struct _Edje_Item_Cell  Edje_Item_Cell;
00078 typedef struct _Edje_Item_Class Edje_Item_Class;
00079 
00080 struct _Edje_Item_Class
00081 {
00082    Evas_Object *(*add)      (Edje_Item *ei);
00083    void         (*del)      (Edje_Item *ei);
00084    void         (*select)   (Edje_Item *ei);
00085    void         (*deselect) (Edje_Item *ei);
00086    void         (*focus)    (Edje_Item *ei);
00087    void         (*unfocus)  (Edje_Item *ei);
00088 };
00089 
00090 /* private */
00091 struct _Edje_Item
00092 {
00093    Edje_Item_Class *class;
00094    void            *class_data;
00095 
00096    void            *sd;
00097 
00098    void            *data;
00099 
00100    Evas_Object     *object;
00101    Evas_Object     *overlay_object;
00102    int              freeze;
00103    Evas_Coord       y, h;
00104 
00105    Evas_Coord       minh, maxh;
00106 
00107    int              cells_num;
00108    Edje_Item_Cell  *cells;
00109 
00110    unsigned char    accessible : 1;
00111 
00112    unsigned char    recalc : 1;
00113    unsigned char    selected : 1;
00114    unsigned char    disabled : 1;
00115    unsigned char    focused : 1;
00116 };
00117 
00118 struct _Edje_Item_Cell
00119 {
00120    Evas_Object *obj;
00121    Evas_Coord   x, w;
00122    Evas_Coord   minw, minh, maxw, maxh;
00123 };
00124 
00125 /* here is an item for a vertical list - with 1 or more columns. this has 3 */
00126 /* just rotate for a horizontal list */
00127 
00128 /*
00129  *             COL 0                 COL 1          COL 2
00130  *
00131  * +-----------------------------+ +-------+ +----------------+
00132  * |          pad_top            | |       | |                |
00133  * | pad_left  OBJECT  pad_right | |  OBJ  | |     OBJECT     | ROW 0
00134  * |         pad_bottom          | |       | |                |
00135  * +-----------------------------+ +-------+ +----------------+
00136  *               /\              /|\
00137  *     space_row ||               +-- space_col
00138  *               \/
00139  * +-----------------------------+ +-------+ +----------------+
00140  * |                             | |       | |                |
00141  * |                             | |       | |                | ROW 1
00142  * |                             | |       | |                |
00143  * +-----------------------------+ +-------+ +----------------+
00144  *
00145  * spacer object:
00146  * 1 Edje object goes in-between each row as a spacer object (opt)
00147  * 1 Edje object goes in-between each column as a spacer object (opt)
00148  *
00149  * surround object:
00150  * 1 Edje object goes around each item - item swallowed into "item" part (opt)
00151  *   if no "item" part then just underlay it
00152  *   on select send "select" "" signal
00153  *   on unselect send "unselect" "" signal
00154  *   on focus send "focus" "" signal
00155  *   on unfocus send "unfocus" signal
00156  *
00157  *   if any list item/cell is an Edje object emit this to them too.
00158  *
00159  *   also call callbacks.
00160  *   if a surround object emits such a signal itself then call callbacks too
00161  *
00162  * only 1 or 0 items can be focused
00163  * disabled items cannot be focused or selected/deselected
00164  *
00165  */