summaryrefslogtreecommitdiff
path: root/plugingui/plugingui.h
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2015-12-21 13:59:37 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2015-12-21 13:59:37 +0100
commit0034f7ddeef9a2564f0ae51a7c815a6652a0f9e0 (patch)
tree6896f0214d8141a60ebdcea3f387ddef87adf1d3 /plugingui/plugingui.h
parentc6c4a6174e3a8301ecdf355452588a98770e1119 (diff)
New DGWindow class for the actual UI implementation. PluginGUI is now just handles events and acts as an interface. testcode.
Diffstat (limited to 'plugingui/plugingui.h')
-rw-r--r--plugingui/plugingui.h77
1 files changed, 28 insertions, 49 deletions
diff --git a/plugingui/plugingui.h b/plugingui/plugingui.h
index 5e617dc..bdb7da5 100644
--- a/plugingui/plugingui.h
+++ b/plugingui/plugingui.h
@@ -26,18 +26,11 @@
*/
#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"
@@ -49,63 +42,49 @@ 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();
- Window *window;
- EventHandler *eventhandler;
+ void show();
+ void hide();
- Label *lbl;
- LineEdit *lineedit;
- ProgressBar *progress;
- Label *lbl2;
- LineEdit *lineedit2;
- ProgressBar *progress2;
+ void handleMessage(Message* msg);
- Config *config;
+ DGWindow* window{nullptr};
+ EventHandler* eventhandler;
- void (*windowClosedHandler)(void *);
- void *windowClosedPtr;
- void (*changeMidimapHandler)(void *, const char *);
- void *changeMidimapPtr;
+ Config* config;
+
+ Notifier<> closeNotifier;
+
+ // Support old interface a little while longer..
+ void setWindowClosedCallback(void (*handler)(void*), void* ptr);
private:
- void attackValueChanged(float value);
- void falloffValueChanged(float value);
- void velocityCheckClick(bool checked);
- void kitBrowseClick();
- void midimapBrowseClick();
void closeEventHandler();
- void selectKitFile(const std::string& filename);
- void selectMapFile(const std::string& filename);
- // Humanized velocity controls:
- CheckBox* velocityCheck;
- Knob* attackKnob;
- Knob* falloffKnob;
- FileBrowser* fileBrowser;
+ volatile bool running{true};
+ volatile bool closing{false};
+ volatile bool initialised{false};
- volatile bool running;
- volatile bool closing;
- volatile bool initialised;
+ Semaphore sem{"plugingui"};
- Semaphore sem;
+ // For the old-style notifier.
+ void (*windowClosedHandler)(void *){nullptr};
+ void *windowClosedPtr{nullptr};
};
} // GUI::
-