bg_example_03.c
//Compile with:
//gcc -o bg_example_03 bg_example_03.c -g `pkg-config --cflags --libs elementary`
//where directory is the a path where images/plant_01.jpg can be found.
#include <Elementary.h>
static void
_cb_radio_changed(void *data, Evas_Object *obj, void *event EINA_UNUSED)
{
Evas_Object *o_bg = data;
}
static void
_cb_overlay_changed(void *data, Evas_Object *obj, void *event EINA_UNUSED)
{
Evas_Object *o_bg = data;
{
Evas_Object *parent, *over;
char buff[PATH_MAX];
snprintf(buff, sizeof(buff), "%s/objects/test.edj", elm_app_data_dir_get());
edje_object_file_set(over, buff, "bg_overlay");
elm_object_part_content_set(o_bg, "overlay", over);
}
else
elm_object_part_content_set(o_bg, "overlay", NULL);
}
static void
_cb_color_changed(void *data, Evas_Object *obj, void *event EINA_UNUSED)
{
Evas_Object *o_bg = data;
double val = 0.0;
if (EINA_DBL_EQ(val, 1.0))
elm_bg_color_set(o_bg, 255, 255, 255);
else if (EINA_DBL_EQ(val, 2.0))
elm_bg_color_set(o_bg, 255, 0, 0);
else if (EINA_DBL_EQ(val, 3.0))
elm_bg_color_set(o_bg, 0, 0, 255);
else if (EINA_DBL_EQ(val, 4.0))
elm_bg_color_set(o_bg, 0, 255, 0);
}
EAPI_MAIN int
elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
{
Evas_Object *box, *hbox, *o_bg;
Evas_Object *rd, *rdg;
char buf[PATH_MAX];
elm_app_info_set(elm_main, "elementary", "objects/test.edj");
win = elm_win_util_standard_add("bg-options", "Bg Options");
box = elm_box_add(win);
o_bg = elm_bg_add(win);
snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get());
elm_bg_file_set(o_bg, buf, NULL);
elm_box_pack_end(box, o_bg);
hbox = elm_box_add(win);
rd = elm_radio_add(win);
elm_object_text_set(rd, "Center");
evas_object_smart_callback_add(rd, "changed", _cb_radio_changed, o_bg);
elm_box_pack_end(hbox, rd);
rdg = rd;
rd = elm_radio_add(win);
elm_object_text_set(rd, "Scale");
evas_object_smart_callback_add(rd, "changed", _cb_radio_changed, o_bg);
elm_box_pack_end(hbox, rd);
rd = elm_radio_add(win);
elm_object_text_set(rd, "Stretch");
evas_object_smart_callback_add(rd, "changed", _cb_radio_changed, o_bg);
elm_box_pack_end(hbox, rd);
rd = elm_radio_add(win);
elm_object_text_set(rd, "Tile");
evas_object_smart_callback_add(rd, "changed", _cb_radio_changed, o_bg);
elm_box_pack_end(hbox, rd);
rd = elm_check_add(win);
elm_object_text_set(rd, "Show Overlay");
evas_object_smart_callback_add(rd, "changed", _cb_overlay_changed, o_bg);
elm_box_pack_end(hbox, rd);
/* color choices ... this is ghetto, but we don't have a 'colorpicker'
* widget yet :( */
rd = elm_spinner_add(win);
elm_object_style_set(rd, "vertical");
evas_object_smart_callback_add(rd, "changed", _cb_color_changed, o_bg);
elm_box_pack_end(hbox, rd);
elm_box_pack_end(box, hbox);
evas_object_resize(win, 460, 320);
return 0;
}
#define EVAS_HINT_EXPAND
Use with evas_object_size_hint_weight_set(), evas_object_size_hint_weight_get(), evas_object_size_hin...
Definition: Evas_Common.h:297
#define EVAS_HINT_FILL
Use with evas_object_size_hint_align_set(), evas_object_size_hint_align_get(), evas_object_size_hint_...
Definition: Evas_Common.h:298
Evas_Object * edje_object_add(Evas *evas)
Instantiates a new Edje object.
Definition: edje_smart.c:22
Eina_Bool edje_object_file_set(Evas_Object *obj, const char *file, const char *group)
Sets the EDJ file (and group within it) to load an Edje object's contents from.
Definition: edje_smart.c:467
#define EINA_DBL_EQ(a, b)
Safe comparison of double.
Definition: eina_util.h:100
#define EINA_TRUE
boolean value TRUE (numerical value 1)
Definition: eina_types.h:539
#define EINA_FALSE
boolean value FALSE (numerical value 0)
Definition: eina_types.h:533
#define EINA_UNUSED
Used to indicate that a function parameter is purposely unused.
Definition: eina_types.h:339
void elm_app_info_set(void *mainfunc, const char *dom, const char *checkfile)
Re-locate the application somewhere else after compilation, if the developer wishes for easier distri...
Definition: elm_main.c:496
const char * elm_app_data_dir_get(void)
Get the application's run time data prefix directory, as set by elm_app_info_set() and the way (envir...
Definition: elm_main.c:586
Eina_Bool elm_bg_file_set(Eo *obj, const char *file, const char *group)
Sets the file (image or edje collection) to give life for the background.
Definition: efl_ui_bg.c:188
void elm_bg_option_set(Evas_Object *obj, Elm_Bg_Option option)
Sets the mode of display for a given background widget's image.
Definition: efl_ui_bg.c:82
void elm_bg_color_set(Evas_Object *obj, int r, int g, int b)
Sets the color on a given background widget.
Definition: efl_ui_bg.c:138
Evas_Object * elm_bg_add(Evas_Object *parent)
Adds a new background to the parent.
Definition: efl_ui_bg.c:304
@ ELM_BG_OPTION_SCALE
Scale the background image, retaining aspect ratio (default).
Definition: elm_bg_legacy.h:13
@ ELM_BG_OPTION_CENTER
Center the background image.
Definition: elm_bg_legacy.h:12
@ ELM_BG_OPTION_TILE
Tile background image at its original size.
Definition: elm_bg_legacy.h:17
@ ELM_BG_OPTION_STRETCH
Stretch the background image to fill the widget's area.
Definition: elm_bg_legacy.h:15
void elm_box_horizontal_set(Elm_Box *obj, Eina_Bool horizontal)
Set the horizontal orientation.
Definition: elm_box_eo.legacy.c:27
Evas_Object * elm_box_add(Evas_Object *parent)
Add a new box to the parent.
Definition: elm_box.c:363
void elm_box_pack_end(Elm_Box *obj, Efl_Canvas_Object *subobj)
Add an object at the end of the pack list.
Definition: elm_box_eo.legacy.c:57
Eina_Bool elm_check_state_get(const Evas_Object *obj)
Get the state of the check object.
Definition: efl_ui_check.c:381
Evas_Object * elm_check_add(Evas_Object *parent)
Add a new Check object.
Definition: efl_ui_check.c:516
void elm_object_part_content_set(Evas_Object *obj, const char *part, Evas_Object *content)
Set the content on part of a given container widget.
Definition: elm_main.c:1562
#define ELM_MAIN()
macro to be used after the elm_main() function
Definition: elm_general.h:556
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:1380
void elm_run(void)
Run Elementary's main loop.
Definition: elm_main.c:1357
@ ELM_POLICY_QUIT_LAST_WINDOW_CLOSED
quit when the application's last window is closed
Definition: elm_general.h:248
@ ELM_POLICY_QUIT
under which circumstances the application should quit automatically.
Definition: elm_general.h:227
Evas_Object * elm_radio_add(Evas_Object *parent)
Add a new radio to the parent.
Definition: efl_ui_radio.c:401
void elm_radio_value_set(Evas_Object *obj, int value)
Set the value of the radio group.
Definition: efl_ui_radio.c:408
void elm_radio_group_add(Efl_Ui_Radio *obj, Efl_Ui_Radio *group)
Add this radio to a group of other radio objects.
Definition: efl_ui_radio.c:465
int elm_radio_value_get(const Evas_Object *obj)
Get the value of the radio group.
Definition: efl_ui_radio.c:420
void elm_radio_state_value_set(Efl_Ui_Radio *obj, int value)
Set the integer value that this radio object represents.
Definition: efl_ui_radio_eo.legacy.c:3
double elm_spinner_value_get(const Evas_Object *obj)
Control the value the spinner displays.
Definition: elm_spinner.c:1387
void elm_spinner_special_value_add(Elm_Spinner *obj, double value, const char *label)
Control special string to display in the place of the numerical value.
Definition: elm_spinner_eo.legacy.c:75
Evas_Object * elm_spinner_add(Evas_Object *parent)
Add a new spinner widget to the given parent Elementary (container) object.
Definition: elm_spinner.c:1350
void elm_spinner_label_format_set(Elm_Spinner *obj, const char *fmt)
Control the format string of the displayed label.
Definition: elm_spinner_eo.legacy.c:63
void elm_spinner_editable_set(Elm_Spinner *obj, Eina_Bool editable)
Control whether the spinner can be directly edited by the user or not.
Definition: elm_spinner_eo.legacy.c:39
void elm_spinner_min_max_set(Evas_Object *obj, double min, double max)
Control the minimum and maximum values for the spinner.
Definition: elm_spinner.c:1357
Eina_Bool elm_object_style_set(Evas_Object *obj, const char *style)
Set the style to used by a given widget.
Definition: elm_main.c:1583
Evas_Object * elm_object_parent_widget_get(const Evas_Object *obj)
Get the first parent of the given object that is an Elementary widget.
Definition: elm_main.c:1833
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:9582
void elm_win_resize_object_add(Eo *obj, Evas_Object *subobj)
Add subobj as a resize object of window obj.
Definition: efl_ui_win.c:8997
void elm_win_autodel_set(Eo *obj, Eina_Bool autodel)
Set the window's autodel state.
Definition: efl_ui_win.c:6194
EVAS_API void evas_object_show(Evas_Object *eo_obj)
Makes the given Evas object visible.
Definition: evas_object_main.c:1814
EVAS_API Evas * evas_object_evas_get(const Eo *eo_obj)
Get the Evas to which this object belongs to.
Definition: evas_object_main.c:2662
EVAS_API void evas_object_size_hint_weight_set(Evas_Object *obj, double x, double y)
Sets the hints for an object's weight.
Definition: evas_object_main.c:2638
Efl_Canvas_Object Evas_Object
An Evas Object handle.
Definition: Evas_Common.h:185
EVAS_API void evas_object_size_hint_align_set(Evas_Object *obj, double x, double y)
Sets the hints for an object's alignment.
Definition: evas_object_main.c:2650
EVAS_API void evas_object_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
Changes the size of the given Evas object.
Definition: evas_object_main.c:1236
EVAS_API void evas_object_smart_callback_add(Evas_Object *eo_obj, const char *event, Evas_Smart_Cb func, const void *data)
Add (register) a callback function to the smart event specified by event on the smart object obj.
Definition: evas_object_smart.c:1040