1 #include "CtrlLib/CtrlLib.h" 2 3 using namespace Upp; 4 5 struct FontFaceDisplay : Display { PaintFontFaceDisplay6 virtual void Paint(Draw& w, const Rect& r, const Value& q, 7 Color ink, Color paper, dword style) const 8 { 9 Font fnt = Font(q, r.Height() - 2); 10 String txt = Font::GetFaceName(q); 11 w.DrawRect(r, paper); 12 w.DrawText(r.left + 2, r.top + (r.Height() - GetTextSize(txt, fnt).cy) / 2, txt, fnt, ink); 13 } 14 }; 15 16 struct MyApp : TopWindow { 17 DropList dl; 18 MyAppMyApp19 MyApp() 20 { 21 Add(dl.HSizePos().TopPos(5, Ctrl::STDSIZE)); 22 dl.SetDisplay(Single<FontFaceDisplay>()); 23 for(int i = 0; i < Font::GetFaceCount(); i++) 24 dl.Add(i); 25 SetRect(0, 0, 200, 70); 26 } 27 }; 28 29 GUI_APP_MAIN 30 { 31 MyApp().Run(); 32 } 33