#ifdef HAVE_CONFIG_H
#include "config.h"
#else
#define PACKAGE_EXAMPLES_DIR "."
#endif
#include <Ecore.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "evas-common.h"
#define WIDTH 320
#define HEIGHT 480
static const char commands[] = \
"commands are:\n"
"\tShift + a - change alignment hints on top rectangle\n"
"\tShift + m - change min. size hint on top rectangle\n"
"\tShift + n - change max. size hint on top rectangle\n"
"\tShift + p - change padding hints on top rectangle\n"
"\tShift + w - change weight hints on top rectangle\n\n"
"\tControl + a - change alignment hints on bottom rectangle\n"
"\tControl + m - change min. size hint on bottom rectangle\n"
"\tControl + n - change max. size hint on bottom rectangle\n"
"\tControl + p - change padding hints on bottom rectangle\n"
"\tControl + w - change weight hints on bottom rectangle\n\n"
"\ts - print current hints information\n"
"\th - print help\n";
static const char *border_img_path = PACKAGE_EXAMPLES_DIR EVAS_IMAGE_FOLDER "/red.png";
struct coord_tuple
{
};
struct weight_tuple
{
double x, y;
};
struct padding_tuple
{
};
struct rect_data
{
struct coord_tuple *min_ptr;
struct coord_tuple min[4];
struct coord_tuple *max_ptr;
struct coord_tuple max[4];
struct weight_tuple *align_ptr;
struct weight_tuple align[3];
struct weight_tuple *weight_ptr;
struct weight_tuple weight[3];
struct padding_tuple *padding_ptr;
struct padding_tuple padding[3];
};
struct test_data
{
Ecore_Evas *ee;
struct rect_data t_data, b_data;
};
static struct test_data d = {0};
static void
_canvas_resize_cb(Ecore_Evas *ee)
{
int w, h;
}
static void
{
double x, y;
printf("\talign hints: h(%f), v(%f)\n",
x, y);
cmin = efl_gfx_hint_size_combined_min_get(rect);
printf("\tmin. size hints: h(%d), v(%d)\n",
printf("\tmax. size hints: h(%d), v(%d)\n",
w, h);
printf("\tpadding hints: l(%d), r(%d), t(%d), b(%d)\n",
l, r, t, b);
printf("\tweight hints: h(%f), v(%f)\n",
x, y);
}
static void
void *einfo)
{
struct rect_data *r_data = NULL;
const Evas_Modifier *mods;
const char *name = NULL;
{
rect = d.t_rect;
r_data = &d.t_data;
name = "top";
}
{
rect = d.b_rect;
r_data = &d.b_data;
name = "bottom";
}
else if (strcmp(ev->
key,
"h") == 0)
{
printf(commands);
return;
}
else if (strcmp(ev->
key,
"s") == 0)
{
printf("Top rectangle:\n");
_print_rect_stats(d.t_rect);
printf("\nBottom rectangle:\n");
_print_rect_stats(d.b_rect);
return;
}
if (!rect) return;
if (strcmp(ev->
key,
"a") == 0)
{
(r_data->align_ptr)++;
if ((unsigned int)
(((unsigned char *)(r_data->align_ptr)) - ((unsigned char *)(r_data->align))) >=
sizeof(r_data->align))
r_data->align_ptr = r_data->align;
rect, r_data->align_ptr->x, r_data->align_ptr->y);
printf("Changing align hints for %s rect. to (%f, %f)\n",
name, r_data->align_ptr->x, r_data->align_ptr->y);
return;
}
if (strcmp(ev->
key,
"m") == 0)
{
(r_data->min_ptr)++;
if ((unsigned int)
(((unsigned char *)(r_data->min_ptr)) - ((unsigned char *)(r_data->min))) >=
sizeof(r_data->min))
r_data->min_ptr = r_data->min;
rect, r_data->min_ptr->w, r_data->min_ptr->h);
printf("Changing min. size hints for %s rect. to (%d, %d)\n",
name, r_data->min_ptr->w, r_data->min_ptr->h);
return;
}
if (strcmp(ev->
key,
"n") == 0)
{
(r_data->max_ptr)++;
if ((unsigned int)
(((unsigned char *)(r_data->max_ptr)) - ((unsigned char *)(r_data->max))) >=
sizeof(r_data->max))
r_data->max_ptr = r_data->max;
rect, r_data->max_ptr->w, r_data->max_ptr->h);
printf("Changing max. size hints for %s rect. to (%d, %d)\n",
name, r_data->max_ptr->w, r_data->max_ptr->h);
return;
}
if (strcmp(ev->
key,
"p") == 0)
{
(r_data->padding_ptr)++;
if ((unsigned int)
(((unsigned char *)(r_data->padding_ptr)) - ((unsigned char *)(r_data->padding))) >=
sizeof(r_data->padding))
r_data->padding_ptr = r_data->padding;
rect, r_data->padding_ptr->l, r_data->padding_ptr->r,
r_data->padding_ptr->t, r_data->padding_ptr->b);
printf("Changing padding size hints for %s rect. to (%d, %d, %d, %d)\n",
name, r_data->padding_ptr->l, r_data->padding_ptr->r,
r_data->padding_ptr->t, r_data->padding_ptr->b);
return;
}
if (strcmp(ev->
key,
"w") == 0)
{
(r_data->weight_ptr)++;
if ((unsigned int)
(((unsigned char *)(r_data->weight_ptr)) - ((unsigned char *)(r_data->weight))) >=
sizeof(r_data->weight))
r_data->weight_ptr = r_data->weight;
rect, r_data->weight_ptr->x, r_data->weight_ptr->y);
printf("Changing weight hints for %s rect. to (%f, %f)\n",
name, r_data->weight_ptr->x, r_data->weight_ptr->y);
return;
}
}
static void
{
}
int
main(void)
{
return EXIT_FAILURE;
struct rect_data init_data = \
{
.min = {{0, 0}, {30, 30}, {100, 70}, {200, 200}},
.max = {{0, 0}, {100, 100}, {100, 70}, {300, 300}},
.align = {{0.0, 0.0}, {0.5, 0.5}, {1.0, 0.5}},
.weight = {{0.0, 0.0}, {3, 6}, {10, 100}},
.padding = {{0, 0, 0, 0}, {3, 6, 9, 12}, {10, 20, 0, 30}}
};
d.t_data = init_data;
d.t_data.min_ptr = d.t_data.min + 1;
d.t_data.max_ptr = d.t_data.max + 1;
d.t_data.align_ptr = d.t_data.align;
d.t_data.weight_ptr = d.t_data.weight;
d.t_data.padding_ptr = d.t_data.padding;
d.b_data = init_data;
d.b_data.min_ptr = d.b_data.min + 1;
d.b_data.max_ptr = d.b_data.max + 1;
d.b_data.align_ptr = d.b_data.align;
d.b_data.weight_ptr = d.b_data.weight;
d.b_data.padding_ptr = d.b_data.padding;
if (!d.ee)
goto error;
d.t_rect, d.t_data.min_ptr->w, d.t_data.min_ptr->h);
d.b_rect, d.b_data.min_ptr->w, d.b_data.min_ptr->h);
_canvas_resize_cb(d.ee);
printf(commands);
return 0;
error:
fprintf(stderr, "error: Requires at least one Evas engine built and linked"
" to ecore-evas for this example to run properly.\n");
return -1;
}
int Evas_Coord
Type used for coordinates (in pixels, int).
Definition: Evas_Common.h:116
@ EVAS_CALLBACK_KEY_DOWN
Key Press Event.
Definition: Evas_Common.h:430
EAPI int ecore_evas_init(void)
Inits the Ecore_Evas system.
Definition: ecore_evas.c:602
EAPI void ecore_evas_callback_destroy_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
Sets a callback for Ecore_Evas destroy events.
Definition: ecore_evas.c:1185
EAPI void ecore_evas_show(Ecore_Evas *ee)
Shows an Ecore_Evas' window.
Definition: ecore_evas.c:1480
EAPI Evas * ecore_evas_get(const Ecore_Evas *ee)
Gets an Ecore_Evas's Evas.
Definition: ecore_evas.c:1300
EAPI void ecore_evas_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int *h)
Gets the geometry of an Ecore_Evas.
Definition: ecore_evas.c:1362
EAPI Ecore_Evas * ecore_evas_new(const char *engine_name, int x, int y, int w, int h, const char *extra_options)
Creates a new Ecore_Evas based on engine name and common parameters.
Definition: ecore_evas.c:1039
EAPI void ecore_evas_callback_resize_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
Sets a callback for Ecore_Evas resize events.
Definition: ecore_evas.c:1140
EAPI int ecore_evas_shutdown(void)
Shuts down the Ecore_Evas system.
Definition: ecore_evas.c:666
void ecore_main_loop_quit(void)
Quits the main loop once all the events currently on the queue have been processed.
Definition: ecore_main.c:1321
void ecore_main_loop_begin(void)
Runs the application main loop.
Definition: ecore_main.c:1311
#define EINA_TRUE
boolean value TRUE (numerical value 1)
Definition: eina_types.h:539
#define EINA_UNUSED
Used to indicate that a function parameter is purposely unused.
Definition: eina_types.h:339
EVAS_API const Evas_Modifier * evas_key_modifier_get(const Evas *eo_e)
Returns a handle to the list of modifier keys registered in the canvas e.
Definition: evas_key.c:35
Eo Evas
An opaque handle to an Evas canvas.
Definition: Evas_Common.h:163
EVAS_API Eina_Bool evas_key_modifier_is_set(const Evas_Modifier *m, const char *keyname)
Checks the state of a given modifier of the default seat, at the time of the call.
Definition: evas_key.c:76
EVAS_API Evas_Object * evas_object_box_add(Evas *evas)
Add a new box object on the provided canvas.
Definition: evas_object_box.c:481
EVAS_API void evas_object_box_layout_vertical(Evas_Box *obj, Evas_Object_Box_Data *priv, void *data)
Layout function which sets the box o to a (basic) vertical box.
Definition: evas_box_eo.legacy.c:39
EVAS_API Evas_Object_Box_Option * evas_object_box_append(Evas_Box *obj, Efl_Canvas_Object *child)
Append a new child object to the given box object o.
Definition: evas_box_eo.legacy.c:81
EVAS_API void evas_object_box_layout_set(Evas_Box *obj, Evas_Object_Box_Layout cb, const void *data, Eina_Free_Cb free_data)
Set a new layouting function to a given box object.
Definition: evas_box_eo.legacy.c:27
EVAS_API void evas_object_show(Evas_Object *eo_obj)
Makes the given Evas object visible.
Definition: evas_object_main.c:1814
EVAS_API void evas_object_color_set(Evas_Object *obj, int r, int g, int b, int a)
Sets the general/main color of the given Evas object to the given one.
Definition: evas_object_main.c:2024
EVAS_API void evas_object_event_callback_add(Evas_Object *eo_obj, Evas_Callback_Type type, Evas_Object_Event_Cb func, const void *data)
Add (register) a callback function to a given Evas object event.
Definition: evas_callbacks.c:478
EVAS_API void evas_object_size_hint_padding_set(Evas_Object *obj, Evas_Coord l, Evas_Coord r, Evas_Coord t, Evas_Coord b)
Sets the hints for an object's padding space.
Definition: evas_object_main.c:2626
EVAS_API void evas_object_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
Move the given Evas object to the given location inside its canvas' viewport.
Definition: evas_object_main.c:1171
EVAS_API void evas_object_size_hint_align_get(const Evas_Object *obj, double *x, double *y)
Retrieves the hints for on object's alignment.
Definition: evas_object_main.c:2656
EVAS_API void evas_object_size_hint_padding_get(const Evas_Object *obj, Evas_Coord *l, Evas_Coord *r, Evas_Coord *t, Evas_Coord *b)
Retrieves the hints for an object's padding space.
Definition: evas_object_main.c:2632
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_max_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
Sets the hints for an object's maximum size.
Definition: evas_object_main.c:2596
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_size_hint_weight_get(const Evas_Object *obj, double *x, double *y)
Retrieves the hints for an object's weight.
Definition: evas_object_main.c:2644
EVAS_API void evas_object_focus_set(Efl_Canvas_Object *obj, Eina_Bool focus)
Indicates that this object is the keyboard event receiver on its canvas.
Definition: efl_canvas_object_eo.legacy.c:39
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_size_hint_max_get(const Evas_Object *obj, Evas_Coord *w, Evas_Coord *h)
Retrieves the hints for an object's maximum size.
Definition: evas_object_main.c:2602
EVAS_API void evas_object_size_hint_min_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
Sets the hints for an object's minimum size.
Definition: evas_object_main.c:2611
EVAS_API void evas_object_image_border_set(Evas_Object *obj, int l, int r, int t, int b)
Dimensions of this image's border, a region that does not scale with the center area.
Definition: evas_image_legacy.c:117
EVAS_API void evas_object_image_border_center_fill_set(Evas_Object *obj, Evas_Border_Fill_Mode fill)
Specifies how the center part of the object (not the borders) should be drawn when EFL is rendering i...
Definition: evas_image_legacy.c:145
EVAS_API void evas_object_image_file_set(Evas_Object *obj, const char *file, const char *key)
Set the source file from where an image object must fetch the real image data (it may be an Eet file,...
Definition: evas_image_legacy.c:194
EVAS_API Evas_Object * evas_object_image_filled_add(Evas *eo_e)
Creates a new image object that automatically scales its bound image to the object's area,...
Definition: evas_image_legacy.c:35
@ EVAS_BORDER_FILL_NONE
Image's center region is not to be rendered.
Definition: Evas_Legacy.h:5721
EVAS_API Evas_Object * evas_object_rectangle_add(Evas *e)
Adds a rectangle to the given evas.
Definition: evas_object_rectangle.c:78
A 2D size in pixel coordinates.
Definition: eina_rectangle.h:70
Key press event.
Definition: Evas_Legacy.h:314
const char * key
The logical key : (eg shift+1 == exclamation)
Definition: Evas_Legacy.h:320