mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -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
11
reference/StatusBar/StatusBar.upp
Normal file
11
reference/StatusBar/StatusBar.upp
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
description "Using StatusBar to provide informations at the bottom of the window";
|
||||
|
||||
uses
|
||||
CtrlLib;
|
||||
|
||||
file
|
||||
main.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "GUI";
|
||||
|
||||
60
reference/StatusBar/main.cpp
Normal file
60
reference/StatusBar/main.cpp
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
#include <CtrlLib/CtrlLib.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
struct PosDisplay : Display {
|
||||
Color color;
|
||||
|
||||
virtual void Paint(Draw& w, const Rect& r, const Value& q,
|
||||
Color ink, Color paper, dword style) const {
|
||||
int i = q;
|
||||
w.DrawRect(0, 0, i, r.Height(), color);
|
||||
w.DrawRect(i, 0, r.Width() - i, r.Height(), SWhite);
|
||||
}
|
||||
};
|
||||
|
||||
struct App : TopWindow {
|
||||
StatusBar status;
|
||||
InfoCtrl pos;
|
||||
InfoCtrl x, y;
|
||||
PosDisplay dx, dy;
|
||||
|
||||
virtual void MouseMove(Point p, dword)
|
||||
{
|
||||
pos.Set(0, AsString(p.x), 40);
|
||||
pos.Set(1, AsString(p.y), 40);
|
||||
x.Set(PaintRect(dx, 100 * p.x / GetSize().cx));
|
||||
y.Set(PaintRect(dy, 100 * p.y / GetSize().cy));
|
||||
}
|
||||
|
||||
virtual void LeftDown(Point, dword)
|
||||
{
|
||||
status.Temporary("Left mouse button pressed!");
|
||||
}
|
||||
|
||||
virtual void RightDown(Point, dword)
|
||||
{
|
||||
ProgressInfo f(status);
|
||||
f.Text("Progress:");
|
||||
for(int i = 0; i < 50; i++) {
|
||||
f.Set(i, 50);
|
||||
Sleep(100);
|
||||
}
|
||||
}
|
||||
|
||||
App() {
|
||||
Sizeable();
|
||||
SetFrame(FieldFrame());
|
||||
AddFrame(status);
|
||||
status.AddFrame(pos.Right(100));
|
||||
status.AddFrame(x.Left(100));
|
||||
status.AddFrame(y.Left(100));
|
||||
dx.color = LtRed;
|
||||
dy.color = LtGreen;
|
||||
}
|
||||
};
|
||||
|
||||
GUI_APP_MAIN
|
||||
{
|
||||
App().Run();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue