Better reporting dialogue

This commit is contained in:
Simon Robertshaw 2012-09-15 15:16:46 +01:00
parent 3ed5672052
commit 8a4d18df49
2 changed files with 12 additions and 5 deletions

View File

@ -28,20 +28,27 @@ public:
}; };
TextPrompt::TextPrompt(std::string title, std::string message, std::string text, std::string placeholder, bool multiline, TextDialogueCallback * callback_): TextPrompt::TextPrompt(std::string title, std::string message, std::string text, std::string placeholder, bool multiline, TextDialogueCallback * callback_):
ui::Window(ui::Point(-1, -1), ui::Point(200, 80)), ui::Window(ui::Point(-1, -1), ui::Point(200, 65)),
callback(callback_) callback(callback_)
{ {
if(multiline)
Size.X += 100;
ui::Label * titleLabel = new ui::Label(ui::Point(4, 5), ui::Point(Size.X-8, 18), title); ui::Label * titleLabel = new ui::Label(ui::Point(4, 5), ui::Point(Size.X-8, 18), title);
titleLabel->SetTextColour(style::Colour::WarningTitle); titleLabel->SetTextColour(style::Colour::WarningTitle);
titleLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft; titleLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
titleLabel->Appearance.VerticalAlign = ui::Appearance::AlignMiddle; titleLabel->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
AddComponent(titleLabel); AddComponent(titleLabel);
ui::Label * messageLabel = new ui::Label(ui::Point(4, 25), ui::Point(Size.X-8, 16), message); ui::Label * messageLabel = new ui::Label(ui::Point(4, 25), ui::Point(Size.X-8, -1), message);
messageLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft; messageLabel->Appearance.VerticalAlign = ui::Appearance::AlignTop; messageLabel->SetMultiline(true);
messageLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
messageLabel->Appearance.VerticalAlign = ui::Appearance::AlignTop;
AddComponent(messageLabel); AddComponent(messageLabel);
textField = new ui::Textbox(ui::Point(4, 45 ), ui::Point(Size.X-8, 16), text, placeholder); Size.Y += messageLabel->Size.Y+4;
textField = new ui::Textbox(ui::Point(4, messageLabel->Position.Y + messageLabel->Size.Y + 7), ui::Point(Size.X-8, 16), text, placeholder);
if(multiline) if(multiline)
{ {
textField->SetMultiline(true); textField->SetMultiline(true);

View File

@ -96,7 +96,7 @@ PreviewView::PreviewView():
ReportAction(PreviewView * v_){ v = v_; } ReportAction(PreviewView * v_){ v = v_; }
virtual void ActionCallback(ui::Button * sender) virtual void ActionCallback(ui::Button * sender)
{ {
new TextPrompt("Report Save", "Reason for reporting", "", "[reason]", true, new ReportPromptCallback(v)); new TextPrompt("Report Save", "Things to consider when reporting:\n\bw1)\bg When reporting stolen saves, please include the ID of the original save.\n\bw2)\bg Do not waste staff time with fake or bogus reports, doing so may result in a ban.", "", "[reason]", true, new ReportPromptCallback(v));
} }
}; };
reportButton = new ui::Button(ui::Point(100, Size.Y-19), ui::Point(51, 19), "Report"); reportButton = new ui::Button(ui::Point(100, Size.Y-19), ui::Point(51, 19), "Report");