DISTRHO Plugin Framework
Public Member Functions | Protected Member Functions | Friends | List of all members
SubWidget Class Reference

#include <SubWidget.hpp>

Inheritance diagram for SubWidget:
Widget ImageBaseButton< ImageType > ImageBaseKnob< ImageType > ImageBaseSlider< ImageType > ImageBaseSwitch< ImageType >

Public Member Functions

 SubWidget (Widget *parentWidget)
 
 ~SubWidget () override
 
template<typename T >
bool contains (T x, T y) const noexcept
 
template<typename T >
bool contains (const Point< T > &pos) const noexcept
 
int getAbsoluteX () const noexcept
 
int getAbsoluteY () const noexcept
 
Point< int > getAbsolutePos () const noexcept
 
Rectangle< int > getAbsoluteArea () const noexcept
 
Rectangle< uint > getConstrainedAbsoluteArea () const noexcept
 
void setAbsoluteX (int x) noexcept
 
void setAbsoluteY (int y) noexcept
 
void setAbsolutePos (int x, int y) noexcept
 
void setAbsolutePos (const Point< int > &pos) noexcept
 
Point< int > getMargin () const noexcept
 
void setMargin (int x, int y) noexcept
 
void setMargin (const Point< int > &offset) noexcept
 
WidgetgetParentWidget () const noexcept
 
void repaint () noexcept override
 
virtual void toBottom ()
 
virtual void toFront ()
 
void setNeedsFullViewportDrawing (bool needsFullViewportForDrawing=true)
 
void setNeedsViewportScaling (bool needsViewportScaling=true, double autoScaleFactor=0.0)
 
void setSkipDrawing (bool skipDrawing=true)
 
- Public Member Functions inherited from Widget
virtual ~Widget ()
 
bool isVisible () const noexcept
 
void setVisible (bool visible)
 
void show ()
 
void hide ()
 
uint getWidth () const noexcept
 
uint getHeight () const noexcept
 
const Size< uint > getSize () const noexcept
 
void setWidth (uint width) noexcept
 
void setHeight (uint height) noexcept
 
void setSize (uint width, uint height) noexcept
 
void setSize (const Size< uint > &size) noexcept
 
uint getId () const noexcept
 
const char * getName () const noexcept
 
void setId (uint id) noexcept
 
void setName (const char *name) noexcept
 
ApplicationgetApp () const noexcept
 
WindowgetWindow () const noexcept
 
const GraphicsContextgetGraphicsContext () const noexcept
 
TopLevelWidgetgetTopLevelWidget () const noexcept
 
std::list< SubWidget * > getChildren () const noexcept
 
ApplicationgetParentApp () const noexcept
 
WindowgetParentWindow () const noexcept
 

Protected Member Functions

virtual void onPositionChanged (const PositionChangedEvent &)
 
- Protected Member Functions inherited from Widget
virtual void onDisplay ()=0
 
virtual bool onKeyboard (const KeyboardEvent &)
 
virtual bool onCharacterInput (const CharacterInputEvent &)
 
virtual bool onMouse (const MouseEvent &)
 
virtual bool onMotion (const MotionEvent &)
 
virtual bool onScroll (const ScrollEvent &)
 
virtual void onResize (const ResizeEvent &)
 
virtual bool onSpecial (const SpecialEvent &)
 

Friends

class Widget
 

Detailed Description

Sub-Widget class.

This class is the main entry point for creating any reusable widgets from within DGL. It can be freely positioned from within a parent widget, thus being named subwidget.

Many subwidgets can share the same parent, and subwidgets themselves can also have its own subwidgets. It is subwidgets all the way down.

TODO check absolute vs relative position and see what makes more sense.

See also
CairoSubWidget

Constructor & Destructor Documentation

◆ SubWidget()

SubWidget::SubWidget ( Widget parentWidget)
explicit

Constructor.

◆ ~SubWidget()

SubWidget::~SubWidget ( )
override

Destructor.

Member Function Documentation

◆ contains() [1/2]

template<typename T >
bool SubWidget::contains ( x,
y 
) const
noexcept

Check if this widget contains the point defined by x and y.

◆ contains() [2/2]

template<typename T >
bool SubWidget::contains ( const Point< T > &  pos) const
noexcept

Check if this widget contains the point pos.

◆ getAbsoluteX()

int SubWidget::getAbsoluteX ( ) const
noexcept

Get absolute X.

◆ getAbsoluteY()

int SubWidget::getAbsoluteY ( ) const
noexcept

Get absolute Y.

◆ getAbsolutePos()

Point<int> SubWidget::getAbsolutePos ( ) const
noexcept

Get absolute position.

◆ getAbsoluteArea()

Rectangle<int> SubWidget::getAbsoluteArea ( ) const
noexcept

Get absolute area of this subwidget. This is the same as Rectangle<int>(getAbsolutePos(), getSize());

See also
getConstrainedAbsoluteArea()

◆ getConstrainedAbsoluteArea()

Rectangle<uint> SubWidget::getConstrainedAbsoluteArea ( ) const
noexcept

Get absolute area of this subwidget, with special consideration for not allowing negative values.

See also
getAbsoluteArea()

◆ setAbsoluteX()

void SubWidget::setAbsoluteX ( int  x)
noexcept

Set absolute X.

◆ setAbsoluteY()

void SubWidget::setAbsoluteY ( int  y)
noexcept

Set absolute Y.

◆ setAbsolutePos() [1/2]

void SubWidget::setAbsolutePos ( int  x,
int  y 
)
noexcept

Set absolute position using x and y values.

◆ setAbsolutePos() [2/2]

void SubWidget::setAbsolutePos ( const Point< int > &  pos)
noexcept

Set absolute position.

◆ getMargin()

Point<int> SubWidget::getMargin ( ) const
noexcept

Get the margin currently in use for widget coordinates. By default this value is (0,0).

◆ setMargin() [1/2]

void SubWidget::setMargin ( int  x,
int  y 
)
noexcept

Set a margin to be used for widget coordinates using x and y values.

◆ setMargin() [2/2]

void SubWidget::setMargin ( const Point< int > &  offset)
noexcept

Set a margin to be used for widget coordinates.

◆ getParentWidget()

Widget* SubWidget::getParentWidget ( ) const
noexcept

Get parent Widget, as passed in the constructor.

◆ repaint()

void SubWidget::repaint ( )
overridevirtualnoexcept

Request repaint of this subwidget's area to the window this widget belongs to.

Reimplemented from Widget.

◆ toBottom()

virtual void SubWidget::toBottom ( )
virtual

Pushes this widget to the "bottom" of the parent widget. Makes the widget behave as if it was the first to be registered on the parent widget, thus being "on bottom".

◆ toFront()

virtual void SubWidget::toFront ( )
virtual

Bring this widget to the "front" of the parent widget. Makes the widget behave as if it was the last to be registered on the parent widget, thus being "in front".

◆ setNeedsFullViewportDrawing()

void SubWidget::setNeedsFullViewportDrawing ( bool  needsFullViewportForDrawing = true)

Indicate that this subwidget will draw out of bounds, and thus needs the entire viewport available for drawing.

◆ setNeedsViewportScaling()

void SubWidget::setNeedsViewportScaling ( bool  needsViewportScaling = true,
double  autoScaleFactor = 0.0 
)

Indicate that this subwidget will always draw at its own internal size and needs scaling to fit target size.

◆ setSkipDrawing()

void SubWidget::setSkipDrawing ( bool  skipDrawing = true)

Indicate that this subwidget should not be drawn on screen, typically because it is managed by something else.

◆ onPositionChanged()

virtual void SubWidget::onPositionChanged ( const PositionChangedEvent )
protectedvirtual

A function called when the subwidget's absolute position is changed.


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