no longer need ffmpeg patch0 which was for Termux
[goodguy/cinelerra.git] / cinelerra-5.1 / guicast / bcdialog.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  *
20  */
21
22 #ifndef BCDIALOG_H
23 #define BCDIALOG_H
24
25 #include "bcdialog.inc"
26 #include "condition.inc"
27 #include "guicast.h"
28 #include "mutex.inc"
29 #include "thread.h"
30
31
32 // Generic dialog box with static thread and proper locking.
33 // Create the thread object at startup.  Call start() to do the dialog.
34 // Only one dialog instance is allowed at a time.  These must be overridden
35 // to add functionality.
36
37 class BC_DialogThread : public Thread
38 {
39 public:
40         BC_DialogThread();
41         virtual ~BC_DialogThread();
42
43 // User calls this to create or raise the dialog box.
44         void start();
45         void run();
46
47 // Return if the window is currently running
48         int is_running();
49
50 // After the window is closed, this is called
51         virtual void handle_done_event(int result);
52
53 // After the window is closed and deleted, this is called.
54         virtual void handle_close_event(int result);
55
56 // User creates the window and initializes it here.
57         virtual BC_Window* new_gui();
58
59 // User can get the GUI here.  Call lock_gui
60 // if not the same thread.  get_gui returns 0 if it doesn't exist.
61         void lock_gui(const char *location);
62         void unlock_gui();
63         BC_Window* get_gui();
64
65 // Called by user to access the gui pointer
66         void lock_dialog(const char *location);
67         void unlock_dialog();
68
69 // Called by user to close the GUI from outside the thread
70         void close_window();
71         void join();
72 private:
73         BC_Window *gui;
74         Condition *startup_lock;
75         Mutex *window_lock;
76         Mutex *active_lock;
77 };
78
79 #endif