void Dialog::setLayout(Widget * contents, Widget * buttons) { LinearContainer * container = new LinearContainer(); container->setVertical(); container->setSpacing(8); container->addWidget(contents); container->addWidget(buttons); setPadding(8); setContent(container); }
Widget * Dialog::setTextMessage(std::string message) { LinearContainer * text = new LinearContainer(); text->setSpacing(4); text->setVertical(); size_t index = 0; while ((index = message.find('\n')) != std::string::npos) { text->addWidget(new TextWidget(message.substr(0, index), 0, 0)); message.erase(0, index + 1); } text->addWidget(new TextWidget(message.substr(0, message.length()), 0, 0)); return text; }