Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
Divide::GUIButton Class Referencefinal

#include <GUIButton.h>

+ Inheritance diagram for Divide::GUIButton:

Public Types

enum class  Event : U8 {
  HoverEnter = 0 , HoverLeave , MouseDown , MouseUp ,
  MouseMove , MouseClick , MouseDoubleClick , MouseTripleClick ,
  COUNT
}
 

Public Member Functions

void setTooltip (const string &tooltipText) override
 
void setText (const std::string_view &text) const
 
void setFont (const string &fontName, const string &fontFileName, U32 size) const
 
void active (bool active) noexcept override
 
void visible (bool visible) noexcept override
 
void setEventCallback (Event event, const ButtonCallback &callback)
 
void setEventSound (Event event, Handle< AudioDescriptor > sound)
 
void setEventCallback (Event event, const ButtonCallback &callback, Handle< AudioDescriptor > sound)
 
- Public Member Functions inherited from Divide::GUIElementBase< GUIType::GUI_BUTTON >
 GUIElementBase (const string &name, CEGUI::Window *const parent)
 
GUIType type () const noexcept override
 
- Public Member Functions inherited from Divide::GUIElement
 GUIElement (string name, CEGUI::Window *parent) noexcept
 
virtual void setTooltip (const string &tooltipText)
 
 PROPERTY_RW (string, name, "")
 
 VIRTUAL_PROPERTY_RW (bool, visible, true)
 
 VIRTUAL_PROPERTY_RW (bool, active, false)
 
virtual GUIType type () const noexcept
 
- Public Member Functions inherited from Divide::GUIDWrapper
 GUIDWrapper () noexcept
 
 GUIDWrapper (const GUIDWrapper &old) noexcept
 
 GUIDWrapper (GUIDWrapper &&old) noexcept
 
virtual ~GUIDWrapper ()=default
 
FORCE_INLINE I64 getGUID () const noexcept
 
GUIDWrapperoperator= (const GUIDWrapper &old)=delete
 
GUIDWrapperoperator= (GUIDWrapper &&other)=delete
 

Static Public Member Functions

static bool soundCallback (const AudioCallback &cbk)
 
- Static Public Member Functions inherited from Divide::GUIDWrapper
static I64 generateGUID () noexcept
 

Protected Member Functions

 GUIButton (const string &name, const string &text, const string &guiScheme, const RelativePosition2D &offset, const RelativeScale2D &size, CEGUI::Window *parent)
 
 ~GUIButton () override
 
bool onEvent (Event event, const CEGUI::EventArgs &)
 

Protected Attributes

std::array< ButtonCallback, to_base(Event::COUNT)> _callbackFunction
 A pointer to a function to call if the button is pressed.
 
std::array< Handle< AudioDescriptor >, to_base(Event::COUNT)> _eventSound
 
std::array< CEGUI::Event::Connection, to_base(Event::COUNT)> _connections
 
CEGUI::Window * _btnWindow
 
- Protected Attributes inherited from Divide::GUIElement
CEGUI::Window * _parent
 
- Protected Attributes inherited from Divide::GUIDWrapper
const I64 _guid
 

Static Protected Attributes

static AudioCallback s_soundCallback
 

Private Types

using ButtonCallback = DELEGATE< void, I64 >
 
using AudioCallback = DELEGATE< void, Handle< AudioDescriptor > >
 

Friends

class GUIInterface
 
class SceneGUIElements
 

Additional Inherited Members

- Static Public Attributes inherited from Divide::GUIElementBase< GUIType::GUI_BUTTON >
static constexpr GUIType Type
 
- Static Public Attributes inherited from Divide::GUIElement
static constexpr GUIType Type = GUIType::COUNT
 

Detailed Description

Definition at line 49 of file GUIButton.h.

Member Typedef Documentation

◆ AudioCallback

Definition at line 51 of file GUIButton.h.

◆ ButtonCallback

Definition at line 50 of file GUIButton.h.

Member Enumeration Documentation

◆ Event

enum class Divide::GUIButton::Event : U8
strong
Enumerator
HoverEnter 
HoverLeave 
MouseDown 
MouseUp 
MouseMove 
MouseClick 
MouseDoubleClick 
MouseTripleClick 
COUNT 

Definition at line 57 of file GUIButton.h.

Constructor & Destructor Documentation

◆ GUIButton()

Divide::GUIButton::GUIButton ( const string name,
const string text,
const string guiScheme,
const RelativePosition2D offset,
const RelativeScale2D size,
CEGUI::Window *  parent 
)
protected

Definition at line 9 of file GUIButton.cpp.

◆ ~GUIButton()

Divide::GUIButton::~GUIButton ( )
overrideprotected

Definition at line 92 of file GUIButton.cpp.

Member Function Documentation

◆ active()

void Divide::GUIButton::active ( bool  active)
overridenoexcept

Definition at line 100 of file GUIButton.cpp.

◆ onEvent()

bool Divide::GUIButton::onEvent ( Event  event,
const CEGUI::EventArgs &   
)
protected

Definition at line 150 of file GUIButton.cpp.

◆ setEventCallback() [1/2]

void Divide::GUIButton::setEventCallback ( Event  event,
const ButtonCallback callback 
)

Definition at line 165 of file GUIButton.cpp.

◆ setEventCallback() [2/2]

void Divide::GUIButton::setEventCallback ( Event  event,
const ButtonCallback callback,
Handle< AudioDescriptor sound 
)

Definition at line 173 of file GUIButton.cpp.

◆ setEventSound()

void Divide::GUIButton::setEventSound ( Event  event,
Handle< AudioDescriptor sound 
)

Definition at line 169 of file GUIButton.cpp.

◆ setFont()

void Divide::GUIButton::setFont ( const string fontName,
const string fontFileName,
U32  size 
) const

Definition at line 126 of file GUIButton.cpp.

◆ setText()

void Divide::GUIButton::setText ( const std::string_view &  text) const

Definition at line 114 of file GUIButton.cpp.

◆ setTooltip()

void Divide::GUIButton::setTooltip ( const string tooltipText)
overridevirtual

Reimplemented from Divide::GUIElement.

Definition at line 120 of file GUIButton.cpp.

◆ soundCallback()

bool Divide::GUIButton::soundCallback ( const AudioCallback cbk)
static

Definition at line 143 of file GUIButton.cpp.

◆ visible()

void Divide::GUIButton::visible ( bool  visible)
overridenoexcept

Definition at line 107 of file GUIButton.cpp.

Friends And Related Function Documentation

◆ GUIInterface

friend class GUIInterface
friend

Definition at line 53 of file GUIButton.h.

◆ SceneGUIElements

friend class SceneGUIElements
friend

Definition at line 54 of file GUIButton.h.

Member Data Documentation

◆ _btnWindow

CEGUI::Window* Divide::GUIButton::_btnWindow
protected

Definition at line 101 of file GUIButton.h.

◆ _callbackFunction

std::array<ButtonCallback, to_base(Event::COUNT)> Divide::GUIButton::_callbackFunction
protected

A pointer to a function to call if the button is pressed.

Definition at line 97 of file GUIButton.h.

◆ _connections

std::array<CEGUI::Event::Connection, to_base(Event::COUNT)> Divide::GUIButton::_connections
protected

Definition at line 99 of file GUIButton.h.

◆ _eventSound

std::array<Handle<AudioDescriptor>, to_base(Event::COUNT)> Divide::GUIButton::_eventSound
protected

Definition at line 98 of file GUIButton.h.

◆ s_soundCallback

NO_DESTROY GUIButton::AudioCallback Divide::GUIButton::s_soundCallback
staticprotected

Definition at line 103 of file GUIButton.h.


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