elm_bg - Plain color background.

The full code for this example can be found at bg_example_01.c, in the function test_bg_plain. It's part of the elementary_test suite, and thus has the code for the three examples referenced by this documentation.

This first example just sets a default background with a plain color. The first part consists of creating an Elementary window. It's the common piece of code that you'll see everywhere in Elementary:

Now we really create our background object, using the window object as its parent:

Then we set the size hints of the background object so that it will use all space available for it, and then add it as a resize object to the window, making it visible in the end:

See evas_object_size_hint_weight_set() and elm_win_resize_object_add() for more detailed info about these functions.

The end of the example is quite simple, just setting the minimum and maximum size of the background, so the Elementary window knows that it has to have at least the minimum size. The background also won't scale to a size above its maximum. Then we resize the window and show it in the end:

And here we finish our very simple background object usage example.

ELM_POLICY_QUIT_LAST_WINDOW_CLOSED
@ ELM_POLICY_QUIT_LAST_WINDOW_CLOSED
quit when the application's last window is closed
Definition: elm_general.h:248
EINA_UNUSED
#define EINA_UNUSED
Definition: eina_types.h:321
Evas_Object
Efl_Canvas_Object Evas_Object
Definition: Evas_Common.h:180
elm_win_util_standard_add
Evas_Object * elm_win_util_standard_add(const char *name, const char *title)
Adds a window object with standard setup.
Definition: efl_ui_win.c:9199
EINA_TRUE
#define EINA_TRUE
Definition: eina_types.h:508
elm_policy_set
Eina_Bool elm_policy_set(unsigned int policy, int value)
Set a new policy's value (for a given policy group/identifier).
Definition: elm_main.c:1408
elm_win_autodel_set
void elm_win_autodel_set(Eo *obj, Eina_Bool autodel)
Set the window's autodel state.
Definition: efl_ui_win.c:6146
ELM_POLICY_QUIT
@ ELM_POLICY_QUIT
under which circumstances the application should quit automatically.
Definition: elm_general.h:227