summaryrefslogtreecommitdiff
path: root/plugingui/plugingui.h
diff options
context:
space:
mode:
Diffstat (limited to 'plugingui/plugingui.h')
-rw-r--r--plugingui/plugingui.h80
1 files changed, 35 insertions, 45 deletions
diff --git a/plugingui/plugingui.h b/plugingui/plugingui.h
index 39643e1..b57855a 100644
--- a/plugingui/plugingui.h
+++ b/plugingui/plugingui.h
@@ -24,77 +24,67 @@
* along with DrumGizmo; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-#ifndef __DRUMGIZMO_PLUGINGUI_H__
-#define __DRUMGIZMO_PLUGINGUI_H__
+#pragma once
-#include "window.h"
+#include "dgwindow.h"
#include "eventhandler.h"
-#include "label.h"
-#include "lineedit.h"
-#include "checkbox.h"
-#include "button.h"
-#include "knob.h"
-#include "progressbar.h"
#include "pluginconfig.h"
-#include "filebrowser.h"
#include "thread.h"
#include "semaphore.h"
#include "messagereceiver.h"
+#include "notifier.h"
-class PluginGUI : public Thread, public MessageReceiver {
+namespace GUI {
+
+class PluginGUI : public Thread, public MessageReceiver, public Listener {
public:
- PluginGUI();
- virtual ~PluginGUI();
+ PluginGUI();
+ virtual ~PluginGUI();
- void thread_main();
- void stopThread();
+ void thread_main();
- void init();
- void deinit();
+ //! Process all events and messages in queue
+ //! \return true if not closing, returns false if closing.
+ bool processEvents();
- void show();
- void hide();
- void processEvents();
- void setWindowClosedCallback(void (*handler)(void *), void *ptr);
+ void stopThread();
- void handleMessage(Message *msg);
+ void init();
+ void deinit();
- //private:
- GUI::Window *window;
- GUI::EventHandler *eventhandler;
+ void show();
+ void hide();
- GUI::FileBrowser *filebrowser;
- GUI::CheckBox *check;
- GUI::Knob *knob;
- GUI::Knob *knob2;
+ void handleMessage(Message* msg);
- GUI::Label *lbl;
- GUI::LineEdit *lineedit;
- GUI::ProgressBar *progress;
+ DGWindow* window{nullptr};
+ EventHandler* eventhandler{nullptr};
- GUI::Label *lbl2;
- GUI::LineEdit *lineedit2;
- GUI::ProgressBar *progress2;
- Config *config;
+ Config* config{nullptr};
- void (*windowClosedHandler)(void *);
- void *windowClosedPtr;
+ Notifier<> closeNotifier;
- void (*changeMidimapHandler)(void *, const char *);
- void *changeMidimapPtr;
+ // Support old interface a little while longer..
+ void setWindowClosedCallback(void (*handler)(void*), void* ptr);
private:
- volatile bool running;
- volatile bool closing;
- volatile bool initialised;
+ void closeEventHandler();
+
+ volatile bool running{true};
+ volatile bool closing{false};
+ volatile bool initialised{false};
+
+ Semaphore sem{"plugingui"};
- Semaphore sem;
+ // For the old-style notifier.
+ void (*windowClosedHandler)(void *){nullptr};
+ void *windowClosedPtr{nullptr};
};
-#endif/*__DRUMGIZMO_PLUGINGUI_H__*/
+} // GUI::