r1007: Make configure detect and work on amd64.
[cinelerra_cv/mob.git] / guicast / bcdelete.C
blobb90230df76cf185ff4f2538223acc1f6104294af
1 #include "bcdelete.h"
2 #include "bcsignals.h"
3 #include "filesystem.h"
4 #include "language.h"
10 BC_DeleteFile::BC_DeleteFile(BC_FileBox *filebox, int x, int y)
11  : BC_Window(filebox->get_delete_title(), 
12         x, 
13         y, 
14         320, 
15         480, 
16         0, 
17         0, 
18         0, 
19         0, 
20         1)
22         this->filebox = filebox;
23         data = 0;
26 BC_DeleteFile::~BC_DeleteFile()
28         delete data;
31 void BC_DeleteFile::create_objects()
33         int x = 10, y = 10;
34         data = new ArrayList<BC_ListBoxItem*>;
35         int i = 1;
36         char *path;
37         FileSystem fs;
39         while((path = filebox->get_path(i)))
40         {
41                 data->append(new BC_ListBoxItem(path));
42                 i++;
43         }
44                 
45         BC_Title *title;
46         add_subwindow(title = new BC_Title(x, y, _("Really delete the following files?")));
47         y += title->get_h() + 5;
48         BC_DeleteList *list;
49         add_subwindow(list = new BC_DeleteList(filebox, 
50                 x, 
51                 y, 
52                 get_w() - x * 2, 
53                 get_h() - y - BC_OKButton::calculate_h() - 20,
54                 data));
55         y += list->get_h() + 5;
56         add_subwindow(new BC_OKButton(this));
57         add_subwindow(new BC_CancelButton(this));
58         show_window();
65 BC_DeleteList::BC_DeleteList(BC_FileBox *filebox, 
66         int x, 
67         int y, 
68         int w, 
69         int h,
70         ArrayList<BC_ListBoxItem*> *data)
71  : BC_ListBox(x, 
72         y, 
73         w, 
74         h, 
75         LISTBOX_TEXT,
76         data)
78         this->filebox = filebox;
90 BC_DeleteThread::BC_DeleteThread(BC_FileBox *filebox)
91  : BC_DialogThread()
93         this->filebox = filebox;
96 void BC_DeleteThread::handle_done_event(int result)
98         if(!result)
99         {
100                 filebox->lock_window("BC_DeleteThread::handle_done_event");
101                 filebox->delete_files();
102                 filebox->unlock_window();
103         }
106 BC_Window* BC_DeleteThread::new_gui()
108         int x = filebox->get_abs_cursor_x(1);
109         int y = filebox->get_abs_cursor_y(1);
110         BC_DeleteFile *result = new BC_DeleteFile(filebox, x, y);
111         result->create_objects();
112         return result;