Etk
Main Page Object Hierarchy Data Structures Related Pages
Etk

Etk_Fixed


Detailed Description

The Etk_Fixed widget is a container which allows you to position widgets at fixed coordinates.

Etk_Fixed allows you to easily position widgets at fixed coordinates. The children will have the same size as their requested-size. So to force a child to have a fixed 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 *fixed;
 Etk_Widget *child;

 fixed = etk_fixed_new();
 child = etk_button_new();
 etk_fixed_put(ETK_FIXED(fixed), child, 20, 30);
 etk_widget_size_request_set(button, 100, 30);

Etk_Fixed may seem to make widget positioning simpler but you should actually avoid using it as much as possible. Indeed, using fixed 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 fixed container, you will probably have to reposition all the other children of the fixed container. It's heavily advised to use Etk_Box, Etk_Table or any other kind of containers instead of a fixed container.

Object Hierarchy:
  • Etk_Object
    • Etk_Widget
      • Etk_Container
        • Etk_Fixed


Data Structures

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

Defines

#define ETK_FIXED_TYPE   (etk_fixed_type_get())
#define ETK_FIXED(obj)   (ETK_OBJECT_CAST((obj), ETK_FIXED_TYPE, Etk_Fixed))
#define ETK_IS_FIXED(obj)   (ETK_OBJECT_CHECK_TYPE((obj), ETK_FIXED_TYPE))

Functions

Etk_Widget * etk_fixed_new (void)
 Creates a new fixed container.
void etk_fixed_put (Etk_Fixed *fixed, Etk_Widget *widget, int x, int y)
 Puts a new child into the fixed container, at the position (x, y).
void etk_fixed_move (Etk_Fixed *fixed, Etk_Widget *widget, int x, int y)
 Moves an existing child of the fixed container to the position (x, y).
void etk_fixed_child_position_get (Etk_Fixed *fixed, Etk_Widget *widget, int *x, int *y)
 Gets the position of a child of the fixed container.


Define Documentation

#define ETK_FIXED_TYPE   (etk_fixed_type_get())

Gets the type of a fixed

#define ETK_FIXED ( obj   )     (ETK_OBJECT_CAST((obj), ETK_FIXED_TYPE, Etk_Fixed))

Casts the object to an Etk_Fixed

#define ETK_IS_FIXED ( obj   )     (ETK_OBJECT_CHECK_TYPE((obj), ETK_FIXED_TYPE))

Checks if the object is an Etk_Fixed


Function Documentation

Etk_Widget * etk_fixed_new ( void   ) 

Creates a new fixed container.

Returns:
Returns the new fixed container

void etk_fixed_put ( Etk_Fixed *  fixed,
Etk_Widget *  widget,
int  x,
int  y 
)

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

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

void etk_fixed_move ( Etk_Fixed *  fixed,
Etk_Widget *  widget,
int  x,
int  y 
)

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

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

void etk_fixed_child_position_get ( Etk_Fixed *  fixed,
Etk_Widget *  widget,
int *  x,
int *  y 
)

Gets the position of a child of the fixed container.

Parameters:
fixed a fixed 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 fixed container, x and y will be set to (0, 0)