Support Forum       G3D Web Page     
Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Friends | List of all members
G3D::GuiPane Class Reference


Sub-rectangle of a window. More...

Inherits G3D::GuiContainer.

Public Types

enum  { CONTROL_HEIGHT = 25 }
 
enum  { CONTROL_WIDTH = 215 }
 
enum  { BUTTON_WIDTH = 80 }
 
enum  { TOOL_BUTTON_WIDTH = 50 }
 
enum  { CONTROL_PADDING = 4 }
 
enum  { DEFAULT_SIZE = -1 }
 For use with setNewChildSize() More...
 

Public Member Functions

 GuiPane (GuiContainer *parent, const GuiText &text, const Rect2D &rect, GuiTheme::PaneStyle style)
 For use by GuiContainers. More...
 
 ~GuiPane ()
 
GuiButtonaddButton (const GuiText &text, const GuiControl::Callback &actionCallback, GuiTheme::ButtonStyle style)
 
template<class Class >
GuiButtonaddButton (const GuiText &text, Class *const callbackObject, void(Class::*callbackMethod)(), GuiTheme::ButtonStyle style=GuiTheme::NORMAL_BUTTON_STYLE)
 
template<class Class >
GuiButtonaddButton (const GuiText &text, const shared_ptr< Class > &callbackObject, void(Class::*callbackMethod)(), GuiTheme::ButtonStyle style=GuiTheme::NORMAL_BUTTON_STYLE)
 
GuiButtonaddButton (const GuiText &text, std::function< void(void)> callbackFunction, GuiTheme::ButtonStyle style=GuiTheme::NORMAL_BUTTON_STYLE)
 
GuiButtonaddButton (const GuiText &text, GuiTheme::ButtonStyle style=GuiTheme::NORMAL_BUTTON_STYLE)
 
GuiCheckBoxaddCheckBox (const GuiText &text, const Pointer< bool > &pointer, GuiTheme::CheckBoxStyle style=GuiTheme::NORMAL_CHECK_BOX_STYLE)
 
GuiCheckBoxaddCheckBox (const GuiText &text, bool *pointer, GuiTheme::CheckBoxStyle style=GuiTheme::NORMAL_CHECK_BOX_STYLE)
 
GuiControladdCustom (GuiControl *control)
 Add a custom ("user-created") subclass of GuiControl. More...
 
GuiDropDownListaddDropDownList (const GuiText &caption, const Array< String > &list, const Pointer< int > &indexPointer=nullptr, const GuiControl::Callback &actionCallback=GuiControl::Callback(), bool usePrefixTreeMenus=false)
 
Add a drop-down list. More...
 
GuiDropDownListaddDropDownList (const GuiText &caption, const Array< GuiText > &list=Array< GuiText >(), const Pointer< int > &indexPointer=nullptr, const GuiControl::Callback &actionCallback=GuiControl::Callback(), bool usePrefixTreeMenus=false)
 
GuiDropDownListaddDropDownList (const GuiText &caption, const Array< String > &list, const Pointer< int > &indexPointer, std::function< void(void)> callbackFunction, bool usePrefixTreeMenus=false)
 
GuiDropDownListaddDropDownList (const GuiText &caption, const Array< GuiText > &list, const Pointer< int > &indexPointer, std::function< void(void)> callbackFunction, bool usePrefixTreeMenus=false)
 
template<class EnumClass >
void addEnumClassRadioButtons (const GuiText &label, const Pointer< EnumClass > &valuePtr, GuiTheme::RadioButtonStyle style=GuiTheme::NORMAL_RADIO_BUTTON_STYLE)
 
Create a set of radio buttons for selecting values from a class declared with G3D_DECLARE_ENUM_CLASS or G3D_DECLARE_ENUM_CLASS_METHOS. More...
 
GuiFrameBoxaddFrameBox (const Pointer< CFrame > &value, bool allowRoll=true, GuiTheme::TextBoxStyle style=GuiTheme::NORMAL_TEXT_BOX_STYLE)
 
GuiFunctionBoxaddFunctionBox (const GuiText &text, Spline< float > *spline)
 
GuiLabeladdLabel (const GuiText &text, GFont::XAlign xalign=GFont::XALIGN_LEFT, GFont::YAlign yalign=GFont::YALIGN_CENTER)
 
GuiMultiLineTextBoxaddMultiLineTextBox (const GuiText &caption, const Pointer< String > &stringPointer, GuiTextBox::Update update=GuiTextBox::DELAYED_UPDATE, GuiTheme::TextBoxStyle style=GuiTheme::NORMAL_TEXT_BOX_STYLE)
 
template<typename Value >
GuiNumberBox< Value > * addNumberBox (const GuiText &text, const Pointer< Value > &value, const GuiText &suffix="", GuiTheme::SliderScale sliderScale=GuiTheme::NO_SLIDER, Value min=(Value) minVal(Value()), Value max=(Value) maxVal(Value()), Value roundIncrement=0, GuiTheme::TextBoxStyle textBoxStyle=GuiTheme::NORMAL_TEXT_BOX_STYLE, bool useLowerInf=false, bool useUpperInf=false)
 Create a text box for numbers. More...
 
template<typename Value >
GuiNumberBox< Value > * addNumberBox (const GuiText &text, Value *value, const GuiText &suffix="", GuiTheme::SliderScale sliderScale=GuiTheme::NO_SLIDER, Value min=(Value) minVal(Value()), Value max=(Value) maxVal(Value()), Value roundIncrement=0, GuiTheme::TextBoxStyle textBoxStyle=GuiTheme::NORMAL_TEXT_BOX_STYLE, bool useLowerInf=false, bool useUpperInf=false)
 
GuiPaneaddPane (const GuiText &text="", GuiTheme::PaneStyle style=GuiTheme::SIMPLE_PANE_STYLE)
 If the text is "", no space is reserved for a caption. More...
 
template<typename EnumOrInt >
GuiRadioButtonaddRadioButton (const GuiText &text, EnumOrInt myID, const Pointer< EnumOrInt > &ptr, GuiTheme::RadioButtonStyle style=GuiTheme::NORMAL_RADIO_BUTTON_STYLE)
 Example: More...
 
template<class G3DEnum >
GuiRadioButtonaddRadioButton (const GuiText &text, typename G3DEnum::Value myID, const Pointer< G3DEnum > &ptr, GuiTheme::RadioButtonStyle style=GuiTheme::NORMAL_RADIO_BUTTON_STYLE)
 
template<typename EnumOrInt >
GuiRadioButtonaddRadioButton (const GuiText &text, EnumOrInt myID, EnumOrInt *ptr, GuiTheme::RadioButtonStyle style=GuiTheme::NORMAL_RADIO_BUTTON_STYLE)
 
template<typename EnumOrInt , class T >
GuiRadioButtonaddRadioButton (const GuiText &text, int myID, T *object, EnumOrInt(T::*get)() const, void(T::*set)(EnumOrInt), GuiTheme::RadioButtonStyle style=GuiTheme::NORMAL_RADIO_BUTTON_STYLE)
 
template<typename EnumOrInt , class T >
GuiRadioButtonaddRadioButton (const GuiText &text, int myID, shared_ptr< T > object, EnumOrInt(T::*get)() const, void(T::*set)(EnumOrInt), GuiTheme::RadioButtonStyle style=GuiTheme::NORMAL_RADIO_BUTTON_STYLE)
 
GuiScrollPaneaddScrollPane (bool enabledVerticalScrolling=true, bool enabledHorizontalScrolling=false, GuiTheme::ScrollPaneStyle style=GuiTheme::BORDERED_SCROLL_PANE_STYLE)
 
template<typename Value >
GuiSlider< Value > * addSlider (const GuiText &text, const Pointer< Value > &value, Value min, Value max, bool horizontal=true, GuiTheme::SliderScale scale=GuiTheme::LINEAR_SLIDER, bool useLowerInf=false, bool useUpperInf=false)
 
template<typename Value >
GuiSlider< Value > * addSlider (const GuiText &text, Value *value, Value min, Value max, bool horizontal=true, GuiTheme::SliderScale scale=GuiTheme::LINEAR_SLIDER, bool useLowerInf=false, bool useUpperInf=false)
 
GuiTabPaneaddTabPane (const Pointer< int > &currentTabID=Pointer< int >())
 The pointer passed is the associated id of the current tab being added. More...
 
GuiTextBoxaddTextBox (const GuiText &caption, const Pointer< String > &stringPointer, GuiTextBox::Update update=GuiTextBox::DELAYED_UPDATE, GuiTheme::TextBoxStyle style=GuiTheme::NORMAL_TEXT_BOX_STYLE)
 
GuiTextureBoxaddTextureBox (GApp *app, const GuiText &caption="", const shared_ptr< Texture > &t=shared_ptr< Texture >(), bool embedded=false, bool drawInverted=false)
 
GuiTextureBoxaddTextureBox (GApp *app, const shared_ptr< Texture > &t, bool embedded=false, bool drawInverted=false)
 Uses the texture name as the caption. More...
 
GuiWidgetDestructoraddWidgetDestructor (const weak_ptr< Widget > &w)
 Adds an invisible object to this pane that, when destroyed, will remove the widget from its manager. More...
 
virtual void beginRow ()
 By default, new controls are placed at the left edge of the pane below the lowest control. More...
 
const GuiTextcaption () const
 
float captionHeight () const
 For controls that have a caption outside the bounds of the control on the top or bottom, this is the size reserved for the caption. More...
 
float captionWidth () const
 For controls that have a caption outside the bounds of the control on the left, this is the size reserved for the caption. More...
 
const Rect2DclickRect () const
 Used by GuiContainers. More...
 
const Rect2DclientRect () const
 Client rect bounds, relative to the parent (or window if there is no parent). More...
 
virtual float defaultCaptionHeight () const
 Default caption size for this control. More...
 
virtual float defaultCaptionWidth () const
 
bool enabled () const
 
virtual void endRow ()
 
virtual void findControlUnderMouse (Vector2 mouse, GuiControl *&control) override
 
bool focused () const
 
Vector2 fromOSWindowCoords (const Vector2 &v) const
 Transforms v from OS window coordinates to this control's coordinates. More...
 
virtual void increaseBounds (const Vector2 &extent)
 Updates this container to ensure that its client rect is least as wide and high as the specified extent, then recursively calls increaseBounds on its parent. More...
 
bool morphing () const
 Returns true while a morph is in progress. More...
 
virtual void morphTo (const Rect2D &r)
 Causes the window to change shape and/or position to meet the specified location. More...
 
bool mouseOver () const
 
void moveBy (const Vector2 &delta)
 
void moveBy (float dx, float dy)
 
void moveRightOf (const GuiControl *control, const Vector2 &offset)
 If these two controls have the same parent, move this one immediately to the right of the argument. More...
 
void moveRightOf (const GuiControl *control, float offsetX=0.0f)
 
virtual bool onChildControlEvent (const GEvent &event)
 Invoked immediately (i.e., outside of the queue sequence) when a child fires an event through Widget::fireEvent. More...
 
void pack ()
 Resize this pane so that all of its controls are visible and so that there is no wasted space. More...
 
const Rect2Drect () const
 
void remove (GuiControl *gui)
 
Removes this control from the GuiPane. More...
 
void removeAllChildren ()
 Removes all children but leaves the current size (call GuiPane::pack() to shrink it). More...
 
virtual void render (RenderDevice *rd, const shared_ptr< GuiTheme > &theme, bool ancestorsEnabled) const override
 
Only methods on theme may be called from this method by default. More...
 
virtual void setCaption (const GuiText &caption) override
 If the original caption was non-empty (even if it was " "), the new caption will be shown. More...
 
virtual void setCaptionHeight (float c)
 
virtual void setCaptionWidth (float c)
 
virtual void setEnabled (bool e)
 
void setEventSource (GuiControl *c)
 
void setFocused (bool b)
 Grab or release keyboard focus. More...
 
void setHeight (float h)
 
virtual void setNewChildSize (float controlWidth=DEFAULT_SIZE, float controlHeight=DEFAULT_SIZE, float captionWidth=DEFAULT_SIZE, float captionHeight=DEFAULT_SIZE)
 
void setPosition (const Vector2 &v)
 
void setPosition (float x, float y)
 
virtual void setRect (const Rect2D &rect) override
 Set relative to the parent pane (or window) More...
 
void setSize (const Vector2 &v)
 
void setSize (float x, float y)
 
void setVisible (bool b)
 
void setWidth (float w)
 
shared_ptr< GuiThemetheme () const
 
virtual bool toolStyle () const
 Return true if this is in tool button style. More...
 
Vector2 toOSWindowCoords (const Vector2 &v) const
 Returns the coordinates of v, which is in the coordinate system of this object, relative to the OSWindow on which it will be rendered. More...
 
Rect2D toOSWindowCoords (const Rect2D &r) const
 
bool visible () const
 
GuiWindowwindow () const
 Get the window containing this control. More...
 

Static Public Member Functions

static int maxVal (int x)
 Provide the default clamp bounds for addNumberBox. More...
 
static double maxVal (double x)
 Provide the default clamp bounds for addNumberBox. More...
 
static int minVal (int x)
 Provide the default clamp bounds for addNumberBox. More...
 
static double minVal (double x)
 Provide the default clamp bounds for addNumberBox. More...
 

Protected Types

enum  {
  LEFT_CAPTION_WIDTH = 80,
  TOP_CAPTION_HEIGHT = 20
}
 
enum  LayoutDirection {
  ROW,
  COLUMN
}
 For use with setLayout. More...
 

Protected Member Functions

 GuiPane (GuiWindow *gui, const GuiText &text, const Rect2D &rect, GuiTheme::PaneStyle style)
 
void fireEvent (GEventType type)
 Fires an event. More...
 
virtual bool onEvent (const GEvent &event)
 Events are only delivered (by GuiWindow) to a GuiControl when the control has the key focus. More...
 

Protected Attributes

Array< GuiContainer * > containerArray
 Sub panes. More...
 
Array< GuiControl * > controlArray
 
Array< GuiLabel * > labelArray
 
GuiText m_caption
 
float m_captionHeight
 
float m_captionWidth
 
Rect2D m_clickRect
 Rect bounds used for mouse actions. More...
 
Rect2D m_clientRect
 Position to which all child controls are relative. More...
 
bool m_enabled
 
GuiControlm_eventSource
 Sent events should appear to be from this object, which is usually "this". More...
 
GuiWindowm_gui
 The window that ultimately contains this control. More...
 
Vector2 m_layoutCaptionSize
 
Vector2 m_layoutControlSize
 
LayoutDirection m_layoutDirection
 
GuiControlm_layoutPreviousControl
 For use in ROW mode. More...
 
_internal::Morph m_morph
 
GuiContainerm_parent
 Parent pane. More...
 
Rect2D m_rect
 Rect bounds used for rendering and layout. More...
 
GuiTheme::PaneStyle m_style
 
bool m_visible
 

Friends

class _GuiSliderBase
 
class GuiButton
 
class GuiControl
 
class GuiRadioButton
 
class GuiWindow
 

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

◆ anonymous enum

anonymous enum
inherited
Enumerator
CONTROL_HEIGHT 

◆ anonymous enum

anonymous enum
inherited
Enumerator
CONTROL_WIDTH 

◆ anonymous enum

anonymous enum
inherited
Enumerator
BUTTON_WIDTH 

◆ anonymous enum

anonymous enum
inherited
Enumerator
TOOL_BUTTON_WIDTH 

◆ anonymous enum

anonymous enum
inherited
Enumerator
CONTROL_PADDING 

◆ anonymous enum

anonymous enum
protectedinherited
Enumerator
LEFT_CAPTION_WIDTH 
TOP_CAPTION_HEIGHT 

◆ anonymous enum

anonymous enum

For use with setNewChildSize()

Enumerator
DEFAULT_SIZE 

◆ LayoutDirection

For use with setLayout.

Enumerator
ROW 

Controls are moved next to the previous control using GuiControl::moveRightOf.

Does not affect the first control added after setLayout.

COLUMN 

Controls are placed at the left edge of the pane below the lowest current control.

Constructor & Destructor Documentation

◆ GuiPane() [1/2]

G3D::GuiPane::GuiPane ( GuiWindow gui,
const GuiText text,
const Rect2D rect,
GuiTheme::PaneStyle  style 
)
protected

◆ GuiPane() [2/2]

G3D::GuiPane::GuiPane ( GuiContainer parent,
const GuiText text,
const Rect2D rect,
GuiTheme::PaneStyle  style 
)

For use by GuiContainers.

See also
GuiPane::addPane, GuiWindow::pane

◆ ~GuiPane()

G3D::GuiPane::~GuiPane ( )

Member Function Documentation

◆ addButton() [1/5]

GuiButton* G3D::GuiPane::addButton ( const GuiText text,
const GuiControl::Callback actionCallback,
GuiTheme::ButtonStyle  style 
)

Referenced by addButton().

◆ addButton() [2/5]

template<class Class >
GuiButton* G3D::GuiPane::addButton ( const GuiText text,
Class *const  callbackObject,
void(Class::*)()  callbackMethod,
GuiTheme::ButtonStyle  style = GuiTheme::NORMAL_BUTTON_STYLE 
)
inline

◆ addButton() [3/5]

template<class Class >
GuiButton* G3D::GuiPane::addButton ( const GuiText text,
const shared_ptr< Class > &  callbackObject,
void(Class::*)()  callbackMethod,
GuiTheme::ButtonStyle  style = GuiTheme::NORMAL_BUTTON_STYLE 
)
inline

◆ addButton() [4/5]

GuiButton* G3D::GuiPane::addButton ( const GuiText text,
std::function< void(void)>  callbackFunction,
GuiTheme::ButtonStyle  style = GuiTheme::NORMAL_BUTTON_STYLE 
)
inline
Parameters
callbackFunctioncan be any callable object that has no parameters or return value.

This means it works for function pointers, functors, and bother non-capturing and capturing lambdas. The last of which is very useful for calling a function of your App that normally takes parameters. See https://blog.feabhas.com/2014/03/demystifying-c-lambdas/ for a nice description of lambdas in C++.

Instead of:

declaring (and defining, unless you want to separate the definition, adding even more code bloat) in the header:

void doSomethingAwesomeSpecialConstantWithAppStorage() {
doSomethingAwesome(SPECIAL_CONSTANT, m_appStorageOfParam1);
}

and then writing:

pane->addButton("Do It (w/ special constant & app storage)", this, &App::doSomethingAwesomeSpecialConstantWithAppStorage);

you can simply write

pane->addButton("Do It (w/ special constant & app storage)", [this](){doSomethingAwesome(SPECIAL_CONSTANT, m_appStorageOfParam1);});

which is much less code, and doesn't pollute App with one-off member functions.
Another example:

const float degreeStep = 45.0f;
for (float degree = degreeStep; degree < 360; degree += degreenStep) {
pane->addButton(format("Rotate %d degrees", int(degree)), [this, degree](){rotateObject(m_object, m_axis, degree);});
}

which replaces writing seven specialized member functions.

◆ addButton() [5/5]

GuiButton* G3D::GuiPane::addButton ( const GuiText text,
GuiTheme::ButtonStyle  style = GuiTheme::NORMAL_BUTTON_STYLE 
)

◆ addCheckBox() [1/2]

GuiCheckBox* G3D::GuiPane::addCheckBox ( const GuiText text,
const Pointer< bool > &  pointer,
GuiTheme::CheckBoxStyle  style = GuiTheme::NORMAL_CHECK_BOX_STYLE 
)
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));

Referenced by addCheckBox().

◆ addCheckBox() [2/2]

GuiCheckBox* G3D::GuiPane::addCheckBox ( const GuiText text,
bool *  pointer,
GuiTheme::CheckBoxStyle  style = GuiTheme::NORMAL_CHECK_BOX_STYLE 
)
inline

◆ addCustom()

GuiControl* G3D::GuiPane::addCustom ( GuiControl control)

Add a custom ("user-created") subclass of GuiControl.

control should not be a subclass of GuiPane. Do not add a standard (e.g., G3D::GuiButton, G3D::GuiPane) control using this method.

◆ addDropDownList() [1/4]

GuiDropDownList* G3D::GuiPane::addDropDownList ( const GuiText caption,
const Array< String > &  list,
const Pointer< int > &  indexPointer = nullptr,
const GuiControl::Callback actionCallback = GuiControl::Callback(),
bool  usePrefixTreeMenus = false 
)


Add a drop-down list.

You can make the indexPointer reference an enum type by casting:

 Pointer<int>(objectPointer, 
              reinterpret_cast<int (Class::*)() const>(getMethod), 
              reinterpret_cast<void (Class::*)(int)>(setMethod)))
 

Referenced by addDropDownList().

◆ addDropDownList() [2/4]

GuiDropDownList* G3D::GuiPane::addDropDownList ( const GuiText caption,
const Array< GuiText > &  list = ArrayGuiText >(),
const Pointer< int > &  indexPointer = nullptr,
const GuiControl::Callback actionCallback = GuiControl::Callback(),
bool  usePrefixTreeMenus = false 
)

◆ addDropDownList() [3/4]

GuiDropDownList* G3D::GuiPane::addDropDownList ( const GuiText caption,
const Array< String > &  list,
const Pointer< int > &  indexPointer,
std::function< void(void)>  callbackFunction,
bool  usePrefixTreeMenus = false 
)
inline

◆ addDropDownList() [4/4]

GuiDropDownList* G3D::GuiPane::addDropDownList ( const GuiText caption,
const Array< GuiText > &  list,
const Pointer< int > &  indexPointer,
std::function< void(void)>  callbackFunction,
bool  usePrefixTreeMenus = false 
)
inline

◆ addEnumClassRadioButtons()

template<class EnumClass >
void G3D::GuiPane::addEnumClassRadioButtons ( const GuiText label,
const Pointer< EnumClass > &  valuePtr,
GuiTheme::RadioButtonStyle  style = GuiTheme::NORMAL_RADIO_BUTTON_STYLE 
)
inline


Create a set of radio buttons for selecting values from a class declared with G3D_DECLARE_ENUM_CLASS or G3D_DECLARE_ENUM_CLASS_METHOS.

Works with any G3D enumerated class, including those that have initializer values.

Parameters
labelLabel for the entire control. No label is created if this is empty.
styleStyle of the individual buttons.

◆ addFrameBox()

GuiFrameBox* G3D::GuiPane::addFrameBox ( const Pointer< CFrame > &  value,
bool  allowRoll = true,
GuiTheme::TextBoxStyle  style = GuiTheme::NORMAL_TEXT_BOX_STYLE 
)

◆ addFunctionBox()

GuiFunctionBox* G3D::GuiPane::addFunctionBox ( const GuiText text,
Spline< float > *  spline 
)

◆ addLabel()

GuiLabel* G3D::GuiPane::addLabel ( const GuiText text,
GFont::XAlign  xalign = GFont::XALIGN_LEFT,
GFont::YAlign  yalign = GFont::YALIGN_CENTER 
)
Parameters
xalignHorizontal alignment of text within the rect of the label
yalignVertical alignment of text within the rect of the label

The label will wordwrap, but only allocates vertical layout space based on the size of the control. If you would like to change the layout space, call GuiControl::setHeight on it.

Referenced by addEnumClassRadioButtons().

◆ addMultiLineTextBox()

GuiMultiLineTextBox* G3D::GuiPane::addMultiLineTextBox ( const GuiText caption,
const Pointer< String > &  stringPointer,
GuiTextBox::Update  update = GuiTextBox::DELAYED_UPDATE,
GuiTheme::TextBoxStyle  style = GuiTheme::NORMAL_TEXT_BOX_STYLE 
)
inline

◆ addNumberBox() [1/2]

template<typename Value >
GuiNumberBox<Value>* G3D::GuiPane::addNumberBox ( const GuiText text,
const Pointer< Value > &  value,
const GuiText suffix = "",
GuiTheme::SliderScale  sliderScale = GuiTheme::NO_SLIDER,
Value  min = (Value)minVal(Value()),
Value  max = (Value)maxVal(Value()),
Value  roundIncrement = 0,
GuiTheme::TextBoxStyle  textBoxStyle = GuiTheme::NORMAL_TEXT_BOX_STYLE,
bool  useLowerInf = false,
bool  useUpperInf = false 
)
inline

Create a text box for numbers.

Parameters
suffixA label to the right of the number, e.g., units
roundIncrementRound typed values to the nearest increment of this, 0 for no rounding.

◆ addNumberBox() [2/2]

template<typename Value >
GuiNumberBox<Value>* G3D::GuiPane::addNumberBox ( const GuiText text,
Value *  value,
const GuiText suffix = "",
GuiTheme::SliderScale  sliderScale = GuiTheme::NO_SLIDER,
Value  min = (Value)minVal(Value()),
Value  max = (Value)maxVal(Value()),
Value  roundIncrement = 0,
GuiTheme::TextBoxStyle  textBoxStyle = GuiTheme::NORMAL_TEXT_BOX_STYLE,
bool  useLowerInf = false,
bool  useUpperInf = false 
)
inline

◆ addPane()

GuiPane* G3D::GuiPane::addPane ( const GuiText text = "",
GuiTheme::PaneStyle  style = GuiTheme::SIMPLE_PANE_STYLE 
)

If the text is "", no space is reserved for a caption.

If non-empty (even " "), then space is reserved and the caption may later be changed.

◆ addRadioButton() [1/5]

template<typename EnumOrInt >
GuiRadioButton* G3D::GuiPane::addRadioButton ( const GuiText text,
EnumOrInt  myID,
const Pointer< EnumOrInt > &  ptr,
GuiTheme::RadioButtonStyle  style = GuiTheme::NORMAL_RADIO_BUTTON_STYLE 
)
inline

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
ptrMust be a pointer to an int or enum. The current selection value for a group of radio buttons.

Referenced by addEnumClassRadioButtons(), and addRadioButton().

◆ addRadioButton() [2/5]

template<class G3DEnum >
GuiRadioButton* G3D::GuiPane::addRadioButton ( const GuiText text,
typename G3DEnum::Value  myID,
const Pointer< G3DEnum > &  ptr,
GuiTheme::RadioButtonStyle  style = GuiTheme::NORMAL_RADIO_BUTTON_STYLE 
)
inline

◆ addRadioButton() [3/5]

template<typename EnumOrInt >
GuiRadioButton* G3D::GuiPane::addRadioButton ( const GuiText text,
EnumOrInt  myID,
EnumOrInt *  ptr,
GuiTheme::RadioButtonStyle  style = GuiTheme::NORMAL_RADIO_BUTTON_STYLE 
)
inline

◆ addRadioButton() [4/5]

template<typename EnumOrInt , class T >
GuiRadioButton* G3D::GuiPane::addRadioButton ( const GuiText text,
int  myID,
T *  object,
EnumOrInt(T::*)() const  get,
void(T::*)(EnumOrInt)  set,
GuiTheme::RadioButtonStyle  style = GuiTheme::NORMAL_RADIO_BUTTON_STYLE 
)
inline

◆ addRadioButton() [5/5]

template<typename EnumOrInt , class T >
GuiRadioButton* G3D::GuiPane::addRadioButton ( const GuiText text,
int  myID,
shared_ptr< T >  object,
EnumOrInt(T::*)() const  get,
void(T::*)(EnumOrInt)  set,
GuiTheme::RadioButtonStyle  style = GuiTheme::NORMAL_RADIO_BUTTON_STYLE 
)
inline

◆ addScrollPane()

GuiScrollPane* G3D::GuiPane::addScrollPane ( bool  enabledVerticalScrolling = true,
bool  enabledHorizontalScrolling = false,
GuiTheme::ScrollPaneStyle  style = GuiTheme::BORDERED_SCROLL_PANE_STYLE 
)

◆ addSlider() [1/2]

template<typename Value >
GuiSlider<Value>* G3D::GuiPane::addSlider ( const GuiText text,
const Pointer< Value > &  value,
Value  min,
Value  max,
bool  horizontal = true,
GuiTheme::SliderScale  scale = GuiTheme::LINEAR_SLIDER,
bool  useLowerInf = false,
bool  useUpperInf = false 
)
inline

Referenced by addSlider().

◆ addSlider() [2/2]

template<typename Value >
GuiSlider<Value>* G3D::GuiPane::addSlider ( const GuiText text,
Value *  value,
Value  min,
Value  max,
bool  horizontal = true,
GuiTheme::SliderScale  scale = GuiTheme::LINEAR_SLIDER,
bool  useLowerInf = false,
bool  useUpperInf = false 
)
inline

◆ addTabPane()

GuiTabPane* G3D::GuiPane::addTabPane ( const Pointer< int > &  currentTabID = Pointer< int >())

The pointer passed is the associated id of the current tab being added.

◆ addTextBox()

GuiTextBox* G3D::GuiPane::addTextBox ( const GuiText caption,
const Pointer< String > &  stringPointer,
GuiTextBox::Update  update = GuiTextBox::DELAYED_UPDATE,
GuiTheme::TextBoxStyle  style = GuiTheme::NORMAL_TEXT_BOX_STYLE 
)
inline

◆ addTextureBox() [1/2]

GuiTextureBox* G3D::GuiPane::addTextureBox ( GApp app,
const GuiText caption = "",
const shared_ptr< Texture > &  t = shared_ptr< Texture >(),
bool  embedded = false,
bool  drawInverted = false 
)

◆ addTextureBox() [2/2]

GuiTextureBox* G3D::GuiPane::addTextureBox ( GApp app,
const shared_ptr< Texture > &  t,
bool  embedded = false,
bool  drawInverted = false 
)

Uses the texture name as the caption.

◆ addWidgetDestructor()

GuiWidgetDestructor* G3D::GuiPane::addWidgetDestructor ( const weak_ptr< Widget > &  w)

Adds an invisible object to this pane that, when destroyed, will remove the widget from its manager.

Useful for automatically destroying Widgets associated with the Entity pane of SceneEditorWindow.

◆ beginRow()

virtual void G3D::GuiPane::beginRow ( )
inlinevirtual

By default, new controls are placed at the left edge of the pane below the lowest control.

Between beginRow()...endRow() controls are placed to the right of the previous control.

You can start a new row by making another call to beginRow().

Referenced by addEnumClassRadioButtons().

◆ caption()

const GuiText& G3D::GuiControl::caption ( ) const
inherited

◆ captionHeight()

float G3D::GuiControl::captionHeight ( ) const
inherited

For controls that have a caption outside the bounds of the control on the top or bottom, this is the size reserved for the caption.

◆ captionWidth()

float G3D::GuiControl::captionWidth ( ) const
inherited

For controls that have a caption outside the bounds of the control on the left, this is the size reserved for the caption.

◆ clickRect()

const Rect2D& G3D::GuiControl::clickRect ( ) const
inlineinherited

Used by GuiContainers.

◆ clientRect()

const Rect2D& G3D::GuiContainer::clientRect ( ) const
inlineinherited

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

◆ defaultCaptionHeight()

virtual float G3D::GuiControl::defaultCaptionHeight ( ) const
inlinevirtualinherited

Default caption size for this control.

Reimplemented in G3D::GuiFunctionBox.

◆ defaultCaptionWidth()

virtual float G3D::GuiControl::defaultCaptionWidth ( ) const
inlinevirtualinherited

◆ enabled()

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

◆ endRow()

virtual void G3D::GuiPane::endRow ( )
inlinevirtual

◆ findControlUnderMouse()

virtual void G3D::GuiPane::findControlUnderMouse ( Vector2  mouse,
GuiControl *&  control 
)
overridevirtual
Parameters
mousein GUI pixels

Reimplemented from G3D::GuiControl.

◆ fireEvent()

void G3D::GuiControl::fireEvent ( GEventType  type)
protectedinherited

Fires an event.

◆ focused()

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

◆ fromOSWindowCoords()

Vector2 G3D::GuiControl::fromOSWindowCoords ( const Vector2 v) const
inherited

Transforms v from OS window coordinates to this control's coordinates.

◆ increaseBounds()

virtual void G3D::GuiContainer::increaseBounds ( const Vector2 extent)
virtualinherited

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

Used during automatic layout sizing.

◆ maxVal() [1/2]

static int G3D::GuiPane::maxVal ( int  x)
inlinestatic

Provide the default clamp bounds for addNumberBox.

◆ maxVal() [2/2]

static double G3D::GuiPane::maxVal ( double  x)
inlinestatic

Provide the default clamp bounds for addNumberBox.

◆ minVal() [1/2]

static int G3D::GuiPane::minVal ( int  x)
inlinestatic

Provide the default clamp bounds for addNumberBox.

◆ minVal() [2/2]

static double G3D::GuiPane::minVal ( double  x)
inlinestatic

Provide the default clamp bounds for addNumberBox.

◆ morphing()

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

Returns true while a morph is in progress.

◆ morphTo()

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.

◆ mouseOver()

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

◆ moveBy() [1/2]

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

◆ moveBy() [2/2]

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

◆ moveRightOf() [1/2]

void G3D::GuiControl::moveRightOf ( const GuiControl control,
const Vector2 offset 
)
inherited

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

Parameters
offsetMay be negative

Referenced by G3D::GuiControl::moveRightOf().

◆ moveRightOf() [2/2]

void G3D::GuiControl::moveRightOf ( const GuiControl control,
float  offsetX = 0.0f 
)
inlineinherited

◆ onChildControlEvent()

virtual bool G3D::GuiContainer::onChildControlEvent ( const GEvent event)
virtualinherited

Invoked immediately (i.e., outside of the queue sequence) when a child fires an event through Widget::fireEvent.

If this method returns true, the event is never submitted to the event queue. The default implementation passes the event to the GUI parent of this GuiContainer.

This enables creation of new custom controls by embedding other controls inside a GuiContainer; the container can suppress or watch the child control events in order to present its own behavior to its parent and the GuiWindow.

◆ onEvent()

virtual bool G3D::GuiControl::onEvent ( const GEvent event)
inlineprotectedvirtualinherited

Events are only delivered (by GuiWindow) to a GuiControl when the control has the key focus.

If the control does not consume the event, the event is delivered to each of its GUI parents in order, back to the window's root pane.

Key focus is transferred during a mouse down event.

Reimplemented in G3D::GuiTextureBox, G3D::GuiTextBox, G3D::GuiFunctionBox, G3D::GuiScrollBar, G3D::GuiDropDownList, G3D::GuiButton, G3D::ProfilerWindow::ProfilerTreeDisplay, G3D::GuiRadioButton, G3D::_GuiSliderBase, G3D::GuiTabPane, G3D::GuiCheckBox, G3D::GuiScrollPane, and G3D::GuiMultiLineTextBox.

◆ pack()

void G3D::GuiPane::pack ( )

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

Does not affect control layout. Recursively packs all child GuiPanes.

See also
G3D::GuiWindow::pack

◆ rect()

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

◆ remove()

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


Removes this control from the GuiPane.

◆ removeAllChildren()

void G3D::GuiPane::removeAllChildren ( )

Removes all children but leaves the current size (call GuiPane::pack() to shrink it).

Removed children are deleted.

Do not invoke during a GuiCallback when the object being called may be deleted.

◆ render()

virtual void G3D::GuiPane::render ( RenderDevice rd,
const shared_ptr< GuiTheme > &  theme,
bool  ancestorsEnabled 
) const
overridevirtual


Only methods on theme may be called from this method by default.

To make arbitrary RenderDevice calls, wrap them in GuiTheme::pauseRendering ... GuiTheme::resumeRendering.

Parameters
ancestorsEnabledDraw as disabled if this is false or if enabled() is false.

Implements G3D::GuiControl.

◆ setCaption()

virtual void G3D::GuiPane::setCaption ( const GuiText caption)
overridevirtual

If the original caption was non-empty (even if it was " "), the new caption will be shown.

Reimplemented from G3D::GuiControl.

◆ setCaptionHeight()

virtual void G3D::GuiControl::setCaptionHeight ( float  c)
virtualinherited

◆ setCaptionWidth()

virtual void G3D::GuiControl::setCaptionWidth ( float  c)
virtualinherited

◆ setEnabled()

virtual void G3D::GuiControl::setEnabled ( bool  e)
virtualinherited

◆ setEventSource()

void G3D::GuiControl::setEventSource ( GuiControl c)
inlineinherited

◆ setFocused()

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

Grab or release keyboard focus.

◆ setHeight()

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

◆ setNewChildSize()

virtual void G3D::GuiPane::setNewChildSize ( float  controlWidth = DEFAULT_SIZE,
float  controlHeight = DEFAULT_SIZE,
float  captionWidth = DEFAULT_SIZE,
float  captionHeight = DEFAULT_SIZE 
)
virtual
Parameters
controlWidthIf not DEFAULT_SIZE, controls have their GuiControl::rect.width set to this value.
controlHeightIf not DEFAULT_SIZE, controls have their GuiControl::rect.width set to this value.
captionWidthIf not DEFAULT_SIZE, controls with non-zero caption widths have their GuiControl::captionWidth adjusted to this value.
captionHeightIf not DEFAULT_SIZE, controls with non-zero caption heights have their GuiControl::captionWidth adjusted to this value.

◆ setPosition() [1/2]

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

◆ setPosition() [2/2]

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

◆ setRect()

virtual void G3D::GuiPane::setRect ( const Rect2D rect)
overridevirtual

Set relative to the parent pane (or window)

Reimplemented from G3D::GuiContainer.

◆ setSize() [1/2]

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

Referenced by addRadioButton().

◆ setSize() [2/2]

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

◆ setVisible()

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

◆ setWidth()

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

◆ theme()

shared_ptr<GuiTheme> G3D::GuiControl::theme ( ) const
inherited

◆ toolStyle()

virtual bool G3D::GuiControl::toolStyle ( ) const
inlinevirtualinherited

Return true if this is in tool button style.

Reimplemented in G3D::GuiRadioButton, G3D::GuiButton, and G3D::GuiCheckBox.

◆ toOSWindowCoords() [1/2]

Vector2 G3D::GuiControl::toOSWindowCoords ( const Vector2 v) const
inherited

Returns the coordinates of v, which is in the coordinate system of this object, relative to the OSWindow on which it will be rendered.

Referenced by G3D::GuiControl::toOSWindowCoords().

◆ toOSWindowCoords() [2/2]

Rect2D G3D::GuiControl::toOSWindowCoords ( const Rect2D r) const
inlineinherited

◆ visible()

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

◆ window()

GuiWindow* G3D::GuiControl::window ( ) const
inherited

Get the window containing this control.

Friends And Related Function Documentation

◆ _GuiSliderBase

friend class _GuiSliderBase
friend

◆ GuiButton

friend class GuiButton
friend

◆ GuiControl

friend class GuiControl
friend

◆ GuiRadioButton

friend class GuiRadioButton
friend

Referenced by addRadioButton().

◆ GuiWindow

friend class GuiWindow
friend

Member Data Documentation

◆ containerArray

Array<GuiContainer*> G3D::GuiPane::containerArray
protected

Sub panes.

◆ controlArray

Array<GuiControl*> G3D::GuiPane::controlArray
protected

◆ labelArray

Array<GuiLabel*> G3D::GuiPane::labelArray
protected

◆ m_caption

GuiText G3D::GuiControl::m_caption
protectedinherited

◆ m_captionHeight

float G3D::GuiControl::m_captionHeight
protectedinherited

◆ m_captionWidth

float G3D::GuiControl::m_captionWidth
protectedinherited

◆ m_clickRect

Rect2D G3D::GuiControl::m_clickRect
protectedinherited

Rect bounds used for mouse actions.

Updated by setRect.

Referenced by G3D::GuiControl::clickRect().

◆ m_clientRect

Rect2D G3D::GuiContainer::m_clientRect
protectedinherited

Position to which all child controls are relative.

Referenced by G3D::GuiContainer::clientRect(), G3D::GuiNumberBox< int >::findControlUnderMouse(), and G3D::GuiNumberBox< int >::render().

◆ m_enabled

bool G3D::GuiControl::m_enabled
protectedinherited

◆ m_eventSource

GuiControl* G3D::GuiControl::m_eventSource
protectedinherited

Sent events should appear to be from this object, which is usually "this".

Other controls can set the event source to create compound controls that seem atomic from the outside.

Referenced by G3D::GuiSlider< int >::GuiSlider(), G3D::GuiNumberBox< Value >::MyTextBox::MyTextBox(), and G3D::GuiControl::setEventSource().

◆ m_gui

GuiWindow* G3D::GuiControl::m_gui
protectedinherited

The window that ultimately contains this control.

◆ m_layoutCaptionSize

Vector2 G3D::GuiPane::m_layoutCaptionSize
protected

◆ m_layoutControlSize

Vector2 G3D::GuiPane::m_layoutControlSize
protected

◆ m_layoutDirection

LayoutDirection G3D::GuiPane::m_layoutDirection
protected

Referenced by beginRow(), and endRow().

◆ m_layoutPreviousControl

GuiControl* G3D::GuiPane::m_layoutPreviousControl
protected

For use in ROW mode.

Referenced by beginRow().

◆ m_morph

_internal::Morph G3D::GuiPane::m_morph
protected

Referenced by morphing().

◆ m_parent

GuiContainer* G3D::GuiControl::m_parent
protectedinherited

Parent pane.

◆ m_rect

Rect2D G3D::GuiControl::m_rect
protectedinherited

Rect bounds used for rendering and layout.

Relative to the enclosing pane's clientRect.

Referenced by G3D::GuiControl::findControlUnderMouse(), G3D::GuiNumberBox< int >::render(), G3D::GuiNumberBox< int >::setCaption(), and G3D::GuiNumberBox< int >::setRect().

◆ m_style

GuiTheme::PaneStyle G3D::GuiPane::m_style
protected

◆ m_visible

bool G3D::GuiControl::m_visible
protectedinherited

documentation generated on Wed Nov 24 2021 08:01:56 using doxygen 1.8.15