5 #include "bcfilebox.inc"
6 #include "bclistbox.inc"
7 #include "bclistboxitem.inc"
8 #include "bcresources.inc"
11 #include "filesystem.inc"
16 class BC_NewFolder
: public BC_Window
19 BC_NewFolder(int x
, int y
, BC_FileBox
*filebox
);
29 class BC_NewFolderThread
: public Thread
32 BC_NewFolderThread(BC_FileBox
*filebox
);
33 ~BC_NewFolderThread();
37 int start_new_folder();
40 Mutex change_lock
, completion_lock
;
45 class BC_FileBoxListBox
: public BC_ListBox
48 BC_FileBoxListBox(int x
, int y
, BC_FileBox
*filebox
);
49 virtual ~BC_FileBoxListBox();
52 int selection_changed();
53 int column_resize_event();
54 int sort_order_event();
55 int move_column_event();
56 int evaluate_query(int list_item
, char *string
);
61 class BC_FileBoxTextBox
: public BC_TextBox
64 BC_FileBoxTextBox(int x
, int y
, BC_FileBox
*filebox
);
71 class BC_FileBoxOK
: public BC_OKButton
74 BC_FileBoxOK(BC_FileBox
*filebox
);
82 class BC_FileBoxUseThis
: public BC_Button
85 BC_FileBoxUseThis(BC_FileBox
*filebox
);
92 class BC_FileBoxCancel
: public BC_CancelButton
95 BC_FileBoxCancel(BC_FileBox
*filebox
);
103 class BC_FileBoxText
: public BC_Button
106 BC_FileBoxText(int x
, int y
, BC_FileBox
*filebox
);
111 class BC_FileBoxFilterText
: public BC_TextBox
114 BC_FileBoxFilterText(int x
, int y
, BC_FileBox
*filebox
);
119 class BC_FileBoxFilterMenu
: public BC_ListBox
122 BC_FileBoxFilterMenu(int x
, int y
, BC_FileBox
*filebox
);
127 class BC_FileBoxIcons
: public BC_Button
130 BC_FileBoxIcons(int x
, int y
, BC_FileBox
*filebox
);
135 class BC_FileBoxNewfolder
: public BC_Button
138 BC_FileBoxNewfolder(int x
, int y
, BC_FileBox
*filebox
);
143 class BC_FileBoxUpdir
: public BC_Button
146 BC_FileBoxUpdir(int x
, int y
, BC_FileBox
*filebox
);
149 char string
[BCTEXTLEN
];
154 class BC_FileBox
: public BC_Window
162 // Set to 1 to get hidden files.
163 int show_all_files
= 0,
164 // Want only directories
165 int want_directory
= 0,
166 int multiple_files
= 0,
168 virtual ~BC_FileBox();
170 friend class BC_FileBoxCancel
;
171 friend class BC_FileBoxListBox
;
172 friend class BC_FileBoxTextBox
;
173 friend class BC_FileBoxText
;
174 friend class BC_FileBoxIcons
;
175 friend class BC_FileBoxNewfolder
;
176 friend class BC_FileBoxOK
;
177 friend class BC_NewFolderThread
;
178 friend class BC_FileBoxUpdir
;
179 friend class BC_FileBoxFilterText
;
180 friend class BC_FileBoxFilterMenu
;
181 friend class BC_FileBoxUseThis
;
183 virtual int create_objects();
184 virtual int keypress_event();
185 virtual int close_event();
189 // The OK and Use This button submits a path.
190 // The cancel button has a current path highlighted but possibly different from the
191 // path actually submitted.
192 // Give the most recently submitted path
193 char* get_submitted_path();
194 // Give the path currently highlighted
195 char* get_current_path();
197 // Give the path of any selected item or 0. Used when many items are
198 // selected in the list. Should only be called when OK is pressed.
199 char* get_path(int selection
);
200 int update_filter(char *filter
);
201 virtual int resize_event(int w
, int h
);
202 char* get_newfolder_title();
208 int submit_file(char *path
, int return_value
, int use_this
= 0);
209 // Called by move_column_event
210 void move_column(int src
, int dst
);
211 int get_display_mode();
213 int get_listbox_h(int y
);
214 void create_listbox(int x
, int y
, int mode
);
215 // Get the icon number for a listbox
216 BC_Pixmap
* get_icon(char *path
, int is_dir
);
217 static char* columntype_to_text(int type
);
218 // Get the column whose type matches type.
219 int column_of_type(int type
);
221 BC_Pixmap
*icons
[TOTAL_ICONS
];
223 BC_FileBoxTextBox
*textbox
;
224 BC_FileBoxListBox
*listbox
;
225 BC_FileBoxFilterText
*filter_text
;
226 BC_FileBoxFilterMenu
*filter_popup
;
227 BC_Title
*directory_title
;
228 BC_Button
*icon_button
, *text_button
, *folder_button
, *updir_button
;
229 BC_Button
*ok_button
, *cancel_button
;
230 BC_FileBoxUseThis
*usethis_button
;
231 char caption
[BCTEXTLEN
];
232 char current_path
[BCTEXTLEN
];
233 char submitted_path
[BCTEXTLEN
];
234 char directory
[BCTEXTLEN
];
235 char filename
[BCTEXTLEN
];
236 char string
[BCTEXTLEN
];
243 char *column_titles
[FILEBOX_COLUMNS
];
244 ArrayList
<BC_ListBoxItem
*> filter_list
;
245 ArrayList
<BC_ListBoxItem
*> *list_column
;
249 char new_folder_title
[BCTEXTLEN
];
250 BC_NewFolderThread
*newfolder_thread
;