#pragma GCC diagnostic ignored "-Wdeprecated-declarations" #include #pragma GCC diagnostic pop #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using namespace Wt; using namespace Wt::cpp17; #define SET_BS5THEME 1 // Always apply theme before creating widgets! class CThemedApplication : public WApplication { public: CThemedApplication(const WEnvironment& rcEnv) : WApplication{rcEnv} { #if SET_BS5THEME setTheme(make_shared()); #endif } }; class CPanel final : public WContainerWidget { public: CPanel(const WString& text) { WBoxLayout& lytPanel{*setLayout(make_unique())}; lytPanel.setContentsMargins(0, 0, 0, 0); lytPanel.setSpacing(0); WText& txtTop{*lytPanel.addWidget(make_unique())}; txtTop.setText(text); txtTop.setTextAlignment(AlignmentFlag::Center); #if 0 for (int i = 0; i < 3; ++i) { lytPanel.addWidget(make_unique()) ->columnAt (0)->setWidth(20); } #endif WTable& tblBottom{*lytPanel.addWidget(make_unique())}; tblBottom.columnAt (0)->setWidth(20); tblBottom.elementAt(0, 2)->addWidget(make_unique("long label text"))->setWordWrap(false); #if 0 tblBottom.elementAt(1, 1)->setColumnSpan(3); tblBottom.elementAt(1, 1)->addWidget(make_unique()); #endif lytPanel.addStretch(100); } }; class CApplication final : public CThemedApplication { public: CApplication(const WEnvironment& rcEnv); private: WContainerWidget& _cntRoot{*root()}; WBoxLayout& _lytRoot{*_cntRoot.setLayout(make_unique())}; WTabWidget& _tbwMain{*_lytRoot.addWidget(make_unique(), /*stretch*/ 100)}; WMenuItem& _tabA{*_tbwMain.addTab(make_unique(), "A", ContentLoading::Eager)}; WContainerWidget& _cntA{dynamic_cast(*_tbwMain.widget(_tbwMain.count() - 1))}; WBoxLayout& _lytA{*_cntA.setLayout(make_unique())}; WContainerWidget& _cntATop{*_lytA.addWidget(make_unique())}; WBoxLayout& _lytATop{*_cntATop.setLayout(make_unique())}; #if 0 WContainerWidget& _cntABottom{*_lytA.addWidget(make_unique())}; WBoxLayout& _lytABottom{*_cntABottom.setLayout(make_unique())}; WMenuItem& _tabB{*_tbwMain.addTab(make_unique(), "B", ContentLoading::Eager)}; #endif }; CApplication::CApplication(const WEnvironment& rcEnv) : CThemedApplication{rcEnv} { setTitle("bug repro " WT_VERSION_STR); _lytA.setContentsMargins(0, 0, 0, 0); _lytA.addStretch(100); _cntA.setOverflow(Overflow::Auto); _lytATop.setContentsMargins(0, 0, 0, 0); _lytATop.setSpacing(0); for (int i = 0; i < 20; ++i) { _lytATop.addWidget(make_unique("panel " + std::to_string(i + 1))); } _lytATop.addStretch(100); _cntATop.setOverflow(Overflow::Auto); #if 0 _lytABottom.setContentsMargins(0, 0, 0, 0); _lytABottom.addStretch(100); _lytABottom.addWidget(make_unique("Button"))->clicked().connect([&] { }); #endif // final action after creating the UI enableUpdates(); } int main(int argc, char* argv[]) { return WRun(argc, argv, [](const WEnvironment& rcEnv) { try { return make_unique(rcEnv); } catch (const std::exception& rcException) { cerr << "exception " << typeid(remove_cvref::type).name() << ": " << rcException.what() << endl; #if DEBUG exit(-1); #endif throw; } }); }