Contents User Forum Source Index APIs by Task APIs by Level Data


G3D::GuiPane Class Reference

Sub-rectangle of a window. More...

#include <GuiPane.h>

Inherits G3D::GuiControl.

List of all members.

Public Types

enum  Style { SIMPLE_FRAME_STYLE, ORNATE_FRAME_STYLE, NO_FRAME_STYLE }

Public Member Functions

GuiButtonaddButton (const GuiCaption &text, GuiButton::Style style=GuiButton::NORMAL_STYLE)
GuiCheckBoxaddCheckBox (const GuiCaption &text, bool *pointer, GuiCheckBox::Style style=GuiCheckBox::BOX_STYLE)
GuiCheckBoxaddCheckBox (const GuiCaption &text, const Pointer< bool > &pointer, GuiCheckBox::Style style=GuiCheckBox::BOX_STYLE)
GuiDropDownListaddDropDownList (const GuiCaption &caption, const Pointer< int > &indexPointer, Array< GuiCaption > *list)
GuiDropDownListaddDropDownList (const GuiCaption &caption, const Pointer< int > &indexPointer, Array< std::string > *list)
GuiLabeladdLabel (const GuiCaption &text, GFont::XAlign xalign=GFont::XALIGN_LEFT, GFont::YAlign=GFont::YALIGN_CENTER)
GuiPaneaddPane (const GuiCaption &text="", float height=0, GuiPane::Style style=GuiPane::SIMPLE_FRAME_STYLE)
GuiRadioButtonaddRadioButton (const GuiCaption &text, int myID, void *selection, GuiRadioButton::Style style=GuiRadioButton::RADIO_STYLE)
template<typename EnumOrInt, class T>
GuiRadioButtonaddRadioButton (const GuiCaption &text, int myID, T *object, EnumOrInt(T::*get)() const, void(T::*set)(EnumOrInt), GuiRadioButton::Style style)
template<typename Value>
GuiSlider< Value > * addSlider (const GuiCaption &text, Value *value, Value min, Value max, bool horizontal=true)
template<typename Value>
GuiSlider< Value > * addSlider (const GuiCaption &text, const Pointer< Value > &value, Value min, Value max, bool horizontal=true)
GuiTextBoxaddTextBox (const GuiCaption &caption, const Pointer< std::string > &stringPointer, GuiTextBox::Update update=GuiTextBox::DELAYED_UPDATE)
const GuiCaptioncaption () const
const Rect2DclientRect () const
bool enabled () const
bool focused () const
bool morphing () const
virtual void morphTo (const Rect2D &r)
bool mouseOver () const
void moveBy (float dx, float dy)
void moveBy (const Vector2 &delta)
void moveRightOf (const GuiControl *control)
void pack ()
const Rect2Drect () const
void remove (GuiControl *gui)
void setCaption (const GuiCaption &text)
void setEnabled (bool e)
void setFocused (bool b)
void setHeight (float h)
void setPosition (float x, float y)
void setPosition (const Vector2 &v)
virtual void setRect (const Rect2D &rect)
void setSize (float x, float y)
void setSize (const Vector2 &v)
void setVisible (bool b)
void setWidth (float w)
GuiSkinRef skin () const
bool visible () const
 ~GuiPane ()

Protected Member Functions

template<class T>
T * addControl (T *c)
Vector2 contentsExtent () const
void findControlUnderMouse (Vector2 mouse, GuiControl *&control) const
void fireActionEvent ()
 GuiPane (GuiWindow *gui, GuiPane *parent, const GuiCaption &text, const Rect2D &rect, Style style)
void increaseBounds (const Vector2 &extent)
Vector2 nextControlPos () const
virtual bool onEvent (const GEvent &event)
virtual void render (RenderDevice *rd, const GuiSkinRef &skin) const

Static Protected Member Functions

static void makeRelative (GEvent &e, const Rect2D &clientRect)

Protected Attributes

Array< GuiControl * > controlArray
Array< GuiLabel * > labelArray
GuiCaption m_caption
Rect2D m_clickRect
Rect2D m_clientRect
bool m_enabled
GuiWindowm_gui
Morph m_morph
GuiPanem_parent
Rect2D m_rect
Style m_style
bool m_visible
Array< GuiPane * > paneArray

Friends

class _GuiSliderBase
class GuiButton
class GuiControl
class GuiRadioButton
class GuiWindow

Classes

class  Morph


Detailed Description

Sub-rectangle of a window.

Created by GuiWindow::addPane(). If a pane is invisible, everything inside of it is also invisible.

All coordinates of objects inside a pane are relative to the pane's clientRect(). See GuiWindow for an example of creating a user interface.


Member Enumeration Documentation

Controls the appearance of the pane's borders and background.

Enumerator:
SIMPLE_FRAME_STYLE 
ORNATE_FRAME_STYLE 
NO_FRAME_STYLE 


Constructor & Destructor Documentation

G3D::GuiPane::GuiPane ( GuiWindow gui,
GuiPane parent,
const GuiCaption text,
const Rect2D rect,
Style  style 
) [protected]

G3D::GuiPane::~GuiPane (  ) 


Member Function Documentation

GuiButton* G3D::GuiPane::addButton ( const GuiCaption text,
GuiButton::Style  style = GuiButton::NORMAL_STYLE 
)

GuiCheckBox* G3D::GuiPane::addCheckBox ( const GuiCaption text,
bool *  pointer,
GuiCheckBox::Style  style = GuiCheckBox::BOX_STYLE 
) [inline]

GuiCheckBox* G3D::GuiPane::addCheckBox ( const GuiCaption text,
const Pointer< bool > &  pointer,
GuiCheckBox::Style  style = GuiCheckBox::BOX_STYLE 
) [inline]

       bool enabled;
       gui->addCheckBox("Enabled", &enabled);

       Foo* foo = new Foo();
       gui->addCheckBox("Enabled", Pointer<bool>(foo, &Foo::enabled, &Foo::setEnabled));

       BarRef foo = Bar::create();
       gui->addCheckBox("Enabled", Pointer<bool>(bar, &Bar::enabled, &Bar::setEnabled));
       

template<class T>
T* G3D::GuiPane::addControl ( T *  c  )  [inline, protected]

GuiDropDownList* G3D::GuiPane::addDropDownList ( const GuiCaption caption,
const Pointer< int > &  indexPointer,
Array< GuiCaption > *  list 
)

GuiDropDownList* G3D::GuiPane::addDropDownList ( const GuiCaption caption,
const Pointer< int > &  indexPointer,
Array< std::string > *  list 
)

GuiLabel* G3D::GuiPane::addLabel ( const GuiCaption text,
GFont::XAlign  xalign = GFont::XALIGN_LEFT,
GFont::YAlign  = GFont::YALIGN_CENTER 
)

GuiPane* G3D::GuiPane::addPane ( const GuiCaption text = "",
float  height = 0,
GuiPane::Style  style = GuiPane::SIMPLE_FRAME_STYLE 
)

Parameters:
height Client size of the pane (size of the inside, not counting the border).

This will automatically grow as controls are added, so it can safely be left as zero.

GuiRadioButton* G3D::GuiPane::addRadioButton ( const GuiCaption text,
int  myID,
void *  selection,
GuiRadioButton::Style  style = GuiRadioButton::RADIO_STYLE 
)

Example:.

       enum Day {SUN, MON, TUE, WED, THU, FRI, SAT};

       Day day;

       gui->addRadioButton("Sun", SUN, &day);
       gui->addRadioButton("Mon", MON, &day);
       gui->addRadioButton("Tue", TUE, &day);
       ...
       

Parameters:
selection Must be a pointer to an int or enum. The current selection value for a group of radio buttons.

template<typename EnumOrInt, class T>
GuiRadioButton* G3D::GuiPane::addRadioButton ( const GuiCaption text,
int  myID,
T *  object,
EnumOrInt(T::*)() const   get,
void(T::*)(EnumOrInt)  set,
GuiRadioButton::Style  style 
) [inline]

template<typename Value>
GuiSlider<Value>* G3D::GuiPane::addSlider ( const GuiCaption text,
Value *  value,
Value  min,
Value  max,
bool  horizontal = true 
) [inline]

template<typename Value>
GuiSlider<Value>* G3D::GuiPane::addSlider ( const GuiCaption text,
const Pointer< Value > &  value,
Value  min,
Value  max,
bool  horizontal = true 
) [inline]

GuiTextBox* G3D::GuiPane::addTextBox ( const GuiCaption caption,
const Pointer< std::string > &  stringPointer,
GuiTextBox::Update  update = GuiTextBox::DELAYED_UPDATE 
) [inline]

const GuiCaption& G3D::GuiControl::caption (  )  const [inherited]

const Rect2D& G3D::GuiPane::clientRect (  )  const [inline]

Client rect bounds, relative to the parent pane (or window if there is no parent).

Vector2 G3D::GuiPane::contentsExtent (  )  const [protected]

bool G3D::GuiControl::enabled (  )  const [inherited]

void G3D::GuiPane::findControlUnderMouse ( Vector2  mouse,
GuiControl *&  control 
) const [protected]

Finds the visible, enabled control underneath the mouse.

Parameters:
control (Output) pointer to the control that the mouse is over
mouse Relative to the parent of this pane.

void G3D::GuiControl::fireActionEvent (  )  [protected, inherited]

Fires an action event.

bool G3D::GuiControl::focused (  )  const [inherited]

void G3D::GuiPane::increaseBounds ( const Vector2 extent  )  [protected]

Updates this pane to ensure that its client rect is least as wide and high as the specified extent, then recursively calls increaseBounds on its parent.

static void G3D::GuiPane::makeRelative ( GEvent e,
const Rect2D clientRect 
) [static, protected]

If this is a mouse event, make it relative to the client rectangle.

bool G3D::GuiPane::morphing (  )  const [inline]

Returns true while a morph is in progress.

virtual void G3D::GuiPane::morphTo ( const Rect2D r  )  [virtual]

Causes the window to change shape and/or position to meet the specified location.

The window will not respond to drag events while it is morphing.

bool G3D::GuiControl::mouseOver (  )  const [inherited]

void G3D::GuiControl::moveBy ( float  dx,
float  dy 
) [inherited]

void G3D::GuiControl::moveBy ( const Vector2 delta  )  [inherited]

void G3D::GuiControl::moveRightOf ( const GuiControl control  )  [inherited]

If these two controls have the same parent, move this one immediately to the right of the argument.

Vector2 G3D::GuiPane::nextControlPos (  )  const [protected]

Finds the next vertical position for a control relative to the client rect.

virtual bool G3D::GuiPane::onEvent ( const GEvent event  )  [inline, protected, virtual]

Events are only delivered to a control when the control that control has the key focus (which is transferred during a mouse down).

Reimplemented from G3D::GuiControl.

void G3D::GuiPane::pack (  ) 

Resize this pane so that all of its controls are visible and so that there is no wasted space.

See also:
G3D::GuiWindow::pack

const Rect2D& G3D::GuiControl::rect (  )  const [inherited]

void G3D::GuiPane::remove ( GuiControl gui  ) 

Removes this control from the GuiPane.

virtual void G3D::GuiPane::render ( RenderDevice rd,
const GuiSkinRef skin 
) const [protected, virtual]

Implements G3D::GuiControl.

void G3D::GuiControl::setCaption ( const GuiCaption text  )  [inherited]

void G3D::GuiControl::setEnabled ( bool  e  )  [inherited]

void G3D::GuiControl::setFocused ( bool  b  )  [inherited]

Grab or release keyboard focus.

void G3D::GuiControl::setHeight ( float  h  )  [inherited]

void G3D::GuiControl::setPosition ( float  x,
float  y 
) [inherited]

void G3D::GuiControl::setPosition ( const Vector2 v  )  [inherited]

virtual void G3D::GuiPane::setRect ( const Rect2D rect  )  [virtual]

Set relative to the parent pane (or window).

Reimplemented from G3D::GuiControl.

void G3D::GuiControl::setSize ( float  x,
float  y 
) [inherited]

void G3D::GuiControl::setSize ( const Vector2 v  )  [inherited]

void G3D::GuiControl::setVisible ( bool  b  )  [inherited]

void G3D::GuiControl::setWidth ( float  w  )  [inherited]

GuiSkinRef G3D::GuiControl::skin (  )  const [inherited]

bool G3D::GuiControl::visible (  )  const [inherited]


Friends And Related Function Documentation

friend class _GuiSliderBase [friend]

friend class GuiButton [friend]

friend class GuiControl [friend]

friend class GuiRadioButton [friend]

friend class GuiWindow [friend]

Reimplemented from G3D::GuiControl.


Member Data Documentation

GuiCaption G3D::GuiControl::m_caption [protected, inherited]

Rect2D G3D::GuiControl::m_clickRect [protected, inherited]

Rect bounds used for mouse actions.

Updated by setRect.

bool G3D::GuiControl::m_enabled [protected, inherited]

GuiWindow* G3D::GuiControl::m_gui [protected, inherited]

The window that ultimately contains this control.

GuiPane* G3D::GuiControl::m_parent [protected, inherited]

Parent pane.

Rect2D G3D::GuiControl::m_rect [protected, inherited]

Rect bounds used for rendering and layout.

Relative to the enclosing pane's clientRect.

bool G3D::GuiControl::m_visible [protected, inherited]

Sub panes.


The documentation for this class was generated from the following file:
Generated on Thu Aug 2 11:40:46 2007 for G3D by doxygen 1.5.2
Hosted by SourceForge.net Logo