mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-10-06 00:30:10 -06:00
Adding uppdev....
git-svn-id: svn://ultimatepp.org/upp/trunk@328 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
0fab880126
commit
351994a6cc
2823 changed files with 619073 additions and 0 deletions
58
uppdev/TreeCtrl/main.cpp
Normal file
58
uppdev/TreeCtrl/main.cpp
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
#include "CtrlLib/CtrlLib.h"
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
struct App : TopWindow {
|
||||
TreeCtrl tree;
|
||||
|
||||
typedef App CLASSNAME;
|
||||
|
||||
void DropInsert(int parent, int ii, PasteClip& d)
|
||||
{
|
||||
tree.AdjustAction(parent, d);
|
||||
if(AcceptInternal<TreeCtrl>(d, "mytreedrag")) {
|
||||
tree.InsertDrop(parent, ii, d);
|
||||
tree.SetFocus();
|
||||
return;
|
||||
}
|
||||
if(AcceptText(d)) {
|
||||
tree.SetCursor(tree.Insert(parent, ii, Image(), GetString(d)));
|
||||
tree.SetFocus();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void Drag()
|
||||
{
|
||||
if(tree.DoDragAndDrop(InternalClip(tree, "mytreedrag"),
|
||||
tree.GetDragSample()) == DND_MOVE)
|
||||
tree.Remove(tree.GetCursor());
|
||||
}
|
||||
|
||||
App() {
|
||||
Add(tree.SizePos());
|
||||
Vector<int> parent, parent2;
|
||||
parent.Add(0);
|
||||
tree.SetRoot(Image(), "The Tree");
|
||||
for(int i = 1; i < 10000; i++) {
|
||||
parent.Add(tree.Add(parent[rand() % parent.GetCount()],
|
||||
i & 1 ? CtrlImg::open() : Image(),
|
||||
FormatIntRoman(i, true)));
|
||||
if((rand() & 3) == 0)
|
||||
tree.Open(parent.Top());
|
||||
}
|
||||
tree.Open(0);
|
||||
tree.WhenDropInsert = THISBACK(DropInsert);
|
||||
tree.WhenDrag = THISBACK(Drag);
|
||||
tree.MultiSelect();
|
||||
|
||||
// tree.Clear();
|
||||
|
||||
Sizeable();
|
||||
}
|
||||
};
|
||||
|
||||
GUI_APP_MAIN
|
||||
{
|
||||
App().Run();
|
||||
}
|
||||
Loading…
Reference in a new issue