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

#include <CtrlControl.hpp>

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

Public Member Functions

C3D_API Control (ControlType type, SceneRPtr scene, castor::String const &name, ControlStyleRPtr style, ControlRPtr parent, castor::Position const &position, castor::Size const &size, ControlFlagType flags=0, bool visible=true)
 
C3D_API ~Control () noexcept override
 
C3D_API void setStyle (ControlStyleRPtr value)
 
C3D_API void setPosition (castor::Position const &value)
 
C3D_API void setSize (castor::Size const &value)
 
C3D_API void setUV (castor::Point4d const &value) const
 
C3D_API void setBorderSize (castor::Point4ui const &value)
 
C3D_API void setBorderInnerUV (castor::Point4d const &value) const
 
C3D_API void setBorderOuterUV (castor::Point4d const &value) const
 
C3D_API void setCaption (castor::U32String const &caption)
 
C3D_API void setVisible (bool value)
 
C3D_API castor::Position getAbsolutePosition () const
 
C3D_API bool isVisible () const
 
C3D_API bool isBackgroundInvisible () const
 
C3D_API ControlRPtr getChildControl (ControlID id) const
 
C3D_API castor::Array< bool, 4u > isInResizeRange (castor::Position const &position) const
 
template<ControlFlagTypeT FlagTypeT>
void addFlag (FlagTypeT flag)
 
template<ControlFlagTypeT FlagTypeT>
void addFlag (castor::FlagCombination< FlagTypeT > flag)
 
template<ControlFlagTypeT FlagTypeT>
void removeFlag (FlagTypeT flag)
 
template<ControlFlagTypeT FlagTypeT>
void removeFlag (castor::FlagCombination< FlagTypeT > flag)
 
- Public Member Functions inherited from castor3d::NonClientEventHandler< Control >
 NonClientEventHandler (castor::String const &name, bool catchMouseEvents)
 Constructor.
 
void connectNC (MouseEventType event, NonClientMouseFunction function)
 Connects a function to a non client mouse event.
 
void connectNC (KeyboardEventType event, NonClientKeyboardFunction function)
 Connects a function to a non client keyboard event.
 
void connectNC (HandlerEventType event, NonClientHandlerFunction function)
 Connects a function to a non client handler event.
 
- Public Member Functions inherited from castor3d::EventHandler
void pushEvent (MouseEvent const &event)
 Adds a mouse event to the events queue.
 
void connect (MouseEventType event, ClientMouseFunction function)
 Connects a function to a mouse event.
 
bool catchesMouseEvents () const
 Tells if the control catches mouse events.
 
void setCatchesMouseEvents (bool value)
 Sets if the control can catch mouse events.
 
void pushEvent (KeyboardEvent const &event)
 Adds a keyboard event to the events queue.
 
void connect (KeyboardEventType event, ClientKeyboardFunction function)
 Connects a function to a keyboard event.
 
bool catchesTabKey () const
 Tells if the control catches 'tab' key.
 
bool catchesReturnKey () const
 Tells if the control catches 'return' key.
 
 EventHandler (castor::String const &name, bool catchMouseEvents)
 Constructor.
 
virtual ~EventHandler () noexcept
 Destructor.
 
void processEvents ()
 Processes all queued events.
 
bool isEnabled () const
 
void enable ()
 Sets if the control is enabled.
 
void disable ()
 Sets if the control is disabled.
 
void pushEvent (HandlerEvent const &event)
 Adds a handler event to the events queue.
 
void connect (HandlerEventType event, ClientHandlerFunction function)
 Connects a function to a handler event.
 
- Public Member Functions inherited from castor::NamedBaseT< T >
 NamedBaseT (T name) noexcept
 Constructor.
 
T const & getName () const noexcept
 Retrieves the name.
 
void rename (T name) noexcept
 

Friends

class ControlsManager
 
class ScrollableCtrl
 
class ProgressCtrl
 

Getters

OnControlChanged onChanged
 
SceneRPtr m_scene {}
 
ControlRPtr m_parent {}
 The parent control, if any.
 
MaterialObs m_backgroundMaterial {}
 The background material.
 
MaterialObs m_foregroundMaterial {}
 The foreground material.
 
ControlFlagType m_flags {}
 The control flgas.
 
C3D_API castor::Point4d const & getBorderInnerUV () const
 
C3D_API castor::Point4d const & getBorderOuterUV () const
 
C3D_API BorderPosition getBorderPosition () const
 
C3D_API castor::Point4d const & getUV () const
 
C3D_API bool isBackgroundVisible () const
 
ControlID getId () const noexcept
 
ControlType getType () const noexcept
 
uint64_t getFlags () const noexcept
 
castor::Position const & getPosition () const noexcept
 
castor::Size const & getSize () const noexcept
 
ControlRPtr getParent () const noexcept
 
castor::Point4ui const & getBorderSize () const noexcept
 
ControlsManagerRPtr getControlsManager () const noexcept
 
MouseCursor getCursor () const noexcept
 
EnginegetEngine () const noexcept
 
ControlStyle const & getBaseStyle () const noexcept
 
castor::Vector< ControlRPtr > const & getChildren () const noexcept
 
bool hasScene () const noexcept
 
ScenegetScene () const noexcept
 
uint32_t getResizeBorderSize () const noexcept
 
castor::Point4ui const & getClientRect () const noexcept
 
castor::Position getClientOffset () const
 
castor::Size getClientSize () const
 
bool isAlwaysOnTop () const noexcept
 
bool isMovable () const noexcept
 
bool isResizable () const noexcept
 
void show ()
 
void hide ()
 
C3D_API OverlaygetBackgroundOverlay ()
 
C3D_API void setBackgroundMaterial (MaterialObs value) const
 
C3D_API void setBackgroundSize (castor::Size const &value) const
 
C3D_API void setBackgroundBorderPosition (BorderPosition value) const
 
C3D_API void setBackgroundBorderMaterial (MaterialObs value) const
 
C3D_API void create (ControlsManager &ctrlManager)
 
C3D_API void destroy ()
 
C3D_API void addChild (ControlRPtr control)
 
C3D_API void removeChild (ControlRPtr control)
 
ControlStylegetBaseStyle ()
 

Additional Inherited Members

- Public Types inherited from castor3d::NonClientEventHandler< Control >
using DerivedPtr
 
using ClientMouseFunction
 
using ClientKeyboardFunction
 
using ClientHandlerFunction
 
using NonClientMouseFunction
 
using NonClientKeyboardFunction
 
using NonClientHandlerFunction
 
using OnNonClientMouseEvent
 
using OnNonClientKeyboardEvent
 
using OnNonClientHandlerEvent
 
using OnNonClientMouseEventConnection
 
using OnNonClientKeyboardEventConnection
 
using OnNonClientHandlerEventConnection
 
- Public Types inherited from castor3d::EventHandler
using ClientMouseFunction = castor::Function< void( MouseEvent const & ) >
 
using ClientKeyboardFunction = castor::Function< void( KeyboardEvent const & ) >
 
using ClientHandlerFunction = castor::Function< void( HandlerEvent const & ) >
 
using EnableFunction = castor::Function< void( bool ) >
 
using OnClientMouseEvent = castor::SignalT< ClientMouseFunction >
 
using OnClientKeyboardEvent = castor::SignalT< ClientKeyboardFunction >
 
using OnClientHandlerEvent = castor::SignalT< ClientHandlerFunction >
 
using OnEnable = castor::SignalT< EnableFunction >
 
using OnClientMouseEventConnection = OnClientMouseEvent::connection
 
using OnClientKeyboardEventConnection = OnClientKeyboardEvent::connection
 
using OnClientHandlerEventConnection = OnClientHandlerEvent::connection
 
using OnEnableConnection = OnEnable::connection
 
- Public Attributes inherited from castor3d::EventHandler
OnEnable onEnable
 
- Protected Types inherited from castor3d::NonClientEventHandler< Control >
using EventHandlerFunction
 
using EventQueue
 
- Protected Types inherited from castor3d::EventHandler
using EventHandlerFunction = castor::Function< void() >
 
using EventQueue = castor::Deque< castor::Pair< UserInputEventSPtr, EventHandlerFunction > >
 
- Protected Member Functions inherited from castor3d::EventHandler
void processMouseEvent (MouseEventSPtr event)
 Mouse event processing function.
 
void processKeyboardEvent (KeyboardEventSPtr event)
 Keyboard event processing function.
 
void processHandlerEvent (HandlerEventSPtr event)
 Handler event processing function.
 
- Protected Attributes inherited from castor3d::NonClientEventHandler< Control >
castor::Array< OnNonClientMouseEvent, size_t(MouseEventType::eCount) > m_ncMouseSlots
 
castor::Array< castor::Vector< OnNonClientMouseEventConnection >, size_t(MouseEventType::eCount) > m_ncMouseSlotsConnections
 
castor::Array< OnNonClientKeyboardEvent, size_t(KeyboardEventType::eCount) > m_ncKeyboardSlots
 
castor::Array< castor::Vector< OnNonClientKeyboardEventConnection >, size_t(KeyboardEventType::eCount) > m_ncKeyboardSlotsConnections
 
castor::Array< OnNonClientHandlerEvent, size_t(HandlerEventType::eCount) > m_ncHandlerSlots
 
castor::Array< castor::Vector< OnNonClientHandlerEventConnection >, size_t(HandlerEventType::eCount) > m_ncHandlerSlotsConnections
 
- Protected Attributes inherited from castor3d::EventHandler
castor::Array< OnClientMouseEvent, size_t(MouseEventType::eCount) > m_mouseSlots
 
castor::Array< castor::Vector< OnClientMouseEventConnection >, size_t(MouseEventType::eCount) > m_mouseSlotsConnections
 
castor::Array< OnClientKeyboardEvent, size_t(KeyboardEventType::eCount) > m_keyboardSlots
 
castor::Array< castor::Vector< OnClientKeyboardEventConnection >, size_t(KeyboardEventType::eCount) > m_keyboardSlotsConnections
 
castor::Array< OnClientHandlerEvent, size_t(HandlerEventType::eCount) > m_handlerSlots
 
castor::Array< castor::Vector< OnClientHandlerEventConnection >, size_t(HandlerEventType::eCount) > m_handlerSlotsConnections
 
- Protected Attributes inherited from castor::NamedBaseT< T >
m_name
 

Constructor & Destructor Documentation

◆ Control()

C3D_API castor3d::Control::Control ( ControlType type,
SceneRPtr scene,
castor::String const & name,
ControlStyleRPtr style,
ControlRPtr parent,
castor::Position const & position,
castor::Size const & size,
ControlFlagType flags = 0,
bool visible = true )

Constructor.

Parameters
[in]typeThe type.
[in]sceneThe parent scene (nullptr for global).
[in]nameThe control name.
[in]styleThe control's style.
[in]parentThe parent control, if any.
[in]positionThe position.
[in]sizeThe size.
[in]flagsThe configuration flags
[in]visibleInitial visibility status.

◆ ~Control()

C3D_API castor3d::Control::~Control ( )
overridenoexcept

Member Function Documentation

◆ addChild()

C3D_API void castor3d::Control::addChild ( ControlRPtr control)
protected

Adds a child control.

◆ addFlag() [1/2]

template<ControlFlagTypeT FlagTypeT>
void castor3d::Control::addFlag ( castor::FlagCombination< FlagTypeT > flag)
inline

Adds a flag.

References m_flags.

◆ addFlag() [2/2]

template<ControlFlagTypeT FlagTypeT>
void castor3d::Control::addFlag ( FlagTypeT flag)
inline

Adds a flag.

References m_flags.

◆ create()

C3D_API void castor3d::Control::create ( ControlsManager & ctrlManager)
protected

Creates the control's overlays.

Parameters
[in]ctrlManagerThe controls manager.

◆ destroy()

C3D_API void castor3d::Control::destroy ( )
protected

Destroys the control's overlays.

◆ getAbsolutePosition()

C3D_API castor::Position castor3d::Control::getAbsolutePosition ( ) const

Retrieves the absolute control position.

Returns
The value.

◆ getBackgroundOverlay()

C3D_API Overlay & castor3d::Control::getBackgroundOverlay ( )
protected
Returns
The background overlay.

◆ getBaseStyle() [1/2]

ControlStyle & castor3d::Control::getBaseStyle ( )
inlineprotected

◆ getBaseStyle() [2/2]

ControlStyle const & castor3d::Control::getBaseStyle ( ) const
inlinenoexcept

◆ getBorderInnerUV()

C3D_API castor::Point4d const & castor3d::Control::getBorderInnerUV ( ) const

◆ getBorderOuterUV()

C3D_API castor::Point4d const & castor3d::Control::getBorderOuterUV ( ) const

◆ getBorderPosition()

C3D_API BorderPosition castor3d::Control::getBorderPosition ( ) const

◆ getBorderSize()

castor::Point4ui const & castor3d::Control::getBorderSize ( ) const
inlinenoexcept

◆ getChildControl()

C3D_API ControlRPtr castor3d::Control::getChildControl ( ControlID id) const

Retrieves a control.

Parameters
[in]idThe control ID.

◆ getChildren()

castor::Vector< ControlRPtr > const & castor3d::Control::getChildren ( ) const
inlinenoexcept

◆ getClientOffset()

castor::Position castor3d::Control::getClientOffset ( ) const
inline

◆ getClientRect()

castor::Point4ui const & castor3d::Control::getClientRect ( ) const
inlinenoexcept

◆ getClientSize()

castor::Size castor3d::Control::getClientSize ( ) const
inline

◆ getControlsManager()

ControlsManagerRPtr castor3d::Control::getControlsManager ( ) const
inlinenoexcept

◆ getCursor()

MouseCursor castor3d::Control::getCursor ( ) const
inlinenoexcept

◆ getEngine()

Engine & castor3d::Control::getEngine ( ) const
inlinenoexcept

◆ getFlags()

uint64_t castor3d::Control::getFlags ( ) const
inlinenoexcept

◆ getId()

ControlID castor3d::Control::getId ( ) const
inlinenoexcept

◆ getParent()

ControlRPtr castor3d::Control::getParent ( ) const
inlinenoexcept

References m_parent.

◆ getPosition()

castor::Position const & castor3d::Control::getPosition ( ) const
inlinenoexcept

◆ getResizeBorderSize()

uint32_t castor3d::Control::getResizeBorderSize ( ) const
inlinenoexcept

◆ getScene()

Scene & castor3d::Control::getScene ( ) const
inlinenoexcept

References CU_Require, hasScene(), and m_scene.

Here is the call graph for this function:

◆ getSize()

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

◆ getType()

ControlType castor3d::Control::getType ( ) const
inlinenoexcept

◆ getUV()

C3D_API castor::Point4d const & castor3d::Control::getUV ( ) const

◆ hasScene()

bool castor3d::Control::hasScene ( ) const
inlinenoexcept

References m_scene.

Referenced by getScene().

Here is the caller graph for this function:

◆ hide()

void castor3d::Control::hide ( )
inline

Hides the control

References setVisible().

Here is the call graph for this function:

◆ isAlwaysOnTop()

bool castor3d::Control::isAlwaysOnTop ( ) const
inlinenoexcept
Returns
The always on top status of the control.

References castor::checkFlag(), castor3d::eAlwaysOnTop, and getFlags().

Here is the call graph for this function:

◆ isBackgroundInvisible()

C3D_API bool castor3d::Control::isBackgroundInvisible ( ) const
inline

Retrieves the background invisibility status.

Returns
true if the background is invisible, making the control not targetable (but it's children still are).

◆ isBackgroundVisible()

C3D_API bool castor3d::Control::isBackgroundVisible ( ) const

◆ isInResizeRange()

C3D_API castor::Array< bool, 4u > castor3d::Control::isInResizeRange ( castor::Position const & position) const

Checks if the position is on any border (N, W, S, E).

Parameters
[in]positionThe position to check for.
Returns
One bool per direction.

◆ isMovable()

bool castor3d::Control::isMovable ( ) const
inlinenoexcept
Returns
The movable status of the control.

References castor::checkFlag(), castor3d::eMovable, and getFlags().

Here is the call graph for this function:

◆ isResizable()

bool castor3d::Control::isResizable ( ) const
inlinenoexcept
Returns
The resizable status of the control.

References castor::checkFlag(), castor3d::eResizable, and getFlags().

Here is the call graph for this function:

◆ isVisible()

C3D_API bool castor3d::Control::isVisible ( ) const

Retrieves the visibility status.

Returns
The value.

◆ removeChild()

C3D_API void castor3d::Control::removeChild ( ControlRPtr control)
protected

Removes a child control.

◆ removeFlag() [1/2]

template<ControlFlagTypeT FlagTypeT>
void castor3d::Control::removeFlag ( castor::FlagCombination< FlagTypeT > flag)
inline

Removes a flag.

References m_flags.

◆ removeFlag() [2/2]

template<ControlFlagTypeT FlagTypeT>
void castor3d::Control::removeFlag ( FlagTypeT flag)
inline

Removes a flag.

References m_flags.

◆ setBackgroundBorderMaterial()

C3D_API void castor3d::Control::setBackgroundBorderMaterial ( MaterialObs value) const
protected

Sets the background borders material.

Parameters
[in]valueThe new value.

◆ setBackgroundBorderPosition()

C3D_API void castor3d::Control::setBackgroundBorderPosition ( BorderPosition value) const
protected

Sets the background borders position.

Parameters
[in]valueThe new value.

◆ setBackgroundMaterial()

C3D_API void castor3d::Control::setBackgroundMaterial ( MaterialObs value) const
protected

Sets the background material.

Parameters
[in]valueThe new value.

◆ setBackgroundSize()

C3D_API void castor3d::Control::setBackgroundSize ( castor::Size const & value) const
protected

Sets the background size.

Parameters
[in]valueThe new value.

◆ setBorderInnerUV()

C3D_API void castor3d::Control::setBorderInnerUV ( castor::Point4d const & value) const

Sets the background borders inner UV.

Parameters
[in]valueThe new value.

◆ setBorderOuterUV()

C3D_API void castor3d::Control::setBorderOuterUV ( castor::Point4d const & value) const

Sets the background borders outer UV.

Parameters
[in]valueThe new value.

◆ setBorderSize()

C3D_API void castor3d::Control::setBorderSize ( castor::Point4ui const & value)

Sets the background borders size.

Parameters
[in]valueThe new value.

◆ setCaption()

C3D_API void castor3d::Control::setCaption ( castor::U32String const & caption)

Sets the caption.

Parameters
[in]captionThe new value

Referenced by castor3d::FrameCtrl::setHeaderCaption().

Here is the caller graph for this function:

◆ setPosition()

C3D_API void castor3d::Control::setPosition ( castor::Position const & value)

Sets the position.

Parameters
[in]valueThe new value.

◆ setSize()

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

Sets the size.

Parameters
[in]valueThe new value.

◆ setStyle()

C3D_API void castor3d::Control::setStyle ( ControlStyleRPtr value)

Sets the style

Parameters
[in]valueThe new value

◆ setUV()

C3D_API void castor3d::Control::setUV ( castor::Point4d const & value) const

Sets the background centerUV.

Parameters
[in]valueThe new value.

◆ setVisible()

C3D_API void castor3d::Control::setVisible ( bool value)

Sets the visibility

Parameters
[in]valueThe new value.

Referenced by hide(), and show().

Here is the caller graph for this function:

◆ show()

void castor3d::Control::show ( )
inline

Shows the control

References setVisible().

Here is the call graph for this function:

Friends And Related Symbol Documentation

◆ ControlsManager

friend class ControlsManager
friend

◆ ProgressCtrl

friend class ProgressCtrl
friend

◆ ScrollableCtrl

friend class ScrollableCtrl
friend

Member Data Documentation

◆ m_backgroundMaterial

MaterialObs castor3d::Control::m_backgroundMaterial {}
protected

The background material.

◆ m_flags

ControlFlagType castor3d::Control::m_flags {}
protected

The control flgas.

Referenced by addFlag(), addFlag(), getFlags(), removeFlag(), and removeFlag().

◆ m_foregroundMaterial

MaterialObs castor3d::Control::m_foregroundMaterial {}
protected

The foreground material.

◆ m_parent

ControlRPtr castor3d::Control::m_parent {}
protected

The parent control, if any.

Referenced by getParent().

◆ m_scene

SceneRPtr castor3d::Control::m_scene {}
protected

Referenced by getScene(), and hasScene().

◆ onChanged

OnControlChanged castor3d::Control::onChanged

Signal called when position, size, borders or visibility are changed.


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