EZ
Up Prev Next Contents


3.21.2 Geometry Manager

Unlike FancyListBox and ListTree which have specific rules to arrange their display items, WorkArea does not have a fixed geometry management policy. Therefore, the EZwgl library provides an option for an application to hook in its own geometry manager. This section discusses the issues on writing geometry managers.

Upon creation, EZ_CreateWorkArea initialize the geometry manager to a default one, which arrange display items in rows and columns.

The responsiblity of a geometry manager is to assign a location for each display item, and possiblly re-assign the dimensions of display items (e.g. make the height of a row of items the same). A geometry manager is invoked whenever the library thinks the geometry of its hosting WorkArea widget needs to be recomputed. For example, after the window has been resized or an item has been deleted.

\subsection*Supporting Routines To acomplish its tasks, a geometry manager needs helps from a few supporting functions, functions that allow the geometry manager to compute and/or alter the dimension of display items and to assign locations for display items.

Warning: The following functions are specifically designed to help geometry managers for WorkArea widgets to do their jobs. Some of them will not work if used for other purposes.

void EZ_ComputeItemSize(EZ_Item *item, int *w_ret, int *h_ret)

This function computes the dimension of a display item.

void EZ_SetItemPosition(EZ_Item *item, int x, int y)

This function sets the location of the upper-left corner of a display item.

void EZ_SetItemWidth(EZ_Item *item, int width)

This function sets the width of a display item.

void EZ_SetItemHeight(EZ_Item *item, int height)

This function sets the height of a display item.

void EZ_SetItemDimension(EZ_Item *item, int width, int height)

This function sets the size of a display item.

int EZ_GetItemWidth(EZ_Item *item)

This function returns the width of a display item.

int EZ_GetItemHeight(EZ_Item *item)

This function returns the height of a display item.

void EZ_GetItemDimension(EZ_Item *item, int width_ret, int height_ret)

This function returns the size of a display item.

\subsection*The Prototype of a Geometry Manager

   void GeometryManager(void *private_data,  EZ_Item **items,  int nitems,
                        int ox,  int oy,  int width,  int height,
                        int xspacing,  int yspacing, 
                        int *width_ret,  int *height_ret)


The meaning of the arguments are explained below.

void EZ_SetWorkAreaGeometryManager(EZ_Widget *workArea,

EZ_WorkAreaGeometryManager manager,

void *manager_data)

This function sets the private geometry manager for a WorkArea widget.


HTML Documentation Maintainance:Arturo Espinosa <arturo@nuclecu.unam.mx>