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

bcdelete.C

Go to the documentation of this file.
00001 #include "bcdelete.h"
00002 #include "bcsignals.h"
00003 #include "filesystem.h"
00004 #include "language.h"
00005 
00006 
00007 
00008 
00009 
00010 BC_DeleteFile::BC_DeleteFile(BC_FileBox *filebox, int x, int y)
00011  : BC_Window(filebox->get_delete_title(), 
00012         x, 
00013         y, 
00014         320, 
00015         480, 
00016         0, 
00017         0, 
00018         0, 
00019         0, 
00020         1)
00021 {
00022         this->filebox = filebox;
00023         data = 0;
00024 }
00025 
00026 BC_DeleteFile::~BC_DeleteFile()
00027 {
00028         delete data;
00029 }
00030 
00031 void BC_DeleteFile::create_objects()
00032 {
00033         int x = 10, y = 10;
00034         data = new ArrayList<BC_ListBoxItem*>;
00035         int i = 1;
00036         char *path;
00037         FileSystem fs;
00038 
00039         while((path = filebox->get_path(i)))
00040         {
00041                 data->append(new BC_ListBoxItem(path));
00042                 i++;
00043         }
00044                 
00045         BC_Title *title;
00046         add_subwindow(title = new BC_Title(x, y, _("Really delete the following files?")));
00047         y += title->get_h() + 5;
00048         BC_DeleteList *list;
00049         add_subwindow(list = new BC_DeleteList(filebox, 
00050                 x, 
00051                 y, 
00052                 get_w() - x * 2, 
00053                 get_h() - y - BC_OKButton::calculate_h() - 20,
00054                 data));
00055         y += list->get_h() + 5;
00056         add_subwindow(new BC_OKButton(this));
00057         add_subwindow(new BC_CancelButton(this));
00058         show_window();
00059 }
00060 
00061 
00062 
00063 
00064 
00065 BC_DeleteList::BC_DeleteList(BC_FileBox *filebox, 
00066         int x, 
00067         int y, 
00068         int w, 
00069         int h,
00070         ArrayList<BC_ListBoxItem*> *data)
00071  : BC_ListBox(x, 
00072         y, 
00073         w, 
00074         h, 
00075         LISTBOX_TEXT,
00076         data)
00077 {
00078         this->filebox = filebox;
00079 }
00080 
00081 
00082 
00083 
00084 
00085 
00086 
00087 
00088 
00089 
00090 BC_DeleteThread::BC_DeleteThread(BC_FileBox *filebox)
00091  : BC_DialogThread()
00092 {
00093         this->filebox = filebox;
00094 }
00095 
00096 void BC_DeleteThread::handle_done_event(int result)
00097 {
00098         if(!result)
00099         {
00100                 filebox->lock_window("BC_DeleteThread::handle_done_event");
00101                 filebox->delete_files();
00102                 filebox->unlock_window();
00103         }
00104 }
00105 
00106 BC_Window* BC_DeleteThread::new_gui()
00107 {
00108         int x = filebox->get_abs_cursor_x(1);
00109         int y = filebox->get_abs_cursor_y(1);
00110         BC_DeleteFile *result = new BC_DeleteFile(filebox, x, y);
00111         result->create_objects();
00112         return result;
00113 }
00114 
00115 
00116 
00117 
00118 
00119 
00120 
00121 

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