ultimatepp/bazaar/CtrlPosTest/main.cpp
kohait 58bb5f1dc7 bazaar: CtrlPos major bugfixes, properly drag controls into others using ALT and changing order using wheel
git-svn-id: svn://ultimatepp.org/upp/trunk@3297 f0d560ea-af0d-0410-9eb7-867de7ffcac7
2011-03-22 18:54:35 +00:00

99 lines
1.7 KiB
C++

#include "CtrlPosTest.h"
void CtrlPosTest::ToInfo(const String& s)
{
vis.info.Insert(vis.info.GetLength(), s + "\n");
vis.info.SetCursor(vis.info.GetLength());
}
void CtrlPosTest::OnSelect(Ctrl& c, Point p, dword keyflags)
{
String inf = "Selected: ";
inf << String(typeid(c).name());
ToInfo(inf);
}
void CtrlPosTest::VisitCB()
{
hk.Visit(vis);
}
void CtrlPosTest::ClearCB()
{
hk.Clear();
}
void CtrlPosTest::EnableCB()
{
hk.Enable();
}
void CtrlPosTest::DisableCB()
{
hk.Disable();
}
void CtrlPosTest::DeepCB()
{
hk.flags &= ~CtrlFinder::DEEP;
hk.flags |= (~ft.deep)?(CtrlFinder::DEEP):(0);
}
void CtrlPosTest::FrameCB()
{
hk.flags &= ~CtrlFinder::FRAME;
hk.flags |= (~ft.frame)?(CtrlFinder::FRAME):(0);
}
void CtrlPosTest::ViewCB()
{
hk.flags &= ~CtrlFinder::VIEW;
hk.flags |= (~ft.view)?(CtrlFinder::VIEW):(0);
}
CtrlPosTest::CtrlPosTest()
{
CtrlLayout(vis);
SetRect(vis.GetRect());
Add(vis.SizePos());
Sizeable().Zoomable();
CtrlLayout(sb);
sb.Width(sb.GetSize().cx);
vis.AddFrame(sb);
vis.pc.Add(es.HCenterPos(50).VCenterPos(20));
st.SetText("STATIC");
vis.pc.Add(st.LeftPos(10,50).TopPos(20,20));
CtrlLayout(ft);
ft.Height(ft.GetSize().cy);
AddFrame(ft);
CtrlLayout(bot);
bot.Height(50);
vis.pc.AddFrame(bot);
ft.visit <<= THISBACK(VisitCB);
ft.clear <<= THISBACK(ClearCB);
ft.enable <<= THISBACK(EnableCB);
ft.disable <<= THISBACK(DisableCB);
ft.deep <<= THISBACK(DeepCB);
ft.frame <<= THISBACK(FrameCB);
ft.view <<= THISBACK(ViewCB);
ft.deep <<= true;
DeepCB();
ft.frame <<= true;
FrameCB();
ft.view <<= true;
ViewCB();
hk.WhenLeftDown = THISBACK(OnSelect);
hk.Visit(vis);
}
GUI_APP_MAIN
{
CtrlPosTest().Run();
}