/
dinruspro
/
tutorial
Обзор
Документация
Войти
/
dinruspro
/
tutorial
Код
Запросы
0
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
main
Gui12/main.cpp
51 строка
1 KB
EnergonV
Уроки теперь тоже здесь!
09 янв 2024, 19:25
09 янв 2024, 19:25
4b3ebd6
Код
Авторство
О чём код?
#include <CtrlLib/CtrlLib.h> using namespace Upp; #define IMAGECLASS TutorialImg #define IMAGEFILE <Gui12/images.iml> #include <Draw/iml.h> struct MyAppWindow : TopWindow { MenuBar menu; ToolBar tool; StatusBar status; typedef MyAppWindow CLASSNAME; // so that we can use THISFN shortcut void SubBar(Bar& bar) { bar.AddMenu("Function", TutorialImg::Fn(), [=] { // AddMenu - only in menu PromptOK("Fn activated!"); }).Help("This invokes MenuFn method of tutorial example"); bar.Add(TutorialImg::Fn2(), [=] { // does not have image - not in toolbar PromptOK("Fn2 activated!"); }).Help("This invokes BarFn method of tutorial example"); bar.Add("Exit", TutorialImg::Exit(), [=] { // in both toolbar and menu if(PromptOKCancel("Exit MyApp?")) Break(); }); } void MainMenu(Bar& bar) { bar.Sub("Menu", THISFN(SubBar)); } MyAppWindow() { Title("My application with bars").Sizeable(); AddFrame(menu); AddFrame(TopSeparatorFrame()); AddFrame(tool); AddFrame(status); AddFrame(InsetFrame()); menu.Set(THISFN(MainMenu)); menu.WhenHelp = status; tool.Set([=](Bar& bar) { SubBar(bar); }); // equivalent to THISFN(SubBar) tool.WhenHelp = status; } }; GUI_APP_MAIN { MyAppWindow app; app.Run(); }