5 #include "bcfilebox.inc"
7 #include "bclistboxitem.inc"
8 #include "bcresources.inc"
11 #include "filesystem.inc"
16 #define FILEBOX_LIST 0
17 #define FILEBOX_ICONS 1
19 #define FILEBOX_COLUMNS 2
21 class BC_NewFolder
: public BC_Window
24 BC_NewFolder(int x
, int y
, BC_FileBox
*filebox
);
34 class BC_NewFolderThread
: public Thread
37 BC_NewFolderThread(BC_FileBox
*filebox
);
38 ~BC_NewFolderThread();
42 int start_new_folder();
45 Mutex change_lock
, completion_lock
;
50 class BC_FileBoxListBox
: public BC_ListBox
53 BC_FileBoxListBox(int x
, int y
, BC_FileBox
*filebox
);
54 virtual ~BC_FileBoxListBox();
57 int selection_changed();
58 int evaluate_query(int list_item
, char *string
);
63 class BC_FileBoxTextBox
: public BC_TextBox
66 BC_FileBoxTextBox(int x
, int y
, BC_FileBox
*filebox
);
73 class BC_FileBoxOK
: public BC_OKButton
76 BC_FileBoxOK(BC_FileBox
*filebox
);
84 class BC_FileBoxUseThis
: public BC_Button
87 BC_FileBoxUseThis(BC_FileBox
*filebox
);
94 class BC_FileBoxCancel
: public BC_CancelButton
97 BC_FileBoxCancel(BC_FileBox
*filebox
);
105 class BC_FileBoxText
: public BC_Button
108 BC_FileBoxText(int x
, int y
, BC_FileBox
*filebox
);
113 class BC_FileBoxFilterText
: public BC_TextBox
116 BC_FileBoxFilterText(int x
, int y
, BC_FileBox
*filebox
);
121 class BC_FileBoxFilterMenu
: public BC_ListBox
124 BC_FileBoxFilterMenu(int x
, int y
, BC_FileBox
*filebox
);
129 class BC_FileBoxIcons
: public BC_Button
132 BC_FileBoxIcons(int x
, int y
, BC_FileBox
*filebox
);
137 class BC_FileBoxNewfolder
: public BC_Button
140 BC_FileBoxNewfolder(int x
, int y
, BC_FileBox
*filebox
);
145 class BC_FileBoxUpdir
: public BC_Button
148 BC_FileBoxUpdir(int x
, int y
, BC_FileBox
*filebox
);
151 char string
[BCTEXTLEN
];
156 class BC_FileBox
: public BC_Window
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,
177 // Set to 1 to get hidden files.
178 int show_all_files
= 0,
179 // Want only directories
180 int want_directory
= 0,
181 int multiple_files
= 0,
183 virtual ~BC_FileBox();
185 friend class BC_FileBoxCancel
;
186 friend class BC_FileBoxListBox
;
187 friend class BC_FileBoxTextBox
;
188 friend class BC_FileBoxText
;
189 friend class BC_FileBoxIcons
;
190 friend class BC_FileBoxNewfolder
;
191 friend class BC_FileBoxOK
;
192 friend class BC_NewFolderThread
;
193 friend class BC_FileBoxUpdir
;
194 friend class BC_FileBoxFilterText
;
195 friend class BC_FileBoxFilterMenu
;
196 friend class BC_FileBoxUseThis
;
198 virtual int create_objects();
199 virtual int keypress_event();
200 virtual int close_event();
204 // Give the most recently selected path
206 // Give the path of any selected item or 0
207 char* get_path(int selection
);
208 int update_filter(char *filter
);
209 virtual int resize_event(int w
, int h
);
210 char* get_newfolder_title();
216 int submit_file(char *path
, int return_value
, int use_this
= 0);
217 int get_display_mode();
219 int get_listbox_h(int y
);
220 void create_listbox(int x
, int y
, int mode
);
221 BC_Pixmap
* get_icon(char *path
, int is_dir
); // Get the icon number for a listbox
223 BC_Pixmap
*icons
[TOTAL_ICONS
];
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 path
[BCTEXTLEN
];
235 char directory
[BCTEXTLEN
];
236 char filename
[BCTEXTLEN
];
237 char string
[BCTEXTLEN
];
240 static char *column_titles
[FILEBOX_COLUMNS
];
241 int column_width
[FILEBOX_COLUMNS
];
242 ArrayList
<BC_ListBoxItem
*> list_column
[FILEBOX_COLUMNS
];
243 ArrayList
<BC_ListBoxItem
*> filter_list
;
244 char new_folder_title
[BCTEXTLEN
];
245 BC_NewFolderThread
*newfolder_thread
;