mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-09-05 17:44:55 -06:00
changed svn layout
git-svn-id: svn://ultimatepp.org/upp/trunk@281 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
commit
263ff5f895
2665 changed files with 642923 additions and 0 deletions
38
reference/ScrollView/main.cpp
Normal file
38
reference/ScrollView/main.cpp
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
#include <CtrlLib/CtrlLib.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
struct App : public TopWindow {
|
||||
Point pos;
|
||||
|
||||
virtual void Paint(Draw &w)
|
||||
{
|
||||
Size sz = GetSize();
|
||||
for(int i = pos.x / 50 - 50; (i * 50 - pos.y) < sz.cy; i++)
|
||||
for(int j = pos.y / 50 - 50; (j * 50 - pos.x) < sz.cx; j++)
|
||||
w.DrawRect(j * 50 - pos.x, i * 50 - pos.y, 50, 50,
|
||||
Color(33 * j % 255, 11 * i % 255, 100));
|
||||
}
|
||||
|
||||
virtual bool Key(dword key, int count)
|
||||
{
|
||||
if(key == K_SPACE) {
|
||||
Size sz = GetSize();
|
||||
Size delta(rand() % 50, rand() % 50);
|
||||
pos += delta;
|
||||
ScrollView(-delta);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
App()
|
||||
{
|
||||
pos = Point(0, 0);
|
||||
}
|
||||
};
|
||||
|
||||
GUI_APP_MAIN
|
||||
{
|
||||
// Ctrl::ShowRepaint = 30;
|
||||
App().Run();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue