Dusk Audio Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
dgl
StandaloneWindow.hpp
1
/*
2
* DISTRHO Plugin Framework (DPF)
3
* Copyright (C) 2012-2022 Filipe Coelho <falktx@falktx.com>
4
*
5
* Permission to use, copy, modify, and/or distribute this software for any purpose with
6
* or without fee is hereby granted, provided that the above copyright notice and this
7
* permission notice appear in all copies.
8
*
9
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
10
* TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
11
* NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
12
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
13
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15
*/
16
17
#ifndef DGL_STANDALONE_WINDOW_HPP_INCLUDED
18
#define DGL_STANDALONE_WINDOW_HPP_INCLUDED
19
20
#include "TopLevelWidget.hpp"
21
#include "Window.hpp"
22
23
START_NAMESPACE_DGL
24
25
// -----------------------------------------------------------------------
26
27
class
StandaloneWindow
:
public
Window,
28
public
TopLevelWidget
29
{
30
public
:
31
/**
32
Constructor without parent.
33
*/
34
StandaloneWindow
(Application& app)
35
: Window(app),
36
TopLevelWidget((Window&)*this),
37
sgc((Window&)*this) {}
38
39
/**
40
Constructor with a transient parent window, typically used to run as modal.
41
*/
42
StandaloneWindow
(Application& app, Window& transientParentWindow)
43
: Window(app, transientParentWindow),
44
TopLevelWidget((Window&)*this),
45
sgc((Window&)*this, transientParentWindow) {}
46
47
/**
48
Clear current graphics context.
49
Must be called at the end of your StandaloneWindow constructor.
50
*/
51
void
done
()
52
{
53
sgc.done();
54
}
55
56
/**
57
Get a graphics context back again.
58
Called when a valid graphics context is needed outside the constructor.
59
*/
60
void
reinit
()
61
{
62
sgc.reinit();
63
}
64
65
/**
66
Overloaded functions to ensure they apply to the Window class.
67
*/
68
bool
isVisible
() const noexcept {
return
Window::isVisible
(); }
69
void
setVisible(
bool
yesNo) {
Window::setVisible
(yesNo); }
70
void
hide() {
Window::hide
(); }
71
void
show() {
Window::show
(); }
72
uint getWidth() const noexcept {
return
Window::getWidth
(); }
73
uint getHeight() const noexcept {
return
Window::getHeight
(); }
74
const
Size<uint> getSize() const noexcept {
return
Window::getSize
(); }
75
void
repaint
() noexcept {
Window::repaint
(); }
76
void
repaint
(
const
Rectangle<uint>
& rect)
noexcept
{
Window::repaint
(rect); }
77
void
setWidth(uint width) {
Window::setWidth
(width); }
78
void
setHeight(uint height) {
Window::setHeight
(height); }
79
void
setSize(uint width, uint height) {
Window::setSize
(width, height); }
80
void
setSize(
const
Size<uint>& size) {
Window::setSize
(size); }
81
bool
addIdleCallback(IdleCallback* callback, uint timerFrequencyInMs = 0)
82
{
return
Window::addIdleCallback
(callback, timerFrequencyInMs); }
83
bool
removeIdleCallback(IdleCallback* callback) {
return
Window::removeIdleCallback
(callback); }
84
Application& getApp() const noexcept {
return
Window::getApp
(); }
85
const
GraphicsContext& getGraphicsContext() const noexcept {
return
Window::getGraphicsContext
(); }
86
double
getScaleFactor() const noexcept {
return
Window::getScaleFactor
(); }
87
void
setGeometryConstraints(uint minimumWidth, uint minimumHeight,
88
bool
keepAspectRatio =
false
,
bool
automaticallyScale =
false
)
89
{
Window::setGeometryConstraints
(minimumWidth, minimumHeight, keepAspectRatio, automaticallyScale); }
90
91
private
:
92
ScopedGraphicsContext
sgc;
93
94
DAF_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(
StandaloneWindow
)
95
};
96
97
// -----------------------------------------------------------------------
98
99
END_NAMESPACE_DGL
100
101
#endif
// DGL_STANDALONE_WINDOW_HPP_INCLUDED
Rectangle
Definition
Geometry.hpp:612
StandaloneWindow::StandaloneWindow
StandaloneWindow(Application &app)
Definition
StandaloneWindow.hpp:34
StandaloneWindow::done
void done()
Definition
StandaloneWindow.hpp:51
StandaloneWindow::isVisible
bool isVisible() const noexcept
Definition
StandaloneWindow.hpp:68
StandaloneWindow::StandaloneWindow
StandaloneWindow(Application &app, Window &transientParentWindow)
Definition
StandaloneWindow.hpp:42
StandaloneWindow::repaint
void repaint() noexcept
Definition
StandaloneWindow.hpp:75
StandaloneWindow::reinit
void reinit()
Definition
StandaloneWindow.hpp:60
Window::setVisible
void setVisible(bool visible)
Window::setHeight
void setHeight(uint height)
Window::hide
void hide()
Window::removeIdleCallback
bool removeIdleCallback(IdleCallback *callback)
Window::getHeight
uint getHeight() const noexcept
Window::isVisible
bool isVisible() const noexcept
Window::getApp
Application & getApp() const noexcept
Window::repaint
void repaint() noexcept
Window::getScaleFactor
double getScaleFactor() const noexcept
Window::setSize
void setSize(uint width, uint height)
Window::show
void show()
Window::setGeometryConstraints
void setGeometryConstraints(uint minimumWidth, uint minimumHeight, bool keepAspectRatio=false, bool automaticallyScale=false, bool resizeNowIfAutoScaling=true)
Window::getWidth
uint getWidth() const noexcept
Window::getGraphicsContext
const GraphicsContext & getGraphicsContext() const noexcept
Window::setWidth
void setWidth(uint width)
Window::addIdleCallback
bool addIdleCallback(IdleCallback *callback, uint timerFrequencyInMs=0)
Window::getSize
Size< uint > getSize() const noexcept
Window::ScopedGraphicsContext
Definition
Window.hpp:99
Generated by
1.18.0