Ejemplo n.º 1
0
	App() {
		horz.Add(tree1);
		horz.Add(tree2);
		horz.Add(optree);
		Add(horz.Horz().SizePos());
		optree.SetRoot("everything");
		for(int i = 0; i < 10; i++)
			optree.Add(i ? rand() % i : 0, x[i], AsString(i));
		tree1.MultiSelect();
		tree1.WhenOpen = THISFN(OpenDir);
		tree1.WhenClose = [=] (int id) { tree1.RemoveChildren(id); };
	#ifdef PLATFORM_WIN32
		String dir = String(GetExeFilePath()[0], 1) + ":\\";
	#else
		String dir = "/usr";
	#endif
		tree1.SetRoot(CtrlImg::Dir(), dir);
		tree2.SetRoot(CtrlImg::Dir(), dir);
		Progress pi;
		pi.AlignText(ALIGN_LEFT);
		LoadTree(0, dir, pi);
		tree2.NoCursor().NoRoot();
		tree2.SortDeep(0);
		Sizeable();

		tree1.WhenCursor = [=] { info = ~tree1; };
		tree1.AddFrame(info);
	}
Ejemplo n.º 2
0
    void OpenDir(int id) {
        String path = tree.GetLabel(id);

        for(FindFile ff(AppendFileName(path, "*.*")); ff; ff.Next()) {
            String n = ff.GetName();

            if(n != "." && n != ".." && ff.IsFolder()) {
                int childId = tree.Add(id, AppendFileName(path, n));
                tree.SetNode(childId, tree.GetNode(childId).CanOpen(true));
            }
        }
    }
Ejemplo n.º 3
0
    App() {
        Add(tree.SizePos());

        tree.WhenOpen = THISBACK(OpenDir);
        tree.WhenClose = THISBACK(CloseDir);

    #ifdef PLATFORM_WIN32
        String dir = String(GetExeFilePath()[0], 1) + ":\\";
    #else
        String dir = "/usr";
    #endif

        tree.SetRoot(dir);
        tree.Set(0, dir);

        Sizeable();
    }
Ejemplo n.º 4
0
 void CloseDir(int id) {
     tree.RemoveChildren(id);
 }