QuakeForge  0.7.2.210-815cf
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Console View Objects

Data Structures

struct  view_s
 

Typedefs

typedef struct view_s view_t
 The view object. More...
 

Enumerations

enum  grav_t {
  grav_center, grav_north, grav_northeast, grav_east,
  grav_southeast, grav_south, grav_southwest, grav_west,
  grav_northwest
}
 Control the positioning of a view within its parent. More...
 

Functions

void view_add (view_t *par, view_t *view)
 Add a view to a parent view at the end of the parents view list. More...
 
void view_delete (view_t *view)
 Delete a view and all its child views. More...
 
void view_draw (view_t *view)
 Draw the child views of a view. More...
 
void view_insert (view_t *par, view_t *view, int pos)
 Insert a view into a parent view at the specified location. More...
 
void view_move (view_t *view, int xp, int yp)
 Chage the location of a view. More...
 
view_tview_new (int xp, int yp, int xl, int yl, grav_t grav)
 Create a new view. More...
 
void view_remove (view_t *par, view_t *view)
 Remove a view from its parent. More...
 
void view_resize (view_t *view, int xl, int yl)
 Change the size of a view. More...
 

Detailed Description

Typedef Documentation

typedef struct view_s view_t

The view object.

Enumeration Type Documentation

enum grav_t

Control the positioning of a view within its parent.

The directions are the standard compass rose (north, east, south, west in clockwise order) with north at the top.

The origin of the view is taken to be the point corresponding point on the edge of the view (eg, southeast is bottom right), or the view's center for center gravity. When the relative coordinates of the view are (0,0), the view's origin is placed on the parent view's gravity point using the view's gravity (not the parent view's gravity). That is, the parent view's gravity has no effect on the view's position within the parent view.

The gravity also affects the direction the view moves as the relative coordinates of the view change.

No checking is done to ensure the view stays within the parent, or that the view is smaller than the parent. This is by design. It is up to the drawing callbacks to do any necessary clipping.

Enumerator
grav_center 

+ve X right, +ve Y down, -X left, -ve Y up

grav_north 

+ve X right, +ve Y down, -X left, -ve Y up

grav_northeast 

+ve X left, +ve Y down, -X right, -ve Y up

grav_east 

+ve X left, +ve Y down, -X right, -ve Y up

grav_southeast 

+ve X left, +ve Y up, -X right, -ve Y down

grav_south 

+ve X right, +ve Y up, -X left, -ve Y down

grav_southwest 

+ve X right, +ve Y up, -X left, -ve Y down

grav_west 

+ve X right, +ve Y down, -X left, -ve Y up

grav_northwest 

+ve X right, +ve Y down, -X left, -ve Y up

Function Documentation

void view_add ( view_t par,
view_t view 
)

Add a view to a parent view at the end of the parents view list.

The absolute X and Y coordianates of the inserted view and its child views are updated based on the view's gravity.

The added view will be drawn last (and thus on top of earlier views).

Parameters
parThe parent view to which the view is to be added.
viewThe view to add.
void view_delete ( view_t view)

Delete a view and all its child views.

If the view has a parent, the view will be removed from its parent.

Parameters
viewThe view to delete.
void view_draw ( view_t view)

Draw the child views of a view.

If a child view is not visible (view_t::visible is 0), the child will be skipped.

Note
It is best to always use view_t::draw() to draw a view rather than calling this directly. This function is really for the view's draw callback to call to draw its sub-views.
Parameters
viewThe view of which to draw the children.
void view_insert ( view_t par,
view_t view,
int  pos 
)

Insert a view into a parent view at the specified location.

If pos is negative, it is taken to be relative to the end of the parent's list of views (view_insert (par, view, -1) is equivalent to view_add (par, view)). pos is clipped to be within the correct range.

The absolute X and Y coordianates of the inserted view and its child views are updated based on the view's gravity.

The position of the view within the parent view's child view list determines the draw order (and thus Z order) of the view, with position 0 being drawn first.

Parameters
parThe parent view into which the view is to be inserted.
viewThe view to insert.
posThe position at which to insert the view into the parent.
void view_move ( view_t view,
int  xp,
int  yp 
)

Chage the location of a view.

The absolute X and Y coorinates of the view are updated as necessary to keep the coordinates of the view's origin correct relative to the view's geometry.

Parameters
viewThe view to move.
xpThe new X coordinate of the view relative to its gravity.
ypThe new Y coordinate of the view relative to its gravity.
view_t* view_new ( int  xp,
int  yp,
int  xl,
int  yl,
grav_t  grav 
)

Create a new view.

view_t::draw is set to view_draw() and the view is made visible. All coordinates are set appropriately for the new view being a root view. All other fields not set by the parameters are 0.

Parameters
xpThe X coordinate of the view's origin.
ypThe Y coordinate of the view's origin.
xlThe width of the view.
ylThe height of the view.
gravThe gravity of the view. determines the view's origin and its positioning within the view's parent.
void view_remove ( view_t par,
view_t view 
)

Remove a view from its parent.

Parameters
parThe parent view from which the view is to be removed.
viewThe view to remove.
void view_resize ( view_t view,
int  xl,
int  yl 
)

Change the size of a view.

The view's children are also resized based on their view_t::resize_x and view_t::resize_y flags.

The absolute X and Y coorinates of the view are updated as necessary to keep the coordinates of the view's origin correct relative to the view's geometry.

Parameters
viewThe view to resize.
xlThe new width of the view.
ylThe new height of the view.