Etk
Main Page Object Hierarchy Data Structures Related Pages
Etk

Etk_Canvas


Detailed Description

The Etk_Canvas widget is a container which allows you to position widgets at canvas coordinates.

Etk_Canvas allows you to easily position widgets at canvas coordinates. The children will have the same size as their requested-size. So to force a child to have a canvas size, you can call etk_widget_size_request_set() on the child.
Fox example, to put a button at the position (20, 30), with the size 100x30:

 Etk_Widget *canvas;
 Etk_Widget *child;

 canvas = etk_canvas_new();
 child = etk_button_new();
 etk_canvas_put(ETK_CANVAS(canvas), child, 20, 30);
 etk_widget_size_request_set(button, 100, 30);

Etk_Canvas may seem to make widget positioning simpler but you should actually avoid using it as much as possible. Indeed, using canvas positions may make widgets overlap and the result can look differently on different configurations (different themes, different fonts, different languages, ...). Also, if you'll ever want to remove a child from the canvas container, you will probably have to reposition all the other children of the canvas container. It's heavily advised to use Etk_Box, Etk_Table or any other kind of containers instead of a canvas container.

Object Hierarchy:
  • Etk_Object
    • Etk_Widget
      • Etk_Container
        • Etk_Canvas


Data Structures

struct  Etk_Canvas
 [Widget] A container which allows you to position widgets at canvas coordinates More...

Defines

#define ETK_CANVAS_TYPE   (etk_canvas_type_get())
#define ETK_CANVAS(obj)   (ETK_OBJECT_CAST((obj), ETK_CANVAS_TYPE, Etk_Canvas))
#define ETK_IS_CANVAS(obj)   (ETK_OBJECT_CHECK_TYPE((obj), ETK_CANVAS_TYPE))

Functions

Etk_Widget * etk_canvas_new (void)
 Creates a new canvas container.
void etk_canvas_put (Etk_Canvas *canvas, Etk_Widget *widget, int x, int y)
 Puts a new child into the canvas container, at the position (x, y).
void etk_canvas_move (Etk_Canvas *canvas, Etk_Widget *widget, int x, int y)
 Moves an existing child of the canvas container to the position (x, y).
void etk_canvas_child_position_get (Etk_Canvas *canvas, Etk_Widget *widget, int *x, int *y)
 Gets the position of a child of the canvas container.
Etk_Widget * etk_canvas_object_add (Etk_Canvas *canvas, Evas_Object *evas_object)
 Adds an Evas_Object to the canvas. This is a convenience function that uses Etk_Evas_Object.
void etk_canvas_object_remove (Etk_Canvas *canvas, Evas_Object *evas_object)
 Removed an Evas_Object from the canvas.
void etk_canvas_object_move (Etk_Canvas *canvas, Evas_Object *evas_object, int x, int y)
 Moves an Evas_Object around in the canvas.


Define Documentation

#define ETK_CANVAS_TYPE   (etk_canvas_type_get())

Gets the type of a canvas

Referenced by etk_canvas_new().

#define ETK_CANVAS ( obj   )     (ETK_OBJECT_CAST((obj), ETK_CANVAS_TYPE, Etk_Canvas))

Casts the object to an Etk_Canvas

#define ETK_IS_CANVAS ( obj   )     (ETK_OBJECT_CHECK_TYPE((obj), ETK_CANVAS_TYPE))

Checks if the object is an Etk_Canvas


Function Documentation

Etk_Widget * etk_canvas_new ( void   ) 

Creates a new canvas container.

Returns:
Returns the new canvas container

References ETK_CANVAS_TYPE, and etk_widget_new().

void etk_canvas_put ( Etk_Canvas *  canvas,
Etk_Widget *  widget,
int  x,
int  y 
)

Puts a new child into the canvas container, at the position (x, y).

Parameters:
canvas a canvas container
child the child to add
x the x position where to put the child
y the y position where to put the child

References children, clip, ETK_OBJECT, etk_object_data_set(), etk_signal_emit(), ETK_WIDGET, etk_widget_clip_set(), and etk_widget_parent_set().

Referenced by etk_canvas_object_add().

void etk_canvas_move ( Etk_Canvas *  canvas,
Etk_Widget *  widget,
int  x,
int  y 
)

Moves an existing child of the canvas container to the position (x, y).

Parameters:
canvas a canvas container
widget the child to move
x the x position where to move the child
y the y position where to move the child

References children, ETK_WIDGET, and etk_widget_size_recalc_queue().

Referenced by etk_canvas_object_move().

void etk_canvas_child_position_get ( Etk_Canvas *  canvas,
Etk_Widget *  widget,
int *  x,
int *  y 
)

Gets the position of a child of the canvas container.

Parameters:
canvas a canvas container
widget the child you want the position of
x the location where to store the x position of the child (it can be NULL)
y the location where to store the y position of the child (it can be NULL)
Note:
if the child is not contained by the canvas container, x and y will be set to (0, 0)

References ETK_OBJECT, and etk_object_data_get().

Etk_Widget * etk_canvas_object_add ( Etk_Canvas *  canvas,
Evas_Object *  evas_object 
)

Adds an Evas_Object to the canvas. This is a convenience function that uses Etk_Evas_Object.

Parameters:
canvas the canvas container evas_object the evas object to add
Returns:
returns the Etk_Evas_Object holding the evas_object
Note:
You will need to show the widget after it has been added.

References etk_canvas_put(), and etk_evas_object_new_from_object().

void etk_canvas_object_remove ( Etk_Canvas *  canvas,
Evas_Object *  evas_object 
)

Removed an Evas_Object from the canvas.

Parameters:
canvas the canvas container
evas_object the Evas_Object to remove

References ETK_CONTAINER.

void etk_canvas_object_move ( Etk_Canvas *  canvas,
Evas_Object *  evas_object,
int  x,
int  y 
)

Moves an Evas_Object around in the canvas.

Parameters:
canvas the canvas container
evas_object the Evas_Object to move
x the x coordinate to move to inside the canvas
y the y coordinate to move to inside the canvas

References etk_canvas_move().