diff options
author | David Robillard <d@drobilla.net> | 2020-11-28 21:41:26 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-11-28 22:49:10 +0100 |
commit | 5128bfab7ddb9504abf17375e910e5bc94af291e (patch) | |
tree | 79cc0953718e1f79ed47282b9f11f9f087edc3bc /src/Driver.hpp | |
parent | 0f25dd575f9c74cc34a54e64468f07e6c631750d (diff) | |
download | patchage-5128bfab7ddb9504abf17375e910e5bc94af291e.tar.gz patchage-5128bfab7ddb9504abf17375e910e5bc94af291e.tar.bz2 patchage-5128bfab7ddb9504abf17375e910e5bc94af291e.zip |
Refresh by emitting events
This decouples drivers from the rest of the application, in particular the
horrible situation where they were working with the canvas directly, by having
them always communicate changes by emitting events.
Diffstat (limited to 'src/Driver.hpp')
-rw-r--r-- | src/Driver.hpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/Driver.hpp b/src/Driver.hpp index 116b29f..d40f7b5 100644 --- a/src/Driver.hpp +++ b/src/Driver.hpp @@ -21,16 +21,16 @@ #include <sigc++/sigc++.h> -#include <string> +#include <functional> class Patchage; -class PatchagePort; -class PatchageCanvas; /// Base class for drivers that handle system clients and ports class Driver { public: + using EventSink = std::function<void(const PatchageEvent&)>; + Driver() = default; Driver(const Driver&) = delete; @@ -47,11 +47,7 @@ public: virtual void detach() = 0; virtual bool is_attached() const = 0; - virtual void refresh() = 0; - virtual void destroy_all() = 0; - - virtual PatchagePort* - create_port_view(Patchage* patchage, const PortID& id) = 0; + virtual void refresh(const EventSink& sink) = 0; virtual bool connect(PortID tail_id, PortID head_id) = 0; virtual bool disconnect(PortID tail_id, PortID head_id) = 0; |