Etk
Main Page Object Hierarchy Data Structures Related Pages
Etk

The main functions of Etk


Detailed Description

The main functions of Etk, used to initialize or shutdown Etk, and to control the main loop.

Every Etk program should call at least two Etk functions:

  • etk_init() which initializes Etk. If you don't call it, the program will crash when you call any Etk function
  • etk_shutdown() which shutdowns Etk and frees the allocated resources. If you don't call it, the memory allocated by Etk won't be freed.

Most of the time, you will also have to call the function etk_main() which runs the main loop, and etk_main_quit() which quits the main loop (for example, when the menu-item "Quit" is clicked)


Functions

int etk_init (int argc, char **argv)
 Initializes Etk. This function needs to be called before any other call to an etk_* function.
You can call safely etk_init() several times, it will only have an effect the first time you call it. The other times, it will just increment the init-counter. etk_shutdown() will decrement this counter and will effectively shutdown Etk only when the counter reaches 0. So you need to call etk_shutdown() the same number of times you've called etk_init().
int etk_init_full (int argc, char **argv, const char *custom_opts)
 Does the same thing as etk_init() except you can specify custom arguments that could be then retrieved with etk_argument_* functions. For example, etk_init_full(argc, argv, "--option1 value --toggle1").
int etk_shutdown (void)
 Shuts down Etk. It decrements the init-counter. If the counter reaches 0, it frees all the resources used by Etk.
void etk_main (void)
 Runs the Etk's main loop until etk_main_quit() is called.
void etk_main_quit (void)
 Leaves the main loop of Etk. It will quit the main loop of Ecore (ecore_main_loop_quit()) and will make etk_main() return.
void etk_main_iterate (void)
 Runs an iteration of the main loop: it updates the widgets that need to be updated.


Function Documentation

int etk_init ( int  argc,
char **  argv 
)

Initializes Etk. This function needs to be called before any other call to an etk_* function.
You can call safely etk_init() several times, it will only have an effect the first time you call it. The other times, it will just increment the init-counter. etk_shutdown() will decrement this counter and will effectively shutdown Etk only when the counter reaches 0. So you need to call etk_shutdown() the same number of times you've called etk_init().

Parameters:
argc the "argc" parameter passed to main(). It is used to parse the arguments specific to Etk. It can be set to 0.
argv the "argv" parameter passed to main(). It is used to parse the arguments specific to Etk. It can be set to NULL.
Returns:
Returns the number of times Etk has been initialized, or 0 on failure
Note:
It initializes Evas, Ecore and Edje so you don't need to initialize them after an etk_init()
See also:
etk_init_full()

etk_shutdown()

References etk_init_full().

int etk_init_full ( int  argc,
char **  argv,
const char *  custom_opts 
)

Does the same thing as etk_init() except you can specify custom arguments that could be then retrieved with etk_argument_* functions. For example, etk_init_full(argc, argv, "--option1 value --toggle1").

Parameters:
argc the location of the "argc" parameter passed to main(). It is used to parse the arguments specific to Etk. It can be set to NULL.
argv the location of the "argv" parameter passed to main(). It is used to parse the arguments specific to Etk. It can be set to NULL.
custom_opts a string corresponding to the custom arguments to add to argv. It can be set to NULL
Returns:
Returns the number of times Etk has been initialized, or 0 on failure
Note:
It initializes Evas, Ecore and Edje so you don't need to initialize them after an etk_init()
See also:
etk_init()

etk_shutdown()

References etk_argument_value_get(), etk_config_init(), etk_config_load(), etk_tooltips_init(), and ETK_WARNING.

Referenced by etk_init().

int etk_shutdown ( void   ) 

Shuts down Etk. It decrements the init-counter. If the counter reaches 0, it frees all the resources used by Etk.

Returns:
Returns the new value of the init-counter. If 0 is returned, it means that the resources has effectively been freed.

References etk_config_shutdown(), etk_tooltips_shutdown(), and etk_type_shutdown().

void etk_main ( void   ) 

Runs the Etk's main loop until etk_main_quit() is called.

Note:
It calls ecore_main_loop_begin() so you should not call ecore_main_loop_begin() or ecore_main_loop_quit() if you are using etk_main() in your program.

void etk_main_quit ( void   ) 

Leaves the main loop of Etk. It will quit the main loop of Ecore (ecore_main_loop_quit()) and will make etk_main() return.

void etk_main_iterate ( void   ) 

Runs an iteration of the main loop: it updates the widgets that need to be updated.

Note:
You usually do not need to call it manually, you might want to use etk_main() instead

References ETK_TOPLEVEL, etk_toplevel_widgets_get(), ETK_WIDGET, and Etk_Toplevel::need_update.