mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-16 06:05:58 -06:00
.reference
git-svn-id: svn://ultimatepp.org/upp/trunk@10275 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
c8dbd68e1d
commit
29eebcd4e0
11 changed files with 13 additions and 109 deletions
|
|
@ -60,6 +60,4 @@ CONSOLE_APP_MAIN
|
|||
h.Do(fn);
|
||||
|
||||
LOG(h.out);
|
||||
|
||||
Thread::ShutdownThreads();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,22 +60,8 @@ void App::Paint(Draw& w)
|
|||
ImageBuffer ib(sz);
|
||||
if(cowork) {
|
||||
CoWork co;
|
||||
for(int y = 0; y < sz.cy; y++) {
|
||||
#ifdef CPP_11
|
||||
co & [=, &ib] {
|
||||
RGBA *line = ib[y];
|
||||
Point c = sz / 2;
|
||||
c = Point(int(sin((double)phase / 131) * c.x + c.x), int(sin((double)phase / 127) * c.y + c.y));
|
||||
int yy = (y - c.y) * (y - c.y);
|
||||
for(int x = 0; x < sz.cx; x++) {
|
||||
double d = (x - c.x) * (x - c.x) + yy;
|
||||
line[x] = GrayColor((int)(120 + 120 * sin(d / 1000 - (double)phase / 5)));
|
||||
}
|
||||
};
|
||||
#else
|
||||
co & callback4(DoLine, ib[y], phase, y, sz);
|
||||
#endif
|
||||
}
|
||||
for(int y = 0; y < sz.cy; y++)
|
||||
co & [=, &ib] { DoLine(ib[y], phase, y, sz); };
|
||||
}
|
||||
else
|
||||
for(int y = 0; y < sz.cy; y++)
|
||||
|
|
|
|||
|
|
@ -42,10 +42,10 @@ public:
|
|||
|
||||
list.Columns(3);
|
||||
list.MultiSelect();
|
||||
list.WhenDropInsert = THISBACK(DropInsert);
|
||||
list.WhenDropItem = THISBACK(DropSum);
|
||||
list.WhenDropInsert = [=](int i, PasteClip& d) { DropInsert(i, d); };
|
||||
list.WhenDropItem = [=](int i, PasteClip& d) { DropSum(i, d); };
|
||||
|
||||
list.WhenDrag = THISBACK(Drag);
|
||||
list.WhenDrag = [=] { Drag(); };
|
||||
|
||||
for(int i = 0; i < 500; i++)
|
||||
list.Add(AsString(i));
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ CONSOLE_APP_MAIN {
|
|||
ImagePainter w(1500, 200);
|
||||
w.DrawRect(0, 0, 1500, 200, White());
|
||||
txt.Paint(w, 0, 0, 1500);
|
||||
PNGEncoder().SaveFile(GetHomeDirFile("richtext.png"), w);
|
||||
PNGEncoder().SaveFile(GetHomeDirFile("richtext.png"), w);
|
||||
|
||||
PdfDraw pdf;
|
||||
txt.Paint(pdf, 0, 0, 1000);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
description "Using Convert to alter EditField for editing binary numbers";
|
||||
description "Using Convert to alter EditField for editing binary numbers\377";
|
||||
|
||||
uses
|
||||
CtrlLib;
|
||||
|
|
|
|||
4
reference/Convert/init
Normal file
4
reference/Convert/init
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
#ifndef _Convert_icpp_init_stub
|
||||
#define _Convert_icpp_init_stub
|
||||
#include "CtrlLib/init"
|
||||
#endif
|
||||
|
|
@ -31,19 +31,14 @@ struct App : TopWindow {
|
|||
EditField bin;
|
||||
EditInt dec;
|
||||
|
||||
void BinChanged() { dec <<= ~bin; }
|
||||
void DecChanged() { bin <<= ~dec; }
|
||||
|
||||
typedef App CLASSNAME;
|
||||
|
||||
App()
|
||||
{
|
||||
SetRect(0, 0, 200, 50);
|
||||
bin.SetConvert(Single<ConvertBin>());
|
||||
Add(bin.HSizePos().TopPos(0, Ctrl::STDSIZE));
|
||||
Add(dec.HSizePos().BottomPos(0, Ctrl::STDSIZE));
|
||||
bin <<= THISBACK(BinChanged);
|
||||
dec <<= THISBACK(DecChanged);
|
||||
bin << [=] { dec <<= ~bin; };
|
||||
dec << [=] { bin <<= ~dec; };
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +0,0 @@
|
|||
LAYOUT(MyAppLayout, 212, 196)
|
||||
ITEM(ArrayCtrl, list, LeftPosZ(4, 96).TopPosZ(4, 188))
|
||||
ITEM(EditInt, number, LeftPosZ(108, 96).TopPosZ(4, 19))
|
||||
ITEM(Button, add, SetLabel(t_("Add")).LeftPosZ(148, 56).TopPosZ(28, 20))
|
||||
END_LAYOUT
|
||||
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
description "Demostrates C++11 features\377";
|
||||
|
||||
uses
|
||||
CtrlLib;
|
||||
|
||||
file
|
||||
main.cpp,
|
||||
Cpp11.lay;
|
||||
|
||||
mainconfig
|
||||
"" = "GUI";
|
||||
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
#ifndef _Cpp11_icpp_init_stub
|
||||
#define _Cpp11_icpp_init_stub
|
||||
#include "CtrlLib/init"
|
||||
#endif
|
||||
|
|
@ -1,57 +0,0 @@
|
|||
#include "CtrlLib/CtrlLib.h"
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
#define LAYOUTFILE <Cpp11/Cpp11.lay>
|
||||
#include <CtrlCore/lay.h>
|
||||
|
||||
#ifdef CPP_11
|
||||
|
||||
GUI_APP_MAIN
|
||||
{
|
||||
WithMyAppLayout<TopWindow> dlg;
|
||||
CtrlLayout(dlg, "C++11 demo");
|
||||
dlg.list.NoHeader().AddColumn();
|
||||
Vector<int> x = { 1, 2, 12, 34, 15, 11 };
|
||||
for(auto i : x)
|
||||
dlg.list.Add(i);
|
||||
dlg.add << [&] {
|
||||
if(dlg.list.Find(~dlg.number) < 0)
|
||||
dlg.list.Add(~dlg.number);
|
||||
};
|
||||
dlg.list.WhenSel << [&] {
|
||||
dlg.number <<= dlg.list.GetKey();
|
||||
};
|
||||
dlg.Execute();
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
struct MyApp : WithMyAppLayout<TopWindow> {
|
||||
typedef MyApp CLASSNAME;
|
||||
|
||||
void Add() {
|
||||
if(list.Find(~number) < 0)
|
||||
list.Add(~number);
|
||||
}
|
||||
void Sel() {
|
||||
number <<= list.GetKey();
|
||||
}
|
||||
MyApp() {
|
||||
CtrlLayout(*this, "C++ demo");
|
||||
list.NoHeader().AddColumn();
|
||||
Vector<int> x;
|
||||
x << 1 << 2 << 12 << 34 << 15 << 11;
|
||||
for(int i = 0; i < x.GetCount(); i++)
|
||||
list.Add(x[i]);
|
||||
add <<= THISBACK(Add);
|
||||
list.WhenSel = THISBACK(Sel);
|
||||
}
|
||||
};
|
||||
|
||||
GUI_APP_MAIN
|
||||
{
|
||||
MyApp().Execute();;
|
||||
}
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue