@@ -101,6 +101,8 @@ public: | |||||
void repaint(const Rectangle<uint>& rect) noexcept; | void repaint(const Rectangle<uint>& rect) noexcept; | ||||
// TODO group stuff after here, convenience functions present in Window class | // TODO group stuff after here, convenience functions present in Window class | ||||
bool setClipboard(const char* mimeType, const void* data, size_t dataSize); | |||||
const void* getClipboard(const char*& mimeType, size_t& dataSize); | |||||
bool addIdleCallback(IdleCallback* callback, uint timerFrequencyInMs = 0); | bool addIdleCallback(IdleCallback* callback, uint timerFrequencyInMs = 0); | ||||
bool removeIdleCallback(IdleCallback* callback); | bool removeIdleCallback(IdleCallback* callback); | ||||
double getScaleFactor() const noexcept; | double getScaleFactor() const noexcept; | ||||
@@ -263,6 +263,27 @@ public: | |||||
*/ | */ | ||||
void setIgnoringKeyRepeat(bool ignore) noexcept; | void setIgnoringKeyRepeat(bool ignore) noexcept; | ||||
/** | |||||
Set the clipboard contents. | |||||
This sets the system clipboard contents, | |||||
which can be retrieved with getClipboard() or pasted into other applications. | |||||
If using a string, the use of a null terminator is required (and must be part of dataSize).@n | |||||
The MIME type of the data "text/plain" is assumed if null is used. | |||||
*/ | |||||
bool setClipboard(const char* mimeType, const void* data, size_t dataSize); | |||||
/** | |||||
Get the clipboard contents. | |||||
This gets the system clipboard contents, | |||||
which may have been set with setClipboard() or copied from another application. | |||||
returns the clipboard contents, or null. | |||||
*/ | |||||
const void* getClipboard(const char*& mimeType, size_t& dataSize); | |||||
/** | /** | ||||
Add a callback function to be triggered on every idle cycle or on a specific timer frequency. | Add a callback function to be triggered on every idle cycle or on a specific timer frequency. | ||||
You can add more than one, and remove them at anytime with removeIdleCallback(). | You can add more than one, and remove them at anytime with removeIdleCallback(). | ||||
@@ -60,6 +60,16 @@ void TopLevelWidget::setSize(const Size<uint>& size) | |||||
pData->window.setSize(size); | pData->window.setSize(size); | ||||
} | } | ||||
bool TopLevelWidget::setClipboard(const char* mimeType, const void* data, size_t dataSize) | |||||
{ | |||||
return pData->window.setClipboard(mimeType, data, dataSize); | |||||
} | |||||
const void* TopLevelWidget::getClipboard(const char*& mimeType, size_t& dataSize) | |||||
{ | |||||
return pData->window.getClipboard(mimeType, dataSize); | |||||
} | |||||
bool TopLevelWidget::addIdleCallback(IdleCallback* const callback, const uint timerFrequencyInMs) | bool TopLevelWidget::addIdleCallback(IdleCallback* const callback, const uint timerFrequencyInMs) | ||||
{ | { | ||||
return pData->window.addIdleCallback(callback, timerFrequencyInMs); | return pData->window.addIdleCallback(callback, timerFrequencyInMs); | ||||
@@ -257,6 +257,16 @@ void Window::setIgnoringKeyRepeat(const bool ignore) noexcept | |||||
puglSetViewHint(pData->view, PUGL_IGNORE_KEY_REPEAT, ignore); | puglSetViewHint(pData->view, PUGL_IGNORE_KEY_REPEAT, ignore); | ||||
} | } | ||||
bool Window::setClipboard(const char* const mimeType, const void* const data, const size_t dataSize) | |||||
{ | |||||
return puglSetClipboard(pData->view, mimeType, data, dataSize) == PUGL_SUCCESS; | |||||
} | |||||
const void* Window::getClipboard(const char*& mimeType, size_t& dataSize) | |||||
{ | |||||
return puglGetClipboard(pData->view, &mimeType, &dataSize); | |||||
} | |||||
bool Window::addIdleCallback(IdleCallback* const callback, const uint timerFrequencyInMs) | bool Window::addIdleCallback(IdleCallback* const callback, const uint timerFrequencyInMs) | ||||
{ | { | ||||
DISTRHO_SAFE_ASSERT_RETURN(callback != nullptr, false) | DISTRHO_SAFE_ASSERT_RETURN(callback != nullptr, false) | ||||