r499: This commit was manufactured by cvs2svn to create tag 'r1_2_1-last'.
[cinelerra_cv/mob.git] / hvirtual / guicast / bcfilebox.h
blob16e97ca67979de85cc338bae282bccae825759bd
1 #ifndef BCFILEBOX_H
2 #define BCFILEBOX_H
4 #include "bcbutton.h"
5 #include "bcfilebox.inc"
6 #include "bclistbox.inc"
7 #include "bclistboxitem.inc"
8 #include "bcresources.inc"
9 #include "bctextbox.h"
10 #include "bcwindow.h"
11 #include "condition.inc"
12 #include "filesystem.inc"
13 #include "mutex.inc"
14 #include "thread.h"
15 #include "bcrecentlist.h"
16 #include "defaults.h"
18 class BC_NewFolder : public BC_Window
20 public:
21 BC_NewFolder(int x, int y, BC_FileBox *filebox);
22 ~BC_NewFolder();
24 int create_objects();
25 char* get_text();
27 private:
28 BC_TextBox *textbox;
31 class BC_NewFolderThread : public Thread
33 public:
34 BC_NewFolderThread(BC_FileBox *filebox);
35 ~BC_NewFolderThread();
37 void run();
38 int interrupt();
39 int start_new_folder();
41 private:
42 Mutex *change_lock;
43 Condition *completion_lock;
44 BC_FileBox *filebox;
45 BC_NewFolder *window;
48 class BC_FileBoxListBox : public BC_ListBox
50 public:
51 BC_FileBoxListBox(int x, int y, BC_FileBox *filebox);
52 virtual ~BC_FileBoxListBox();
54 int handle_event();
55 int selection_changed();
56 int column_resize_event();
57 int sort_order_event();
58 int move_column_event();
59 int evaluate_query(int list_item, char *string);
61 BC_FileBox *filebox;
64 class BC_FileBoxTextBox : public BC_TextBox
66 public:
67 BC_FileBoxTextBox(int x, int y, BC_FileBox *filebox);
68 ~BC_FileBoxTextBox();
70 int handle_event();
71 BC_FileBox *filebox;
74 class BC_FileBoxOK : public BC_OKButton
76 public:
77 BC_FileBoxOK(BC_FileBox *filebox);
78 ~BC_FileBoxOK();
80 int handle_event();
82 BC_FileBox *filebox;
85 class BC_FileBoxUseThis : public BC_Button
87 public:
88 BC_FileBoxUseThis(BC_FileBox *filebox);
89 ~BC_FileBoxUseThis();
90 int handle_event();
92 BC_FileBox *filebox;
95 class BC_FileBoxCancel : public BC_CancelButton
97 public:
98 BC_FileBoxCancel(BC_FileBox *filebox);
99 ~BC_FileBoxCancel();
101 int handle_event();
103 BC_FileBox *filebox;
106 class BC_FileBoxText : public BC_Button
108 public:
109 BC_FileBoxText(int x, int y, BC_FileBox *filebox);
110 int handle_event();
111 BC_FileBox *filebox;
114 class BC_FileBoxFilterText : public BC_TextBox
116 public:
117 BC_FileBoxFilterText(int x, int y, BC_FileBox *filebox);
118 int handle_event();
119 BC_FileBox *filebox;
122 class BC_FileBoxFilterMenu : public BC_ListBox
124 public:
125 BC_FileBoxFilterMenu(int x, int y, BC_FileBox *filebox);
126 int handle_event();
127 BC_FileBox *filebox;
130 class BC_FileBoxIcons : public BC_Button
132 public:
133 BC_FileBoxIcons(int x, int y, BC_FileBox *filebox);
134 int handle_event();
135 BC_FileBox *filebox;
138 class BC_FileBoxNewfolder : public BC_Button
140 public:
141 BC_FileBoxNewfolder(int x, int y, BC_FileBox *filebox);
142 int handle_event();
143 BC_FileBox *filebox;
146 class BC_FileBoxUpdir : public BC_Button
148 public:
149 BC_FileBoxUpdir(int x, int y, BC_FileBox *filebox);
150 int handle_event();
151 BC_FileBox *filebox;
152 char string[BCTEXTLEN];
157 class BC_FileBox : public BC_Window
159 public:
160 BC_FileBox(int x,
161 int y,
162 char *init_path,
163 char *title,
164 char *caption,
165 Defaults *defaults = NULL,
166 const char *recent_prefix = NULL,
167 // Set to 1 to get hidden files.
168 int show_all_files = 0,
169 // Want only directories
170 int want_directory = 0,
171 int multiple_files = 0,
172 int h_padding = 0
175 virtual ~BC_FileBox();
177 friend class BC_FileBoxCancel;
178 friend class BC_FileBoxListBox;
179 friend class BC_FileBoxTextBox;
180 friend class BC_FileBoxText;
181 friend class BC_FileBoxIcons;
182 friend class BC_FileBoxNewfolder;
183 friend class BC_FileBoxOK;
184 friend class BC_NewFolderThread;
185 friend class BC_FileBoxUpdir;
186 friend class BC_FileBoxFilterText;
187 friend class BC_FileBoxFilterMenu;
188 friend class BC_FileBoxUseThis;
190 virtual int create_objects();
191 virtual int keypress_event();
192 virtual int close_event();
194 int refresh();
196 // The OK and Use This button submits a path.
197 // The cancel button has a current path highlighted but possibly different from the
198 // path actually submitted.
199 // Give the most recently submitted path
200 char* get_submitted_path();
201 // Give the path currently highlighted
202 char* get_current_path();
204 // Give the path of any selected item or 0. Used when many items are
205 // selected in the list. Should only be called when OK is pressed.
206 char* get_path(int selection);
207 int update_filter(char *filter);
208 virtual int resize_event(int w, int h);
209 char* get_newfolder_title();
211 private:
212 int create_icons();
213 int create_tables();
214 int delete_tables();
215 int submit_file(char *path, int return_value, int use_this = 0);
216 // Called by move_column_event
217 void move_column(int src, int dst);
218 int get_display_mode();
219 int get_listbox_w();
220 int get_listbox_h(int y);
221 void create_listbox(int x, int y, int mode);
222 // Get the icon number for a listbox
223 BC_Pixmap* get_icon(char *path, int is_dir);
224 static char* columntype_to_text(int type);
225 // Get the column whose type matches type.
226 int column_of_type(int type);
228 BC_Pixmap *icons[TOTAL_ICONS];
229 FileSystem *fs;
230 BC_FileBoxTextBox *textbox;
231 BC_RecentList *recent;
232 BC_FileBoxListBox *listbox;
233 BC_FileBoxFilterText *filter_text;
234 BC_FileBoxFilterMenu *filter_popup;
235 BC_Title *directory_title;
236 BC_Button *icon_button, *text_button, *folder_button, *updir_button;
237 BC_Button *ok_button, *cancel_button;
238 BC_FileBoxUseThis *usethis_button;
239 char caption[BCTEXTLEN];
240 char current_path[BCTEXTLEN];
241 char submitted_path[BCTEXTLEN];
242 char directory[BCTEXTLEN];
243 char filename[BCTEXTLEN];
244 char string[BCTEXTLEN];
245 int want_directory;
246 int select_multiple;
248 int sort_column;
249 int sort_order;
251 char *column_titles[FILEBOX_COLUMNS];
252 ArrayList<BC_ListBoxItem*> filter_list;
253 ArrayList<BC_ListBoxItem*> *list_column;
254 int *column_type;
255 int *column_width;
257 char new_folder_title[BCTEXTLEN];
258 BC_NewFolderThread *newfolder_thread;
259 int h_padding;
260 Defaults *defaults;
261 const char *recent_prefix;
264 #endif