Castor3D 0.16.0
Multiplatform 3D engine
Public Member Functions | Friends | List of all members
castor3d::ControlsManager Class Reference

#include <ControlsManager.hpp>

Inheritance diagram for castor3d::ControlsManager:
Inheritance graph
[legend]
Collaboration diagram for castor3d::ControlsManager:
Collaboration graph
[legend]

Public Member Functions

void setDefaultFont (castor::FontResPtr font)
 sets the default font used by controls
 
General
C3D_API ControlsManager (Engine &engine)
 
C3D_API void setSize (castor::Size const &value)
 
C3D_API void setLayout (LayoutUPtr layout)
 
castor::Size const & getSize () const noexcept
 
Style management
C3D_API ThemeRPtr createTheme (castor::String const &name, Scene *scene)
 
C3D_API ThemeRPtr getTheme (castor::String const &name) const
 
auto & getThemes () const
 
C3D_API ButtonStyleRPtr getButtonStyle (castor::String const &name) const override
 
C3D_API ComboBoxStyleRPtr getComboBoxStyle (castor::String const &name) const override
 
C3D_API EditStyleRPtr getEditStyle (castor::String const &name) const override
 
C3D_API ExpandablePanelStyleRPtr getExpandablePanelStyle (castor::String const &name) const override
 
C3D_API FrameStyleRPtr getFrameStyle (castor::String const &name) const override
 
C3D_API ListBoxStyleRPtr getListBoxStyle (castor::String const &name) const override
 
C3D_API PanelStyleRPtr getPanelStyle (castor::String const &name) const override
 
C3D_API ProgressStyleRPtr getProgressStyle (castor::String const &name) const override
 
C3D_API ScrollBarStyleRPtr getScrollBarStyle (castor::String const &name) const override
 
C3D_API SliderStyleRPtr getSliderStyle (castor::String const &name) const override
 
C3D_API StaticStyleRPtr getStaticStyle (castor::String const &name) const override
 
- Public Member Functions inherited from castor3d::UserInputListener
 UserInputListener (UserInputListener const &)=delete
 
 UserInputListener (UserInputListener &&) noexcept=delete
 
UserInputListeneroperator= (UserInputListener const &)=delete
 
UserInputListeneroperator= (UserInputListener &&) noexcept=delete
 
C3D_API UserInputListener (Engine &engine, castor::String const &name)
 Constructor.
 
virtual C3D_API ~UserInputListener () noexcept=default
 Destructor.
 
C3D_API bool initialise ()
 Initialises the listener.
 
C3D_API void cleanup ()
 Cleans up the listener.
 
C3D_API void processEvents ()
 Processes all queued events.
 
castor::Position const & getMousePosition () const
 
EventHandlerRPtr getActiveControl () const
 
EventHandlerRPtr getFocusedControl () const
 
FrameListenergetFrameListener () const
 
C3D_API void registerMouseMoveAction (castor::String const &handler, OnMouseMoveActionFunction function)
 Registers a function to call when a mouse move event is raised by the given handler.
 
C3D_API void registerClickAction (castor::String const &handler, OnClickActionFunction function)
 Registers a function to call when a mouse click event is raised by the given handler.
 
C3D_API void registerSelectAction (castor::String const &handler, OnSelectActionFunction function)
 Registers a function to call when a select event is raised by the given handler.
 
C3D_API void registerTextAction (castor::String const &handler, OnTextActionFunction function)
 Registers a function to call when a text event is raised by the given handler.
 
C3D_API void registerExpandAction (castor::String const &handler, OnExpandActionFunction function)
 Registers a function to call when an expand event is raised by the given handler.
 
C3D_API void registerCursorAction (OnCursorActionFunction function)
 Registers a function to call when a mouse cursor event is raised by the given handler.
 
C3D_API void registerClipboardTextAction (OnClipboardTextActionFunction function)
 Registers a function to call when a clipboard event is raised by the given handler.
 
C3D_API void unregisterMouseMoveAction (castor::String const &handler)
 Unregisters ths function to call when a mouse move event is raised by the given handler.
 
C3D_API void unregisterClickAction (castor::String const &handler)
 Unregisters ths function to call when a mouse click event is raised by the given handler.
 
C3D_API void unregisterSelectAction (castor::String const &handler)
 Unregisters ths function to call when a select event is raised by the given handler.
 
C3D_API void unregisterTextAction (castor::String const &handler)
 Unregisters ths function to call when a text event is raised by the given handler.
 
C3D_API void unregisterExpandAction (castor::String const &handler)
 Unregisters ths function to call when an expand event is raised by the given handler.
 
C3D_API void unregisterCursorAction ()
 Unregisters the function to call when mouse cursor event is raised by the given handler.
 
C3D_API void unregisterClipboardTextAction ()
 Unregisters the function to call when a clipboard event is raised by the given handler.
 
C3D_API void onMouseMoveAction (castor::String const &handler) const
 Event raised by the handler when the mouse is moved over it.
 
C3D_API void onClickAction (castor::String const &handler) const
 Event raised by the handler when it is clicked, if it supports clicking.
 
C3D_API void onSelectAction (castor::String const &handler, int index) const
 Event raised by the handler when one of its sub elements is selected.
 
C3D_API void onTextAction (castor::String const &handler, castor::U32String const &text) const
 Event raised by the handler when its caption has changed.
 
C3D_API void onExpandAction (castor::String const &handler, bool expand) const
 Event raised by the handler when its expansion has changed.
 
C3D_API void onCursorAction (MouseCursor cursor) const
 Event raised when mouse cursor has changed.
 
C3D_API castor::U32String onClipboardTextAction (bool set, castor::U32String text) const
 Event raised interaction with the clipboard is needed.
 
C3D_API void enableHandler (castor::String const &handler)
 Enables handler.
 
C3D_API void disableHandler (castor::String const &handler)
 Disables handler.
 
C3D_API bool fireMouseMove (castor::Position const &position, bool ctrl, bool alt, bool shift)
 Fires a mouse move event.
 
C3D_API bool fireMouseButtonPushed (MouseButton button, bool ctrl, bool alt, bool shift)
 Fires a mouse pushed event.
 
C3D_API bool fireMouseButtonReleased (MouseButton button, bool ctrl, bool alt, bool shift)
 Fires a mouse released event.
 
C3D_API bool fireMouseWheel (castor::Position const &offsets, bool ctrl, bool alt, bool shift)
 Fires a mouse wheel event.
 
C3D_API bool fireKeydown (KeyboardKey key, bool ctrl, bool alt, bool shift)
 Fires a keyboard key down event.
 
C3D_API bool fireKeyUp (KeyboardKey key, bool ctrl, bool alt, bool shift)
 Fires a keyboard key up event.
 
C3D_API bool fireChar (KeyboardKey key, castor::String const &c)
 Fires a printable key event.
 
- Public Member Functions inherited from castor::OwnedBy< Engine >
Engine * getOwner () const
 
- Public Member Functions inherited from castor3d::StylesHolder
virtual C3D_API ~StylesHolder () noexcept=default
 
 StylesHolder (castor::String name, Engine &engine)
 
castor::FontResPtr getDefaultFont () const
 Retrieves the default font used by controls.
 
void setDefaultFont (castor::FontResPtr font)
 sets the default font used by controls
 
C3D_API ButtonStyleRPtr createButtonStyle (castor::String name, Scene *scene)
 
C3D_API ComboBoxStyleRPtr createComboBoxStyle (castor::String name, Scene *scene)
 
C3D_API EditStyleRPtr createEditStyle (castor::String name, Scene *scene)
 
C3D_API ExpandablePanelStyleRPtr createExpandablePanelStyle (castor::String name, Scene *scene)
 
C3D_API FrameStyleRPtr createFrameStyle (castor::String name, Scene *scene)
 
C3D_API ListBoxStyleRPtr createListBoxStyle (castor::String name, Scene *scene)
 
C3D_API PanelStyleRPtr createPanelStyle (castor::String name, Scene *scene)
 
C3D_API ProgressStyleRPtr createProgressStyle (castor::String name, Scene *scene)
 
C3D_API ScrollBarStyleRPtr createScrollBarStyle (castor::String name, Scene *scene)
 
C3D_API SliderStyleRPtr createSliderStyle (castor::String name, Scene *scene)
 
C3D_API StaticStyleRPtr createStaticStyle (castor::String name, Scene *scene)
 
template<typename StyleT >
StyleT * getStyle (castor::String const &name) const
 
auto & getButtonStyles () const noexcept
 
auto & getComboBoxStyles () const noexcept
 
auto & getEditStyles () const noexcept
 
auto & getExpandablePanelStyles () const noexcept
 
auto & getFrameStyles () const noexcept
 
auto & getListBoxStyles () const noexcept
 
auto & getPanelStyles () const noexcept
 
auto & getProgressStyles () const noexcept
 
auto & getScrollBarStyles () const noexcept
 
auto & getSliderStyles () const noexcept
 
auto & getStaticStyles () const noexcept
 
bool isEmpty () const noexcept
 

Friends

class Control
 
class ButtonCtrl
 
class ComboBoxCtrl
 
class EditCtrl
 
class ExpandablePanelCtrl
 
class FrameCtrl
 
class ListBoxCtrl
 
class PanelCtrl
 
class ScrollBarCtrl
 
class SliderCtrl
 

Controls management

static C3D_API castor::String Name
 
C3D_API ControlRPtr registerControl (ControlUPtr control)
 
template<typename ControlT >
ControlT * registerControlT (castor::UniquePtr< ControlT > control)
 
C3D_API void unregisterControl (Control const &control)
 
C3D_API void create (ControlRPtr control)
 
C3D_API void destroy (ControlRPtr control)
 
C3D_API void destroyControls (Scene const &scene)
 
C3D_API void addControl (ControlRPtr control)
 
C3D_API void removeControl (ControlID id)
 
C3D_API ControlRPtr getControl (ControlID id) const
 
C3D_API ControlRPtr findControl (castor::String const &name, SceneRPtr scene) const
 
C3D_API castor::Vector< ControlRPtr > getRootControls () const
 
static C3D_API castor::AttributeParsers createParsers ()
 
static C3D_API castor::StrUInt32Map createSections ()
 

Additional Inherited Members

- Public Types inherited from castor3d::UserInputListener
using OnClickActionFunction = castor::Function< void() >
 
using OnMouseMoveActionFunction = castor::Function< void( castor::Position const & ) >
 
using OnSelectActionFunction = castor::Function< void( int ) >
 
using OnTextActionFunction = castor::Function< void( castor::U32String const & ) >
 
using OnExpandActionFunction = castor::Function< void( bool ) >
 
using OnClipboardTextActionFunction = castor::Function< castor::U32String( bool, castor::U32String ) >
 
using OnCursorActionFunction = castor::Function< void( MouseCursor ) >
 
- Protected Member Functions inherited from castor3d::UserInputListener
castor::Vector< EventHandlerRPtr > doGetHandlers () const
 
bool doHasHandlers () const
 
EventHandlerRPtr doAddHandler (EventHandlerUPtr handler)
 Removes a handler.
 
void doRemoveHandlerNL (EventHandler const &handler)
 Removes a handler.
 
void doRemoveHandler (EventHandler const &handler)
 Removes a handler.
 
- Protected Member Functions inherited from castor::OwnedBy< Engine >
 OwnedBy (Engine &owner)
 Constructor.
 
- Protected Member Functions inherited from castor3d::StylesHolder
auto & getHolderName () const noexcept
 
void cleanupStyles () noexcept
 
- Protected Attributes inherited from castor3d::UserInputListener
castor::Mutex m_mutexHandlers
 
castor::Vector< EventHandlerUPtr > m_handlers
 
FrameListenerRPtr m_frameListener
 

Constructor & Destructor Documentation

◆ ControlsManager()

C3D_API castor3d::ControlsManager::ControlsManager ( Engine & engine)
explicit

Constructor

Parameters
[in]engineThe engine

Member Function Documentation

◆ addControl()

C3D_API void castor3d::ControlsManager::addControl ( ControlRPtr control)

Adds a control that can an event target

Parameters
[in]controlThe control

◆ create()

C3D_API void castor3d::ControlsManager::create ( ControlRPtr control)

Creates the given control's overlays and binds its callbacks to appropriate events

Parameters
[in]controlThe control

◆ createParsers()

static C3D_API castor::AttributeParsers castor3d::ControlsManager::createParsers ( )
static

◆ createSections()

static C3D_API castor::StrUInt32Map castor3d::ControlsManager::createSections ( )
static

◆ createTheme()

C3D_API ThemeRPtr castor3d::ControlsManager::createTheme ( castor::String const & name,
Scene * scene )

Creates a theme if it doesn't exist, returns the existing one if it exists

Parameters
[in]nameThe theme name
[in]sceneThe parent scene
Returns
The theme.

◆ destroy()

C3D_API void castor3d::ControlsManager::destroy ( ControlRPtr control)

Destroys the given control's overlays and unbinds its callbacks from appropriate events.

Parameters
[in]controlThe control.

◆ destroyControls()

C3D_API void castor3d::ControlsManager::destroyControls ( Scene const & scene)

Destroys the controls related to given scene.

Parameters
[in]sceneThe controls scene.

◆ findControl()

C3D_API ControlRPtr castor3d::ControlsManager::findControl ( castor::String const & name,
SceneRPtr scene ) const

Retrieves a control.

Parameters
[in]nameThe control name.
[in]sceneThe control scene.
Returns
The control.

◆ getButtonStyle()

C3D_API ButtonStyleRPtr castor3d::ControlsManager::getButtonStyle ( castor::String const & name) const
overridevirtual
Returns
The button style with given name (nullptr if it doesn't exist).
Parameters
[in]nameThe name

Reimplemented from castor3d::StylesHolder.

◆ getComboBoxStyle()

C3D_API ComboBoxStyleRPtr castor3d::ControlsManager::getComboBoxStyle ( castor::String const & name) const
overridevirtual
Returns
The combo box style with given name (nullptr if it doesn't exist).
Parameters
[in]nameThe name

Reimplemented from castor3d::StylesHolder.

◆ getControl()

C3D_API ControlRPtr castor3d::ControlsManager::getControl ( ControlID id) const

Retrieves a control.

Parameters
[in]idThe control ID.
Returns
The control.

◆ getEditStyle()

C3D_API EditStyleRPtr castor3d::ControlsManager::getEditStyle ( castor::String const & name) const
overridevirtual
Returns
The edit style with given name (nullptr if it doesn't exist).
Parameters
[in]nameThe name

Reimplemented from castor3d::StylesHolder.

◆ getExpandablePanelStyle()

C3D_API ExpandablePanelStyleRPtr castor3d::ControlsManager::getExpandablePanelStyle ( castor::String const & name) const
overridevirtual
Returns
The expandable panel style with given name (nullptr if it doesn't exist).
Parameters
[in]nameThe name

Reimplemented from castor3d::StylesHolder.

◆ getFrameStyle()

C3D_API FrameStyleRPtr castor3d::ControlsManager::getFrameStyle ( castor::String const & name) const
overridevirtual
Returns
The frame style with given name (nullptr if it doesn't exist).
Parameters
[in]nameThe name

Reimplemented from castor3d::StylesHolder.

◆ getListBoxStyle()

C3D_API ListBoxStyleRPtr castor3d::ControlsManager::getListBoxStyle ( castor::String const & name) const
overridevirtual
Returns
The list box style with given name (nullptr if it doesn't exist).
Parameters
[in]nameThe name

Reimplemented from castor3d::StylesHolder.

◆ getPanelStyle()

C3D_API PanelStyleRPtr castor3d::ControlsManager::getPanelStyle ( castor::String const & name) const
overridevirtual
Returns
The panel style with given name (nullptr if it doesn't exist).
Parameters
[in]nameThe name

Reimplemented from castor3d::StylesHolder.

◆ getProgressStyle()

C3D_API ProgressStyleRPtr castor3d::ControlsManager::getProgressStyle ( castor::String const & name) const
overridevirtual
Returns
The progress style with given name (nullptr if it doesn't exist).
Parameters
[in]nameThe name

Reimplemented from castor3d::StylesHolder.

◆ getRootControls()

C3D_API castor::Vector< ControlRPtr > castor3d::ControlsManager::getRootControls ( ) const
Returns
The root controls.

◆ getScrollBarStyle()

C3D_API ScrollBarStyleRPtr castor3d::ControlsManager::getScrollBarStyle ( castor::String const & name) const
overridevirtual
Returns
The scrollbar style with given name (nullptr if it doesn't exist).
Parameters
[in]nameThe name

Reimplemented from castor3d::StylesHolder.

◆ getSize()

castor::Size const & castor3d::ControlsManager::getSize ( ) const
inlinenoexcept

◆ getSliderStyle()

C3D_API SliderStyleRPtr castor3d::ControlsManager::getSliderStyle ( castor::String const & name) const
overridevirtual
Returns
The slider style with given name (nullptr if it doesn't exist).
Parameters
[in]nameThe name

Reimplemented from castor3d::StylesHolder.

◆ getStaticStyle()

C3D_API StaticStyleRPtr castor3d::ControlsManager::getStaticStyle ( castor::String const & name) const
overridevirtual
Returns
The static style with given name (nullptr if it doesn't exist).
Parameters
[in]nameThe name

Reimplemented from castor3d::StylesHolder.

◆ getTheme()

C3D_API ThemeRPtr castor3d::ControlsManager::getTheme ( castor::String const & name) const
Returns
The theme for given name (nullptr if it doesn't exist).
Parameters
[in]nameThe name

◆ getThemes()

auto & castor3d::ControlsManager::getThemes ( ) const
inline

◆ registerControl()

C3D_API ControlRPtr castor3d::ControlsManager::registerControl ( ControlUPtr control)

Adds a control that still needs to be created.

Parameters
[in]controlThe control

Referenced by registerControlT().

Here is the caller graph for this function:

◆ registerControlT()

template<typename ControlT >
ControlT * castor3d::ControlsManager::registerControlT ( castor::UniquePtr< ControlT > control)
inline

References registerControl().

Here is the call graph for this function:

◆ removeControl()

C3D_API void castor3d::ControlsManager::removeControl ( ControlID id)

Removes a control

Parameters
[in]idThe control ID

◆ setDefaultFont()

void castor3d::StylesHolder::setDefaultFont ( castor::FontResPtr font)
inline

sets the default font used by controls

Parameters
[in]fontThe font

◆ setLayout()

C3D_API void castor3d::ControlsManager::setLayout ( LayoutUPtr layout)

Sets the layout for the elements contained in this one.

Parameters
[in]layoutThe new value

◆ setSize()

C3D_API void castor3d::ControlsManager::setSize ( castor::Size const & value)

Sets the size.

Parameters
[in]valueThe new value.

◆ unregisterControl()

C3D_API void castor3d::ControlsManager::unregisterControl ( Control const & control)

Removes a control that has been destroyed.

Parameters
[in]controlThe control

Friends And Related Symbol Documentation

◆ ButtonCtrl

friend class ButtonCtrl
friend

◆ ComboBoxCtrl

friend class ComboBoxCtrl
friend

◆ Control

friend class Control
friend

◆ EditCtrl

friend class EditCtrl
friend

◆ ExpandablePanelCtrl

friend class ExpandablePanelCtrl
friend

◆ FrameCtrl

friend class FrameCtrl
friend

◆ ListBoxCtrl

friend class ListBoxCtrl
friend

◆ PanelCtrl

friend class PanelCtrl
friend

◆ ScrollBarCtrl

friend class ScrollBarCtrl
friend

◆ SliderCtrl

friend class SliderCtrl
friend

Member Data Documentation

◆ Name

C3D_API castor::String castor3d::ControlsManager::Name
static

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