2 * @defgroup General General
4 * @brief General Elementary API. Functions that don't relate to
5 * Elementary objects specifically.
7 * Here are documented functions which init/shutdown the library,
8 * that apply to generic Elementary objects, that deal with
9 * configuration, et cetera.
11 * @ref general_functions_example_page "This" example contemplates
12 * some of these functions.
21 * Defines couple of standard Evas_Object layers to be used
22 * with evas_object_layer_set().
24 * @note whenever extending with new values, try to keep some padding
25 * to siblings so there is room for further extensions.
27 typedef enum _Elm_Object_Layer
29 ELM_OBJECT_LAYER_BACKGROUND = EVAS_LAYER_MIN + 64, /**< where to place backgrounds */
30 ELM_OBJECT_LAYER_DEFAULT = 0, /**< Evas_Object default layer (and thus for Elementary) */
31 ELM_OBJECT_LAYER_FOCUS = EVAS_LAYER_MAX - 128, /**< where focus object visualization is */
32 ELM_OBJECT_LAYER_TOOLTIP = EVAS_LAYER_MAX - 64, /**< where to show tooltips */
33 ELM_OBJECT_LAYER_CURSOR = EVAS_LAYER_MAX - 32, /**< where to show cursors */
34 ELM_OBJECT_LAYER_LAST /**< last layer known by Elementary */
37 /**************************************************************************/
38 EAPI extern int ELM_ECORE_EVENT_ETHUMB_CONNECT;
41 * Emitted when the application has reconfigured elementary settings due
42 * to an external configuration tool asking it to.
44 EAPI extern int ELM_EVENT_CONFIG_ALL_CHANGED;
47 * Emitted when any Elementary's policy value is changed.
49 EAPI extern int ELM_EVENT_POLICY_CHANGED;
52 * @typedef Elm_Event_Policy_Changed
54 * Data on the event when an Elementary policy has changed
56 typedef struct _Elm_Event_Policy_Changed Elm_Event_Policy_Changed;
59 * @struct _Elm_Event_Policy_Changed
61 * Data on the event when an Elementary policy has changed
63 struct _Elm_Event_Policy_Changed
65 unsigned int policy; /**< the policy identifier */
66 int new_value; /**< value the policy had before the change */
67 int old_value; /**< new value the policy got */
73 typedef enum _Elm_Policy
75 ELM_POLICY_QUIT, /**< under which circumstances the application
76 * should quit automatically. @see
80 } Elm_Policy; /**< Elementary policy identifiers/groups enumeration. @see elm_policy_set() */
82 typedef enum _Elm_Policy_Quit
84 ELM_POLICY_QUIT_NONE = 0, /**< never quit the application
86 ELM_POLICY_QUIT_LAST_WINDOW_CLOSED /**< quit when the
89 } Elm_Policy_Quit; /**< Possible values for the #ELM_POLICY_QUIT policy */
91 typedef enum _Elm_Focus_Direction
95 } Elm_Focus_Direction;
98 * @typedef Elm_Object_Item
99 * An Elementary Object item handle.
102 typedef struct _Elm_Object_Item Elm_Object_Item;
104 typedef Eina_Bool (*Elm_Event_Cb)(void *data, Evas_Object *obj, Evas_Object *src, Evas_Callback_Type type, void *event_info); /**< Function prototype definition for callbacks on input events happening on Elementary widgets. @a data will receive the user data pointer passed to elm_object_event_callback_add(). @a src will be a pointer to the widget on which the input event took place. @a type will get the type of this event and @a event_info, the struct with details on this event. */
106 #ifndef ELM_LIB_QUICKLAUNCH
107 #define ELM_MAIN() int main(int argc, char **argv) {elm_init(argc, argv); return elm_main(argc, argv); } /**< macro to be used after the elm_main() function */
109 #define ELM_MAIN() int main(int argc, char **argv) {return elm_quicklaunch_fallback(argc, argv); } /**< macro to be used after the elm_main() function */
112 /**************************************************************************/
116 * Initialize Elementary
118 * @param[in] argc System's argument count value
119 * @param[in] argv System's pointer to array of argument strings
120 * @return The init counter value.
122 * This function initializes Elementary and increments a counter of
123 * the number of calls to it. It returns the new counter's value.
125 * @warning This call is exported only for use by the @c ELM_MAIN()
126 * macro. There is no need to use this if you use this macro (which
127 * is highly advisable). An elm_main() should contain the entry
128 * point code for your application, having the same prototype as
129 * elm_init(), and @b not being static (putting the @c EAPI symbol
130 * in front of its type declaration is advisable). The @c
131 * ELM_MAIN() call should be placed just after it.
134 * @dontinclude bg_example_01.c
138 * See the full @ref bg_example_01_c "example".
140 * @see elm_shutdown().
143 EAPI int elm_init(int argc, char **argv);
146 * Shut down Elementary
148 * @return The init counter value.
150 * This should be called at the end of your application, just
151 * before it ceases to do any more processing. This will clean up
152 * any permanent resources your application may have allocated via
153 * Elementary that would otherwise persist.
155 * @see elm_init() for an example
159 EAPI int elm_shutdown(void);
162 * Run Elementary's main loop
164 * This call should be issued just after all initialization is
165 * completed. This function will not return until elm_exit() is
166 * called. It will keep looping, running the main
167 * (event/processing) loop for Elementary.
169 * @see elm_init() for an example
173 EAPI void elm_run(void);
176 * Exit Elementary's main loop
178 * If this call is issued, it will flag the main loop to cease
179 * processing and return back to its parent function (usually your
180 * elm_main() function).
182 * @see elm_init() for an example. There, just after a request to
183 * close the window comes, the main loop will be left.
185 * @note By using the appropriate #ELM_POLICY_QUIT on your Elementary
186 * applications, you'll be able to get this function called automatically for you.
190 EAPI void elm_exit(void);
193 * Exposed symbol used only by macros and should not be used by apps
195 EAPI void elm_quicklaunch_mode_set(Eina_Bool ql_on);
198 * Exposed symbol used only by macros and should not be used by apps
200 EAPI Eina_Bool elm_quicklaunch_mode_get(void);
203 * Exposed symbol used only by macros and should not be used by apps
205 EAPI int elm_quicklaunch_init(int argc, char **argv);
208 * Exposed symbol used only by macros and should not be used by apps
210 EAPI int elm_quicklaunch_sub_init(int argc, char **argv);
213 * Exposed symbol used only by macros and should not be used by apps
215 EAPI int elm_quicklaunch_sub_shutdown(void);
218 * Exposed symbol used only by macros and should not be used by apps
220 EAPI int elm_quicklaunch_shutdown(void);
223 * Exposed symbol used only by macros and should not be used by apps
225 EAPI void elm_quicklaunch_seed(void);
228 * Exposed symbol used only by macros and should not be used by apps
230 EAPI Eina_Bool elm_quicklaunch_prepare(int argc, char **argv);
233 * Exposed symbol used only by macros and should not be used by apps
235 EAPI Eina_Bool elm_quicklaunch_fork(int argc, char **argv, char *cwd, void (postfork_func) (void *data), void *postfork_data);
238 * Exposed symbol used only by macros and should not be used by apps
240 EAPI void elm_quicklaunch_cleanup(void);
243 * Exposed symbol used only by macros and should not be used by apps
245 EAPI int elm_quicklaunch_fallback(int argc, char **argv);
248 * Exposed symbol used only by macros and should not be used by apps
250 EAPI char *elm_quicklaunch_exe_path_get(const char *exe);
253 * Set a new policy's value (for a given policy group/identifier).
255 * @param policy policy identifier, as in @ref Elm_Policy.
256 * @param value policy value, which depends on the identifier
258 * @return @c EINA_TRUE on success or @c EINA_FALSE, on error.
260 * Elementary policies define applications' behavior,
261 * somehow. These behaviors are divided in policy groups (see
262 * #Elm_Policy enumeration). This call will emit the Ecore event
263 * #ELM_EVENT_POLICY_CHANGED, which can be hooked at with
264 * handlers. An #Elm_Event_Policy_Changed struct will be passed,
267 * @note Currently, we have only one policy identifier/group
268 * (#ELM_POLICY_QUIT), which has two possible values.
272 EAPI Eina_Bool elm_policy_set(unsigned int policy, int value);
275 * Gets the policy value for given policy identifier.
277 * @param policy policy identifier, as in #Elm_Policy.
278 * @return The currently set policy value, for that
279 * identifier. Will be @c 0 if @p policy passed is invalid.
283 EAPI int elm_policy_get(unsigned int policy);
286 * Change the language of the current application
288 * The @p lang passed must be the full name of the locale to use, for
289 * example "en_US.utf8" or "es_ES@euro".
291 * Changing language with this function will make Elementary run through
292 * all its widgets, translating strings set with
293 * elm_object_domain_translatable_text_part_set(). This way, an entire
294 * UI can have its language changed without having to restart the program.
296 * For more complex cases, like having formatted strings that need
297 * translation, widgets will also emit a "language,changed" signal that
298 * the user can listen to to manually translate the text.
300 * @param lang Language to set, must be the full name of the locale
304 EAPI void elm_language_set(const char *lang);
307 * Set the text for an objects' part, marking it as translatable.
309 * The string to set as @p text must be the original one. Do not pass the
310 * return of @c gettext() here. Elementary will translate the string
311 * internally and set it on the object using elm_object_part_text_set(),
312 * also storing the original string so that it can be automatically
313 * translated when the language is changed with elm_language_set().
315 * The @p domain will be stored along to find the translation in the
316 * correct catalog. It can be NULL, in which case it will use whatever
317 * domain was set by the application with @c textdomain(). This is useful
318 * in case you are building a library on top of Elementary that will have
319 * its own translatable strings, that should not be mixed with those of
320 * programs using the library.
322 * @param obj The object containing the text part
323 * @param part The name of the part to set
324 * @param domain The translation domain to use
325 * @param text The original, non-translated text to set
329 EAPI void elm_object_domain_translatable_text_part_set(Evas_Object *obj, const char *part, const char *domain, const char *text);
331 #define elm_object_domain_translatable_text_set(obj, domain, text) elm_object_domain_translatable_text_part_set((obj), NULL, (domain), (text))
333 #define elm_object_translatable_text_set(obj, text) elm_object_domain_translatable_text_part_set((obj), NULL, NULL, (text))
336 * Gets the original string set as translatable for an object
338 * When setting translated strings, the function elm_object_part_text_get()
339 * will return the translation returned by @c gettext(). To get the
340 * original string use this function.
342 * @param obj The object
343 * @param part The name of the part that was set
345 * @return The original, untranslated string
349 EAPI const char *elm_object_translatable_text_part_get(const Evas_Object *obj, const char *part);
351 #define elm_object_translatable_text_get(obj) elm_object_translatable_text_part_get((obj), NULL)