/* client/dialog.cc This file is part of the Osirion project and is distributed under the terms and conditions of the GNU General Public License version 2 */ #include "client/dialog.h" #include "ui/ui.h" namespace client { Dialog::Dialog(ui::Widget * parent) : ui::Window(parent) { set_border(false); set_background(false); set_label("dialog"); dialog_widget = new ui::Widget(this); dialog_widget->set_border(true); dialog_widget->set_background(true); dialog_label = new ui::Label(dialog_widget); dialog_label->set_border(false); dialog_label->set_background(false); dialog_label->set_alignment(ui::AlignTop | ui::AlignHCenter); dialog_button = new ui::Button(dialog_widget); } Dialog::~Dialog() { } void Dialog::set_text(const std::string &text) { dialog_label->set_text(text); } void Dialog::set_button(const std::string &text) { dialog_button->set_text(text); } void Dialog::set_command(const std::string &command) { dialog_button->set_command(command); } void Dialog::resize() { const float padding = ui::root()->font_large()->height(); dialog_widget->set_size( ui::UI::elementsize.width() * 3.0f, ui::UI::elementsize.width() * 1.5f ); dialog_widget->set_location( (width() - dialog_widget->width()) * 0.5f, (height() - dialog_widget->height()) * 0.5f ); dialog_label->set_size(dialog_widget->width() - padding * 2.0f, dialog_widget->height() - padding * 2.0f); dialog_label->set_location(padding, padding); dialog_button->set_size(ui::UI::elementsize); dialog_button->set_location((dialog_widget->width() - dialog_button->width()) * 0.5f, dialog_widget->height() - dialog_button->height() - padding); } } // namespace client