5 #include "bcfilebox.inc"
6 #include "bclistbox.inc"
7 #include "bclistboxitem.inc"
8 #include "bcresources.inc"
11 #include "condition.inc"
12 #include "filesystem.inc"
15 #include "bcrecentlist.h"
18 class BC_NewFolder
: public BC_Window
21 BC_NewFolder(int x
, int y
, BC_FileBox
*filebox
);
31 class BC_NewFolderThread
: public Thread
34 BC_NewFolderThread(BC_FileBox
*filebox
);
35 ~BC_NewFolderThread();
39 int start_new_folder();
43 Condition
*completion_lock
;
48 class BC_FileBoxListBox
: public BC_ListBox
51 BC_FileBoxListBox(int x
, int y
, BC_FileBox
*filebox
);
52 virtual ~BC_FileBoxListBox();
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
);
64 class BC_FileBoxTextBox
: public BC_TextBox
67 BC_FileBoxTextBox(int x
, int y
, BC_FileBox
*filebox
);
74 class BC_FileBoxOK
: public BC_OKButton
77 BC_FileBoxOK(BC_FileBox
*filebox
);
85 class BC_FileBoxUseThis
: public BC_Button
88 BC_FileBoxUseThis(BC_FileBox
*filebox
);
95 class BC_FileBoxCancel
: public BC_CancelButton
98 BC_FileBoxCancel(BC_FileBox
*filebox
);
106 class BC_FileBoxText
: public BC_Button
109 BC_FileBoxText(int x
, int y
, BC_FileBox
*filebox
);
114 class BC_FileBoxFilterText
: public BC_TextBox
117 BC_FileBoxFilterText(int x
, int y
, BC_FileBox
*filebox
);
122 class BC_FileBoxFilterMenu
: public BC_ListBox
125 BC_FileBoxFilterMenu(int x
, int y
, BC_FileBox
*filebox
);
130 class BC_FileBoxIcons
: public BC_Button
133 BC_FileBoxIcons(int x
, int y
, BC_FileBox
*filebox
);
138 class BC_FileBoxNewfolder
: public BC_Button
141 BC_FileBoxNewfolder(int x
, int y
, BC_FileBox
*filebox
);
146 class BC_FileBoxUpdir
: public BC_Button
149 BC_FileBoxUpdir(int x
, int y
, BC_FileBox
*filebox
);
152 char string
[BCTEXTLEN
];
157 class BC_FileBox
: public BC_Window
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,
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();
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();
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();
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
];
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
];
251 char *column_titles
[FILEBOX_COLUMNS
];
252 ArrayList
<BC_ListBoxItem
*> filter_list
;
253 ArrayList
<BC_ListBoxItem
*> *list_column
;
257 char new_folder_title
[BCTEXTLEN
];
258 BC_NewFolderThread
*newfolder_thread
;
261 const char *recent_prefix
;