diff --git a/tutorial/Draw01/main.cpp b/tutorial/Draw01/main.cpp index a91154b4f..ecb9d07be 100644 --- a/tutorial/Draw01/main.cpp +++ b/tutorial/Draw01/main.cpp @@ -3,7 +3,7 @@ using namespace Upp; struct MyApp : TopWindow { - virtual void Paint(Draw& w) { + virtual void Paint(Draw& w) override { w.DrawRect(GetSize(), White()); w.DrawRect(10, 10, 60, 80, Green()); diff --git a/tutorial/Draw02/main.cpp b/tutorial/Draw02/main.cpp index ff19eeef7..a00e5c782 100644 --- a/tutorial/Draw02/main.cpp +++ b/tutorial/Draw02/main.cpp @@ -7,7 +7,8 @@ struct MyApp : TopWindow { w.DrawEllipse(0, 0, 100, 30, WhiteGray(), 1, Cyan); w.DrawText(0, 0, "Hello world", Roman(30).Bold()); } - virtual void Paint(Draw& w) { + + virtual void Paint(Draw& w) override { w.DrawRect(GetSize(), White()); DoPainting(w); w.Offset(30, 50); diff --git a/tutorial/Draw03/main.cpp b/tutorial/Draw03/main.cpp index 7d23cd62a..814fde5af 100644 --- a/tutorial/Draw03/main.cpp +++ b/tutorial/Draw03/main.cpp @@ -3,17 +3,18 @@ using namespace Upp; struct MyApp : TopWindow { - DropList fontlist; + DropList font_list; - void Paint(Draw& w) { + virtual void Paint(Draw& w) override { + const String text = "Programming is fun"; + Font fnt(~font_list, 60); + w.DrawRect(GetSize(), White); w.Offset(50, 50); - const char *text = "Programming is fun"; - Font fnt(~fontlist, 60); int x = 0; Vector dx; - for(const char *s = text; *s; s++) { - int width = fnt[*s]; + for(char letter : text) { + int width = fnt[letter]; w.DrawRect(x, 0, width - 1, fnt.GetAscent(), Color(255, 255, 200)); w.DrawRect(x, fnt.GetAscent(), width - 1, fnt.GetDescent(), Color(255, 200, 255)); w.DrawRect(x + width - 1, 0, 1, fnt.GetHeight(), Black()); @@ -30,14 +31,12 @@ struct MyApp : TopWindow { Refresh(); } - typedef MyApp CLASSNAME; - MyApp() { for(int i = 0; i < Font::GetFaceCount(); i++) - fontlist.Add(i, Font::GetFaceName(i)); - Add(fontlist.TopPos(0, MINSIZE).LeftPosZ(0, 200)); - fontlist <<= 0; - fontlist <<= THISBACK(NewFont); + font_list.Add(i, Font::GetFaceName(i)); + Add(font_list.TopPos(0, MINSIZE).LeftPosZ(0, 200)); + font_list <<= 0; + font_list << [=] { NewFont(); }; } }; diff --git a/tutorial/Draw04/main.cpp b/tutorial/Draw04/main.cpp index 6d8fcc7b8..d6fbeb1a4 100644 --- a/tutorial/Draw04/main.cpp +++ b/tutorial/Draw04/main.cpp @@ -5,7 +5,7 @@ using namespace Upp; struct MyApp : TopWindow { Drawing drawing; - void Paint(Draw& w) { + virtual void Paint(Draw& w) override { w.DrawRect(GetSize(), White()); w.DrawDrawing(10, 10, 50, 60, drawing); w.DrawDrawing(100, 10, 150, 100, drawing); diff --git a/tutorial/Draw05/main.cpp b/tutorial/Draw05/main.cpp index 6c28b9017..50618a297 100644 --- a/tutorial/Draw05/main.cpp +++ b/tutorial/Draw05/main.cpp @@ -5,7 +5,7 @@ using namespace Upp; struct MyApp : TopWindow { Image image; - void Paint(Draw& w) { + virtual void Paint(Draw& w) override { w.DrawRect(GetSize(), Cyan()); w.DrawImage(10, 10, image); }