add formatting trailer for emacs
[cinelerra_cv/ct.git] / guicast / bcfilebox.h
blob5abb3f0de9eca72c5250b06abdf1f4a657417efd
1 #ifndef BCFILEBOX_H
2 #define BCFILEBOX_H
4 #include "bcbutton.h"
5 #include "bcdelete.inc"
6 #include "bcfilebox.inc"
7 #include "bclistbox.inc"
8 #include "bclistboxitem.inc"
9 #include "bcnewfolder.inc"
10 #include "bcresources.inc"
11 #include "bctextbox.h"
12 #include "bcwindow.h"
13 #include "condition.inc"
14 #include "filesystem.inc"
15 #include "mutex.inc"
16 #include "thread.h"
33 class BC_FileBoxListBox : public BC_ListBox
35 public:
36 BC_FileBoxListBox(int x, int y, BC_FileBox *filebox);
37 virtual ~BC_FileBoxListBox();
39 int handle_event();
40 int selection_changed();
41 int column_resize_event();
42 int sort_order_event();
43 int move_column_event();
44 int evaluate_query(int list_item, char *string);
46 BC_FileBox *filebox;
49 class BC_FileBoxTextBox : public BC_TextBox
51 public:
52 BC_FileBoxTextBox(int x, int y, BC_FileBox *filebox);
53 ~BC_FileBoxTextBox();
55 int handle_event();
56 BC_FileBox *filebox;
59 class BC_FileBoxOK : public BC_OKButton
61 public:
62 BC_FileBoxOK(BC_FileBox *filebox);
63 ~BC_FileBoxOK();
65 int handle_event();
67 BC_FileBox *filebox;
70 class BC_FileBoxUseThis : public BC_Button
72 public:
73 BC_FileBoxUseThis(BC_FileBox *filebox);
74 ~BC_FileBoxUseThis();
75 int handle_event();
77 BC_FileBox *filebox;
80 class BC_FileBoxCancel : public BC_CancelButton
82 public:
83 BC_FileBoxCancel(BC_FileBox *filebox);
84 ~BC_FileBoxCancel();
86 int handle_event();
88 BC_FileBox *filebox;
91 class BC_FileBoxText : public BC_Button
93 public:
94 BC_FileBoxText(int x, int y, BC_FileBox *filebox);
95 int handle_event();
96 BC_FileBox *filebox;
99 class BC_FileBoxDirectoryText : public BC_TextBox
101 public:
102 BC_FileBoxDirectoryText(int x, int y, BC_FileBox *filebox);
103 int handle_event();
104 BC_FileBox *filebox;
107 class BC_FileBoxFilterText : public BC_TextBox
109 public:
110 BC_FileBoxFilterText(int x, int y, BC_FileBox *filebox);
111 int handle_event();
112 BC_FileBox *filebox;
115 class BC_FileBoxFilterMenu : public BC_ListBox
117 public:
118 BC_FileBoxFilterMenu(int x, int y, BC_FileBox *filebox);
119 int handle_event();
120 BC_FileBox *filebox;
123 class BC_FileBoxIcons : public BC_Button
125 public:
126 BC_FileBoxIcons(int x, int y, BC_FileBox *filebox);
127 int handle_event();
128 BC_FileBox *filebox;
131 class BC_FileBoxNewfolder : public BC_Button
133 public:
134 BC_FileBoxNewfolder(int x, int y, BC_FileBox *filebox);
135 int handle_event();
136 BC_FileBox *filebox;
139 class BC_FileBoxUpdir : public BC_Button
141 public:
142 BC_FileBoxUpdir(int x, int y, BC_FileBox *filebox);
143 int handle_event();
144 BC_FileBox *filebox;
145 char string[BCTEXTLEN];
148 class BC_FileBoxDelete : public BC_Button
150 public:
151 BC_FileBoxDelete(int x, int y, BC_FileBox *filebox);
152 int handle_event();
153 BC_FileBox *filebox;
156 class BC_FileBoxReload : public BC_Button
158 public:
159 BC_FileBoxReload(int x, int y, BC_FileBox *filebox);
160 int handle_event();
161 BC_FileBox *filebox;
166 class BC_FileBoxRecent : public BC_ListBox
168 public:
169 BC_FileBoxRecent(BC_FileBox *filebox, int x, int y);
170 int handle_event();
171 BC_FileBox *filebox;
177 class BC_FileBox : public BC_Window
179 public:
180 BC_FileBox(int x,
181 int y,
182 char *init_path,
183 char *title,
184 char *caption,
185 // Set to 1 to get hidden files.
186 int show_all_files = 0,
187 // Want only directories
188 int want_directory = 0,
189 int multiple_files = 0,
190 int h_padding = -1);
191 virtual ~BC_FileBox();
193 friend class BC_FileBoxCancel;
194 friend class BC_FileBoxListBox;
195 friend class BC_FileBoxTextBox;
196 friend class BC_FileBoxText;
197 friend class BC_FileBoxIcons;
198 friend class BC_FileBoxNewfolder;
199 friend class BC_FileBoxOK;
200 friend class BC_NewFolderThread;
201 friend class BC_FileBoxUpdir;
202 friend class BC_FileBoxFilterText;
203 friend class BC_FileBoxFilterMenu;
204 friend class BC_FileBoxUseThis;
205 friend class BC_DeleteThread;
206 friend class BC_FileBoxDelete;
207 friend class BC_FileBoxReload;
208 friend class BC_FileBoxRecent;
210 virtual int create_objects();
211 virtual int keypress_event();
212 virtual int close_event();
213 // When file is submitted this is called for the user to retrieve it before the
214 // window is deleted.
215 virtual int handle_event();
217 void create_history();
218 void update_history();
219 int refresh();
221 // The OK and Use This button submits a path.
222 // The cancel button has a current path highlighted but possibly different from the
223 // path actually submitted.
224 // Give the most recently submitted path
225 char* get_submitted_path();
226 // Give the path currently highlighted
227 char* get_current_path();
229 // Give the path of any selected item or 0. Used when many items are
230 // selected in the list. Should only be called when OK is pressed.
231 char* get_path(int selection);
232 int update_filter(char *filter);
233 virtual int resize_event(int w, int h);
234 char* get_newfolder_title();
235 char* get_delete_title();
236 void delete_files();
237 BC_Button* get_ok_button();
238 BC_Button* get_cancel_button();
239 FileSystem *fs;
241 private:
242 int create_icons();
243 int extract_extension(char *out, const char *in);
244 int create_tables();
245 int delete_tables();
246 // Called by directory history menu to change directories but leave
247 // filename untouched.
248 int submit_dir(char *dir);
249 int submit_file(char *path, int use_this = 0);
250 // Called by move_column_event
251 void move_column(int src, int dst);
252 int get_display_mode();
253 int get_listbox_w();
254 int get_listbox_h(int y);
255 void create_listbox(int x, int y, int mode);
256 // Get the icon number for a listbox
257 BC_Pixmap* get_icon(char *path, int is_dir);
258 static char* columntype_to_text(int type);
259 // Get the column whose type matches type.
260 int column_of_type(int type);
262 BC_Pixmap *icons[TOTAL_ICONS];
263 BC_FileBoxRecent *recent_popup;
264 BC_FileBoxTextBox *textbox;
265 BC_FileBoxListBox *listbox;
266 BC_FileBoxFilterText *filter_text;
267 BC_FileBoxFilterMenu *filter_popup;
268 BC_TextBox *directory_title;
269 BC_Button *icon_button, *text_button, *folder_button, *updir_button, *delete_button, *reload_button;
270 BC_Button *ok_button, *cancel_button;
271 BC_FileBoxUseThis *usethis_button;
272 char caption[BCTEXTLEN];
273 char current_path[BCTEXTLEN];
274 char submitted_path[BCTEXTLEN];
275 char directory[BCTEXTLEN];
276 char filename[BCTEXTLEN];
277 char string[BCTEXTLEN];
278 int want_directory;
279 int select_multiple;
281 int sort_column;
282 int sort_order;
284 char *column_titles[FILEBOX_COLUMNS];
285 ArrayList<BC_ListBoxItem*> filter_list;
286 ArrayList<BC_ListBoxItem*> *list_column;
287 int *column_type;
288 int *column_width;
289 // Calculated based on directory or regular file searching
290 int columns;
292 char new_folder_title[BCTEXTLEN];
293 BC_NewFolderThread *newfolder_thread;
294 BC_DeleteThread *delete_thread;
295 int h_padding;
296 ArrayList<BC_ListBoxItem*> recent_dirs;
299 #endif
301 // Local Variables:
302 // mode: C++
303 // c-file-style: "linux"
304 // End: