@@ -38,18 +38,18 @@ class Window; | |||||
In standalone mode an application will automatically quit its | In standalone mode an application will automatically quit its | ||||
event-loop when all its windows are closed. | event-loop when all its windows are closed. | ||||
*/ | */ | ||||
class App | |||||
class Application | |||||
{ | { | ||||
public: | public: | ||||
/** | /** | ||||
Constructor. | Constructor. | ||||
*/ | */ | ||||
App(); | |||||
Application(); | |||||
/** | /** | ||||
Destructor. | Destructor. | ||||
*/ | */ | ||||
~App(); | |||||
~Application(); | |||||
/** | /** | ||||
Idle function. | Idle function. | ||||
@@ -81,7 +81,7 @@ private: | |||||
PrivateData* const pData; | PrivateData* const pData; | ||||
friend class Window; | friend class Window; | ||||
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(App) | |||||
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(Application) | |||||
}; | }; | ||||
// ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- |
@@ -121,50 +121,50 @@ START_NAMESPACE_DGL | |||||
Convenience symbols for ASCII control characters. | Convenience symbols for ASCII control characters. | ||||
*/ | */ | ||||
enum Char { | enum Char { | ||||
CHAR_BACKSPACE = 0x08, | |||||
CHAR_ESCAPE = 0x1B, | |||||
CHAR_DELETE = 0x7F | |||||
kCharBackspace = 0x08, | |||||
kCharEscape = 0x1B, | |||||
kCharDelete = 0x7F | |||||
}; | }; | ||||
/** | /** | ||||
Keyboard modifier flags. | Keyboard modifier flags. | ||||
*/ | */ | ||||
enum Modifier { | enum Modifier { | ||||
MODIFIER_SHIFT = 1 << 0, /**< Shift key */ | |||||
MODIFIER_CTRL = 1 << 1, /**< Control key */ | |||||
MODIFIER_ALT = 1 << 2, /**< Alt/Option key */ | |||||
MODIFIER_SUPER = 1 << 3 /**< Mod4/Command/Windows key */ | |||||
kModifierShift = 1 << 0, /**< Shift key */ | |||||
kModifierControl = 1 << 1, /**< Control key */ | |||||
kModifierAlt = 1 << 2, /**< Alt/Option key */ | |||||
kModifierSuper = 1 << 3 /**< Mod4/Command/Windows key */ | |||||
}; | }; | ||||
/** | /** | ||||
Special (non-Unicode) keyboard keys. | Special (non-Unicode) keyboard keys. | ||||
*/ | */ | ||||
enum Key { | enum Key { | ||||
KEY_F1 = 1, | |||||
KEY_F2, | |||||
KEY_F3, | |||||
KEY_F4, | |||||
KEY_F5, | |||||
KEY_F6, | |||||
KEY_F7, | |||||
KEY_F8, | |||||
KEY_F9, | |||||
KEY_F10, | |||||
KEY_F11, | |||||
KEY_F12, | |||||
KEY_LEFT, | |||||
KEY_UP, | |||||
KEY_RIGHT, | |||||
KEY_DOWN, | |||||
KEY_PAGE_UP, | |||||
KEY_PAGE_DOWN, | |||||
KEY_HOME, | |||||
KEY_END, | |||||
KEY_INSERT, | |||||
KEY_SHIFT, | |||||
KEY_CTRL, | |||||
KEY_ALT, | |||||
KEY_SUPER | |||||
kKeyF1 = 1, | |||||
kKeyF2, | |||||
kKeyF3, | |||||
kKeyF4, | |||||
kKeyF5, | |||||
kKeyF6, | |||||
kKeyF7, | |||||
kKeyF8, | |||||
kKeyF9, | |||||
kKeyF10, | |||||
kKeyF11, | |||||
kKeyF12, | |||||
kKeyLeft, | |||||
kKeyUp, | |||||
kKeyRight, | |||||
kKeyDown, | |||||
kKeyPageUp, | |||||
kKeyPageDown, | |||||
kKeyHome, | |||||
kKeyEnd, | |||||
kKeyInsert, | |||||
kKeyShift, | |||||
kKeyControl, | |||||
kKeyAlt, | |||||
kKeySuper | |||||
}; | }; | ||||
// ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
@@ -184,4 +184,12 @@ public: | |||||
END_NAMESPACE_DGL | END_NAMESPACE_DGL | ||||
#ifndef DONT_SET_USING_DGL_NAMESPACE | |||||
// If your code uses a lot of DGL classes, then this will obviously save you | |||||
// a lot of typing, but can be disabled by setting DONT_SET_USING_DGL_NAMESPACE. | |||||
using namespace DGL_NAMESPACE; | |||||
#endif | |||||
// ----------------------------------------------------------------------- | |||||
#endif // DGL_BASE_HPP_INCLUDED | #endif // DGL_BASE_HPP_INCLUDED |
@@ -164,6 +164,8 @@ private: | |||||
// ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
// note set range and step before setting the value | |||||
class ImageSlider : public Widget | class ImageSlider : public Widget | ||||
{ | { | ||||
public: | public: | ||||
@@ -178,10 +180,9 @@ public: | |||||
explicit ImageSlider(Window& parent, const Image& image) noexcept; | explicit ImageSlider(Window& parent, const Image& image) noexcept; | ||||
explicit ImageSlider(Widget* widget, const Image& image) noexcept; | explicit ImageSlider(Widget* widget, const Image& image) noexcept; | ||||
explicit ImageSlider(const ImageSlider& imageSlider) noexcept; | |||||
ImageSlider& operator=(const ImageSlider& imageSlider) noexcept; | |||||
float getValue() const noexcept; | float getValue() const noexcept; | ||||
void setValue(float value, bool sendCallback = false) noexcept; | |||||
void setStartPos(const Point<int>& startPos) noexcept; | void setStartPos(const Point<int>& startPos) noexcept; | ||||
void setStartPos(int x, int y) noexcept; | void setStartPos(int x, int y) noexcept; | ||||
@@ -191,7 +192,6 @@ public: | |||||
void setInverted(bool inverted) noexcept; | void setInverted(bool inverted) noexcept; | ||||
void setRange(float min, float max) noexcept; | void setRange(float min, float max) noexcept; | ||||
void setStep(float step) noexcept; | void setStep(float step) noexcept; | ||||
void setValue(float value, bool sendCallback = false) noexcept; | |||||
void setCallback(Callback* callback) noexcept; | void setCallback(Callback* callback) noexcept; | ||||
@@ -210,6 +210,7 @@ private: | |||||
bool fDragging; | bool fDragging; | ||||
bool fInverted; | bool fInverted; | ||||
bool fValueIsSet; | |||||
int fStartedX; | int fStartedX; | ||||
int fStartedY; | int fStartedY; | ||||
@@ -15,7 +15,7 @@ LINK_FLAGS += $(DGL_LIBS) | |||||
# -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
OBJS = \ | OBJS = \ | ||||
src/App.cpp.o \ | |||||
src/Application.cpp.o \ | |||||
src/Color.cpp.o \ | src/Color.cpp.o \ | ||||
src/Geometry.cpp.o \ | src/Geometry.cpp.o \ | ||||
src/Image.cpp.o \ | src/Image.cpp.o \ | ||||
@@ -17,7 +17,7 @@ | |||||
#ifndef DGL_STANDALONE_WINDOW_HPP_INCLUDED | #ifndef DGL_STANDALONE_WINDOW_HPP_INCLUDED | ||||
#define DGL_STANDALONE_WINDOW_HPP_INCLUDED | #define DGL_STANDALONE_WINDOW_HPP_INCLUDED | ||||
#include "App.hpp" | |||||
#include "Application.hpp" | |||||
#include "Widget.hpp" | #include "Widget.hpp" | ||||
#include "Window.hpp" | #include "Window.hpp" | ||||
@@ -25,19 +25,19 @@ START_NAMESPACE_DGL | |||||
// ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
class StandaloneWindow : public App, | |||||
class StandaloneWindow : public Application, | |||||
public Window | public Window | ||||
{ | { | ||||
public: | public: | ||||
StandaloneWindow() | StandaloneWindow() | ||||
: App(), | |||||
Window((App&)*this), | |||||
: Application(), | |||||
Window((Application&)*this), | |||||
fWidget(nullptr) {} | fWidget(nullptr) {} | ||||
void exec() | void exec() | ||||
{ | { | ||||
Window::show(); | Window::show(); | ||||
App::exec(); | |||||
Application::exec(); | |||||
} | } | ||||
protected: | protected: | ||||
@@ -30,7 +30,7 @@ END_NAMESPACE_DISTRHO | |||||
START_NAMESPACE_DGL | START_NAMESPACE_DGL | ||||
class App; | |||||
class Application; | |||||
class ImageSlider; | class ImageSlider; | ||||
class NanoWidget; | class NanoWidget; | ||||
class Window; | class Window; | ||||
@@ -287,7 +287,7 @@ public: | |||||
Get this widget's window application. | Get this widget's window application. | ||||
Same as calling getParentWindow().getApp(). | Same as calling getParentWindow().getApp(). | ||||
*/ | */ | ||||
App& getParentApp() const noexcept; | |||||
Application& getParentApp() const noexcept; | |||||
/** | /** | ||||
Get parent window, as passed in the constructor. | Get parent window, as passed in the constructor. | ||||
@@ -23,7 +23,7 @@ START_NAMESPACE_DGL | |||||
// ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
class App; | |||||
class Application; | |||||
class Widget; | class Widget; | ||||
class StandaloneWindow; | class StandaloneWindow; | ||||
@@ -67,9 +67,9 @@ public: | |||||
buttons() {} | buttons() {} | ||||
}; | }; | ||||
explicit Window(App& app); | |||||
explicit Window(App& app, Window& parent); | |||||
explicit Window(App& app, intptr_t parentId); | |||||
explicit Window(Application& app); | |||||
explicit Window(Application& app, Window& parent); | |||||
explicit Window(Application& app, intptr_t parentId); | |||||
virtual ~Window(); | virtual ~Window(); | ||||
void show(); | void show(); | ||||
@@ -99,7 +99,7 @@ public: | |||||
void setTransientWinId(uintptr_t winId); | void setTransientWinId(uintptr_t winId); | ||||
App& getApp() const noexcept; | |||||
Application& getApp() const noexcept; | |||||
intptr_t getWindowId() const noexcept; | intptr_t getWindowId() const noexcept; | ||||
void addIdleCallback(IdleCallback* const callback); | void addIdleCallback(IdleCallback* const callback); | ||||
@@ -116,7 +116,7 @@ protected: | |||||
private: | private: | ||||
struct PrivateData; | struct PrivateData; | ||||
PrivateData* const pData; | PrivateData* const pData; | ||||
friend class App; | |||||
friend class Application; | |||||
friend class Widget; | friend class Widget; | ||||
friend class StandaloneWindow; | friend class StandaloneWindow; | ||||
@@ -14,23 +14,23 @@ | |||||
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||||
*/ | */ | ||||
#include "AppPrivateData.hpp" | |||||
#include "ApplicationPrivateData.hpp" | |||||
#include "../Window.hpp" | #include "../Window.hpp" | ||||
START_NAMESPACE_DGL | START_NAMESPACE_DGL | ||||
// ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
App::App() | |||||
Application::Application() | |||||
: pData(new PrivateData()), | : pData(new PrivateData()), | ||||
leakDetector_App() {} | |||||
leakDetector_Application() {} | |||||
App::~App() | |||||
Application::~Application() | |||||
{ | { | ||||
delete pData; | delete pData; | ||||
} | } | ||||
void App::idle() | |||||
void Application::idle() | |||||
{ | { | ||||
for (std::list<Window*>::iterator it = pData->windows.begin(), ite = pData->windows.end(); it != ite; ++it) | for (std::list<Window*>::iterator it = pData->windows.begin(), ite = pData->windows.end(); it != ite; ++it) | ||||
{ | { | ||||
@@ -45,7 +45,7 @@ void App::idle() | |||||
} | } | ||||
} | } | ||||
void App::exec() | |||||
void Application::exec() | |||||
{ | { | ||||
for (; pData->doLoop;) | for (; pData->doLoop;) | ||||
{ | { | ||||
@@ -54,7 +54,7 @@ void App::exec() | |||||
} | } | ||||
} | } | ||||
void App::quit() | |||||
void Application::quit() | |||||
{ | { | ||||
pData->doLoop = false; | pData->doLoop = false; | ||||
@@ -65,7 +65,7 @@ void App::quit() | |||||
} | } | ||||
} | } | ||||
bool App::isQuiting() const noexcept | |||||
bool Application::isQuiting() const noexcept | |||||
{ | { | ||||
return !pData->doLoop; | return !pData->doLoop; | ||||
} | } |
@@ -17,7 +17,7 @@ | |||||
#ifndef DGL_APP_PRIVATE_DATA_HPP_INCLUDED | #ifndef DGL_APP_PRIVATE_DATA_HPP_INCLUDED | ||||
#define DGL_APP_PRIVATE_DATA_HPP_INCLUDED | #define DGL_APP_PRIVATE_DATA_HPP_INCLUDED | ||||
#include "../App.hpp" | |||||
#include "../Application.hpp" | |||||
#include "../../distrho/extra/Sleep.hpp" | #include "../../distrho/extra/Sleep.hpp" | ||||
#include <list> | #include <list> | ||||
@@ -26,7 +26,7 @@ START_NAMESPACE_DGL | |||||
// ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
struct App::PrivateData { | |||||
struct Application::PrivateData { | |||||
bool doLoop; | bool doLoop; | ||||
uint visibleWindows; | uint visibleWindows; | ||||
std::list<Window*> windows; | std::list<Window*> windows; |
@@ -60,7 +60,7 @@ void ImageAboutWindow::onDisplay() | |||||
bool ImageAboutWindow::onKeyboard(const KeyboardEvent& ev) | bool ImageAboutWindow::onKeyboard(const KeyboardEvent& ev) | ||||
{ | { | ||||
if (ev.press && ev.key == CHAR_ESCAPE) | |||||
if (ev.press && ev.key == kCharEscape) | |||||
{ | { | ||||
Window::close(); | Window::close(); | ||||
return true; | return true; | ||||
@@ -591,7 +591,7 @@ bool ImageKnob::onMouse(const MouseEvent& ev) | |||||
if (! contains(ev.pos)) | if (! contains(ev.pos)) | ||||
return false; | return false; | ||||
if ((ev.mod & MODIFIER_SHIFT) != 0 && fUsingDefault) | |||||
if ((ev.mod & kModifierShift) != 0 && fUsingDefault) | |||||
{ | { | ||||
setValue(fValueDef, true); | setValue(fValueDef, true); | ||||
fValueTmp = fValue; | fValueTmp = fValue; | ||||
@@ -631,7 +631,7 @@ bool ImageKnob::onMotion(const MotionEvent& ev) | |||||
{ | { | ||||
if (const int movX = ev.pos.getX() - fLastX) | if (const int movX = ev.pos.getX() - fLastX) | ||||
{ | { | ||||
d = (ev.mod & MODIFIER_CTRL) ? 2000.0f : 200.0f; | |||||
d = (ev.mod & kModifierControl) ? 2000.0f : 200.0f; | |||||
value = (fUsingLog ? _invlogscale(fValueTmp) : fValueTmp) + (float(fMaximum - fMinimum) / d * float(movX)); | value = (fUsingLog ? _invlogscale(fValueTmp) : fValueTmp) + (float(fMaximum - fMinimum) / d * float(movX)); | ||||
doVal = true; | doVal = true; | ||||
} | } | ||||
@@ -640,7 +640,7 @@ bool ImageKnob::onMotion(const MotionEvent& ev) | |||||
{ | { | ||||
if (const int movY = fLastY - ev.pos.getY()) | if (const int movY = fLastY - ev.pos.getY()) | ||||
{ | { | ||||
d = (ev.mod & MODIFIER_CTRL) ? 2000.0f : 200.0f; | |||||
d = (ev.mod & kModifierControl) ? 2000.0f : 200.0f; | |||||
value = (fUsingLog ? _invlogscale(fValueTmp) : fValueTmp) + (float(fMaximum - fMinimum) / d * float(movY)); | value = (fUsingLog ? _invlogscale(fValueTmp) : fValueTmp) + (float(fMaximum - fMinimum) / d * float(movY)); | ||||
doVal = true; | doVal = true; | ||||
} | } | ||||
@@ -680,7 +680,7 @@ bool ImageKnob::onScroll(const ScrollEvent& ev) | |||||
if (! contains(ev.pos)) | if (! contains(ev.pos)) | ||||
return false; | return false; | ||||
const float d = (ev.mod & MODIFIER_CTRL) ? 2000.0f : 200.0f; | |||||
const float d = (ev.mod & kModifierControl) ? 2000.0f : 200.0f; | |||||
float value = (fUsingLog ? _invlogscale(fValueTmp) : fValueTmp) + (float(fMaximum - fMinimum) / d * 10.f * ev.delta.getY()); | float value = (fUsingLog ? _invlogscale(fValueTmp) : fValueTmp) + (float(fMaximum - fMinimum) / d * 10.f * ev.delta.getY()); | ||||
if (fUsingLog) | if (fUsingLog) | ||||
@@ -733,6 +733,7 @@ ImageSlider::ImageSlider(Window& parent, const Image& image) noexcept | |||||
fValueTmp(fValue), | fValueTmp(fValue), | ||||
fDragging(false), | fDragging(false), | ||||
fInverted(false), | fInverted(false), | ||||
fValueIsSet(false), | |||||
fStartedX(0), | fStartedX(0), | ||||
fStartedY(0), | fStartedY(0), | ||||
fCallback(nullptr), | fCallback(nullptr), | ||||
@@ -754,6 +755,7 @@ ImageSlider::ImageSlider(Widget* widget, const Image& image) noexcept | |||||
fValueTmp(fValue), | fValueTmp(fValue), | ||||
fDragging(false), | fDragging(false), | ||||
fInverted(false), | fInverted(false), | ||||
fValueIsSet(false), | |||||
fStartedX(0), | fStartedX(0), | ||||
fStartedY(0), | fStartedY(0), | ||||
fCallback(nullptr), | fCallback(nullptr), | ||||
@@ -765,50 +767,32 @@ ImageSlider::ImageSlider(Widget* widget, const Image& image) noexcept | |||||
fNeedsFullViewport = true; | fNeedsFullViewport = true; | ||||
} | } | ||||
ImageSlider::ImageSlider(const ImageSlider& imageSlider) noexcept | |||||
: Widget(imageSlider.getParentWindow()), | |||||
fImage(imageSlider.fImage), | |||||
fMinimum(imageSlider.fMinimum), | |||||
fMaximum(imageSlider.fMaximum), | |||||
fStep(imageSlider.fStep), | |||||
fValue(imageSlider.fValue), | |||||
fValueTmp(fValue), | |||||
fDragging(false), | |||||
fInverted(imageSlider.fInverted), | |||||
fStartedX(0), | |||||
fStartedY(0), | |||||
fCallback(imageSlider.fCallback), | |||||
fStartPos(imageSlider.fStartPos), | |||||
fEndPos(imageSlider.fEndPos), | |||||
fSliderArea(imageSlider.fSliderArea), | |||||
leakDetector_ImageSlider() | |||||
float ImageSlider::getValue() const noexcept | |||||
{ | { | ||||
fNeedsFullViewport = true; | |||||
return fValue; | |||||
} | } | ||||
ImageSlider& ImageSlider::operator=(const ImageSlider& imageSlider) noexcept | |||||
void ImageSlider::setValue(float value, bool sendCallback) noexcept | |||||
{ | { | ||||
fImage = imageSlider.fImage; | |||||
fMinimum = imageSlider.fMinimum; | |||||
fMaximum = imageSlider.fMaximum; | |||||
fStep = imageSlider.fStep; | |||||
fValue = imageSlider.fValue; | |||||
fValueTmp = fValue; | |||||
fDragging = false; | |||||
fInverted = imageSlider.fInverted; | |||||
fStartedX = 0; | |||||
fStartedY = 0; | |||||
fCallback = imageSlider.fCallback; | |||||
fStartPos = imageSlider.fStartPos; | |||||
fEndPos = imageSlider.fEndPos; | |||||
fSliderArea = imageSlider.fSliderArea; | |||||
if (! fValueIsSet) | |||||
fValueIsSet = true; | |||||
return *this; | |||||
} | |||||
if (d_isEqual(fValue, value)) | |||||
return; | |||||
float ImageSlider::getValue() const noexcept | |||||
{ | |||||
return fValue; | |||||
fValue = value; | |||||
if (d_isZero(fStep)) | |||||
fValueTmp = value; | |||||
repaint(); | |||||
if (sendCallback && fCallback != nullptr) | |||||
{ | |||||
try { | |||||
fCallback->imageSliderValueChanged(this, fValue); | |||||
} DISTRHO_SAFE_EXCEPTION("ImageSlider::setValue"); | |||||
} | |||||
} | } | ||||
void ImageSlider::setStartPos(const Point<int>& startPos) noexcept | void ImageSlider::setStartPos(const Point<int>& startPos) noexcept | ||||
@@ -844,12 +828,15 @@ void ImageSlider::setInverted(bool inverted) noexcept | |||||
void ImageSlider::setRange(float min, float max) noexcept | void ImageSlider::setRange(float min, float max) noexcept | ||||
{ | { | ||||
fMinimum = min; | |||||
fMaximum = max; | |||||
if (fValue < min) | if (fValue < min) | ||||
{ | { | ||||
fValue = min; | fValue = min; | ||||
repaint(); | repaint(); | ||||
if (fCallback != nullptr) | |||||
if (fCallback != nullptr && fValueIsSet) | |||||
{ | { | ||||
try { | try { | ||||
fCallback->imageSliderValueChanged(this, fValue); | fCallback->imageSliderValueChanged(this, fValue); | ||||
@@ -861,16 +848,13 @@ void ImageSlider::setRange(float min, float max) noexcept | |||||
fValue = max; | fValue = max; | ||||
repaint(); | repaint(); | ||||
if (fCallback != nullptr) | |||||
if (fCallback != nullptr && fValueIsSet) | |||||
{ | { | ||||
try { | try { | ||||
fCallback->imageSliderValueChanged(this, fValue); | fCallback->imageSliderValueChanged(this, fValue); | ||||
} DISTRHO_SAFE_EXCEPTION("ImageSlider::setRange > max"); | } DISTRHO_SAFE_EXCEPTION("ImageSlider::setRange > max"); | ||||
} | } | ||||
} | } | ||||
fMinimum = min; | |||||
fMaximum = max; | |||||
} | } | ||||
void ImageSlider::setStep(float step) noexcept | void ImageSlider::setStep(float step) noexcept | ||||
@@ -878,26 +862,6 @@ void ImageSlider::setStep(float step) noexcept | |||||
fStep = step; | fStep = step; | ||||
} | } | ||||
void ImageSlider::setValue(float value, bool sendCallback) noexcept | |||||
{ | |||||
if (d_isEqual(fValue, value)) | |||||
return; | |||||
fValue = value; | |||||
if (d_isZero(fStep)) | |||||
fValueTmp = value; | |||||
repaint(); | |||||
if (sendCallback && fCallback != nullptr) | |||||
{ | |||||
try { | |||||
fCallback->imageSliderValueChanged(this, fValue); | |||||
} DISTRHO_SAFE_EXCEPTION("ImageSlider::setValue"); | |||||
} | |||||
} | |||||
void ImageSlider::setCallback(Callback* callback) noexcept | void ImageSlider::setCallback(Callback* callback) noexcept | ||||
{ | { | ||||
fCallback = callback; | fCallback = callback; | ||||
@@ -210,7 +210,7 @@ void Widget::setAbsolutePos(const Point<int>& pos) noexcept | |||||
fParent.repaint(); | fParent.repaint(); | ||||
} | } | ||||
App& Widget::getParentApp() const noexcept | |||||
Application& Widget::getParentApp() const noexcept | |||||
{ | { | ||||
return fParent.getApp(); | return fParent.getApp(); | ||||
} | } | ||||
@@ -17,10 +17,7 @@ | |||||
// we need this for now | // we need this for now | ||||
//#define PUGL_GRAB_FOCUS 1 | //#define PUGL_GRAB_FOCUS 1 | ||||
#include "AppPrivateData.hpp" | |||||
#include "../Widget.hpp" | |||||
#include "../Window.hpp" | |||||
#include "../../distrho/extra/String.hpp" | |||||
#include "../../distrho/src/DistrhoDefines.h" | |||||
#undef PUGL_HAVE_CAIRO | #undef PUGL_HAVE_CAIRO | ||||
#undef PUGL_HAVE_GL | #undef PUGL_HAVE_GL | ||||
@@ -42,6 +39,11 @@ extern "C" { | |||||
# error Unsupported platform | # error Unsupported platform | ||||
#endif | #endif | ||||
#include "ApplicationPrivateData.hpp" | |||||
#include "../Widget.hpp" | |||||
#include "../Window.hpp" | |||||
#include "../../distrho/extra/String.hpp" | |||||
#define FOR_EACH_WIDGET(it) \ | #define FOR_EACH_WIDGET(it) \ | ||||
for (std::list<Widget*>::iterator it = fWidgets.begin(); it != fWidgets.end(); ++it) | for (std::list<Widget*>::iterator it = fWidgets.begin(); it != fWidgets.end(); ++it) | ||||
@@ -64,7 +66,7 @@ START_NAMESPACE_DGL | |||||
// Window Private | // Window Private | ||||
struct Window::PrivateData { | struct Window::PrivateData { | ||||
PrivateData(App& app, Window* const self) | |||||
PrivateData(Application& app, Window* const self) | |||||
: fApp(app), | : fApp(app), | ||||
fSelf(self), | fSelf(self), | ||||
fView(puglInit()), | fView(puglInit()), | ||||
@@ -93,7 +95,7 @@ struct Window::PrivateData { | |||||
init(); | init(); | ||||
} | } | ||||
PrivateData(App& app, Window* const self, Window& parent) | |||||
PrivateData(Application& app, Window* const self, Window& parent) | |||||
: fApp(app), | : fApp(app), | ||||
fSelf(self), | fSelf(self), | ||||
fView(puglInit()), | fView(puglInit()), | ||||
@@ -132,7 +134,7 @@ struct Window::PrivateData { | |||||
#endif | #endif | ||||
} | } | ||||
PrivateData(App& app, Window* const self, const intptr_t parentId) | |||||
PrivateData(Application& app, Window* const self, const intptr_t parentId) | |||||
: fApp(app), | : fApp(app), | ||||
fSelf(self), | fSelf(self), | ||||
fView(puglInit()), | fView(puglInit()), | ||||
@@ -884,9 +886,9 @@ struct Window::PrivateData { | |||||
// ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
App& fApp; | |||||
Window* fSelf; | |||||
PuglView* fView; | |||||
Application& fApp; | |||||
Window* fSelf; | |||||
PuglView* fView; | |||||
bool fFirstInit; | bool fFirstInit; | ||||
bool fVisible; | bool fVisible; | ||||
@@ -990,15 +992,15 @@ struct Window::PrivateData { | |||||
// ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
// Window | // Window | ||||
Window::Window(App& app) | |||||
Window::Window(Application& app) | |||||
: pData(new PrivateData(app, this)), | : pData(new PrivateData(app, this)), | ||||
leakDetector_Window() {} | leakDetector_Window() {} | ||||
Window::Window(App& app, Window& parent) | |||||
Window::Window(Application& app, Window& parent) | |||||
: pData(new PrivateData(app, this, parent)), | : pData(new PrivateData(app, this, parent)), | ||||
leakDetector_Window() {} | leakDetector_Window() {} | ||||
Window::Window(App& app, intptr_t parentId) | |||||
Window::Window(Application& app, intptr_t parentId) | |||||
: pData(new PrivateData(app, this, parentId)), | : pData(new PrivateData(app, this, parentId)), | ||||
leakDetector_Window() {} | leakDetector_Window() {} | ||||
@@ -1169,7 +1171,7 @@ void Window::setTransientWinId(uintptr_t winId) | |||||
pData->setTransientWinId(winId); | pData->setTransientWinId(winId); | ||||
} | } | ||||
App& Window::getApp() const noexcept | |||||
Application& Window::getApp() const noexcept | |||||
{ | { | ||||
return pData->fApp; | return pData->fApp; | ||||
} | } | ||||
@@ -221,4 +221,13 @@ uint32_t d_nextPowerOf2(uint32_t size) noexcept | |||||
// ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
#ifndef DONT_SET_USING_DISTRHO_NAMESPACE | |||||
// If your code uses a lot of DGL classes, then this will obviously save you | |||||
// a lot of typing, but can be disabled by setting DONT_SET_USING_DISTRHO_NAMESPACE. | |||||
namespace DISTRHO_NAMESPACE {} | |||||
using namespace DISTRHO_NAMESPACE; | |||||
#endif | |||||
// ----------------------------------------------------------------------- | |||||
#endif // DISTRHO_UTILS_HPP_INCLUDED | #endif // DISTRHO_UTILS_HPP_INCLUDED |