Fix last commit
[carla.git] / source / utils / CarlaPluginUI.hpp
blob77a2d76f866482e61e53a26f7ec59adbdd4b8b55
1 /*
2 * Carla Plugin UI
3 * Copyright (C) 2014-2022 Filipe Coelho <falktx@falktx.com>
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 2 of
8 * the License, or any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * For a full copy of the GNU General Public License see the doc/GPL.txt file.
18 #ifndef CARLA_PLUGIN_UI_HPP_INCLUDED
19 #define CARLA_PLUGIN_UI_HPP_INCLUDED
21 #include "CarlaUtils.hpp"
23 // -----------------------------------------------------
25 class CarlaPluginUI
27 public:
28 class Callback {
29 public:
30 virtual ~Callback() {}
31 virtual void handlePluginUIClosed() = 0;
32 virtual void handlePluginUIResized(uint width, uint height) = 0;
35 virtual ~CarlaPluginUI() {}
36 virtual void show() = 0;
37 virtual void hide() = 0;
38 virtual void focus() = 0;
39 virtual void idle() = 0;
40 virtual void setMinimumSize(uint with, uint height) = 0;
41 virtual void setSize(uint with, uint height, bool forceUpdate, bool resizeChild) = 0;
42 virtual void setTitle(const char* title) = 0;
43 virtual void setChildWindow(void* ptr) = 0;
44 virtual void setTransientWinId(uintptr_t winId) = 0;
45 virtual void* getPtr() const noexcept = 0;
46 #ifdef HAVE_X11
47 virtual void* getDisplay() const noexcept = 0;
48 #endif
50 #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH
51 static bool tryTransientWinIdMatch(uintptr_t pid, const char* uiTitle, uintptr_t winId, bool centerUI);
52 #endif
54 #ifdef CARLA_OS_MAC
55 static CarlaPluginUI* newCocoa(Callback*, uintptr_t, bool isStandalone, bool isResizable);
56 #endif
57 #ifdef CARLA_OS_WIN
58 static CarlaPluginUI* newWindows(Callback*, uintptr_t, bool isStandalone, bool isResizable);
59 #endif
60 #ifdef HAVE_X11
61 static CarlaPluginUI* newX11(Callback*, uintptr_t, bool isStandalone, bool isResizable, bool canMonitorChildren);
62 #endif
64 protected:
65 bool fIsIdling;
66 bool fIsStandalone;
67 bool fIsResizable;
68 Callback* fCallback;
70 CarlaPluginUI(Callback* const cb,
71 const bool isStandalone,
72 const bool isResizable) noexcept
73 : fIsIdling(false),
74 fIsStandalone(isStandalone),
75 fIsResizable(isResizable),
76 fCallback(cb) {}
78 CARLA_DECLARE_NON_COPYABLE(CarlaPluginUI)
81 // -----------------------------------------------------
83 #endif // CARLA_PLUGIN_UI_HPP_INCLUDED