DISTRHO Plugin Framework
|
#include <Widget.hpp>
Classes | |
struct | BaseEvent |
struct | CharacterInputEvent |
struct | KeyboardEvent |
struct | MotionEvent |
struct | MouseEvent |
struct | PositionChangedEvent |
struct | ResizeEvent |
struct | ScrollEvent |
Public Member Functions | |
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 |
Application & | getApp () const noexcept |
Window & | getWindow () const noexcept |
const GraphicsContext & | getGraphicsContext () const noexcept |
TopLevelWidget * | getTopLevelWidget () const noexcept |
std::list< SubWidget * > | getChildren () const noexcept |
virtual void | repaint () noexcept |
Application & | getParentApp () const noexcept |
Window & | getParentWindow () const noexcept |
Protected Member Functions | |
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 | SubWidget |
class | TopLevelWidget |
Base DGL Widget class.
This is the base Widget class, from which all widgets are built.
All widgets have a parent widget where they'll be drawn, this can be the top-level widget or a group widget. This parent is never changed during a widget's lifetime.
Widgets receive events in relative coordinates. (0, 0) means its top-left position.
The top-level widget will draw subwidgets in the order they are constructed. Early subwidgets are drawn first, at the bottom, then newer ones on top. Events are sent in the inverse order so that the top-most widgets get a chance to catch the event and stop its propagation.
All widget event callbacks do nothing by default and onDisplay MUST be reimplemented by subclasses.
|
virtual |
Destructor.
|
noexcept |
Check if this widget is visible within its parent window. Invisible widgets do not receive events except resize.
void Widget::setVisible | ( | bool | visible | ) |
Set widget visible (or not) according to visible.
void Widget::show | ( | ) |
Show widget. This is the same as calling setVisible(true).
void Widget::hide | ( | ) |
Hide widget. This is the same as calling setVisible(false).
|
noexcept |
Get width.
|
noexcept |
Get height.
|
noexcept |
Get size.
|
noexcept |
Set width.
|
noexcept |
Set height.
|
noexcept |
Set size using width and height values.
|
noexcept |
Set size.
|
noexcept |
Get the Id associated with this widget. Returns 0 by default.
|
noexcept |
Get the name associated with this widget. This is complately optional, mostly useful for debugging purposes. Returns an empty string by default.
|
noexcept |
Set an Id to be associated with this widget.
|
noexcept |
Set a name to be associated with this widget. This is complately optional, only useful for debugging purposes.
|
noexcept |
Get the application associated with this widget's window. This is the same as calling getTopLevelWidget()->getApp()
.
|
noexcept |
Get the window associated with this widget. This is the same as calling getTopLevelWidget()->getWindow()
.
|
noexcept |
Get the graphics context associated with this widget's window. GraphicsContext is an empty struct and needs to be casted into a different type in order to be usable, for example GraphicsContext.
|
noexcept |
Get top-level widget, as passed directly in the constructor or going up the chain of group widgets until it finds the top-level one.
|
noexcept |
Get list of children (a subwidgets) that belong to this widget.
|
virtualnoexcept |
Request repaint of this widget's area to the window this widget belongs to. On the raw Widget class this function does nothing.
Reimplemented in TopLevelWidget, SubWidget, and StandaloneWindow.
|
protectedpure virtual |
A function called to draw the widget contents.
Implemented in ImageBaseSwitch< ImageType >, ImageBaseSlider< ImageType >, ImageBaseKnob< ImageType >, ImageBaseButton< ImageType >, and ImageBaseAboutWindow< ImageType >.
|
protectedvirtual |
A function called when a key is pressed or released.
Reimplemented in TopLevelWidget, and ImageBaseAboutWindow< ImageType >.
|
protectedvirtual |
A function called when an UTF-8 character is received.
Reimplemented in TopLevelWidget.
|
protectedvirtual |
A function called when a mouse button is pressed or released.
Reimplemented in TopLevelWidget, ImageBaseSwitch< ImageType >, ImageBaseSlider< ImageType >, ImageBaseKnob< ImageType >, ImageBaseButton< ImageType >, and ImageBaseAboutWindow< ImageType >.
|
protectedvirtual |
A function called when the pointer moves.
Reimplemented in TopLevelWidget, ImageBaseSlider< ImageType >, ImageBaseKnob< ImageType >, and ImageBaseButton< ImageType >.
|
protectedvirtual |
A function called on scrolling (e.g. mouse wheel or track pad).
Reimplemented in TopLevelWidget, and ImageBaseKnob< ImageType >.
|
protectedvirtual |
A function called when the widget is resized.
|
inlineprotectedvirtual |
A function called when a special key is pressed or released. DEPRECATED use onKeyboard or onCharacterInput