explorer: attemp at opening files with desktop environment's file associations.
[ede] / explorer / src / DeleteBox.ec
1 public import "ecere"
2
3 import "ExplorerTree"
4
5 public class DeleteBox : Window
6 {
7    background = activeBorder;
8    hasClose = true;
9    tabCycle = true;
10    size = Size { 400, 300 };
11    text = "Delete Confirmation";
12
13 public:
14    ListBox source;
15
16 private:
17    
18    ListBox list
19    {
20       parent = this, borderStyle = deep, hasVertScroll = true, hasHorzScroll = true;
21       fullRowSelect = false, treeBranches = true, collapseControl = true, rootCollapseButton = true;
22       multiSelect = true;
23       size = Size { 624, 268 }, anchor = Anchor { left = 248, right = 8, bottom = 8 };
24       text = "Browser", hotKey = Key { e, alt = true };
25
26       /*hasHeader = true, moveFields = true, resizable = true, sortable = true;*/
27       anchor = Anchor { left = 8, top = 8, right = 8, bottom = 48 };
28    };
29    DataField listNameField { header = "Name", dataType = "ExplorerFileBranch", width = 304, userData = this }; // editable = true
30
31    DeleteBox()
32    {
33       list.AddField(listNameField);
34    }
35
36    ~DeleteBox()
37    {
38    }
39
40    /*
41    bool OnPostCreate()
42    {
43       if(source)
44       {
45          Link item;
46          OldList selection;
47          FileTreeBranchArray copies { growingFactor = 2 };
48          FileTreeBranchBSArray branches { };
49          FileTreeBranchArray parents { growingFactor = 4 };
50
51          source.GetMultiSelection(selection);
52
53          for(item = selection.first; item; item = item.next)
54          {
55             DataRow row = item.data;
56             ExplorerFileBranch branch = (ExplorerFileBranch)row.tag;
57             if(parents.count)
58             {
59                uint c;
60                for(c = 0; c < parents.count; c++)
61                {
62                   if(branch.IsChildOf(parents._[c]))
63                      break;
64                }
65                if(c == parents.count)
66                {
67                   parents.Add(branch);
68                }
69             }
70             else
71             {
72                parents.Add(branch);
73             }
74             // what if a child of some parent was added before that parent, should check to remove
75             // or is it imposible to get the backwards order from GetMultiSelection
76             
77             //for(branch = (ExplorerFileBranch)row.tag; branch; branch = branch.parent)
78             //   branches.Add(branch);
79          }
80          selection.Free(null);
81
82          {
83             uint c;
84             char path[MAX_LOCATION];
85             for(c = 0; c < parents.count; c++)
86             {
87                ExplorerFileBranch parent = parents._[c];
88                ExplorerFileBranch root { };
89                parent.GetPath(path);
90                root.name = CopyString(path);
91                root.childrenLoaded = true;
92                root.type = parent.type;
93                AddBranch(root, true, false, null, list);
94                parent.DuplicateChildren(true, true, root, list);
95             }
96          }
97          
98          */
99          /*
100          copies.count = branches.count;
101          
102          {
103             bool added = true;
104             uint b;
105             int i = 0;
106             while(added)
107             {
108                for(b = 0; b < branches.count; b++)
109                {
110                   if(branches._[b].indent == i)
111                   {
112                      ExplorerFileBranch copy;
113                      //copy = branches._[b].Copy();
114                      added = true;
115                   }
116                }
117                i++;
118             }
119          }
120          */
121          /*
122
123             */
124             /*
125             char path[MAX_LOCATION];
126             DataRow row = item.data;
127             ExplorerFileBranch branch = (ExplorerFileBranch)row.tag;
128             branch.GetPath(path);
129             if(FileExists(path))
130                DeleteFile(path);
131             if(!FileExists(path))
132                DeleteBranch(branch, source);
133             */
134             /*
135
136       }
137    }
138    */
139 };