diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2012-04-24 16:45:38 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2012-04-24 16:45:38 +0000 |
commit | d5e14b3d9144400fb8026fb9783a5a8582c0ad87 (patch) | |
tree | 9c74ea0c58f80a58c5d9e9d52b26f09d34e677d3 /libs/pbd/pbd/base_ui.h | |
parent | 9b8fe0b09fb62fd96e21e219b916e3b61fab0150 (diff) |
eventloop and abstractui debugging, lots more commenting on abstractui/eventloop implementation; minor tweaks elsewhere
git-svn-id: svn://localhost/ardour2/branches/3.0@12076 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/pbd/pbd/base_ui.h')
-rw-r--r-- | libs/pbd/pbd/base_ui.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/libs/pbd/pbd/base_ui.h b/libs/pbd/pbd/base_ui.h index ccd4878cd9..414c9970d9 100644 --- a/libs/pbd/pbd/base_ui.h +++ b/libs/pbd/pbd/base_ui.h @@ -32,6 +32,15 @@ #include "pbd/crossthread.h" #include "pbd/event_loop.h" +/** A BaseUI is an abstraction designed to be used with any "user + * interface" (not necessarily graphical) that needs to wait on + * events/requests and dispatch/process them as they arrive. + * + * This implementation starts up a thread that runs a Glib main loop + * to wait on events/requests etc. + */ + + class BaseUI : virtual public sigc::trackable, public PBD::EventLoop { public: @@ -52,7 +61,13 @@ class BaseUI : virtual public sigc::trackable, public PBD::EventLoop static RequestType CallSlot; static RequestType Quit; + /** start up a thread to run the main loop + */ void run (); + + /** stop the thread running the main loop (and block + * until it exits) + */ void quit (); protected: @@ -62,9 +77,21 @@ class BaseUI : virtual public sigc::trackable, public PBD::EventLoop Glib::RefPtr<Glib::MainLoop> _main_loop; Glib::Thread* run_loop_thread; + /** Derived UI objects can implement thread_init() + * which will be called by the event loop thread + * immediately before it enters the event loop. + */ + virtual void thread_init () {}; + + /** Called when there input ready on the request_channel + */ bool request_handler (Glib::IOCondition); + /** Derived UI objects must implement this method, + * which will be called whenever there are requests + * to be dealt with. + */ virtual void handle_ui_requests () = 0; private: |