| 70 | UrlButton* linkButton; |
| 71 | |
| 72 | TipWindow() { |
| 73 | box.size = math::Vec(550, 200); |
| 74 | const float margin = 10; |
| 75 | const float buttonWidth = 100; |
| 76 | |
| 77 | layout = new ui::SequentialLayout; |
| 78 | layout->box.pos = math::Vec(0, 10); |
| 79 | layout->box.size = box.size; |
| 80 | layout->orientation = ui::SequentialLayout::VERTICAL_ORIENTATION; |
| 81 | layout->margin = math::Vec(margin, margin); |
| 82 | layout->spacing = math::Vec(margin, margin); |
| 83 | layout->wrap = false; |
| 84 | addChild(layout); |
| 85 | |
| 86 | ui::Label* header = new ui::Label; |
| 87 | // header->box.size.x = box.size.x - 2*margin; |
| 88 | header->box.size.y = 20; |
| 89 | header->fontSize = 20; |
| 90 | header->text = string::f(string::translate("TipWindow.welcome"), APP_NAME + " " + APP_EDITION_NAME + " " + APP_VERSION); |
| 91 | layout->addChild(header); |
| 92 | |
| 93 | label = new ui::Label; |
| 94 | label->box.size.y = 80; |
| 95 | label->box.size.x = box.size.x - 2*margin; |
| 96 | layout->addChild(label); |
| 97 | |
| 98 | // Container for link button so hiding it won't shift layout |
| 99 | widget::Widget* linkPlaceholder = new widget::Widget; |
| 100 | layout->addChild(linkPlaceholder); |
| 101 | |
| 102 | linkButton = new UrlButton; |
| 103 | linkButton->box.size.x = box.size.x - 2*margin; |
| 104 | linkPlaceholder->box.size = linkButton->box.size; |
| 105 | linkPlaceholder->addChild(linkButton); |
| 106 | |
| 107 | buttonLayout = new ui::SequentialLayout; |
| 108 | buttonLayout->box.size.x = box.size.x - 2*margin; |
| 109 | buttonLayout->spacing = math::Vec(margin, margin); |
| 110 | layout->addChild(buttonLayout); |
| 111 | |
| 112 | struct ShowQuantity : Quantity { |
| 113 | void setValue(float value) override { |
| 114 | settings::showTipsOnLaunch = (value > 0.f); |
| 115 | } |
| 116 | float getValue() override { |
| 117 | return settings::showTipsOnLaunch ? 1.f : 0.f; |
| 118 | } |
| 119 | }; |
| 120 | static ShowQuantity showQuantity; |
| 121 | |
| 122 | ui::OptionButton* showButton = new ui::OptionButton; |
| 123 | showButton->box.size.x = 200; |
| 124 | showButton->text = string::translate("TipWindow.startup"); |
| 125 | showButton->quantity = &showQuantity; |
| 126 | buttonLayout->addChild(showButton); |
| 127 | |
| 128 | struct PreviousButton : ui::Button { |
| 129 | TipWindow* tipWindow; |