Browse Source

Allow to store window title in external windows

pull/6/head
falkTX 8 years ago
parent
commit
d1e127289c
2 changed files with 25 additions and 9 deletions
  1. +15
    -3
      distrho/extra/ExternalWindow.hpp
  2. +10
    -6
      distrho/src/DistrhoUIInternal.hpp

+ 15
- 3
distrho/extra/ExternalWindow.hpp View File

@@ -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;


+ 10
- 6
distrho/src/DistrhoUIInternal.hpp View File

@@ -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


Loading…
Cancel
Save