version update
[goodguy/cinelerra.git] / cinelerra-5.1 / guicast / bckeyboard.h
1 #ifndef _BC_KEYBOARD_H_
2 #define _BC_KEYBOARD_H_
3
4 #include "bcwindowbase.inc"
5 #include "bcsignals.inc"
6 #include "mutex.h"
7
8 // global listeners for remote control
9
10 class BC_KeyboardHandler {
11         int(BC_WindowBase::*handler)(BC_WindowBase *win);
12         BC_WindowBase *win;
13         static ArrayList<BC_KeyboardHandler*> listeners;
14         friend class BC_WindowBase;
15         friend class BC_Signals;
16 public:
17         BC_KeyboardHandler(int(BC_WindowBase::*h)(BC_WindowBase *), BC_WindowBase *d)
18                 : handler(h), win(d) {}
19         ~BC_KeyboardHandler() {}
20         static int run_listeners(BC_WindowBase *wp);
21         int run_event(BC_WindowBase *wp);
22         static void kill_grabs();
23 };
24
25 class BC_KeyboardHandlerLock {
26         static Mutex keyboard_listener_mutex;
27 public:
28         BC_KeyboardHandlerLock() { keyboard_listener_mutex.lock(); }
29         ~BC_KeyboardHandlerLock() { keyboard_listener_mutex.unlock(); }
30 };
31
32 #endif