glictContainer Class Reference

#include <container.h>

Inheritance diagram for glictContainer:

glictButton glictPanel glictProgressBar glictScrollbar glictTextbox glictWindow glictList glictMessageBox

List of all members.


Detailed Description

Container class, base for all other widgets.

This is the Container class, which is actually a base class for all other widgets. Althought this one does not render itself, it actually contains most of reusable code for the widgets to inherit. An example of these inherited functionalities are children management, children rendering, proper clipping, mouse coordinate transformation, et al.

Examples:

examples/memory/main.cpp, and examples/memory_sdl/main.cpp.

Definition at line 47 of file container.h.


Public Member Functions

virtual void AddObject (glictContainer *object)
 Adds an object as a child.
bool CastEvent (glictEvents evt, void *wparam, long lparam)
 Casts an event omitting the returnvalue. (deprecated, I'm lazy and don't want to rewrite code so I abuse namespace).
virtual bool CastEvent (glictEvents evt, void *wparam, long lparam, void *returnvalue)
 Casts an event to the class, so it can process it. Example is mouseclick or mousedown.
void CPaint ()
 Renders all children.
bool DefaultCastEvent (glictEvents evt, void *wparam, long lparam, void *returnvalue)
 Casts an event into default event processor, omitting the widget's code.
void DelayedRemove ()
 Runs delayed removal of objects.
const char * EvtTypeDescriptor (glictEvents evt)
 Returns string with generated event.
virtual void FixContainerOffsets ()
 Fixes container offsets. Should be used only internally.
void Focus (glictContainer *callerchild)
 Sets the focus to the current object.
std::string GetCaption ()
 Retrieves the caption of the control, if supported.
virtual void * GetCustomData ()
 Allows the application programmer to retrieve previously stored custom data assigned to this object.
bool GetEnabled ()
 Retrieves enabledness.
virtual bool GetFocusable ()
 Allows to retrieve whether or not a widget can be focused.
float GetHeight ()
 Returns object's height.
glictContainerGetParent ()
void GetPos (glictPos *pos)
 Gets object's position and writes it into predefined type. Useful when exchanging data between library's functions.
void GetPos (float *x, float *y)
 Gets object's position and writes it into integers x and y.
void GetSize (glictSize *size)
 Gets object's size (height and width) and writes it into predefined type.
virtual glictPosGetVirtualPos ()
bool GetVisible ()
 Retrieves visibility.
float GetWidth ()
 Returns object's width.
float GetX ()
 Returns object position's x coordinate.
float GetY ()
 Returns object position's y coordinate.
 glictContainer (long guid)
 Constructor for the class, specifying guid. (Guid is unused at the moment).
 glictContainer ()
 Constructor for the class.
virtual void Paint ()
 Renders the element. Should contain call to CPaint().
virtual void RecursiveBoundaryFix ()
 Fixes boundaries recursively up to the root of the tree (desktop, probably). Also used to make scrollbars appear in case of virtual size, where appropriate. Should be used only internally. FIXME: Make private/protected.
void RememberTransformations ()
 When calling parent's paint, call it's 'remember transformations' too, so clicking detection is done properly. if clicking unused, or no transformations done, then not important.
virtual void RemoveObject (glictContainer *object)
 Removes an object that's a child.
void ReportDebug ()
 Reports debug information to stdout.
void ResetTransformations ()
 Resets transformations to default transf matrix (identity matrix).
void SetCaption (const std::string caption)
 Sets the caption of the control, if supported.
virtual void SetCustomData (void *param)
 Allows the application programmer to store custom data assigned to this object.
void SetEnabled (bool enabled)
 Sets enabledness.
virtual void SetFocusable (bool b)
 Allows to set whether or not a widget can be focused.
void SetFont (std::string name, unsigned int size=10)
 Sets the name of the font to be used for rendering of any caption that the widget may be attempting to paint. Also sets the size, which may be disregarded by the font engine.
virtual void SetHeight (float h)
 Sets object's height.
void SetNext (glictContainer *)
void SetOnClick (void(*OnClickFunction)(glictPos *relmousepos, glictContainer *callerclass))
 Sets a function to execute upon click. OBJECT MUST NOT DESTROY ITSELF OR REMOVE ITSELF FROM OBJECT LIST OF ITS PARENT FROM WITHIN.
void SetOnMouseDown (void(*FunctionPtr)(glictPos *relmousepos, glictContainer *callerclass))
 Sets a function to execute upon mouse pressed down over this object. OBJECT MUST NOT DESTROY ITSELF OR REMOVE ITSELF FROM OBJECT LIST OF ITS PARENT FROM WITHIN.
void SetOnMouseUp (void(*FunctionPtr)(glictPos *relmousepos, glictContainer *callerclass))
 Sets a function to execute upon mouse pressed down over this object. OBJECT MUST NOT DESTROY ITSELF OR REMOVE ITSELF FROM OBJECT LIST OF ITS PARENT FROM WITHIN.
void SetOnPaint (void(*OnPaintFunction)(glictRect *real, glictRect *clipped, glictContainer *callerclass))
 Sets a function to execute whenever drawing. OBJECT MUST NOT DESTROY ITSELF OR REMOVE ITSELF FROM OBJECT LIST OF ITS PARENT FROM WITHIN.
void SetPos (glictPos pos)
 Sets object's position using predefined type. Useful when exchanging data between library's functions.
void SetPos (float x, float y)
 Sets object's position using classical access using two integers.
void SetPrevious (glictContainer *)
void SetScissor ()
 This one adjusts the clipping window through which something can be seen, and which is set by SetClip.
virtual void SetVirtualSize (float w, float h)
void SetVisible (bool visibility)
 Sets visibility.
virtual void SetWidth (float w)
 Sets object's width.
void TransformScreenCoords (glictPos *pos)
 Transforms screen coordinates into plane coordinates.
virtual void VirtualScrollBottom ()
virtual ~glictContainer ()
 Destructor for the class.

Public Attributes

float bottom
 Current boundaries of the widget, calculated from height, width, x and y. FIXME: Make private.
float clipbottom
 Current clipping boundaries of the widget. Somewhat depends on the parent's clipping. FIXME: Make private.
float clipleft
float clipright
float cliptop
float containeroffsetx
float containeroffsety
 Offsets of container object positions.
float height
float left
char objtype [50]
 Short descriptive string containing name of the object. (Each class actually rewrites this one upon intialization in constructor.).
float right
float top
float width
 Current height and width of the widget. FIXME: Make private/protected.
float x
float y
 Current position of the widget. FIXME: Make private/protected.

Protected Attributes

std::string caption
 Caption written on the control, if control supports it.
void * customdata
std::vector
< glictContainer * > 
delayedremove
bool focusable
std::string fontname
unsigned int fontsize
unsigned int guid
 Unique identifier; unused so far.
float ModelviewMatrix [16]
 Modelview matrix, as remembered last time RememberTransformations() was called.
glictContainernext
std::vector
< glictContainer * > 
objects
 Contains all the children objects.
void(* OnClick )(glictPos *relmousepos, glictContainer *callerclass)
 Pointer to function specified as OnClick function.
void(* OnMouseDown )(glictPos *relmousepos, glictContainer *callerclass)
 Pointer to function specified as OnMouseDown function.
void(* OnMouseUp )(glictPos *relmousepos, glictContainer *callerclass)
 Pointer to function specified as OnMouseUp function.
void(* OnPaint )(glictRect *real, glictRect *clipped, glictContainer *callerclass)
 Pointer to function specified as OnPaint function.
glictContainerparent
 Pointer to class' parents.
glictContainerprevious
glictPos virtualpos
glictSize virtualsize

Private Member Functions

void SetClip (float left, float top, float right, float bottom)
 Internal function. Sets the clipping boundaries of the widget.
void SetRect (float left, float top, float right, float bottom)
 Internal function. Sets the boundaries of the widget.

Private Attributes

bool enabled
bool visible

Friends

void _glictMessageBox_Closer (glictPos *relmousepos, glictContainer *caller)

Constructor & Destructor Documentation

glictContainer::glictContainer (  ) 

Constructor for the class.

It fills up the class with default infos.

Definition at line 53 of file container.cpp.

References containeroffsetx, containeroffsety, focusable, fontname, fontsize, guid, height, next, OnClick, OnMouseDown, OnMouseUp, OnPaint, parent, previous, ResetTransformations(), SetCaption(), SetClip(), SetEnabled(), SetRect(), SetVisible(), virtualpos, virtualsize, width, glictPos::x, x, glictPos::y, and y.

glictContainer::~glictContainer (  )  [virtual]

Destructor for the class.

Only used to determine if this is the currently focused item; if so, then it sets currently focused item to NULL.

Definition at line 104 of file container.cpp.

References glictGlobalsClass::topFocused.


Member Function Documentation

void glictContainer::AddObject ( glictContainer obj  )  [virtual]

Adds an object as a child.

Parameters:
obj Pointer to object to add as a child. Simply inserts the passed object pointer into a vector/list of objects, also giving the child object a "this" as a parent, so the child knows who gave birth to it. Also tells it to ResetTransformations, which'd be incorrect at display, but lets us get rid of it at init time. (Oh, dear, no more biology...)
See also:
RemoveObject

Reimplemented in glictList.

Examples:
examples/memory/main.cpp, and examples/memory_sdl/main.cpp.

Definition at line 129 of file container.cpp.

References objects, parent, RecursiveBoundaryFix(), and ResetTransformations().

Referenced by glictList::AddObject(), glictMessageBox::glictMessageBox(), and glictPanel::glictPanel().

bool glictContainer::CastEvent ( glictEvents  evt,
void *  wparam,
long  lparam 
)

Casts an event omitting the returnvalue. (deprecated, I'm lazy and don't want to rewrite code so I abuse namespace).

Parameters:
evt Event that occured
*wparam Any kind of value that needs to be passed on to the function. (For example if a structure needs to be passed.)
lparam Numeric value that needed to be passed for event processing.
Returns:
Boolean value specifying if the event was processed at all. True means an event was caught by the widget, or by a child.
Function that can be used in case returnvalue is not necessary, meaning that caller is not interested in a result of the function. Actually just calls to regular CastEvent with returnvalue set to NULL. See the regular CastEvent for more info.

See also:
CastEvent(glictEvents, void*, long, void*);

Definition at line 787 of file container.cpp.

References CastEvent().

bool glictContainer::CastEvent ( glictEvents  evt,
void *  wparam,
long  lparam,
void *  returnvalue 
) [virtual]

Casts an event to the class, so it can process it. Example is mouseclick or mousedown.

Parameters:
evt Event that occured
*wparam Any kind of value that needs to be passed on to the function. (For example if a structure needs to be passed.)
lparam Numeric value that needed to be passed for event processing.
*returnvalue Return value, if any, will be stored here. If NULL, no return value shall be stored.
Returns:
Boolean value specifying if the event was processed at all. True means an event was caught by the widget, or by a child.
Unlike other UI libraries, this library has one philosophy and that is it does not like hooking to any of the windowing system's functions; it does not depend upon either GLUT, Windows, Linux or MacOS. Widgets are receiving user feedback upon being told that user made some. They are told this by the program that uses this library. Example of this action is that in, let's say, GLUT the program receives a call to mouse() function. Upon this, the program casts an event using this function to the widget which then processes what should actually happen. A button, for example, would upon a mouseclick call to OnClick function.

The thing is, this CastEvent function first tries to tell its children that the event happened, and upon being told by each of them that they didn't do anything with the event, goes on with processing it itself.

Container class does not do anything except pushing events on to DefaultCastEvent.

See also:
DefaultCastEvent()

Reimplemented in glictButton, glictPanel, glictScrollbar, glictTextbox, and glictWindow.

Examples:
examples/memory/main.cpp, and examples/memory_sdl/main.cpp.

Definition at line 820 of file container.cpp.

References DefaultCastEvent(), GetEnabled(), GetVisible(), and GLICT_MOUSECLICK.

Referenced by CastEvent(), and DefaultCastEvent().

void glictContainer::CPaint (  ) 

Renders all children.

CPaint() is used to render "all the small things". All children are properly rendered here, with calls to SetScissor() and then to Paint(), and although the call to SetScissor() might be unnecessary it's always good to do things twice if you're not certain. After that Paint() of each object is called.

So, we have a loop that goes through the objects vector/list, then calls for each object the SetScissor() and then Paint().

Prior to rendering, however, the delayedremove vector is checked out and all objects requested are removed.

This f. is used within Paint(); actually there should be no reason for this function to be used except internally when writing a widget. You may be more interested in the Paint() method.

See also:
Paint()

Definition at line 520 of file container.cpp.

References glictGlobalsClass::clippingMode, containeroffsetx, containeroffsety, DelayedRemove(), glictGlobalsClass::drawPartialOut, GetHeight(), GetWidth(), GLICT_SCISSORTEST, GLICT_STENCILTEST, objects, glictGlobalsClass::Translatef(), virtualpos, glictPos::x, and glictPos::y.

Referenced by glictWindow::Paint(), glictTextbox::Paint(), glictScrollbar::Paint(), glictProgressBar::Paint(), glictPanel::Paint(), Paint(), and glictButton::Paint().

bool glictContainer::DefaultCastEvent ( glictEvents  evt,
void *  wparam,
long  lparam,
void *  returnvalue 
)

Casts an event into default event processor, omitting the widget's code.

Parameters:
evt Event that occured
*wparam Any kind of value that needs to be passed on to the function. (For example if a structure needs to be passed.)
lparam Numeric value that needed to be passed for event processing.
*returnvalue Return value, if any, will be stored here. If NULL, no return value shall be stored.
Returns:
Boolean value specifying if the event was processed at all. True means an event was caught by the widget, or by a child.
This function does default processing of event, so that each widget does not have to reinvent the wheel. If the widget does not want to process an event, it simply can call upon this function.

There is very little practical use for this function apart from internal use when making a widget. You may be more interested in classical CastEvent().

For external use you should only use CastEvent().

For more information on how the event system works, see the CastEvent() as well. You'll also read of parameters there, as well as return value.

See also:
CastEvent(glictEvents evt, void* wparam, long lparam, void* returnvalue)
Todo:
Clicking must be handled via verifying if an element has been rendered on certain pixel, not the way it's done right now. Currently we cannot do custom-shaped widgets, only rectangle widgets! (This todo is not strictly related to this function.)

Definition at line 619 of file container.cpp.

References CastEvent(), clipbottom, clipright, containeroffsetx, containeroffsety, Focus(), focusable, GLICT_KEYDOWN, GLICT_KEYPRESS, GLICT_KEYUP, GLICT_MOUSECLICK, GLICT_MOUSEDOWN, GLICT_MOUSEUP, glictGlobalsClass::lastMousePos, left, objects, objtype, OnClick, OnMouseDown, OnMouseUp, top, glictGlobalsClass::topFocused, virtualpos, glictPos::x, x, y, and glictPos::y.

Referenced by glictWindow::CastEvent(), glictTextbox::CastEvent(), glictScrollbar::CastEvent(), glictPanel::CastEvent(), CastEvent(), and glictButton::CastEvent().

void glictContainer::DelayedRemove (  ) 

Runs delayed removal of objects.

Executes the delayedremoval.

Definition at line 165 of file container.cpp.

References delayedremove, and objects.

Referenced by CPaint().

const char * glictContainer::EvtTypeDescriptor ( glictEvents  evt  ) 

Returns string with generated event.

This function goes all the way up to the root of the tree and fixes the boundaries from up there, making sure clipping occurs properly.

This function should be used only internally. Describes event being passed as the parameter and returns its name as a string. For debugging purposes.

Definition at line 1188 of file container.cpp.

References GLICT_MOUSECLICK, GLICT_MOUSEDOWN, and GLICT_MOUSEUP.

void glictContainer::FixContainerOffsets (  )  [virtual]

Fixes container offsets. Should be used only internally.

In case user sets a new skin, we need to fix container offsets. Each widget should redefine it and use appropriate skin element's properties.

This function should be used only internally.

Reimplemented in glictWindow.

Definition at line 1218 of file container.cpp.

Referenced by SetPos().

void glictContainer::Focus ( glictContainer callerchild  ) 

Sets the focus to the current object.

Parameters:
callerchild This object's child that asks this object to focus.
Sets the focus to the current object. Parameter is either the child that has called the focusing function, or NULL to signify that there is no child to refocus here, that the widget is supposed only to refocus itself.

In applications, you should mostly use NULL argument.

Definition at line 1107 of file container.cpp.

References Focus(), focusable, objects, parent, and glictGlobalsClass::topFocused.

Referenced by glictWindow::CastEvent(), glictTextbox::CastEvent(), glictScrollbar::CastEvent(), glictButton::CastEvent(), DefaultCastEvent(), Focus(), and glictMessageBox::glictMessageBox().

std::string glictContainer::GetCaption (  ) 

Retrieves the caption of the control, if supported.

Returns:
Caption of the object.
If the object that derived from this class supports captions, then this function will get the caption being displayed on it.

Definition at line 1086 of file container.cpp.

References caption.

void * glictContainer::GetCustomData (  )  [virtual]

Allows the application programmer to retrieve previously stored custom data assigned to this object.

Todo:
Document this function

Definition at line 1234 of file container.cpp.

References customdata.

bool glictContainer::GetEnabled (  ) 

Retrieves enabledness.

Returns:
Boolean, object's "enabledness"
Retrieves whether the object is enabled or not.

Definition at line 1171 of file container.cpp.

References enabled.

Referenced by glictWindow::CastEvent(), glictTextbox::CastEvent(), glictPanel::CastEvent(), CastEvent(), and glictButton::CastEvent().

float glictContainer::GetHeight (  ) 

Returns object's height.

Returns:
Current height of the object.
Retrieves height of the object and returns it as a value.
See also:
SetHeight(float h), GetSize(glictSize* size)

Definition at line 326 of file container.cpp.

References height.

Referenced by CPaint().

glictContainer * glictContainer::GetParent (  ) 

Obtains the current object's parent, as stored in parent variable.

Definition at line 1093 of file container.cpp.

References parent.

void glictContainer::GetPos ( glictPos pos  ) 

Gets object's position and writes it into predefined type. Useful when exchanging data between library's functions.

Parameters:
*pos Pointer to struct where coordinates should be saved.
This function puts the current object's position (relative to parent) into specified memory locations.
See also:
SetPos(glictPos pos), GetPos(float *x, float *y)

Definition at line 292 of file container.cpp.

References x, glictPos::x, y, and glictPos::y.

void glictContainer::GetPos ( float *  x,
float *  y 
)

Gets object's position and writes it into integers x and y.

Parameters:
*x Pointer where X coordinate should be saved.
*y Pointer where Y coordinate should be saved.
This function puts the current object's position (relative to parent) into specified memory locations.
See also:
SetPos(float x, float y), GetPos(glictPos *pos)
Bug:
Possible containeroffset*-based problem, manifests upon moving of a window which is a child of another window by dragging. See also bugnote in glictWindow::CastEvent()

Definition at line 280 of file container.cpp.

void glictContainer::GetSize ( glictSize size  ) 

Gets object's size (height and width) and writes it into predefined type.

Parameters:
*size Pointer to which the size of object should be saved.
Retrieves width and height and puts it into a structure specified by the pointer.
See also:
SetWidth(float w), SetHeight(float h)

Definition at line 305 of file container.cpp.

References glictPos::h, height, glictPos::w, and width.

bool glictContainer::GetVisible (  ) 

Retrieves visibility.

Returns:
Boolean, object's visibility
Retrieves whether the object is visible or not.

Definition at line 1149 of file container.cpp.

References visible.

Referenced by glictWindow::CastEvent(), glictTextbox::CastEvent(), glictScrollbar::CastEvent(), glictPanel::CastEvent(), CastEvent(), glictButton::CastEvent(), glictWindow::Paint(), glictTextbox::Paint(), glictScrollbar::Paint(), glictPanel::Paint(), glictMessageBox::Paint(), Paint(), and glictButton::Paint().

float glictContainer::GetWidth (  ) 

Returns object's width.

Returns:
Current width of the object.
Retrieves width of the object and returns it as a value.
See also:
SetWidth(int w), GetSize(glictSize* size)

Definition at line 316 of file container.cpp.

References width.

Referenced by CPaint().

void glictContainer::Paint (  )  [virtual]

Renders the element. Should contain call to CPaint().

(This description applies for the glictContainer::Paint(). If you are reading it for some other class, then its documentation is not written yet for this function.)

In glictContainer class, Paint does nothing except calling SetScissor() and CPaint(). This is because as a widget the container class does not render anything; it serves as a point of divergence for other classes. Other widgets should define their own procedure with these two calls as a minimum.

When writing a widget, put SetScissor() on the beginning of this function, and CPaint() on the end.

See also:
SetScissor(), CPaint()

Reimplemented in glictButton, glictMessageBox, glictPanel, glictProgressBar, glictScrollbar, glictTextbox, and glictWindow.

Examples:
examples/memory/main.cpp, and examples/memory_sdl/main.cpp.

Definition at line 493 of file container.cpp.

References CPaint(), GetVisible(), and SetScissor().

void glictContainer::RecursiveBoundaryFix (  )  [virtual]

Fixes boundaries recursively up to the root of the tree (desktop, probably). Also used to make scrollbars appear in case of virtual size, where appropriate. Should be used only internally. FIXME: Make private/protected.

This function goes all the way up to the root of the tree and fixes the boundaries from up there, making sure clipping occurs properly.

This function should be used only internally.

Definition at line 1205 of file container.cpp.

References parent, RecursiveBoundaryFix(), SetPos(), x, and y.

Referenced by AddObject(), RecursiveBoundaryFix(), SetHeight(), and SetWidth().

void glictContainer::RememberTransformations (  ) 

When calling parent's paint, call it's 'remember transformations' too, so clicking detection is done properly. if clicking unused, or no transformations done, then not important.

Function collects the OpenGL's modelview matrix, and remembers whatever state it currently is in. It is later used in TransformScreenCoords(). It is not necessary to call this function unless you wish to perform a transformation on user interface, for example rotation. If you do not do this kind of thing, you do not need to call this function.

This also makes all children remember their transformation.

See also:
TransformScreenCoords(glictPos *pos)

Definition at line 873 of file container.cpp.

References ModelviewMatrix, and objects.

void glictContainer::RemoveObject ( glictContainer object  )  [virtual]

Removes an object that's a child.

Parameters:
obj Pointer to object to remove.
Adds the object to delayed-remove vector, which means the object will be removed upon next call to CPaint() before real painting. Note: object stored in pointer is not touched and if dynamically created it must be manually cleaned up.

See also:
AddObject(glictContainer* obj)

Reimplemented in glictList.

Definition at line 148 of file container.cpp.

References delayedremove.

Referenced by glictList::RemoveObject(), and glictMessageBox::~glictMessageBox().

void glictContainer::ReportDebug (  ) 

Reports debug information to stdout.

Debugging function that reports some info about the current object, such as its name, height, width, position et al.

Definition at line 896 of file container.cpp.

References bottom, clipbottom, clipleft, clipright, cliptop, guid, height, left, objects, objtype, right, top, width, x, and y.

void glictContainer::ResetTransformations (  ) 

Resets transformations to default transf matrix (identity matrix).

Sets coordinate transformations to identity matrix.

Definition at line 113 of file container.cpp.

References ModelviewMatrix.

Referenced by AddObject(), and glictContainer().

void glictContainer::SetCaption ( const std::string  caption  ) 

Sets the caption of the control, if supported.

Parameters:
caption Caption that's to be set
If the object that derived from this class supports captions, then this function will change the caption being displayed on it.
Examples:
examples/memory/main.cpp, and examples/memory_sdl/main.cpp.

Definition at line 1077 of file container.cpp.

Referenced by glictTextbox::CastEvent(), glictContainer(), glictMessageBox::glictMessageBox(), glictWindow::glictWindow(), glictTextbox::Paint(), and glictMessageBox::SetMessage().

void glictContainer::SetClip ( float  left,
float  top,
float  right,
float  bottom 
) [private]

Internal function. Sets the clipping boundaries of the widget.

Parameters:
left Left clipping boundary of the object.
top Top clipping boundary of the object.
right Right clipping boundary of the object.
bottom Bottom clipping boundary of the object.
Internal use function that sets the display related, clipping boundaries of the object. Note, these are the display-related boundaries, they are visible on screen. To set internal boundaries use SetRect().

These functions can be overridden, always use SetPos(), SetWidth(), SetHeight() and other related functions!

See also:
SetRect(float left, float top, float right, float bottom)

SetPos(float x, float y), SetPos(glictPos pos), SetWidth(float w), SetHeight(float h)

Definition at line 383 of file container.cpp.

References clipbottom, clipleft, clipright, and cliptop.

Referenced by glictContainer(), and SetRect().

void glictContainer::SetCustomData ( void *  param  )  [virtual]

Allows the application programmer to store custom data assigned to this object.

Todo:
Document this function

Definition at line 1227 of file container.cpp.

References customdata.

void glictContainer::SetEnabled ( bool  enabled  ) 

Sets enabledness.

Parameters:
enabled Object's "enabledness"
Sets whether the object is enabled or not.

Reimplemented in glictMessageBox.

Definition at line 1159 of file container.cpp.

Referenced by glictContainer(), and glictMessageBox::SetEnabled().

void glictContainer::SetFont ( std::string  name,
unsigned int  size = 10 
)

Sets the name of the font to be used for rendering of any caption that the widget may be attempting to paint. Also sets the size, which may be disregarded by the font engine.

Parameters:
name Font name
size Font size
Sets using which font should this widget be rendered.

Definition at line 1269 of file container.cpp.

References fontname, and fontsize.

void glictContainer::SetHeight ( float  h  )  [virtual]

Sets object's height.

Parameters:
h Height to which the object should be set.
This function sets up the current object's height and the object's boundaries properly, to whatever values they should be set.
See also:
SetWidth(float w), GetSize(glictSize* size)
Examples:
examples/memory/main.cpp, and examples/memory_sdl/main.cpp.

Definition at line 190 of file container.cpp.

References height, and RecursiveBoundaryFix().

Referenced by glictMessageBox::glictMessageBox(), glictScrollbar::glictScrollbar(), glictTextbox::glictTextbox(), glictWindow::glictWindow(), glictPanel::Paint(), glictList::RemoveObject(), and glictMessageBox::SetHeight().

void glictContainer::SetNext ( glictContainer n  ) 

Parameters:
n 'next' widget
When Shift+Tab is pressed, focus should switch to n widget.

Definition at line 1288 of file container.cpp.

References next.

void glictContainer::SetOnClick ( void(*)(glictPos *relmousepos, glictContainer *callerclass)  f  ) 

Sets a function to execute upon click. OBJECT MUST NOT DESTROY ITSELF OR REMOVE ITSELF FROM OBJECT LIST OF ITS PARENT FROM WITHIN.

Sets an OnClick function that would a, for example, button use.

Definition at line 836 of file container.cpp.

References OnClick.

Referenced by glictMessageBox::glictMessageBox().

void glictContainer::SetOnMouseDown ( void(*)(glictPos *relmousepos, glictContainer *callerclass)  f  ) 

Sets a function to execute upon mouse pressed down over this object. OBJECT MUST NOT DESTROY ITSELF OR REMOVE ITSELF FROM OBJECT LIST OF ITS PARENT FROM WITHIN.

Sets an OnMouseDown function.

Definition at line 843 of file container.cpp.

References OnMouseDown.

void glictContainer::SetOnMouseUp ( void(*)(glictPos *relmousepos, glictContainer *callerclass)  f  ) 

Sets a function to execute upon mouse pressed down over this object. OBJECT MUST NOT DESTROY ITSELF OR REMOVE ITSELF FROM OBJECT LIST OF ITS PARENT FROM WITHIN.

Sets an OnMouseUp function.

Definition at line 849 of file container.cpp.

References OnMouseUp.

void glictContainer::SetOnPaint ( void(*)(glictRect *real, glictRect *clipped, glictContainer *callerclass)  f  ) 

Sets a function to execute whenever drawing. OBJECT MUST NOT DESTROY ITSELF OR REMOVE ITSELF FROM OBJECT LIST OF ITS PARENT FROM WITHIN.

Sets an OnPaint function that would a, for example, button use.

Todo:
Not all widgets obey OnPaint.

Definition at line 858 of file container.cpp.

References OnPaint.

void glictContainer::SetPos ( glictPos  pos  ) 

Sets object's position using predefined type. Useful when exchanging data between library's functions.

Parameters:
pos Position specified in a struct, relative to parent.
This function sets up the current object's position and the object's boundaries properly, to whatever values they should be set.
See also:
SetPos(float x, float y), GetPos(glictPos *pos)

Definition at line 265 of file container.cpp.

References SetPos(), glictPos::x, and glictPos::y.

void glictContainer::SetPos ( float  x,
float  y 
)

Sets object's position using classical access using two integers.

Parameters:
x X coordinate of the object, relative to parent
y Y coordinate of the object, relative to parent
This function sets up the current object's position and the object's boundaries properly, to whatever values they should be set.
See also:
SetPos(glictPos pos), GetPos(float *x, float *y)
Examples:
examples/memory/main.cpp, and examples/memory_sdl/main.cpp.

Definition at line 215 of file container.cpp.

References containeroffsetx, containeroffsety, FixContainerOffsets(), glictPos::h, height, left, objects, parent, SetRect(), top, virtualpos, glictPos::w, width, glictPos::x, and glictPos::y.

Referenced by glictWindow::CastEvent(), glictPanel::CastEvent(), glictMessageBox::glictMessageBox(), glictScrollbar::glictScrollbar(), glictWindow::glictWindow(), glictPanel::Paint(), RecursiveBoundaryFix(), glictMessageBox::SetHeight(), SetPos(), and glictMessageBox::SetWidth().

void glictContainer::SetPrevious ( glictContainer p  ) 

Parameters:
p 'previous' widget
When Tab is pressed, focus should switch to p widget.

Definition at line 1279 of file container.cpp.

References previous.

void glictContainer::SetRect ( float  left,
float  top,
float  right,
float  bottom 
) [private]

Internal function. Sets the boundaries of the widget.

Parameters:
left Left boundary of the object.
top Top boundary of the object.
right Right boundary of the object.
bottom Bottom boundary of the object.
Internal use function that sets the boundaries of the object. Note, these are not the display-related boundaries, they are imaginary boundaries. To set the display-related boundaries use SetClip().

These functions can be overridden, always use SetPos(), SetWidth(), SetHeight() and other related functions!

See also:
SetClip(float left, float top, float right, float bottom)

SetPos(float x, float y), SetPos(glictPos pos), SetWidth(float w), SetHeight(float h)

Definition at line 348 of file container.cpp.

References clipbottom, clipleft, clipright, cliptop, max, min, parent, and SetClip().

Referenced by glictContainer(), and SetPos().

void glictContainer::SetScissor (  ) 

This one adjusts the clipping window through which something can be seen, and which is set by SetClip.

Sets up scissoring of the current object. Should be called withing Paint() function. If necessary, it can be manually called by program that uses the library, however in most cases it should not be necessary.

Note: although named SetScissor, GLICT can be set to use either scissor or stencil testing. This is so that special transformations can be painlessly used on entire GUI, which was one of goals in making the library. Default mode is scissor test for performance, scissoring/clipping can be turned off in glictGlobals's member clippingTest, or can be set to scissor testing.

It is up to main program to enable or disable appropriate stencil/scissor test.

If using scissor test, then you MUST update the glictGlobals.h, although that is always recommended. glictGlobals.h must contain current viewport height.

See also:
Paint(), CPaint(), glictGlobals::clippingMode

Definition at line 427 of file container.cpp.

References glictGlobalsClass::clippingMode, GLICT_SCISSORTEST, GLICT_STENCILTEST, glictGlobalsClass::h, ModelviewMatrix, and glictGlobalsClass::PaintRect().

Referenced by glictWindow::Paint(), glictScrollbar::Paint(), glictProgressBar::Paint(), Paint(), and glictButton::Paint().

void glictContainer::SetVirtualSize ( float  w,
float  h 
) [virtual]

Parameters:
w Virtual width
h Virtual height
Sets the extended, virtual width and height of the panel, the total area which can be accessed using scrollbars that become visible unless the virtual width and height are set to zero or smaller than real width and height.

If virtual width and height are set to smaller than real width and height, they are simply ignored.

Reimplemented in glictPanel.

Definition at line 1251 of file container.cpp.

References glictPos::h, virtualsize, and glictPos::w.

Referenced by glictPanel::SetVirtualSize().

void glictContainer::SetVisible ( bool  vsbl  ) 

Sets visibility.

Parameters:
vsbl New value for visibility
Sets whether the object is visible or not.

Definition at line 1139 of file container.cpp.

References visible.

Referenced by glictContainer(), glictPanel::glictPanel(), glictPanel::Paint(), and glictMessageBox::SetEnabled().

void glictContainer::SetWidth ( float  w  )  [virtual]

Sets object's width.

Parameters:
w Width to which the object should be set.
This function sets up the current object's height and the object's boundaries properly, to whatever values they should be set.
See also:
SetHeight(float h), GetSize(glictSize* size)

Reimplemented in glictList.

Examples:
examples/memory/main.cpp, and examples/memory_sdl/main.cpp.

Definition at line 202 of file container.cpp.

References RecursiveBoundaryFix(), and width.

Referenced by glictMessageBox::glictMessageBox(), glictScrollbar::glictScrollbar(), glictTextbox::glictTextbox(), glictWindow::glictWindow(), glictPanel::Paint(), glictMessageBox::SetWidth(), and glictList::SetWidth().

void glictContainer::TransformScreenCoords ( glictPos pos  ) 

Transforms screen coordinates into plane coordinates.

Parameters:
*pos Coordinates to transform. Result gets placed here as well.
Using the modelview matrix that was stored using the RememberTransformations() this function will create an inverse matrix of the modelview matrix and multiply the original coordinates by it, storing the result in the input parameter.

Warning:
Watch out, *pos gets overwritten!
See also:
RememberTransformations()
Bug:
This function does not work properly the way it should, it should be inspected whether the float/double precision is causing problems or something else. It is also certain that there is some other problem within this function as certain translation transfo's don't work.
Todo:
Scale is not operational, look into that. (Mathematicians, please come to aid.)

This only takes modelview matrix into account, while we should take projection matrix into account as well.

Definition at line 931 of file container.cpp.

References ModelviewMatrix, glictPos::x, and glictPos::y.

void glictContainer::VirtualScrollBottom (  )  [virtual]

Scrolls to the virtual area's bottom. Container has it EMPTY because it does not directly support virtual area.

Reimplemented in glictPanel.

Definition at line 1259 of file container.cpp.


Friends And Related Function Documentation

void _glictMessageBox_Closer ( glictPos relmousepos,
glictContainer caller 
) [friend]

Todo:
Remove this friend!

Reimplemented in glictMessageBox.

Definition at line 22 of file messagebox.cpp.


The documentation for this class was generated from the following files:
SourceForge.net Logo
generated with doxygen 1.5.3 on Mon Oct 29 18:09:27 2007