5 #include "bcfilebox.inc"
6 #include "bclistbox.inc"
7 #include "bclistboxitem.inc"
8 #include "bcresources.inc"
11 #include "condition.inc"
12 #include "filesystem.inc"
17 class BC_NewFolder
: public BC_Window
20 BC_NewFolder(int x
, int y
, BC_FileBox
*filebox
);
30 class BC_NewFolderThread
: public Thread
33 BC_NewFolderThread(BC_FileBox
*filebox
);
34 ~BC_NewFolderThread();
38 int start_new_folder();
42 Condition
*completion_lock
;
47 class BC_FileBoxListBox
: public BC_ListBox
50 BC_FileBoxListBox(int x
, int y
, BC_FileBox
*filebox
);
51 virtual ~BC_FileBoxListBox();
54 int selection_changed();
55 int column_resize_event();
56 int sort_order_event();
57 int move_column_event();
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,
170 virtual ~BC_FileBox();
172 friend class BC_FileBoxCancel
;
173 friend class BC_FileBoxListBox
;
174 friend class BC_FileBoxTextBox
;
175 friend class BC_FileBoxText
;
176 friend class BC_FileBoxIcons
;
177 friend class BC_FileBoxNewfolder
;
178 friend class BC_FileBoxOK
;
179 friend class BC_NewFolderThread
;
180 friend class BC_FileBoxUpdir
;
181 friend class BC_FileBoxFilterText
;
182 friend class BC_FileBoxFilterMenu
;
183 friend class BC_FileBoxUseThis
;
185 virtual int create_objects();
186 virtual int keypress_event();
187 virtual int close_event();
191 // The OK and Use This button submits a path.
192 // The cancel button has a current path highlighted but possibly different from the
193 // path actually submitted.
194 // Give the most recently submitted path
195 char* get_submitted_path();
196 // Give the path currently highlighted
197 char* get_current_path();
199 // Give the path of any selected item or 0. Used when many items are
200 // selected in the list. Should only be called when OK is pressed.
201 char* get_path(int selection
);
202 int update_filter(char *filter
);
203 virtual int resize_event(int w
, int h
);
204 char* get_newfolder_title();
210 int submit_file(char *path
, int return_value
, int use_this
= 0);
211 // Called by move_column_event
212 void move_column(int src
, int dst
);
213 int get_display_mode();
215 int get_listbox_h(int y
);
216 void create_listbox(int x
, int y
, int mode
);
217 // Get the icon number for a listbox
218 BC_Pixmap
* get_icon(char *path
, int is_dir
);
219 static char* columntype_to_text(int type
);
220 // Get the column whose type matches type.
221 int column_of_type(int type
);
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 current_path
[BCTEXTLEN
];
235 char submitted_path
[BCTEXTLEN
];
236 char directory
[BCTEXTLEN
];
237 char filename
[BCTEXTLEN
];
238 char string
[BCTEXTLEN
];
245 char *column_titles
[FILEBOX_COLUMNS
];
246 ArrayList
<BC_ListBoxItem
*> filter_list
;
247 ArrayList
<BC_ListBoxItem
*> *list_column
;
251 char new_folder_title
[BCTEXTLEN
];
252 BC_NewFolderThread
*newfolder_thread
;