diff options
author | falkTX <falktx@gmail.com> | 2016-02-14 21:30:04 +0100 |
---|---|---|
committer | falkTX <falktx@gmail.com> | 2016-02-14 21:30:04 +0100 |
commit | d1e127289c4f3f51d34177ed3adb67f2e75925fe (patch) | |
tree | 8ba69c017a17002b2083d13815fbab0bc715b0b6 | |
parent | 720d681a09bd8bef418b0e12a65679a7905699d8 (diff) |
Allow to store window title in external windows
-rw-r--r-- | distrho/extra/ExternalWindow.hpp | 18 | ||||
-rw-r--r-- | distrho/src/DistrhoUIInternal.hpp | 16 |
2 files changed, 25 insertions, 9 deletions
diff --git a/distrho/extra/ExternalWindow.hpp b/distrho/extra/ExternalWindow.hpp index a0001149..e3e4bcf7 100644 --- 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 index a649be93..40340812 100644 --- 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 |