Nazara Engine  0.4
A fast, complete, cross-platform API designed for game development
Ndk::BaseWidget Class Referenceabstract

Abstract class serving as a base class for all widgets. More...

Inherits Nz::Node.

Inherited by Ndk::ButtonWidget, Ndk::Canvas, Ndk::CheckboxWidget, Ndk::LabelWidget, Ndk::ProgressBarWidget, and Ndk::TextAreaWidget.

Public Member Functions

 BaseWidget (BaseWidget *parent)
 Constructs a BaseWidget object using another widget as its parent. More...
 
 BaseWidget (const BaseWidget &)=delete
 
 BaseWidget (BaseWidget &&)=default
 
virtual ~BaseWidget ()
 Frees the widget, unregistering it from its canvas.
 
template<typename T , typename... Args>
T * Add (Args &&... args)
 
void AddChild (std::unique_ptr< BaseWidget > &&widget)
 
void Center ()
 
void CenterHorizontal ()
 
void CenterVertical ()
 
void Destroy ()
 Destroy the widget, deleting it in the process. More...
 
void EnableBackground (bool enable)
 Enable or disables the widget background.
 
const Nz::ColorGetBackgroundColor () const
 
Canvas * GetCanvas ()
 
Nz::SystemCursor GetCursor () const
 
const Padding & GetPadding () const
 
Nz::Vector2f GetContentOrigin () const
 
const Nz::Vector2fGetContentSize () const
 
Nz::Vector2f GetSize () const
 
bool IsVisible () const
 
void GrabKeyboard ()
 
virtual void ResizeToContent ()=0
 
void SetBackgroundColor (const Nz::Color &color)
 
void SetCursor (Nz::SystemCursor systemCursor)
 
void SetContentSize (const Nz::Vector2f &size)
 
void SetPadding (float left, float top, float right, float bottom)
 
void SetSize (const Nz::Vector2f &size)
 
void Show (bool show=true)
 
BaseWidgetoperator= (const BaseWidget &)=delete
 
BaseWidgetoperator= (BaseWidget &&)=default
 

Protected Member Functions

const EntityHandleCreateEntity ()
 
void DestroyEntity (Entity *entity)
 
virtual void Layout ()
 
void InvalidateNode () override
 
virtual void OnKeyPressed (const Nz::WindowEvent::KeyEvent &key)
 
virtual void OnKeyReleased (const Nz::WindowEvent::KeyEvent &key)
 
virtual void OnMouseEnter ()
 
virtual void OnMouseMoved (int x, int y, int deltaX, int deltaY)
 
virtual void OnMouseButtonPress (int x, int y, Nz::Mouse::Button button)
 
virtual void OnMouseButtonRelease (int x, int y, Nz::Mouse::Button button)
 
virtual void OnMouseExit ()
 
virtual void OnParentResized (const Nz::Vector2f &newSize)
 
virtual void OnTextEntered (char32_t character, bool repeated)
 

Detailed Description

Abstract class serving as a base class for all widgets.

Constructor & Destructor Documentation

◆ BaseWidget()

Ndk::BaseWidget::BaseWidget ( BaseWidget parent)

Constructs a BaseWidget object using another widget as its parent.

Parameters
parentParent widget, must be valid and attached to a canvas

Constructs a BaseWidget object using another widget as a base. This will also register the widget to the canvas owning the top-most widget.

Member Function Documentation

◆ Destroy()

void Ndk::BaseWidget::Destroy ( )
inline

Destroy the widget, deleting it in the process.

Calling this function immediately destroys the widget, freeing its memory.


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