Signed-off-by: falkTX <falktx@falktx.com>pull/321/head
@@ -306,7 +306,10 @@ public: | |||||
This gets the system clipboard contents, | This gets the system clipboard contents, | ||||
which may have been set with setClipboard() or copied from another application. | which may have been set with setClipboard() or copied from another application. | ||||
returns the clipboard contents, or null. | |||||
Returns the clipboard contents, or null. | |||||
@note By default only "text/plain" mimetype is supported and returned. | |||||
Override onClipboardDataOffer for supporting other types. | |||||
*/ | */ | ||||
const void* getClipboard(size_t& dataSize); | const void* getClipboard(size_t& dataSize); | ||||
@@ -465,7 +468,7 @@ protected: | |||||
Reimplement and return a non-zero id to accept the clipboard data offer for a particular type. | Reimplement and return a non-zero id to accept the clipboard data offer for a particular type. | ||||
Applications must ignore any type they do not recognize. | Applications must ignore any type they do not recognize. | ||||
The default implementation does nothing. | |||||
The default implementation accepts the "text/plain" mimetype. | |||||
*/ | */ | ||||
virtual uint32_t onClipboardDataOffer(); | virtual uint32_t onClipboardDataOffer(); | ||||
@@ -485,6 +485,15 @@ std::vector<ClipboardDataOffer> Window::getClipboardDataOfferTypes() | |||||
uint32_t Window::onClipboardDataOffer() | uint32_t Window::onClipboardDataOffer() | ||||
{ | { | ||||
std::vector<ClipboardDataOffer> offers(getClipboardDataOfferTypes()); | |||||
for (std::vector<ClipboardDataOffer>::iterator it=offers.begin(), end=offers.end(); it != end;++it) | |||||
{ | |||||
const ClipboardDataOffer offer = *it; | |||||
if (std::strcmp(offer.type, "text/plain") == 0) | |||||
return offer.id; | |||||
} | |||||
return 0; | return 0; | ||||
} | } | ||||
@@ -309,7 +309,7 @@ protected: | |||||
Reimplement and return a non-zero id to accept the clipboard data offer for a particular type. | Reimplement and return a non-zero id to accept the clipboard data offer for a particular type. | ||||
UIs must ignore any type they do not recognize. | UIs must ignore any type they do not recognize. | ||||
The default implementation does nothing. | |||||
The default implementation accepts the "text/plain" mimetype. | |||||
*/ | */ | ||||
virtual uint32_t uiClipboardDataOffer(); | virtual uint32_t uiClipboardDataOffer(); | ||||
@@ -345,6 +345,15 @@ std::vector<DGL_NAMESPACE::ClipboardDataOffer> UI::getClipboardDataOfferTypes() | |||||
uint32_t UI::uiClipboardDataOffer() | uint32_t UI::uiClipboardDataOffer() | ||||
{ | { | ||||
std::vector<ClipboardDataOffer> offers(uiData->window->getClipboardDataOfferTypes()); | |||||
for (std::vector<ClipboardDataOffer>::iterator it=offers.begin(), end=offers.end(); it != end;++it) | |||||
{ | |||||
const ClipboardDataOffer offer = *it; | |||||
if (std::strcmp(offer.type, "text/plain") == 0) | |||||
return offer.id; | |||||
} | |||||
return 0; | return 0; | ||||
} | } | ||||
@@ -4,7 +4,3 @@ puglSetWindowSize was used on first show, still needed? | |||||
transientParentView needed? remove from WindowPrivateData | transientParentView needed? remove from WindowPrivateData | ||||
update distrhoui.cpp get scale factor to match new parent request setup and pugl | update distrhoui.cpp get scale factor to match new parent request setup and pugl | ||||
clipboard todo | |||||
pugl namespace details finalized |