1 #ifndef ELM_WIDGET_PANEL_H
2 #define ELM_WIDGET_PANEL_H
4 #include "elm_widget_layout.h"
11 * @section elm-panel-class The Elementary Panel Class
13 * Elementary, besides having the @ref Panel widget, exposes its
14 * foundation -- the Elementary Panel Class -- in order to create other
15 * widgets which are a panel with some more logic on top.
19 * @def ELM_PANEL_CLASS
21 * Use this macro to cast whichever subclass of
22 * #Elm_Panel_Smart_Class into it, so to access its fields.
26 #define ELM_PANEL_CLASS(x) ((Elm_Panel_Smart_Class *)x)
31 * Use this macro to cast whichever subdata of
32 * #Elm_Panel_Smart_Data into it, so to access its fields.
36 #define ELM_PANEL_DATA(x) ((Elm_Panel_Smart_Data *)x)
39 * @def ELM_PANEL_SMART_CLASS_VERSION
41 * Current version for Elementary panel @b base smart class, a value
42 * which goes to _Elm_Panel_Smart_Class::version.
46 #define ELM_PANEL_SMART_CLASS_VERSION 1
49 * @def ELM_PANEL_SMART_CLASS_INIT
51 * Initializer for a whole #Elm_Panel_Smart_Class structure, with
52 * @c NULL values on its specific fields.
54 * @param smart_class_init initializer to use for the "base" field
55 * (#Evas_Smart_Class).
57 * @see EVAS_SMART_CLASS_INIT_NULL
58 * @see EVAS_SMART_CLASS_INIT_NAME_VERSION
59 * @see ELM_PANEL_SMART_CLASS_INIT_NULL
60 * @see ELM_PANEL_SMART_CLASS_INIT_NAME_VERSION
64 #define ELM_PANEL_SMART_CLASS_INIT(smart_class_init) \
65 {smart_class_init, ELM_PANEL_SMART_CLASS_VERSION}
68 * @def ELM_PANEL_SMART_CLASS_INIT_NULL
70 * Initializer to zero out a whole #Elm_Panel_Smart_Class structure.
72 * @see ELM_PANEL_SMART_CLASS_INIT_NAME_VERSION
73 * @see ELM_PANEL_SMART_CLASS_INIT
77 #define ELM_PANEL_SMART_CLASS_INIT_NULL \
78 ELM_PANEL_SMART_CLASS_INIT(EVAS_SMART_CLASS_INIT_NULL)
81 * @def ELM_PANEL_SMART_CLASS_INIT_NAME_VERSION
83 * Initializer to zero out a whole #Elm_Panel_Smart_Class structure and
84 * set its name and version.
86 * This is similar to #ELM_PANEL_SMART_CLASS_INIT_NULL, but it will
87 * also set the version field of #Elm_Panel_Smart_Class (base field)
88 * to the latest #ELM_PANEL_SMART_CLASS_VERSION and name it to the
91 * It will keep a reference to the name field as a <c>"const char *"</c>,
92 * i.e., the name must be available while the structure is
93 * used (hint: static or global variable!) and must not be modified.
95 * @see ELM_PANEL_SMART_CLASS_INIT_NULL
96 * @see ELM_PANEL_SMART_CLASS_INIT
100 #define ELM_PANEL_SMART_CLASS_INIT_NAME_VERSION(name) \
101 ELM_PANEL_SMART_CLASS_INIT \
102 (ELM_LAYOUT_SMART_CLASS_INIT_NAME_VERSION(name))
105 * Elementary panel base smart class. This inherits directly from
106 * #Elm_Layout_Smart_Class and is meant to build widgets extending the
107 * behavior of a panel.
109 * All of the functions listed on @ref Panel namespace will work for
110 * objects deriving from #Elm_Panel_Smart_Class.
112 typedef struct _Elm_Panel_Smart_Class
114 Elm_Layout_Smart_Class base;
116 int version; /**< Version of this smart class definition */
117 } Elm_Panel_Smart_Class;
120 * Base layout smart data extended with panel instance data.
122 typedef struct _Elm_Panel_Smart_Data Elm_Panel_Smart_Data;
123 struct _Elm_Panel_Smart_Data
125 Elm_Layout_Smart_Data base; /* base widget smart data as
126 * first member obligatory, as
127 * we're inheriting from it */
129 Evas_Object *bx, *content;
131 Elm_Panel_Orient orient;
133 Eina_Bool hidden : 1;
134 Eina_Bool on_deletion : 1;
141 EAPI extern const char ELM_PANEL_SMART_NAME[];
142 EAPI const Elm_Panel_Smart_Class *elm_panel_smart_class_get(void);
144 #define ELM_PANEL_DATA_GET(o, sd) \
145 Elm_Panel_Smart_Data * sd = evas_object_smart_data_get(o)
147 #define ELM_PANEL_DATA_GET_OR_RETURN(o, ptr) \
148 ELM_PANEL_DATA_GET(o, ptr); \
151 CRITICAL("No widget data for object %p (%s)", \
152 o, evas_object_type_get(o)); \
156 #define ELM_PANEL_DATA_GET_OR_RETURN_VAL(o, ptr, val) \
157 ELM_PANEL_DATA_GET(o, ptr); \
160 CRITICAL("No widget data for object %p (%s)", \
161 o, evas_object_type_get(o)); \
165 #define ELM_PANEL_CHECK(obj) \
166 if (!obj || !elm_widget_type_check((obj), ELM_PANEL_SMART_NAME, \