elementary/map - map supports language,changed
[framework/uifw/elementary.git] / src / lib / elm_widget_fileselector_button.h
1 #ifndef ELM_WIDGET_FILESELECTOR_BUTTON_H
2 #define ELM_WIDGET_FILESELECTOR_BUTTON_H
3
4 #include "elm_widget_button.h"
5
6 #ifdef HAVE_EIO
7 # include <Eio.h>
8 #endif
9
10 /**
11  * @addtogroup Widget
12  * @{
13  *
14  * @section elm-fileselector-button-class The Elementary Fileselector Button Class
15  *
16  * Elementary, besides having the @ref Fileselector_Button widget,
17  * exposes its foundation -- the Elementary Fileselector Button Class
18  * -- in order to create other widgets which are a fileselector_button
19  * with some more logic on top.
20  */
21
22 /**
23  * @def ELM_FILESELECTOR_BUTTON_CLASS
24  *
25  * Use this macro to cast whichever subclass of
26  * #Elm_Fileselector_Button_Smart_Class into it, so to access its fields.
27  *
28  * @ingroup Widget
29  */
30 #define ELM_FILESELECTOR_BUTTON_CLASS(x) ((Elm_Fileselector_Button_Smart_Class *)x)
31
32 /**
33  * @def ELM_FILESELECTOR_BUTTON_DATA
34  *
35  * Use this macro to cast whichever subdata of
36  * #Elm_Fileselector_Button_Smart_Data into it, so to access its fields.
37  *
38  * @ingroup Widget
39  */
40 #define ELM_FILESELECTOR_BUTTON_DATA(x)  ((Elm_Fileselector_Button_Smart_Data *)x)
41
42 /**
43  * @def ELM_FILESELECTOR_BUTTON_SMART_CLASS_VERSION
44  *
45  * Current version for Elementary fileselector_button @b base smart
46  * class, a value which goes to
47  * _Elm_Fileselector_Button_Smart_Class::version.
48  *
49  * @ingroup Widget
50  */
51 #define ELM_FILESELECTOR_BUTTON_SMART_CLASS_VERSION 1
52
53 /**
54  * @def ELM_FILESELECTOR_BUTTON_SMART_CLASS_INIT
55  *
56  * Initializer for a whole #Elm_Fileselector_Button_Smart_Class structure, with
57  * @c NULL values on its specific fields.
58  *
59  * @param smart_class_init initializer to use for the "base" field
60  * (#Evas_Smart_Class).
61  *
62  * @see EVAS_SMART_CLASS_INIT_NULL
63  * @see EVAS_SMART_CLASS_INIT_NAME_VERSION
64  * @see ELM_FILESELECTOR_BUTTON_SMART_CLASS_INIT_NULL
65  * @see ELM_FILESELECTOR_BUTTON_SMART_CLASS_INIT_NAME_VERSION
66  *
67  * @ingroup Widget
68  */
69 #define ELM_FILESELECTOR_BUTTON_SMART_CLASS_INIT(smart_class_init) \
70   {smart_class_init, ELM_FILESELECTOR_BUTTON_SMART_CLASS_VERSION}
71
72 /**
73  * @def ELM_FILESELECTOR_BUTTON_SMART_CLASS_INIT_NULL
74  *
75  * Initializer to zero out a whole
76  * #Elm_Fileselector_Button_Smart_Class structure.
77  *
78  * @see ELM_FILESELECTOR_BUTTON_SMART_CLASS_INIT_NAME_VERSION
79  * @see ELM_FILESELECTOR_BUTTON_SMART_CLASS_INIT
80  *
81  * @ingroup Widget
82  */
83 #define ELM_FILESELECTOR_BUTTON_SMART_CLASS_INIT_NULL \
84   ELM_FILESELECTOR_BUTTON_SMART_CLASS_INIT(EVAS_SMART_CLASS_INIT_NULL)
85
86 /**
87  * @def ELM_FILESELECTOR_BUTTON_SMART_CLASS_INIT_NAME_VERSION
88  *
89  * Initializer to zero out a whole
90  * #Elm_Fileselector_Button_Smart_Class structure and set its name and
91  * version.
92  *
93  * This is similar to #ELM_FILESELECTOR_BUTTON_SMART_CLASS_INIT_NULL,
94  * but it will also set the version field of
95  * #Elm_Fileselector_Button_Smart_Class (base field) to the latest
96  * #ELM_FILESELECTOR_BUTTON_SMART_CLASS_VERSION and name it to the
97  * specific value.
98  *
99  * It will keep a reference to the name field as a <c>"const char *"</c>,
100  * i.e., the name must be available while the structure is
101  * used (hint: static or global variable!) and must not be modified.
102  *
103  * @see ELM_FILESELECTOR_BUTTON_SMART_CLASS_INIT_NULL
104  * @see ELM_FILESELECTOR_BUTTON_SMART_CLASS_INIT
105  *
106  * @ingroup Widget
107  */
108 #define ELM_FILESELECTOR_BUTTON_SMART_CLASS_INIT_NAME_VERSION(name) \
109   ELM_FILESELECTOR_BUTTON_SMART_CLASS_INIT                          \
110     (ELM_BUTTON_SMART_CLASS_INIT_NAME_VERSION(name))
111
112 /**
113  * Elementary fileselector_button base smart class. This inherits directly from
114  * #Elm_Button_Smart_Class and is meant to build widgets extending the
115  * behavior of a fileselector_button.
116  *
117  * All of the functions listed on @ref Fileselector_Button namespace
118  * will work for objects deriving from
119  * #Elm_Fileselector_Button_Smart_Class.
120  */
121 typedef struct _Elm_Fileselector_Button_Smart_Class
122 {
123    Elm_Button_Smart_Class base;
124
125    int                    version;    /**< Version of this smart class definition */
126 } Elm_Fileselector_Button_Smart_Class;
127
128 /**
129  * Base button smart data extended with fileselector_button instance data.
130  */
131 typedef struct _Elm_Fileselector_Button_Smart_Data \
132   Elm_Fileselector_Button_Smart_Data;
133 struct _Elm_Fileselector_Button_Smart_Data
134 {
135    Elm_Button_Smart_Data base;
136
137    Evas_Object          *fs, *fsw;
138    const char           *window_title;
139    Evas_Coord            w, h;
140
141    struct
142    {
143       const char *path;
144       Eina_Bool   expandable : 1;
145       Eina_Bool   folder_only : 1;
146       Eina_Bool   is_save : 1;
147    } fsd;
148
149    Eina_Bool             inwin_mode : 1;
150 };
151
152 /**
153  * @}
154  */
155
156 EAPI extern const char ELM_FILESELECTOR_BUTTON_SMART_NAME[];
157 EAPI const Elm_Fileselector_Button_Smart_Class
158 *elm_fileselector_button_smart_class_get(void);
159
160 #define ELM_FILESELECTOR_BUTTON_DATA_GET(o, sd) \
161   Elm_Fileselector_Button_Smart_Data * sd = evas_object_smart_data_get(o)
162
163 #define ELM_FILESELECTOR_BUTTON_DATA_GET_OR_RETURN(o, ptr) \
164   ELM_FILESELECTOR_BUTTON_DATA_GET(o, ptr);                \
165   if (!ptr)                                                \
166     {                                                      \
167        CRITICAL("No widget data for object %p (%s)",       \
168                 o, evas_object_type_get(o));               \
169        return;                                             \
170     }
171
172 #define ELM_FILESELECTOR_BUTTON_DATA_GET_OR_RETURN_VAL(o, ptr, val) \
173   ELM_FILESELECTOR_BUTTON_DATA_GET(o, ptr);                         \
174   if (!ptr)                                                         \
175     {                                                               \
176        CRITICAL("No widget data for object %p (%s)",                \
177                 o, evas_object_type_get(o));                        \
178        return val;                                                  \
179     }
180
181 #define ELM_FILESELECTOR_BUTTON_CHECK(obj)                     \
182   if (!obj || !elm_widget_type_check                           \
183         ((obj), ELM_FILESELECTOR_BUTTON_SMART_NAME, __func__)) \
184     return
185
186 #endif