mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 06:05:58 -06:00
Tutorial: Removed depricated CLASSNAME from GUI tutorials.
git-svn-id: svn://ultimatepp.org/upp/trunk@15432 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
14645d6680
commit
707a7864de
7 changed files with 23 additions and 25 deletions
|
|
@ -3,7 +3,7 @@
|
||||||
using namespace Upp;
|
using namespace Upp;
|
||||||
|
|
||||||
struct MyAppWindow : TopWindow {
|
struct MyAppWindow : TopWindow {
|
||||||
virtual void Paint(Draw& w) {
|
virtual void Paint(Draw& w) override {
|
||||||
w.DrawRect(GetSize(), SWhite);
|
w.DrawRect(GetSize(), SWhite);
|
||||||
w.DrawText(20, 20, "Hello world!", Arial(30), Magenta);
|
w.DrawText(20, 20, "Hello world!", Arial(30), Magenta);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,17 +6,17 @@ struct MyAppWindow : TopWindow {
|
||||||
Point p;
|
Point p;
|
||||||
String text;
|
String text;
|
||||||
|
|
||||||
virtual void LeftDown(Point pos, dword flags) {
|
virtual void LeftDown(Point pos, dword flags) override {
|
||||||
p = pos;
|
p = pos;
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void MouseMove(Point pos, dword flags) {
|
virtual void MouseMove(Point pos, dword flags) override {
|
||||||
text = Format("[%d:%d]", pos.x, pos.y);
|
text = Format("[%d:%d]", pos.x, pos.y);
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void Paint(Draw& w) {
|
virtual void Paint(Draw& w) override {
|
||||||
w.DrawRect(GetSize(), SWhite);
|
w.DrawRect(GetSize(), SWhite);
|
||||||
w.DrawText(p.x, p.y, text, Arial(20), Magenta);
|
w.DrawText(p.x, p.y, text, Arial(20), Magenta);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,15 +3,15 @@
|
||||||
using namespace Upp;
|
using namespace Upp;
|
||||||
|
|
||||||
struct MyAppWindow : TopWindow {
|
struct MyAppWindow : TopWindow {
|
||||||
virtual void Close() {
|
virtual void Close() override {
|
||||||
delete this;
|
delete this;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void LeftDown(Point pos, dword flags) {
|
virtual void LeftDown(Point pos, dword flags) override {
|
||||||
(new MyAppWindow)->OpenMain();
|
(new MyAppWindow)->OpenMain();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void Paint(Draw& w) {
|
virtual void Paint(Draw& w) override {
|
||||||
w.DrawRect(GetSize(), SWhite);
|
w.DrawRect(GetSize(), SWhite);
|
||||||
w.DrawText(0, 0, "Click the view area to open next window!", Arial(20));
|
w.DrawText(0, 0, "Click the view area to open next window!", Arial(20));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ struct MyAppWindow : TopWindow {
|
||||||
Break();
|
Break();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RightDown(Point, dword) {
|
virtual void RightDown(Point, dword) override {
|
||||||
MenuBar::Execute(
|
MenuBar::Execute(
|
||||||
[=](Bar& bar) {
|
[=](Bar& bar) {
|
||||||
bar.Add("Exit", [=] { Exit(); });
|
bar.Add("Exit", [=] { Exit(); });
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ struct MyAppWindow : TopWindow {
|
||||||
Break();
|
Break();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RightDown(Point, dword) {
|
virtual void RightDown(Point, dword) override {
|
||||||
int result = Null;
|
int result = Null;
|
||||||
MenuBar menu;
|
MenuBar menu;
|
||||||
for(int i = 0; i < 10; i++)
|
for(int i = 0; i < 10; i++)
|
||||||
|
|
|
||||||
|
|
@ -24,23 +24,21 @@ struct MyAppWindow : TopWindow {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SubBar(Bar& bar) {
|
void SubBar(Bar& bar) {
|
||||||
bar.AddMenu("Function", TutorialImg::Fn(), THISBACK(MenuFn));
|
bar.AddMenu("Function", TutorialImg::Fn(), [=] { MenuFn(); });
|
||||||
bar.Add(TutorialImg::Fn2(), THISBACK(BarFn));
|
bar.Add(TutorialImg::Fn2(), [=] { BarFn(); });
|
||||||
bar.Add("Exit", TutorialImg::Exit(), THISBACK(Exit));
|
bar.Add("Exit", TutorialImg::Exit(), [=] { Exit(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainMenu(Bar& bar) {
|
void MainMenu(Bar& bar) {
|
||||||
bar.Add("Menu", THISBACK(SubBar));
|
bar.Sub("Menu", [=](Bar& bar) { SubBar(bar); });
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef MyAppWindow CLASSNAME;
|
|
||||||
|
|
||||||
MyAppWindow() {
|
MyAppWindow() {
|
||||||
Title("My application with bars").Sizeable();
|
Title("My application with bars").Sizeable();
|
||||||
AddFrame(menu);
|
AddFrame(menu);
|
||||||
AddFrame(tool);
|
AddFrame(tool);
|
||||||
menu.Set(THISBACK(MainMenu));
|
menu.Set([=](Bar& bar) { MainMenu(bar); });
|
||||||
tool.Set(THISBACK(SubBar));
|
tool.Set([=](Bar& bar) { SubBar(bar); });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,19 +25,19 @@ struct MyAppWindow : TopWindow {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SubBar(Bar& bar) {
|
void SubBar(Bar& bar) {
|
||||||
bar.AddMenu("Function", TutorialImg::Fn(), THISBACK(MenuFn))
|
bar.AddMenu("Function", TutorialImg::Fn(), [=] { MenuFn(); })
|
||||||
.Help("This invokes MenuFn method of tutorial example");
|
.Help("This invokes MenuFn method of tutorial example");
|
||||||
bar.Add(TutorialImg::Fn2(), THISBACK(BarFn))
|
bar.Add(TutorialImg::Fn2(), [=] { BarFn(); })
|
||||||
.Help("This invokes BarFn method of tutorial example");
|
.Help("This invokes BarFn method of tutorial example");
|
||||||
bar.Add("Exit", TutorialImg::Exit(), THISBACK(Exit));
|
bar.Add("Exit", TutorialImg::Exit(), [=] { Exit(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainMenu(Bar& bar) {
|
void MainMenu(Bar& bar) {
|
||||||
bar.Add("Menu", THISBACK(SubBar));
|
bar.Sub("Menu", [=](Bar& bar) {
|
||||||
|
SubBar(bar);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef MyAppWindow CLASSNAME;
|
|
||||||
|
|
||||||
MyAppWindow() {
|
MyAppWindow() {
|
||||||
Title("My application with bars").Sizeable();
|
Title("My application with bars").Sizeable();
|
||||||
AddFrame(menu);
|
AddFrame(menu);
|
||||||
|
|
@ -45,9 +45,9 @@ struct MyAppWindow : TopWindow {
|
||||||
AddFrame(tool);
|
AddFrame(tool);
|
||||||
AddFrame(status);
|
AddFrame(status);
|
||||||
AddFrame(InsetFrame());
|
AddFrame(InsetFrame());
|
||||||
menu.Set(THISBACK(MainMenu));
|
menu.Set([=](Bar& bar) { MainMenu(bar); });
|
||||||
menu.WhenHelp = status; // callback cast to fix it for older CLANG version in C++11
|
menu.WhenHelp = status; // callback cast to fix it for older CLANG version in C++11
|
||||||
tool.Set(THISBACK(SubBar));
|
tool.Set([=](Bar& bar) { SubBar(bar); });
|
||||||
tool.WhenHelp = status; // callback cast to fix it for older CLANG version in C++11
|
tool.WhenHelp = status; // callback cast to fix it for older CLANG version in C++11
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue