r199: This commit was manufactured by cvs2svn to create tag 'hv_1_1_9'.
[cinelerra_cv/ct.git] / hvirtual / guicast / bcfilebox.h
blob570674d85872de2342e6b1db8b10e7ad0aed42c2
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 "filesystem.inc"
12 #include "mutex.h"
13 #include "thread.h"
16 class BC_NewFolder : public BC_Window
18 public:
19 BC_NewFolder(int x, int y, BC_FileBox *filebox);
20 ~BC_NewFolder();
22 int create_objects();
23 char* get_text();
25 private:
26 BC_TextBox *textbox;
29 class BC_NewFolderThread : public Thread
31 public:
32 BC_NewFolderThread(BC_FileBox *filebox);
33 ~BC_NewFolderThread();
35 void run();
36 int interrupt();
37 int start_new_folder();
39 private:
40 Mutex change_lock, completion_lock;
41 BC_FileBox *filebox;
42 BC_NewFolder *window;
45 class BC_FileBoxListBox : public BC_ListBox
47 public:
48 BC_FileBoxListBox(int x, int y, BC_FileBox *filebox);
49 virtual ~BC_FileBoxListBox();
51 int handle_event();
52 int selection_changed();
53 int column_resize_event();
54 int sort_order_event();
55 int move_column_event();
56 int evaluate_query(int list_item, char *string);
58 BC_FileBox *filebox;
61 class BC_FileBoxTextBox : public BC_TextBox
63 public:
64 BC_FileBoxTextBox(int x, int y, BC_FileBox *filebox);
65 ~BC_FileBoxTextBox();
67 int handle_event();
68 BC_FileBox *filebox;
71 class BC_FileBoxOK : public BC_OKButton
73 public:
74 BC_FileBoxOK(BC_FileBox *filebox);
75 ~BC_FileBoxOK();
77 int handle_event();
79 BC_FileBox *filebox;
82 class BC_FileBoxUseThis : public BC_Button
84 public:
85 BC_FileBoxUseThis(BC_FileBox *filebox);
86 ~BC_FileBoxUseThis();
87 int handle_event();
89 BC_FileBox *filebox;
92 class BC_FileBoxCancel : public BC_CancelButton
94 public:
95 BC_FileBoxCancel(BC_FileBox *filebox);
96 ~BC_FileBoxCancel();
98 int handle_event();
100 BC_FileBox *filebox;
103 class BC_FileBoxText : public BC_Button
105 public:
106 BC_FileBoxText(int x, int y, BC_FileBox *filebox);
107 int handle_event();
108 BC_FileBox *filebox;
111 class BC_FileBoxFilterText : public BC_TextBox
113 public:
114 BC_FileBoxFilterText(int x, int y, BC_FileBox *filebox);
115 int handle_event();
116 BC_FileBox *filebox;
119 class BC_FileBoxFilterMenu : public BC_ListBox
121 public:
122 BC_FileBoxFilterMenu(int x, int y, BC_FileBox *filebox);
123 int handle_event();
124 BC_FileBox *filebox;
127 class BC_FileBoxIcons : public BC_Button
129 public:
130 BC_FileBoxIcons(int x, int y, BC_FileBox *filebox);
131 int handle_event();
132 BC_FileBox *filebox;
135 class BC_FileBoxNewfolder : public BC_Button
137 public:
138 BC_FileBoxNewfolder(int x, int y, BC_FileBox *filebox);
139 int handle_event();
140 BC_FileBox *filebox;
143 class BC_FileBoxUpdir : public BC_Button
145 public:
146 BC_FileBoxUpdir(int x, int y, BC_FileBox *filebox);
147 int handle_event();
148 BC_FileBox *filebox;
149 char string[BCTEXTLEN];
154 class BC_FileBox : public BC_Window
156 public:
157 BC_FileBox(int x,
158 int y,
159 char *init_path,
160 char *title,
161 char *caption,
162 // Set to 1 to get hidden files.
163 int show_all_files = 0,
164 // Want only directories
165 int want_directory = 0,
166 int multiple_files = 0,
167 int h_padding = 0);
168 virtual ~BC_FileBox();
170 friend class BC_FileBoxCancel;
171 friend class BC_FileBoxListBox;
172 friend class BC_FileBoxTextBox;
173 friend class BC_FileBoxText;
174 friend class BC_FileBoxIcons;
175 friend class BC_FileBoxNewfolder;
176 friend class BC_FileBoxOK;
177 friend class BC_NewFolderThread;
178 friend class BC_FileBoxUpdir;
179 friend class BC_FileBoxFilterText;
180 friend class BC_FileBoxFilterMenu;
181 friend class BC_FileBoxUseThis;
183 virtual int create_objects();
184 virtual int keypress_event();
185 virtual int close_event();
187 int refresh();
189 // The OK and Use This button submits a path.
190 // The cancel button has a current path highlighted but possibly different from the
191 // path actually submitted.
192 // Give the most recently submitted path
193 char* get_submitted_path();
194 // Give the path currently highlighted
195 char* get_current_path();
197 // Give the path of any selected item or 0. Used when many items are
198 // selected in the list. Should only be called when OK is pressed.
199 char* get_path(int selection);
200 int update_filter(char *filter);
201 virtual int resize_event(int w, int h);
202 char* get_newfolder_title();
204 private:
205 int create_icons();
206 int create_tables();
207 int delete_tables();
208 int submit_file(char *path, int return_value, int use_this = 0);
209 // Called by move_column_event
210 void move_column(int src, int dst);
211 int get_display_mode();
212 int get_listbox_w();
213 int get_listbox_h(int y);
214 void create_listbox(int x, int y, int mode);
215 // Get the icon number for a listbox
216 BC_Pixmap* get_icon(char *path, int is_dir);
217 static char* columntype_to_text(int type);
218 // Get the column whose type matches type.
219 int column_of_type(int type);
221 BC_Pixmap *icons[TOTAL_ICONS];
222 FileSystem *fs;
223 BC_FileBoxTextBox *textbox;
224 BC_FileBoxListBox *listbox;
225 BC_FileBoxFilterText *filter_text;
226 BC_FileBoxFilterMenu *filter_popup;
227 BC_Title *directory_title;
228 BC_Button *icon_button, *text_button, *folder_button, *updir_button;
229 BC_Button *ok_button, *cancel_button;
230 BC_FileBoxUseThis *usethis_button;
231 char caption[BCTEXTLEN];
232 char current_path[BCTEXTLEN];
233 char submitted_path[BCTEXTLEN];
234 char directory[BCTEXTLEN];
235 char filename[BCTEXTLEN];
236 char string[BCTEXTLEN];
237 int want_directory;
238 int select_multiple;
240 int sort_column;
241 int sort_order;
243 char *column_titles[FILEBOX_COLUMNS];
244 ArrayList<BC_ListBoxItem*> filter_list;
245 ArrayList<BC_ListBoxItem*> *list_column;
246 int *column_type;
247 int *column_width;
249 char new_folder_title[BCTEXTLEN];
250 BC_NewFolderThread *newfolder_thread;
251 int h_padding;
254 #endif