class AboutDialog : public ui::ModalDialog { // Construction: public: AboutDialog(ui::TopWindow* owner, COLORREF bc); // Implementation: protected: virtual bool onCreate(CREATESTRUCT* cs); private: ui::window_ptr<ui::controls::Label> label; ui::window_ptr<ui::controls::Button> okButton; ui::window_ptr<ui::controls::Panel> backPanel, buttonPanel; COLORREF backColor; }; AboutDialog::AboutDialog(TopWindow* owner, COLORREF bc) : ModalDialog(RES("about.title"), owner), backColor(bc) {} bool AboutDialog::onCreate(CREATESTRUCT* cs) { setWidth(350); setHeight(160); const COLORREF BGCOLOR = gdi::desaturate( gdi::alphaBlendColors(backColor, RGB(255, 255, 255), 0.08), 40); const COLORREF BTCOLOR = gdi::desaturate( gdi::alphaBlendColors(backColor, RGB(255, 255, 255), 0.11), 40); label = new Label(this, application.getName() + L" " + application.getVersion() + L"\n" + RES("about.text"), SS_CENTER); label->setBgColor(BGCOLOR); label->setMargins(10, 20, 10, 10); okButton = new Button(this, RES("ok"), true); okButton->clickEvent.connect(bind(&AboutDialog::close, this)); buttonPanel = new Panel(this, 0, 0); buttonPanel->setColor(BTCOLOR); backPanel = new Panel(this, 0, 0); backPanel->setColor(BGCOLOR); Pane& cp = getContentPane(); cp.setLayout(VBorderLayout()); Pane& mainPane = cp.addPane(Place::CENTER, VBoxLayout(Align::CENTER, Align::CENTER)); mainPane.put(label); mainPane.assign(backPanel); Pane& bottomPane = cp.addPane(Place::BOTTOM, HBoxLayout(Align::RIGHT)); bottomPane.setPadding(8,8); bottomPane.assign(buttonPanel); bottomPane.put(okButton); setIcon(IDI_MAINICON); setDefaultControl(okButton); return __super::onCreate(cs); } |