r125: This commit was manufactured by cvs2svn to create tag 'r1_1_7-last'.
[cinelerra_cv/mob.git] / hvirtual / guicast / bcfilebox.h
blobb3e9e0e3444a2bdfc4f6dec120fd5b802dbc12c9
1 #ifndef BCFILEBOX_H
2 #define BCFILEBOX_H
4 #include "bcbutton.h"
5 #include "bcfilebox.inc"
6 #include "bclistbox.h"
7 #include "bclistboxitem.inc"
8 #include "bcresources.inc"
9 #include "bctextbox.h"
10 #include "bcwindow.h"
11 #include "filesystem.inc"
12 #include "mutex.h"
13 #include "thread.h"
15 // Display modes
16 #define FILEBOX_LIST 0
17 #define FILEBOX_ICONS 1
19 #define FILEBOX_COLUMNS 2
21 class BC_NewFolder : public BC_Window
23 public:
24 BC_NewFolder(int x, int y, BC_FileBox *filebox);
25 ~BC_NewFolder();
27 int create_objects();
28 char* get_text();
30 private:
31 BC_TextBox *textbox;
34 class BC_NewFolderThread : public Thread
36 public:
37 BC_NewFolderThread(BC_FileBox *filebox);
38 ~BC_NewFolderThread();
40 void run();
41 int interrupt();
42 int start_new_folder();
44 private:
45 Mutex change_lock, completion_lock;
46 BC_FileBox *filebox;
47 BC_NewFolder *window;
50 class BC_FileBoxListBox : public BC_ListBox
52 public:
53 BC_FileBoxListBox(int x, int y, BC_FileBox *filebox);
54 virtual ~BC_FileBoxListBox();
56 int handle_event();
57 int selection_changed();
58 int evaluate_query(int list_item, char *string);
60 BC_FileBox *filebox;
63 class BC_FileBoxTextBox : public BC_TextBox
65 public:
66 BC_FileBoxTextBox(int x, int y, BC_FileBox *filebox);
67 ~BC_FileBoxTextBox();
69 int handle_event();
70 BC_FileBox *filebox;
73 class BC_FileBoxOK : public BC_OKButton
75 public:
76 BC_FileBoxOK(BC_FileBox *filebox);
77 ~BC_FileBoxOK();
79 int handle_event();
81 BC_FileBox *filebox;
84 class BC_FileBoxUseThis : public BC_Button
86 public:
87 BC_FileBoxUseThis(BC_FileBox *filebox);
88 ~BC_FileBoxUseThis();
89 int handle_event();
91 BC_FileBox *filebox;
94 class BC_FileBoxCancel : public BC_CancelButton
96 public:
97 BC_FileBoxCancel(BC_FileBox *filebox);
98 ~BC_FileBoxCancel();
100 int handle_event();
102 BC_FileBox *filebox;
105 class BC_FileBoxText : public BC_Button
107 public:
108 BC_FileBoxText(int x, int y, BC_FileBox *filebox);
109 int handle_event();
110 BC_FileBox *filebox;
113 class BC_FileBoxFilterText : public BC_TextBox
115 public:
116 BC_FileBoxFilterText(int x, int y, BC_FileBox *filebox);
117 int handle_event();
118 BC_FileBox *filebox;
121 class BC_FileBoxFilterMenu : public BC_ListBox
123 public:
124 BC_FileBoxFilterMenu(int x, int y, BC_FileBox *filebox);
125 int handle_event();
126 BC_FileBox *filebox;
129 class BC_FileBoxIcons : public BC_Button
131 public:
132 BC_FileBoxIcons(int x, int y, BC_FileBox *filebox);
133 int handle_event();
134 BC_FileBox *filebox;
137 class BC_FileBoxNewfolder : public BC_Button
139 public:
140 BC_FileBoxNewfolder(int x, int y, BC_FileBox *filebox);
141 int handle_event();
142 BC_FileBox *filebox;
145 class BC_FileBoxUpdir : public BC_Button
147 public:
148 BC_FileBoxUpdir(int x, int y, BC_FileBox *filebox);
149 int handle_event();
150 BC_FileBox *filebox;
151 char string[BCTEXTLEN];
156 class BC_FileBox : public BC_Window
158 public:
159 BC_FileBox(int x,
160 int y,
161 char *init_path,
162 char *title,
163 char *caption,
164 // Set to 1 to get hidden files.
165 int show_all_files = 0,
166 // Want only directories
167 int want_directory = 0,
168 int multiple_files = 0,
169 int h_padding = 0);
170 BC_FileBox(int x,
171 int y,
172 int w,
173 int h,
174 char *init_path,
175 char *title,
176 char *caption,
177 // Set to 1 to get hidden files.
178 int show_all_files = 0,
179 // Want only directories
180 int want_directory = 0,
181 int multiple_files = 0,
182 int h_padding = 0);
183 virtual ~BC_FileBox();
185 friend class BC_FileBoxCancel;
186 friend class BC_FileBoxListBox;
187 friend class BC_FileBoxTextBox;
188 friend class BC_FileBoxText;
189 friend class BC_FileBoxIcons;
190 friend class BC_FileBoxNewfolder;
191 friend class BC_FileBoxOK;
192 friend class BC_NewFolderThread;
193 friend class BC_FileBoxUpdir;
194 friend class BC_FileBoxFilterText;
195 friend class BC_FileBoxFilterMenu;
196 friend class BC_FileBoxUseThis;
198 virtual int create_objects();
199 virtual int keypress_event();
200 virtual int close_event();
202 int refresh();
204 // Give the most recently selected path
205 char* get_path();
206 // Give the path of any selected item or 0
207 char* get_path(int selection);
208 int update_filter(char *filter);
209 virtual int resize_event(int w, int h);
210 char* get_newfolder_title();
212 private:
213 int create_icons();
214 int create_tables();
215 int delete_tables();
216 int submit_file(char *path, int return_value, int use_this = 0);
217 int get_display_mode();
218 int get_listbox_w();
219 int get_listbox_h(int y);
220 void create_listbox(int x, int y, int mode);
221 BC_Pixmap* get_icon(char *path, int is_dir); // Get the icon number for a listbox
223 BC_Pixmap *icons[TOTAL_ICONS];
224 FileSystem *fs;
225 BC_FileBoxTextBox *textbox;
226 BC_FileBoxListBox *listbox;
227 BC_FileBoxFilterText *filter_text;
228 BC_FileBoxFilterMenu *filter_popup;
229 BC_Title *directory_title;
230 BC_Button *icon_button, *text_button, *folder_button, *updir_button;
231 BC_Button *ok_button, *cancel_button;
232 BC_FileBoxUseThis *usethis_button;
233 char caption[BCTEXTLEN];
234 char path[BCTEXTLEN];
235 char directory[BCTEXTLEN];
236 char filename[BCTEXTLEN];
237 char string[BCTEXTLEN];
238 int want_directory;
239 int select_multiple;
240 static char *column_titles[FILEBOX_COLUMNS];
241 int column_width[FILEBOX_COLUMNS];
242 ArrayList<BC_ListBoxItem*> list_column[FILEBOX_COLUMNS];
243 ArrayList<BC_ListBoxItem*> filter_list;
244 char new_folder_title[BCTEXTLEN];
245 BC_NewFolderThread *newfolder_thread;
246 int h_padding;
249 #endif