Main Page | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

Viewported versus not Viewported

Every grafical element has a size, internally they are called mWidth and mHeight.

E.g. a window constructed with new CSWindow(200, 400) has a height of 200 and a width of 400. This is space the window occupies on the screen (if not out of bounds).

(The following text refers to windows only, since windows are easy to understand, but the viewport concept holds true for ALL CSGraphikElements.)

The maximum size of the viewport of the window is at this moment also 200 x 400 (that doesn't imply, that all elements added to the window are size restricted to be smaller than 200 x 400 -> but that later).

The viewport of the window is the hole, thru that a spectator can watch the action that takes place behind the window. A real life example, take a window: a REAL window - out of glass. What makes up the window? Say you see it from two meters distant.

This example has everything in it a computer window needs. Here the translation: The viewport is the part of the window "thru" which you can see elements of the window. With this example you see that there are defenitly elements of a window, that don't reside in the viewport. Elements that usually are not viewported: Elements that usually are viewported: The viewport is (nearly all the time) smaller than the window size. Internally the size is kept in mViewportHeight and mViewportHeight. The viewport has an offset to the position of the window start (kept in mViewportX and mViewportY).

Non viewported elements are usually autosizing (menubars stretch all the way, even if the size of the window changes). If they are not autosizing, it is assumed they don't influence the viewport size! ->

See also:
CSGrafikElement::buildArea()
The size of the viewport is changed, when adding non viewported elements (since the size of the window does not change).

When adding a viewported element, the position of the element is in relation to the viewport start. That means you cannot position a viewported element on the window on a position that is not taken up by the viewport. The window thinks it belongs to the viewport and is actually displaying only parts of it if positioned out of bounds (like -> you don't see the whole sky if you look out of the real window, only part of it).

When adding elements to a window that are not viewported, they are in relation to the actual start position of the window.

All elements can either be viewported or non viewported. Befor they are added to another element, they must be set to either viewported or non viewported, using:

void setViewported(bool viewported)
All elements have sensible default values!
Generated on Wed Jul 14 00:45:34 2004 for CSLib by doxygen 1.3.6