r370: Heroine Virutal's official release 1.2.1
[cinelerra_cv/mob.git] / hvirtual / guicast / bcfilebox.h
blob7f7b9482fe6f8a46450373667fa94238aee0c8c2
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"
17 class BC_NewFolder : public BC_Window
19 public:
20 BC_NewFolder(int x, int y, BC_FileBox *filebox);
21 ~BC_NewFolder();
23 int create_objects();
24 char* get_text();
26 private:
27 BC_TextBox *textbox;
30 class BC_NewFolderThread : public Thread
32 public:
33 BC_NewFolderThread(BC_FileBox *filebox);
34 ~BC_NewFolderThread();
36 void run();
37 int interrupt();
38 int start_new_folder();
40 private:
41 Mutex *change_lock;
42 Condition *completion_lock;
43 BC_FileBox *filebox;
44 BC_NewFolder *window;
47 class BC_FileBoxListBox : public BC_ListBox
49 public:
50 BC_FileBoxListBox(int x, int y, BC_FileBox *filebox);
51 virtual ~BC_FileBoxListBox();
53 int handle_event();
54 int selection_changed();
55 int column_resize_event();
56 int sort_order_event();
57 int move_column_event();
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 virtual ~BC_FileBox();
172 friend class BC_FileBoxCancel;
173 friend class BC_FileBoxListBox;
174 friend class BC_FileBoxTextBox;
175 friend class BC_FileBoxText;
176 friend class BC_FileBoxIcons;
177 friend class BC_FileBoxNewfolder;
178 friend class BC_FileBoxOK;
179 friend class BC_NewFolderThread;
180 friend class BC_FileBoxUpdir;
181 friend class BC_FileBoxFilterText;
182 friend class BC_FileBoxFilterMenu;
183 friend class BC_FileBoxUseThis;
185 virtual int create_objects();
186 virtual int keypress_event();
187 virtual int close_event();
189 int refresh();
191 // The OK and Use This button submits a path.
192 // The cancel button has a current path highlighted but possibly different from the
193 // path actually submitted.
194 // Give the most recently submitted path
195 char* get_submitted_path();
196 // Give the path currently highlighted
197 char* get_current_path();
199 // Give the path of any selected item or 0. Used when many items are
200 // selected in the list. Should only be called when OK is pressed.
201 char* get_path(int selection);
202 int update_filter(char *filter);
203 virtual int resize_event(int w, int h);
204 char* get_newfolder_title();
206 private:
207 int create_icons();
208 int create_tables();
209 int delete_tables();
210 int submit_file(char *path, int return_value, int use_this = 0);
211 // Called by move_column_event
212 void move_column(int src, int dst);
213 int get_display_mode();
214 int get_listbox_w();
215 int get_listbox_h(int y);
216 void create_listbox(int x, int y, int mode);
217 // Get the icon number for a listbox
218 BC_Pixmap* get_icon(char *path, int is_dir);
219 static char* columntype_to_text(int type);
220 // Get the column whose type matches type.
221 int column_of_type(int type);
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 current_path[BCTEXTLEN];
235 char submitted_path[BCTEXTLEN];
236 char directory[BCTEXTLEN];
237 char filename[BCTEXTLEN];
238 char string[BCTEXTLEN];
239 int want_directory;
240 int select_multiple;
242 int sort_column;
243 int sort_order;
245 char *column_titles[FILEBOX_COLUMNS];
246 ArrayList<BC_ListBoxItem*> filter_list;
247 ArrayList<BC_ListBoxItem*> *list_column;
248 int *column_type;
249 int *column_width;
251 char new_folder_title[BCTEXTLEN];
252 BC_NewFolderThread *newfolder_thread;
253 int h_padding;
256 #endif