comparison DPF-Prymula-audioplugins/dpf/dgl/src/TopLevelWidget.cpp @ 3:84e66ea83026

DPF-Prymula-audioplugins-0.231015-2
author prymula <prymula76@outlook.com>
date Mon, 16 Oct 2023 21:53:34 +0200
parents
children
comparison
equal deleted inserted replaced
2:cf2cb71d31dd 3:84e66ea83026
1 /*
2 * DISTRHO Plugin Framework (DPF)
3 * Copyright (C) 2012-2021 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 #include "TopLevelWidgetPrivateData.hpp"
18 #include "../Window.hpp"
19
20 START_NAMESPACE_DGL
21
22 // --------------------------------------------------------------------------------------------------------------------
23
24 TopLevelWidget::TopLevelWidget(Window& windowToMapTo)
25 : Widget(this),
26 pData(new PrivateData(this, windowToMapTo)) {}
27
28 TopLevelWidget::~TopLevelWidget()
29 {
30 delete pData;
31 }
32
33 Application& TopLevelWidget::getApp() const noexcept
34 {
35 return pData->window.getApp();
36 }
37
38 Window& TopLevelWidget::getWindow() const noexcept
39 {
40 return pData->window;
41 }
42
43 void TopLevelWidget::setWidth(const uint width)
44 {
45 pData->window.setWidth(width);
46 }
47
48 void TopLevelWidget::setHeight(const uint height)
49 {
50 pData->window.setHeight(height);
51 }
52
53 void TopLevelWidget::setSize(const uint width, const uint height)
54 {
55 pData->window.setSize(width, height);
56 }
57
58 void TopLevelWidget::setSize(const Size<uint>& size)
59 {
60 pData->window.setSize(size);
61 }
62
63 const void* TopLevelWidget::getClipboard(size_t& dataSize)
64 {
65 return pData->window.getClipboard(dataSize);
66 }
67
68 bool TopLevelWidget::setClipboard(const char* const mimeType, const void* const data, const size_t dataSize)
69 {
70 return pData->window.setClipboard(mimeType, data, dataSize);
71 }
72
73 bool TopLevelWidget::setCursor(const MouseCursor cursor)
74 {
75 return pData->window.setCursor(cursor);
76 }
77
78 bool TopLevelWidget::addIdleCallback(IdleCallback* const callback, const uint timerFrequencyInMs)
79 {
80 return pData->window.addIdleCallback(callback, timerFrequencyInMs);
81 }
82
83 bool TopLevelWidget::removeIdleCallback(IdleCallback* const callback)
84 {
85 return pData->window.removeIdleCallback(callback);
86 }
87
88 double TopLevelWidget::getScaleFactor() const noexcept
89 {
90 return pData->window.getScaleFactor();
91 }
92
93 void TopLevelWidget::repaint() noexcept
94 {
95 pData->window.repaint();
96 }
97
98 void TopLevelWidget::repaint(const Rectangle<uint>& rect) noexcept
99 {
100 pData->window.repaint(rect);
101 }
102
103 void TopLevelWidget::setGeometryConstraints(const uint minimumWidth,
104 const uint minimumHeight,
105 const bool keepAspectRatio,
106 const bool automaticallyScale,
107 const bool resizeNowIfAutoScaling)
108 {
109 pData->window.setGeometryConstraints(minimumWidth,
110 minimumHeight,
111 keepAspectRatio,
112 automaticallyScale,
113 resizeNowIfAutoScaling);
114 }
115
116 // --------------------------------------------------------------------------------------------------------------------
117
118 bool TopLevelWidget::onKeyboard(const KeyboardEvent& ev)
119 {
120 return pData->keyboardEvent(ev);
121 }
122
123 bool TopLevelWidget::onCharacterInput(const CharacterInputEvent& ev)
124 {
125 return pData->characterInputEvent(ev);
126 }
127
128 bool TopLevelWidget::onMouse(const MouseEvent& ev)
129 {
130 return pData->mouseEvent(ev);
131 }
132
133 bool TopLevelWidget::onMotion(const MotionEvent& ev)
134 {
135 return pData->motionEvent(ev);
136 }
137
138 bool TopLevelWidget::onScroll(const ScrollEvent& ev)
139 {
140 return pData->scrollEvent(ev);
141 }
142
143 // --------------------------------------------------------------------------------------------------------------------
144
145 void TopLevelWidget::requestSizeChange(uint, uint)
146 {
147 }
148
149 // --------------------------------------------------------------------------------------------------------------------
150
151 END_NAMESPACE_DGL