OpenGUI::Control Class Reference

#include <OpenGUI_Control.h>

Inheritance diagram for OpenGUI::Control:

OpenGUI::Widget OpenGUI::Object OpenGUI::ContainerControl OpenGUI::Window List of all members.

Detailed Description

Base class for all GUI objects that have position and size.

Properties
Events Introduced
See also:
Control Events


Public Types

enum  ControlSides {
  None = 0,
  Left = 1,
  Right = 1 << 1,
  Top = 1 << 2,
  Bottom = 1 << 3,
  All = Left | Right | Top | Bottom,
  Fill = All
}
 Values used by get/setDocking and get/setAnchor. More...

Public Member Functions

 Control ()
 public constructor
virtual ~Control ()
 public destructor
void setLeft (float left)
 Sets the position of the left side of the Control.
float getLeft ()
 Returns the position of the left side of the Control.
void setTop (float top)
 Sets the position of the top side of the Control.
float getTop ()
 Returns the position of the top side of the Control.
void setWidth (float width)
 Sets the width of the Control.
float getWidth ()
 Returns the width of the Control.
void setHeight (float height)
 Sets the height of the Control.
float getHeight ()
 Returns the height of the Control.
const FVector2getPosition ()
 Returns the position of the upper left corner of the Control.
FVector2 getSize ()
 Returns the size of the Control.
const FRectgetRect ()
 Returns the FRect describing this Control's size and position.
const FVector2getMinimumSize ()
 Returns the minimum size this Control will allow itself to be resized to.
void setMinimumSize (const FVector2 &size)
 Sets the minimum size this Control will allow itself to be resized to.
const FVector2getMaximumSize ()
 Returns the maximum size this Control will allow itself to be resized to.
void setMaximumSize (const FVector2 &size)
 Sets the maximum size this Control will allow itself to be resized to.
void setVisible (bool visible)
 Sets the visibility of this Control.
bool getVisible ()
 Returns the visibility of this Control.
void setAlpha (float alpha)
 Sets the alpha transparency of this Control.
float getAlpha ()
 Returns the alpha transparency of this Control.
virtual ObjectAccessorListgetAccessors ()
 returns this object's ObjectAccessorList head
virtual unsigned int getObjectType () const
 Returns an integer identifying the type of object.
void setDocking (int dockStyle)
 Sets the docking preference for this Control.
int getDocking ()
 Gets the current docking preference for this Control.
void setAnchor (int anchoredSides)
 Sets the anchored sides for this Control.
int getAnchor ()
 Gets the current anchored sides for this control.
void setMargin (float margin)
 sets the margin of this Control
float getMargin ()
 gets the margin of this Control
virtual bool isInside (const FVector2 &position)
 Returns true if the given point is inside this Widget.

Protected Member Functions

void setCursor (CursorPtr cursorPtr)
 Sets the cursor displayed when the Screen cursor is over this Control.
CursorPtr getCursor () const
 Gets the current cursor displayed when the Screen cursor is over this Control.
Event Injectors
void eventMoved (const FVector2 &oldPosition, const FVector2 &newPosition)
 Control has been moved.
void eventResized (const FVector2 &oldSize, const FVector2 &newSize)
 Control has been resized.
void eventTargeted ()
 Called when this Control is targeted, either by cursor or by menu navigation.
void eventUnTargeted ()
 Called when this Control is no longer targeted, either by cursor or by menu navigation.
Event Handlers
virtual void onMoved (Object *sender, Moved_EventArgs &evtArgs)
 "Moved" event
virtual void onResized (Object *sender, Resized_EventArgs &evtArgs)
 "Resized" event
virtual void onCursorMove (Object *sender, Cursor_EventArgs &evtArgs)
 "CursorMove" event, consumes the event
virtual void onCursorPress (Object *sender, Cursor_EventArgs &evtArgs)
 "CursorPress" event, consumes the event
virtual void onCursorRelease (Object *sender, Cursor_EventArgs &evtArgs)
 "CursorRelease" event, consumes the event
virtual void onCursorEnter (Object *sender, EventArgs &evtArgs)
 "CursorEnter" event
virtual void onCursorLeave (Object *sender, EventArgs &evtArgs)
 "CursorLeave" event
virtual void onTargeted (Object *sender, EventArgs &evtArgs)
 "Targeted" event
virtual void onUnTargeted (Object *sender, EventArgs &evtArgs)
 "UnTargeted" event


Member Enumeration Documentation

enum OpenGUI::Control::ControlSides
 

Values used by get/setDocking and get/setAnchor.

Enumerator:
None  No side.
Left  Left side.
Right  Right side.
Top  Top side.
Bottom  Bottom side.
All  All sides.
Fill  Alias for All sides.


Constructor & Destructor Documentation

OpenGUI::Control::Control  ) 
 

public constructor

OpenGUI::Control::~Control  )  [virtual]
 

public destructor


Member Function Documentation

void OpenGUI::Control::eventMoved const FVector2 oldPosition,
const FVector2 newPosition
[protected]
 

Control has been moved.

void OpenGUI::Control::eventResized const FVector2 oldSize,
const FVector2 newSize
[protected]
 

Control has been resized.

void OpenGUI::Control::eventTargeted  )  [protected]
 

Called when this Control is targeted, either by cursor or by menu navigation.

void OpenGUI::Control::eventUnTargeted  )  [protected]
 

Called when this Control is no longer targeted, either by cursor or by menu navigation.

ObjectAccessorList * OpenGUI::Control::getAccessors  )  [virtual]
 

returns this object's ObjectAccessorList head

Reimplemented from OpenGUI::Widget.

Reimplemented in OpenGUI::ContainerControl, and OpenGUI::Window.

float OpenGUI::Control::getAlpha  ) 
 

Returns the alpha transparency of this Control.

int OpenGUI::Control::getAnchor  ) 
 

Gets the current anchored sides for this control.

Return value will be a bit mask comprised of values within ControlSides.

CursorPtr OpenGUI::Control::getCursor  )  const [protected]
 

Gets the current cursor displayed when the Screen cursor is over this Control.

int OpenGUI::Control::getDocking  ) 
 

Gets the current docking preference for this Control.

Return value will be a single value within ControlSides.

float OpenGUI::Control::getHeight  ) 
 

Returns the height of the Control.

float OpenGUI::Control::getLeft  ) 
 

Returns the position of the left side of the Control.

float OpenGUI::Control::getMargin  ) 
 

gets the margin of this Control

See also:
See setMargin() for information on margins

const FVector2 & OpenGUI::Control::getMaximumSize  ) 
 

Returns the maximum size this Control will allow itself to be resized to.

const FVector2 & OpenGUI::Control::getMinimumSize  ) 
 

Returns the minimum size this Control will allow itself to be resized to.

unsigned int OpenGUI::Control::getObjectType  )  const [virtual]
 

Returns an integer identifying the type of object.

See also:
Object_Type

Reimplemented from OpenGUI::Widget.

Reimplemented in OpenGUI::ContainerControl, and OpenGUI::Window.

const FVector2 & OpenGUI::Control::getPosition  ) 
 

Returns the position of the upper left corner of the Control.

const FRect & OpenGUI::Control::getRect  ) 
 

Returns the FRect describing this Control's size and position.

FVector2 OpenGUI::Control::getSize  ) 
 

Returns the size of the Control.

float OpenGUI::Control::getTop  ) 
 

Returns the position of the top side of the Control.

bool OpenGUI::Control::getVisible  ) 
 

Returns the visibility of this Control.

float OpenGUI::Control::getWidth  ) 
 

Returns the width of the Control.

bool OpenGUI::Control::isInside const FVector2 position  )  [virtual]
 

Returns true if the given point is inside this Widget.

Control implementation returns true if the point is within its rect, otherwise false.

Note:
This function is not focus aware. The given position should already be in the correct coordinate space.

Reimplemented from OpenGUI::Widget.

void OpenGUI::Control::onCursorEnter Object sender,
EventArgs evtArgs
[protected, virtual]
 

"CursorEnter" event

Reimplemented from OpenGUI::Widget.

void OpenGUI::Control::onCursorLeave Object sender,
EventArgs evtArgs
[protected, virtual]
 

"CursorLeave" event

Reimplemented from OpenGUI::Widget.

void OpenGUI::Control::onCursorMove Object sender,
Cursor_EventArgs evtArgs
[protected, virtual]
 

"CursorMove" event, consumes the event

Reimplemented from OpenGUI::Widget.

Reimplemented in OpenGUI::ContainerControl, and OpenGUI::Window.

void OpenGUI::Control::onCursorPress Object sender,
Cursor_EventArgs evtArgs
[protected, virtual]
 

"CursorPress" event, consumes the event

Reimplemented from OpenGUI::Widget.

Reimplemented in OpenGUI::ContainerControl.

void OpenGUI::Control::onCursorRelease Object sender,
Cursor_EventArgs evtArgs
[protected, virtual]
 

"CursorRelease" event, consumes the event

Reimplemented from OpenGUI::Widget.

Reimplemented in OpenGUI::ContainerControl.

void OpenGUI::Control::onMoved Object sender,
Moved_EventArgs evtArgs
[protected, virtual]
 

"Moved" event

Default is to do nothing

void OpenGUI::Control::onResized Object sender,
Resized_EventArgs evtArgs
[protected, virtual]
 

"Resized" event

Default is to do nothing

Reimplemented in OpenGUI::ContainerControl.

void OpenGUI::Control::onTargeted Object sender,
EventArgs evtArgs
[protected, virtual]
 

"Targeted" event

Default is to do nothing

void OpenGUI::Control::onUnTargeted Object sender,
EventArgs evtArgs
[protected, virtual]
 

"UnTargeted" event

Default is to do nothing

void OpenGUI::Control::setAlpha float  alpha  ) 
 

Sets the alpha transparency of this Control.

Alpha is clamped to 0.0f through 1.0f. Passing values outside of this range will result in alpha being set to either 0.0f or 1.0f, whichever is closer.

The local Alpha setting is a value that is not automatically enforced before onDraw(), meaning that if a Control is going to obey its Alpha setting, it should push that setting to the Brush before performing its draw routines.

In the case of Controls that contain other Controls, Alpha of the parent is automatically applied to the children in a multiplicative fashion. In other words, if both the parent and child Controls are set to 50% alpha, at final output the parent will draw at 50% alpha, and the child will draw at 25% alpha.
(50% * 50% = 25%)

void OpenGUI::Control::setAnchor int  anchoredSides  ) 
 

Sets the anchored sides for this Control.

Anchoring is a service provided by the container. During resizes the container will check all of its children for Anchor preference. The children can specify anchoring preference to any sides they wish, but at least one top/bottom and one left/right side must be specified at all times.
For example, it is legal to anchor against:

  • Top/Left
  • Top/Right
  • Top/Left/Right
  • Bottom/Left
  • All (also known as Fill) It is not legal to anchor against:
  • Top
  • Right
  • Left
  • Bottom
  • None Failure to specify an axis' anchor preference will result in the default of Top or Left being assigned as necessary to fulfill the anchor requirements.
    Note:
    Docking and Anchoring are mutually exclusive. Defining new anchors will remove any docking preferences. Conversely, selecting dockings will reset anchoring to the default (Top/Left).

void OpenGUI::Control::setCursor CursorPtr  cursorPtr  )  [protected]
 

Sets the cursor displayed when the Screen cursor is over this Control.

void OpenGUI::Control::setDocking int  dockStyle  ) 
 

Sets the docking preference for this Control.

Docking is a service provided by the container. It

Note:
Docking and Anchoring are mutually exclusive. Defining new anchors will remove any docking preferences. Conversely, selecting dockings will reset anchoring to the default (Top/Left).

void OpenGUI::Control::setHeight float  height  ) 
 

Sets the height of the Control.

Controls cannot have a height less than 0.0f, so negative values are clamped to 0.0f.

This function obeys the MinimumSize and MaximumSize properties, and the given size will be adjusted to fit within the constraints if applicable.

void OpenGUI::Control::setLeft float  left  ) 
 

Sets the position of the left side of the Control.

void OpenGUI::Control::setMargin float  margin  ) 
 

sets the margin of this Control

The "margin" is the distance to stay away from sibling Controls' margins during automatic layouts. It is up to the control performing the layout operations to honor this value.

Parameters:
margin The margin size in Screen units. Negative values are clamped to 0.0f

void OpenGUI::Control::setMaximumSize const FVector2 size  ) 
 

Sets the maximum size this Control will allow itself to be resized to.

During this call the current size is tested against the new maximum size and calls to setWidth and setHeight may be invoked to bring the Controls size back into the allowed constraints.

If the the maximum size is set smaller than the minimum size, the minimum size is adjusted to match the maximum size for any offending axis.

If any axis == 0, that axis will be ignored in size tests. Negative values for an axis are illegal and are automatically assigned to 0.

void OpenGUI::Control::setMinimumSize const FVector2 size  ) 
 

Sets the minimum size this Control will allow itself to be resized to.

During this call the current size is tested against the new minimum size and calls to setWidth and setHeight may be invoked to bring the Controls size back into the allowed constraints.

If the the minimum size is set larger than the maximum size, the maximum size is adjusted to match the minimum size for any offending axis.

If any axis == 0, that axis will be ignored in size tests. Negative values for an axis are illegal and are automatically assigned to 0.

void OpenGUI::Control::setTop float  top  ) 
 

Sets the position of the top side of the Control.

void OpenGUI::Control::setVisible bool  visible  ) 
 

Sets the visibility of this Control.

void OpenGUI::Control::setWidth float  width  ) 
 

Sets the width of the Control.

Controls cannot have a width less than 0.0f, so negative values are clamped to 0.0f.

This function obeys the MinimumSize and MaximumSize properties, and the given size will be adjusted to fit within the constraints if applicable.


The documentation for this class was generated from the following files:
Copyright © 2006 OpenGUI | OpenGUI.SF.net
Generated: Sun Sep 9 02:00:21 2007