Fifth set of 50 GPL attribution for CV-Contributors +
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / remotecontrol.h
1 /*
2  * CINELERRA
3  * Copyright (C) 2016-2020 William Morrow
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License as published
7  * by the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public
16  * License along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
18  * USA
19  */
20
21 #ifndef _REMOTECONTROL_H_
22 #define _REMOTECONTROL_H_
23
24 #include "bcpopup.h"
25 #include "bcwindow.h"
26 #include "mutex.h"
27 #include "mwindowgui.inc"
28 #include "thread.h"
29
30 class RemoteControl;
31 class RemoteGUI;
32 class RemoteHandler;
33 class RemoteWindow;
34
35 class RemoteGUI : public BC_Popup
36 {
37 public:
38         RemoteControl *remote_control;
39
40         void set_active(RemoteHandler *handler);
41         void set_inactive();
42         void fill_color(int color);
43         void tile_windows(int config);
44         int button_press_event();
45         int keypress_event();
46         int process_key(int key);
47
48         RemoteGUI(BC_WindowBase *wdw, RemoteControl *remote_control);
49         ~RemoteGUI();
50 };
51
52 class RemoteWindow : public BC_Window
53 {
54 public:
55         RemoteControl *remote_control;
56
57          RemoteWindow(RemoteControl *remote_control);
58          ~RemoteWindow();
59 };
60
61 class RemoteHandler
62 {
63 public:
64         RemoteGUI *gui;
65         int color;
66
67         void activate() { gui->set_active(this); }
68         virtual int remote_key(int key);
69         virtual int process_key(int key);
70
71         virtual int is_keytv() { return 0; }
72         virtual int is_wintv() { return 0; }
73         virtual int is_x10tv() { return 0; }
74
75         RemoteHandler(RemoteGUI *gui, int color);
76         virtual ~RemoteHandler();
77 };
78
79 class RemoteControl : Thread {
80 public:
81         MWindowGUI *mwindow_gui;
82         RemoteWindow *remote_window;
83         RemoteGUI *gui;
84         RemoteHandler *handler;
85         Mutex *active_lock;
86
87         void run();
88         void set_color(int color);
89         void fill_color(int color);
90         int remote_key(int key);
91
92         int activate(RemoteHandler *handler=0);
93         int deactivate();
94         bool is_active() { return handler != 0; }
95
96         RemoteControl(MWindowGUI *gui);
97         ~RemoteControl();
98 };
99
100 #endif