DPF

DISTRHO Plugin Framework
Log | Files | Refs | Submodules | README | LICENSE

commit d1e127289c4f3f51d34177ed3adb67f2e75925fe
parent 720d681a09bd8bef418b0e12a65679a7905699d8
Author: falkTX <falktx@gmail.com>
Date:   Sun, 14 Feb 2016 21:29:38 +0100

Allow to store window title in external windows

Diffstat:
Mdistrho/extra/ExternalWindow.hpp | 18+++++++++++++++---
Mdistrho/src/DistrhoUIInternal.hpp | 16++++++++++------
2 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/distrho/extra/ExternalWindow.hpp b/distrho/extra/ExternalWindow.hpp @@ -17,7 +17,7 @@ #ifndef DISTRHO_EXTERNAL_WINDOW_HPP_INCLUDED #define DISTRHO_EXTERNAL_WINDOW_HPP_INCLUDED -#include "../DistrhoUtils.hpp" +#include "String.hpp" #ifdef DISTRHO_OS_UNIX # include <cerrno> @@ -35,12 +35,13 @@ START_NAMESPACE_DISTRHO class ExternalWindow { public: - ExternalWindow(const uint w = 1, const uint h = 1) + ExternalWindow(const uint w = 1, const uint h = 1, const char* const t = "") : width(w), height(h), + title(t), pid(0) {} - ~ExternalWindow() + virtual ~ExternalWindow() { terminateAndWaitForProcess(); } @@ -55,6 +56,16 @@ public: return height; } + const char* getTitle() const noexcept + { + return title; + } + + void setTitle(const char* const t) noexcept + { + title = t; + } + bool isRunning() noexcept { if (pid <= 0) @@ -98,6 +109,7 @@ protected: private: uint width; uint height; + String title; pid_t pid; friend class UIExporter; diff --git a/distrho/src/DistrhoUIInternal.hpp b/distrho/src/DistrhoUIInternal.hpp @@ -370,6 +370,16 @@ public: // ------------------------------------------------------------------- + void setWindowTitle(const char* const uiTitle) + { +#ifdef HAVE_DGL + glWindow.setTitle(uiTitle); +#else + DISTRHO_SAFE_ASSERT_RETURN(fUI != nullptr,); + fUI->setTitle(uiTitle); +#endif + } + #ifdef HAVE_DGL void setWindowSize(const uint width, const uint height, const bool updateUI = false) { @@ -386,11 +396,6 @@ public: fChangingSize = false; } - void setWindowTitle(const char* const uiTitle) - { - glWindow.setTitle(uiTitle); - } - void setWindowTransientWinId(const uintptr_t winId) { glWindow.setTransientWinId(winId); @@ -404,7 +409,6 @@ public: } #else void setWindowSize(const uint width, const uint height, const bool updateUI = false) {} - void setWindowTitle(const char* const uiTitle) {} void setWindowTransientWinId(const uintptr_t winId) {} bool setWindowVisible(const bool yesNo) { return true; } #endif