Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

bcfilebox.h

Go to the documentation of this file.
00001 #ifndef BCFILEBOX_H
00002 #define BCFILEBOX_H
00003 
00004 #include "bcbutton.h"
00005 #include "bcdelete.inc"
00006 #include "bcfilebox.inc"
00007 #include "bclistbox.inc"
00008 #include "bclistboxitem.inc"
00009 #include "bcnewfolder.inc"
00010 #include "bcresources.inc"
00011 #include "bctextbox.h"
00012 #include "bcwindow.h"
00013 #include "condition.inc"
00014 #include "filesystem.inc"
00015 #include "mutex.inc"
00016 #include "thread.h"
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 
00033 class BC_FileBoxListBox : public BC_ListBox
00034 {
00035 public:
00036         BC_FileBoxListBox(int x, int y, BC_FileBox *filebox);
00037         virtual ~BC_FileBoxListBox();
00038 
00039         int handle_event();
00040         int selection_changed();
00041         int column_resize_event();
00042         int sort_order_event();
00043         int move_column_event();
00044         int evaluate_query(int list_item, char *string);
00045 
00046         BC_FileBox *filebox;
00047 };
00048 
00049 class BC_FileBoxTextBox : public BC_TextBox
00050 {
00051 public:
00052         BC_FileBoxTextBox(int x, int y, BC_FileBox *filebox);
00053         ~BC_FileBoxTextBox();
00054 
00055         int handle_event();
00056         BC_FileBox *filebox;
00057 };
00058 
00059 class BC_FileBoxOK : public BC_OKButton
00060 {
00061 public:
00062         BC_FileBoxOK(BC_FileBox *filebox);
00063         ~BC_FileBoxOK();
00064 
00065         int handle_event();
00066 
00067         BC_FileBox *filebox;
00068 };
00069 
00070 class BC_FileBoxUseThis : public BC_Button
00071 {
00072 public:
00073         BC_FileBoxUseThis(BC_FileBox *filebox);
00074         ~BC_FileBoxUseThis();
00075         int handle_event();
00076 
00077         BC_FileBox *filebox;
00078 };
00079 
00080 class BC_FileBoxCancel : public BC_CancelButton
00081 {
00082 public:
00083         BC_FileBoxCancel(BC_FileBox *filebox);
00084         ~BC_FileBoxCancel();
00085 
00086         int handle_event();
00087 
00088         BC_FileBox *filebox;
00089 };
00090 
00091 class BC_FileBoxText : public BC_Button
00092 {
00093 public:
00094         BC_FileBoxText(int x, int y, BC_FileBox *filebox);
00095         int handle_event();
00096         BC_FileBox *filebox;
00097 };
00098 
00099 class BC_FileBoxDirectoryText : public BC_TextBox
00100 {
00101 public:
00102         BC_FileBoxDirectoryText(int x, int y, BC_FileBox *filebox);
00103         int handle_event();
00104         BC_FileBox *filebox;
00105 };
00106 
00107 class BC_FileBoxFilterText : public BC_TextBox
00108 {
00109 public:
00110         BC_FileBoxFilterText(int x, int y, BC_FileBox *filebox);
00111         int handle_event();
00112         BC_FileBox *filebox;
00113 };
00114 
00115 class BC_FileBoxFilterMenu : public BC_ListBox
00116 {
00117 public:
00118         BC_FileBoxFilterMenu(int x, int y, BC_FileBox *filebox);
00119         int handle_event();
00120         BC_FileBox *filebox;
00121 };
00122 
00123 class BC_FileBoxIcons : public BC_Button
00124 {
00125 public:
00126         BC_FileBoxIcons(int x, int y, BC_FileBox *filebox);
00127         int handle_event();
00128         BC_FileBox *filebox;
00129 };
00130 
00131 class BC_FileBoxNewfolder : public BC_Button
00132 {
00133 public:
00134         BC_FileBoxNewfolder(int x, int y, BC_FileBox *filebox);
00135         int handle_event();
00136         BC_FileBox *filebox;
00137 };
00138 
00139 class BC_FileBoxUpdir : public BC_Button
00140 {
00141 public:
00142         BC_FileBoxUpdir(int x, int y, BC_FileBox *filebox);
00143         int handle_event();
00144         BC_FileBox *filebox;
00145         char string[BCTEXTLEN];
00146 };
00147 
00148 class BC_FileBoxDelete : public BC_Button
00149 {
00150 public:
00151         BC_FileBoxDelete(int x, int y, BC_FileBox *filebox);
00152         int handle_event();
00153         BC_FileBox *filebox;
00154 };
00155 
00156 class BC_FileBoxReload : public BC_Button
00157 {
00158 public:
00159         BC_FileBoxReload(int x, int y, BC_FileBox *filebox);
00160         int handle_event();
00161         BC_FileBox *filebox;
00162 };
00163 
00164 
00165 
00166 class BC_FileBoxRecent : public BC_ListBox
00167 {
00168 public:
00169         BC_FileBoxRecent(BC_FileBox *filebox, int x, int y);
00170         int handle_event();
00171         BC_FileBox *filebox;
00172 };
00173 
00174 
00175 
00176 
00177 class BC_FileBox : public BC_Window
00178 {
00179 public:
00180         BC_FileBox(int x, 
00181                 int y,
00182                 char *init_path,
00183                 char *title,
00184                 char *caption,
00185 // Set to 1 to get hidden files. 
00186                 int show_all_files = 0,
00187 // Want only directories
00188                 int want_directory = 0,
00189                 int multiple_files = 0,
00190                 int h_padding = 0);
00191         virtual ~BC_FileBox();
00192 
00193         friend class BC_FileBoxCancel;
00194         friend class BC_FileBoxListBox;
00195         friend class BC_FileBoxTextBox;
00196         friend class BC_FileBoxText;
00197         friend class BC_FileBoxIcons;
00198         friend class BC_FileBoxNewfolder;
00199         friend class BC_FileBoxOK;
00200         friend class BC_NewFolderThread;
00201         friend class BC_FileBoxUpdir;
00202         friend class BC_FileBoxFilterText;
00203         friend class BC_FileBoxFilterMenu;
00204         friend class BC_FileBoxUseThis;
00205         friend class BC_DeleteThread;
00206         friend class BC_FileBoxDelete;
00207         friend class BC_FileBoxReload;
00208         friend class BC_FileBoxRecent;
00209 
00210         virtual int create_objects();
00211         virtual int keypress_event();
00212         virtual int close_event();
00213 // When file is submitted this is called for the user to retrieve it before the
00214 // window is deleted.
00215         virtual int handle_event();
00216 
00217         void create_history();
00218         void update_history();
00219         int refresh();
00220 
00221 // The OK and Use This button submits a path.
00222 // The cancel button has a current path highlighted but possibly different from the
00223 // path actually submitted.
00224 // Give the most recently submitted path
00225         char* get_submitted_path();
00226 // Give the path currently highlighted
00227         char* get_current_path();
00228 
00229 // Give the path of any selected item or 0.  Used when many items are
00230 // selected in the list.  Should only be called when OK is pressed.
00231         char* get_path(int selection);
00232         int update_filter(char *filter);
00233         virtual int resize_event(int w, int h);
00234         char* get_newfolder_title();
00235         char* get_delete_title();
00236         void delete_files();
00237         BC_Button* get_ok_button();
00238         BC_Button* get_cancel_button();
00239         FileSystem *fs;
00240 
00241 private:
00242         int create_icons();
00243         int extract_extension(char *out, const char *in);
00244         int create_tables();
00245         int delete_tables();
00246 // Called by directory history menu to change directories but leave
00247 // filename untouched.
00248         int submit_dir(char *dir);
00249         int submit_file(char *path, int use_this = 0);
00250 // Called by move_column_event
00251         void move_column(int src, int dst);
00252         int get_display_mode();
00253         int get_listbox_w();
00254         int get_listbox_h(int y);
00255         void create_listbox(int x, int y, int mode);
00256 // Get the icon number for a listbox
00257         BC_Pixmap* get_icon(char *path, int is_dir);
00258         static char* columntype_to_text(int type);
00259 // Get the column whose type matches type.
00260         int column_of_type(int type);
00261 
00262         BC_Pixmap *icons[TOTAL_ICONS];
00263         BC_FileBoxRecent *recent_popup;
00264         BC_FileBoxTextBox *textbox;
00265         BC_FileBoxListBox *listbox;
00266         BC_FileBoxFilterText *filter_text;
00267         BC_FileBoxFilterMenu *filter_popup;
00268         BC_TextBox *directory_title;
00269         BC_Button *icon_button, *text_button, *folder_button, *updir_button, *delete_button, *reload_button;
00270         BC_Button *ok_button, *cancel_button;
00271         BC_FileBoxUseThis *usethis_button;
00272         char caption[BCTEXTLEN];
00273         char current_path[BCTEXTLEN];
00274         char submitted_path[BCTEXTLEN];
00275         char directory[BCTEXTLEN];
00276         char filename[BCTEXTLEN];
00277         char string[BCTEXTLEN];
00278         int want_directory;
00279         int select_multiple;
00280 
00281         int sort_column;
00282         int sort_order;
00283 
00284         char *column_titles[FILEBOX_COLUMNS];
00285         ArrayList<BC_ListBoxItem*> filter_list;
00286         ArrayList<BC_ListBoxItem*> *list_column;
00287         int *column_type;
00288         int *column_width;
00289 // Calculated based on directory or regular file searching
00290         int columns;
00291         
00292         char new_folder_title[BCTEXTLEN];
00293         BC_NewFolderThread *newfolder_thread;
00294         BC_DeleteThread *delete_thread;
00295         int h_padding;
00296         ArrayList<BC_ListBoxItem*> recent_dirs;
00297 };
00298 
00299 #endif

Generated on Sun Jan 8 13:26:32 2006 for Guicast-svn by  doxygen 1.4.4