-
-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start Window related tests; comment out all code
Signed-off-by: falkTX <[email protected]>
- Loading branch information
Showing
12 changed files
with
589 additions
and
372 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* | ||
* DISTRHO Plugin Framework (DPF) | ||
* Copyright (C) 2012-2020 Filipe Coelho <[email protected]> | ||
* Copyright (C) 2012-2021 Filipe Coelho <[email protected]> | ||
* | ||
* Permission to use, copy, modify, and/or distribute this software for any purpose with | ||
* or without fee is hereby granted, provided that the above copyright notice and this | ||
|
@@ -19,29 +19,59 @@ | |
|
||
#include "Geometry.hpp" | ||
|
||
#ifdef DISTRHO_DEFINES_H_INCLUDED | ||
START_NAMESPACE_DISTRHO | ||
class UI; | ||
class UIExporter; | ||
END_NAMESPACE_DISTRHO | ||
#endif | ||
|
||
START_NAMESPACE_DGL | ||
|
||
// ----------------------------------------------------------------------- | ||
|
||
class Application; | ||
class Widget; | ||
class StandaloneWindow; | ||
|
||
class Window | ||
{ | ||
public: | ||
explicit Window(Application& app); | ||
explicit Window(Application& app, uintptr_t parentWindowHandle, double scaling, bool resizable); | ||
virtual ~Window(); | ||
|
||
void close(); | ||
|
||
/** | ||
Get the "native" window handle. | ||
Returned value depends on the platform: | ||
- HaikuOS: This is a pointer to a `BView`. | ||
- MacOS: This is a pointer to an `NSView*`. | ||
- Windows: This is a `HWND`. | ||
- Everything else: This is an [X11] `Window`. | ||
*/ | ||
uintptr_t getNativeWindowHandle() const noexcept; | ||
|
||
private: | ||
struct PrivateData; | ||
PrivateData* const pData; | ||
friend class Application; | ||
|
||
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(Window); | ||
}; | ||
|
||
// ----------------------------------------------------------------------- | ||
|
||
END_NAMESPACE_DGL | ||
|
||
/* TODO | ||
* add focusEvent with CrossingMode arg | ||
* add eventcrossing/enter-leave event | ||
*/ | ||
|
||
class Window | ||
{ | ||
public: | ||
// class StandaloneWindow; | ||
// class Widget; | ||
|
||
// #ifdef DISTRHO_DEFINES_H_INCLUDED | ||
// START_NAMESPACE_DISTRHO | ||
// class UI; | ||
// class UIExporter; | ||
// END_NAMESPACE_DISTRHO | ||
// #endif | ||
|
||
#if 0 | ||
#ifndef DGL_FILE_BROWSER_DISABLED | ||
/** | ||
File browser options. | ||
|
@@ -81,14 +111,10 @@ class Window | |
}; | ||
#endif // DGL_FILE_BROWSER_DISABLED | ||
|
||
explicit Window(Application& app); | ||
explicit Window(Window& transientParentWindow); | ||
explicit Window(Application& app, uintptr_t parentWindowHandle, double scaling, bool resizable); | ||
virtual ~Window(); | ||
static Window& withTransientParentWindow(Window& transientParentWindow); | ||
|
||
void show(); | ||
void hide(); | ||
void close(); | ||
void exec(bool lockWait = false); | ||
|
||
void focus(); | ||
|
@@ -129,21 +155,12 @@ class Window | |
Application& getApp() const noexcept; | ||
#endif | ||
|
||
/** | ||
Get the "native" window handle. | ||
Returned value depends on the platform: | ||
- HaikuOS: This is a pointer to a `BView`. | ||
- MacOS: This is a pointer to an `NSView*`. | ||
- Windows: This is a `HWND`. | ||
- Everything else: This is an [X11] `Window`. | ||
*/ | ||
uintptr_t getNativeWindowHandle() const noexcept; | ||
|
||
const GraphicsContext& getGraphicsContext() const noexcept; | ||
|
||
void addIdleCallback(IdleCallback* const callback); | ||
void removeIdleCallback(IdleCallback* const callback); | ||
|
||
|
||
protected: | ||
virtual void onDisplayBefore(); | ||
virtual void onDisplayAfter(); | ||
|
@@ -157,38 +174,31 @@ class Window | |
// internal | ||
void _setAutoScaling(double scaling) noexcept; | ||
|
||
private: | ||
struct PrivateData; | ||
PrivateData* const pData; | ||
friend class Application; | ||
friend class Widget; | ||
friend class StandaloneWindow; | ||
#ifdef DISTRHO_DEFINES_H_INCLUDED | ||
friend class DISTRHO_NAMESPACE::UI; | ||
friend class DISTRHO_NAMESPACE::UIExporter; | ||
#endif | ||
|
||
virtual void _addWidget(Widget* const widget); | ||
virtual void _removeWidget(Widget* const widget); | ||
void _idle(); | ||
|
||
bool handlePluginKeyboard(const bool press, const uint key); | ||
bool handlePluginSpecial(const bool press, const Key key); | ||
|
||
// friend class Widget; | ||
// friend class StandaloneWindow; | ||
// #ifdef DISTRHO_DEFINES_H_INCLUDED | ||
// friend class DISTRHO_NAMESPACE::UI; | ||
// friend class DISTRHO_NAMESPACE::UIExporter; | ||
// #endif | ||
|
||
// Prevent copies | ||
#ifdef DISTRHO_PROPER_CPP11_SUPPORT | ||
Window& operator=(Window&) = delete; | ||
Window& operator=(const Window&) = delete; | ||
#else | ||
Window& operator=(Window&); | ||
Window& operator=(const Window&); | ||
#endif | ||
// #ifdef DISTRHO_PROPER_CPP11_SUPPORT | ||
// Window& operator=(Window&) = delete; | ||
// Window& operator=(const Window&) = delete; | ||
// #else | ||
// Window& operator=(Window&); | ||
// Window& operator=(const Window&); | ||
// #endif | ||
|
||
DISTRHO_LEAK_DETECTOR(Window); | ||
}; | ||
#endif | ||
|
||
// ----------------------------------------------------------------------- | ||
|
||
END_NAMESPACE_DGL | ||
|
||
#endif // DGL_WINDOW_HPP_INCLUDED |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* | ||
* DISTRHO Plugin Framework (DPF) | ||
* Copyright (C) 2012-2020 Filipe Coelho <[email protected]> | ||
* Copyright (C) 2012-2021 Filipe Coelho <[email protected]> | ||
* | ||
* Permission to use, copy, modify, and/or distribute this software for any purpose with | ||
* or without fee is hereby granted, provided that the above copyright notice and this | ||
|
@@ -16,17 +16,19 @@ | |
|
||
#include "WindowPrivateData.hpp" | ||
|
||
#include "pugl.hpp" | ||
|
||
START_NAMESPACE_DGL | ||
|
||
// ----------------------------------------------------------------------- | ||
// Window | ||
|
||
// Window::Window(Window& transientParentWindow) | ||
// : pData(new PrivateData(transientParentWindow.pData->fAppData, this, transientParentWindow)) {} | ||
|
||
Window::Window(Application& app) | ||
: pData(new PrivateData(app.pData, this)) {} | ||
|
||
Window::Window(Window& transientParentWindow) | ||
: pData(new PrivateData(transientParentWindow.pData->fAppData, this, transientParentWindow)) {} | ||
|
||
Window::Window(Application& app, const uintptr_t parentWindowHandle, const double scaling, const bool resizable) | ||
: pData(new PrivateData(app.pData, this, parentWindowHandle, scaling, resizable)) {} | ||
|
||
|
@@ -35,6 +37,17 @@ Window::~Window() | |
delete pData; | ||
} | ||
|
||
void Window::close() | ||
{ | ||
pData->close(); | ||
} | ||
|
||
uintptr_t Window::getNativeWindowHandle() const noexcept | ||
{ | ||
return puglGetNativeWindow(pData->view); | ||
} | ||
|
||
#if 0 | ||
void Window::show() | ||
{ | ||
pData->setVisible(true); | ||
|
@@ -45,11 +58,6 @@ void Window::hide() | |
pData->setVisible(false); | ||
} | ||
|
||
void Window::close() | ||
{ | ||
pData->close(); | ||
} | ||
|
||
#if 0 | ||
void Window::exec(bool lockWait) | ||
{ | ||
|
@@ -191,11 +199,6 @@ Application& Window::getApp() const noexcept | |
} | ||
#endif | ||
|
||
uintptr_t Window::getNativeWindowHandle() const noexcept | ||
{ | ||
return puglGetNativeWindow(pData->fView); | ||
} | ||
|
||
#if 0 | ||
const GraphicsContext& Window::getGraphicsContext() const noexcept | ||
{ | ||
|
@@ -285,6 +288,7 @@ bool Window::handlePluginSpecial(const bool press, const Key key) | |
return false; | ||
// return pData->handlePluginSpecial(press, key); | ||
} | ||
#endif | ||
|
||
// ----------------------------------------------------------------------- | ||
|
||
|
Oops, something went wrong.