MyGUI: MyGUI::Gui Class Reference

MyGUI 3.4.3

Public Member Functions | Static Public Member Functions | Data Fields | Friends
MyGUI::Gui Class Reference

`#include <MyGUI_Gui.h>`

Inheritance diagram for MyGUI::Gui:
[legend]

## Public Member Functions
| Gui (const Gui &)=delete
Gui & | operator= (const Gui &)=delete
| Gui ()
void | initialise (const std::string &_core="MyGUI_Core.xml")
void | initialise (const std::string &_core, std::string_view _logFileName)
void | shutdown ()
Widget * | createWidgetT (std::string_view _type, std::string_view _skin, const IntCoord &_coord, Align _align, std::string_view _layer, std::string_view _name={})
Widget * | createWidgetT (std::string_view _type, std::string_view _skin, int _left, int _top, int _width, int _height, Align _align, std::string_view _layer, std::string_view _name={})
Widget * | createWidgetRealT (std::string_view _type, std::string_view _skin, const FloatCoord &_coord, Align _align, std::string_view _layer, std::string_view _name={})
Widget * | createWidgetRealT (std::string_view _type, std::string_view _skin, float _left, float _top, float _width, float _height, Align _align, std::string_view _layer, std::string_view _name={})
template<typename T>
T * | createWidget (std::string_view _skin, const IntCoord &_coord, Align _align, std::string_view _layer, std::string_view _name={})
template<typename T>
T * | createWidget (std::string_view _skin, int _left, int _top, int _width, int _height, Align _align, std::string_view _layer, std::string_view _name={})
template<typename T>
T * | createWidgetReal (std::string_view _skin, const FloatCoord &_coord, Align _align, std::string_view _layer, std::string_view _name={})
template<typename T>
T * | createWidgetReal (std::string_view _skin, float _left, float _top, float _width, float _height, Align _align, std::string_view _layer, std::string_view _name={})
void | destroyWidget (Widget *_widget)
void | destroyWidgets (const VectorWidgetPtr &_widgets)
void | destroyWidgets (EnumeratorWidgetPtr &_widgets)
Widget * | findWidgetT (std::string_view _name, bool _throw=true) const
Widget * | findWidgetT (std::string_view _name, std::string_view _prefix, bool _throw=true) const
template<typename T>
T * | findWidget (std::string_view _name, bool _throw=true) const
template<typename T>
T * | findWidget (std::string_view _name, std::string_view _prefix, bool _throw=true) const
void | destroyChildWidget (Widget *_widget)
void | destroyAllChildWidget ()
EnumeratorWidgetPtr | getEnumerator () const
void | frameEvent (float _time) const
void | _linkChildWidget (Widget *_widget)
void | _unlinkChildWidget (Widget *_widget)
Public Member Functions inherited from MyGUI::IUnlinkWidget
virtual | ~IUnlinkWidget ()=default
Public Member Functions inherited from MyGUI::MemberObsolete< Gui >
void | destroyWidgetsVector (VectorWidgetPtr &_widgets)
void | hidePointer ()
void | showPointer ()
bool | isShowPointer ()
void | injectFrameEntered (float)
int | getViewWidth () const
int | getViewHeight () const
bool | injectMouseMove (int _absx, int _absy, int _absz)
bool | injectMousePress (int _absx, int _absy, MouseButton _id)
bool | injectMouseRelease (int _absx, int _absy, MouseButton _id)
bool | injectKeyPress (KeyCode _key, Char _text=0)
bool | injectKeyRelease (KeyCode _key)
void | setVisiblePointer (bool _value)
bool | isVisiblePointer ()
bool | load (const std::string &_file)
const IntSize & | getViewSize () const
void | _injectFrameEntered (float _time)
void | _resizeWindow (const IntSize &_size)

## Static Public Member Functions
static Gui & | getInstance ()
static Gui * | getInstancePtr ()
static std::string_view | getClassTypeName ()

## Data Fields
EventHandle_FrameEventDelegate | eventFrameStart

## Friends
class | WidgetManager

## Detailed Description

Definition at line 23 of file MyGUI_Gui.h.

## Constructor & Destructor Documentation

## ◆ Gui() [1/2]

MyGUI::Gui::Gui | ( | const Gui & |  | ) |
| delete

## ◆ Gui() [2/2]

MyGUI::Gui::Gui | ( |  | ) |

Definition at line 36 of file MyGUI_Gui.cpp.

## Member Function Documentation

## ◆ _linkChildWidget()

void MyGUI::Gui::_linkChildWidget | ( | Widget * | _widget | ) |

Definition at line 261 of file MyGUI_Gui.cpp.

## ◆ _unlinkChildWidget()

void MyGUI::Gui::_unlinkChildWidget | ( | Widget * | _widget | ) |

Definition at line 268 of file MyGUI_Gui.cpp.

## ◆ createWidget() [1/2]

template<typename T>

T * MyGUI::Gui::createWidget | ( | std::string_view | _skin,
|  | const IntCoord & | _coord,
|  | Align | _align,
|  | std::string_view | _layer,
|  | std::string_view | _name = {} )
| inline

Same as Gui::createWidgetT but return T* instead of Widget*

Definition at line 98 of file MyGUI_Gui.h.

## ◆ createWidget() [2/2]

template<typename T>

T * MyGUI::Gui::createWidget | ( | std::string_view | _skin,
|  | int | _left,
|  | int | _top,
|  | int | _width,
|  | int | _height,
|  | Align | _align,
|  | std::string_view | _layer,
|  | std::string_view | _name = {} )
| inline

Same as Gui::createWidgetT but return T* instead of Widget*

Definition at line 109 of file MyGUI_Gui.h.

## ◆ createWidgetReal() [1/2]

template<typename T>

T * MyGUI::Gui::createWidgetReal | ( | std::string_view | _skin,
|  | const FloatCoord & | _coord,
|  | Align | _align,
|  | std::string_view | _layer,
|  | std::string_view | _name = {} )
| inline

Same as Gui::createWidgetRealT but return T* instead of Widget*

Definition at line 129 of file MyGUI_Gui.h.

## ◆ createWidgetReal() [2/2]

template<typename T>

T * MyGUI::Gui::createWidgetReal | ( | std::string_view | _skin,
|  | float | _left,
|  | float | _top,
|  | float | _width,
|  | float | _height,
|  | Align | _align,
|  | std::string_view | _layer,
|  | std::string_view | _name = {} )
| inline

Same as Gui::createWidgetRealT but return T* instead of Widget*

Definition at line 140 of file MyGUI_Gui.h.

## ◆ createWidgetRealT() [1/2]

Widget * MyGUI::Gui::createWidgetRealT | ( | std::string_view | _type,
|  | std::string_view | _skin,
|  | const FloatCoord & | _coord,
|  | Align | _align,
|  | std::string_view | _layer,
|  | std::string_view | _name = {} )

Create widget using coordinates relative to parent widget. see Gui::createWidgetT

Definition at line 300 of file MyGUI_Gui.cpp.

## ◆ createWidgetRealT() [2/2]

Widget * MyGUI::Gui::createWidgetRealT | ( | std::string_view | _type,
|  | std::string_view | _skin,
|  | float | _left,
|  | float | _top,
|  | float | _width,
|  | float | _height,
|  | Align | _align,
|  | std::string_view | _layer,
|  | std::string_view | _name = {} )

Create widget using coordinates relative to parent. see Gui::createWidgetT

Definition at line 322 of file MyGUI_Gui.cpp.

## ◆ createWidgetT() [1/2]

Widget * MyGUI::Gui::createWidgetT | ( | std::string_view | _type,
|  | std::string_view | _skin,
|  | const IntCoord & | _coord,
|  | Align | _align,
|  | std::string_view | _layer,
|  | std::string_view | _name = {} )

Create widget

Parameters

  _type | widget type
  _skin | widget skin
  _coord | int coordinates of widget (_left, _top, _width, _height)
  _align | widget align (possible values can be found in enum Align)
  _layer | layer where widget will be created (all layers usually defined in core_layer.xml file).
  _name | optional widget name (you can use it for finding widget by name later)

Definition at line 275 of file MyGUI_Gui.cpp.

## ◆ createWidgetT() [2/2]

Widget * MyGUI::Gui::createWidgetT | ( | std::string_view | _type,
|  | std::string_view | _skin,
|  | int | _left,
|  | int | _top,
|  | int | _width,
|  | int | _height,
|  | Align | _align,
|  | std::string_view | _layer,
|  | std::string_view | _name = {} )

See Gui::createWidgetT

Definition at line 286 of file MyGUI_Gui.cpp.

## ◆ destroyAllChildWidget()

void MyGUI::Gui::destroyAllChildWidget | ( |  | ) |

Destroy all child widgets

Definition at line 359 of file MyGUI_Gui.cpp.

## ◆ destroyChildWidget()

void MyGUI::Gui::destroyChildWidget | ( | Widget * | _widget | ) |

Destroy child widget or throw exception if this child widget not found

Definition at line 354 of file MyGUI_Gui.cpp.

## ◆ destroyWidget()

void MyGUI::Gui::destroyWidget | ( | Widget * | _widget | ) |

Destroy any created widget

Definition at line 233 of file MyGUI_Gui.cpp.

## ◆ destroyWidgets() [1/2]

void MyGUI::Gui::destroyWidgets | ( | const VectorWidgetPtr & | _widgets | ) |

Destroy vector of widgets

Definition at line 242 of file MyGUI_Gui.cpp.

## ◆ destroyWidgets() [2/2]

void MyGUI::Gui::destroyWidgets | ( | EnumeratorWidgetPtr & | _widgets | ) |

Destroy Enumerator of widgets

Definition at line 248 of file MyGUI_Gui.cpp.

## ◆ findWidget() [1/2]

template<typename T>

T * MyGUI::Gui::findWidget | ( | std::string_view | _name,
|  | bool | _throw = true ) const
| inline

Find widget by name and cast it to T type. If widget not found or T and found widget have different types exception will be thrown, or if the second parameter is false the nullptr pointer will be returned

Definition at line 177 of file MyGUI_Gui.h.

## ◆ findWidget() [2/2]

template<typename T>

T * MyGUI::Gui::findWidget | ( | std::string_view | _name,
|  | std::string_view | _prefix,
|  | bool | _throw = true ) const
| inline

Find widget by name and prefix and cast it to T type If widget not found or T and found widget have different types cause exception, or if the second parameter is false the nullptr pointer will be returned

Definition at line 189 of file MyGUI_Gui.h.

## ◆ findWidgetT() [1/2]

Widget * MyGUI::Gui::findWidgetT | ( | std::string_view | _name,
|  | bool | _throw = true ) const

Find widget by name If widget is not found the exception will be thrown, or if the second parameter is false the nullptr pointer will be returned

Definition at line 178 of file MyGUI_Gui.cpp.

## ◆ findWidgetT() [2/2]

Widget * MyGUI::Gui::findWidgetT | ( | std::string_view | _name,
|  | std::string_view | _prefix,
|  | bool | _throw = true ) const

Find widget by name and prefix If widget is not found the exception will be thrown, or if the second parameter is false the nullptr pointer will be returned

Definition at line 347 of file MyGUI_Gui.cpp.

## ◆ frameEvent()

void MyGUI::Gui::frameEvent | ( | float | _time | ) | const

Inject frame entered event (called be renderer, do not call it manually). This function is called every frame by renderer.

Definition at line 369 of file MyGUI_Gui.cpp.

## ◆ getClassTypeName()

std::string_view MyGUI::Gui::getClassTypeName | ( |  | ) |
| static

Definition at line 34 of file MyGUI_Gui.cpp.

## ◆ getEnumerator()

EnumeratorWidgetPtr MyGUI::Gui::getEnumerator | ( |  | ) | const

Get root widgets Enumerator

Definition at line 364 of file MyGUI_Gui.cpp.

## ◆ getInstance()

Gui & MyGUI::Gui::getInstance | ( |  | ) |
| static

Definition at line 34 of file MyGUI_Gui.cpp.

## ◆ getInstancePtr()

Gui * MyGUI::Gui::getInstancePtr | ( |  | ) |
| static

Definition at line 34 of file MyGUI_Gui.cpp.

## ◆ initialise() [1/2]

void MyGUI::Gui::initialise | ( | const std::string & | _core,
|  | std::string_view | _logFileName )

Deprecated
  " is deprecated, use : void Gui::initialise(const std::string& _core) and set log filename in Platform"

Definition at line 98 of file MyGUI_Gui.cpp.

## ◆ initialise() [2/2]

void MyGUI::Gui::initialise | ( | const std::string & | _core = "MyGUI_Core.xml" | ) |

Initialise GUI and all GUI Managers

Parameters

  _core | name of core config file for MyGUI (contain main config files with skins, layers, fonts, etc.)
  _logFileName | Log file name

Definition at line 41 of file MyGUI_Gui.cpp.

## ◆ operator=()

Gui & MyGUI::Gui::operator= | ( | const Gui & |  | ) |
| delete

## ◆ shutdown()

void MyGUI::Gui::shutdown | ( |  | ) |

Shutdown GUI and all GUI Managers

Definition at line 104 of file MyGUI_Gui.cpp.

## Friends And Related Symbol Documentation

## ◆ WidgetManager

friend class WidgetManager
| friend

Definition at line 26 of file MyGUI_Gui.h.

## Field Documentation

## ◆ eventFrameStart

EventHandle_FrameEventDelegate MyGUI::Gui::eventFrameStart

Event : Multidelegate. GUI per frame call.
signature : void method(float _time)

Parameters

  _time | Time elapsed since last frame

Definition at line 215 of file MyGUI_Gui.h.

The documentation for this class was generated from the following files:

- MyGUI_Gui.h
- MyGUI_Gui.cpp