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"
13 #include "condition.inc"
14 #include "filesystem.inc"
33 class BC_FileBoxListBox
: public BC_ListBox
36 BC_FileBoxListBox(int x
, int y
, BC_FileBox
*filebox
);
37 virtual ~BC_FileBoxListBox();
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
);
49 class BC_FileBoxTextBox
: public BC_TextBox
52 BC_FileBoxTextBox(int x
, int y
, BC_FileBox
*filebox
);
59 class BC_FileBoxOK
: public BC_OKButton
62 BC_FileBoxOK(BC_FileBox
*filebox
);
70 class BC_FileBoxUseThis
: public BC_Button
73 BC_FileBoxUseThis(BC_FileBox
*filebox
);
80 class BC_FileBoxCancel
: public BC_CancelButton
83 BC_FileBoxCancel(BC_FileBox
*filebox
);
91 class BC_FileBoxText
: public BC_Button
94 BC_FileBoxText(int x
, int y
, BC_FileBox
*filebox
);
99 class BC_FileBoxDirectoryText
: public BC_TextBox
102 BC_FileBoxDirectoryText(int x
, int y
, BC_FileBox
*filebox
);
107 class BC_FileBoxFilterText
: public BC_TextBox
110 BC_FileBoxFilterText(int x
, int y
, BC_FileBox
*filebox
);
115 class BC_FileBoxFilterMenu
: public BC_ListBox
118 BC_FileBoxFilterMenu(int x
, int y
, BC_FileBox
*filebox
);
123 class BC_FileBoxIcons
: public BC_Button
126 BC_FileBoxIcons(int x
, int y
, BC_FileBox
*filebox
);
131 class BC_FileBoxNewfolder
: public BC_Button
134 BC_FileBoxNewfolder(int x
, int y
, BC_FileBox
*filebox
);
139 class BC_FileBoxUpdir
: public BC_Button
142 BC_FileBoxUpdir(int x
, int y
, BC_FileBox
*filebox
);
145 char string
[BCTEXTLEN
];
148 class BC_FileBoxDelete
: public BC_Button
151 BC_FileBoxDelete(int x
, int y
, BC_FileBox
*filebox
);
156 class BC_FileBoxReload
: public BC_Button
159 BC_FileBoxReload(int x
, int y
, BC_FileBox
*filebox
);
166 class BC_FileBoxRecent
: public BC_ListBox
169 BC_FileBoxRecent(BC_FileBox
*filebox
, int x
, int y
);
177 class BC_FileBox
: public BC_Window
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,
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();
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();
237 BC_Button
* get_ok_button();
238 BC_Button
* get_cancel_button();
243 int extract_extension(char *out
, const char *in
);
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();
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
];
284 char *column_titles
[FILEBOX_COLUMNS
];
285 ArrayList
<BC_ListBoxItem
*> filter_list
;
286 ArrayList
<BC_ListBoxItem
*> *list_column
;
289 // Calculated based on directory or regular file searching
292 char new_folder_title
[BCTEXTLEN
];
293 BC_NewFolderThread
*newfolder_thread
;
294 BC_DeleteThread
*delete_thread
;
296 ArrayList
<BC_ListBoxItem
*> recent_dirs
;