InformationMessage expands like the other dialogs, "numeric" textboxes now allow negative numbers

This commit is contained in:
jacob1
2016-03-31 22:05:55 -04:00
parent db9d7399d1
commit 535ade0ec4
2 changed files with 18 additions and 5 deletions

View File

@@ -5,12 +5,12 @@
#include "gui/interface/ScrollPanel.h" #include "gui/interface/ScrollPanel.h"
InformationMessage::InformationMessage(std::string title, std::string message, bool large): InformationMessage::InformationMessage(std::string title, std::string message, bool large):
ui::Window(ui::Point(-1, -1), ui::Point(200, 75)) ui::Window(ui::Point(-1, -1), ui::Point(200, 35))
{ {
if (large) //Maybe also use this large mode for changelogs eventually, or have it as a customizable size? if (large) //Maybe also use this large mode for changelogs eventually, or have it as a customizable size?
{ {
Size.X += 200; Size.X += 200;
Size.Y += 175; Size.Y += 215;
} }
if (large) if (large)
@@ -28,10 +28,21 @@ InformationMessage::InformationMessage(std::string title, std::string message, b
} }
else else
{ {
ui::Label * messageLabel = new ui::Label(ui::Point(4, 24), ui::Point(Size.X-8, 60), message); ui::ScrollPanel *messagePanel = new ui::ScrollPanel(ui::Point(4, 24), ui::Point(Size.X-8, 206));
AddComponent(messagePanel);
ui::Label * messageLabel = new ui::Label(ui::Point(4, 0), ui::Point(Size.X-8, -1), message);
messageLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft; messageLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
messageLabel->Appearance.VerticalAlign = ui::Appearance::AlignTop; messageLabel->Appearance.VerticalAlign = ui::Appearance::AlignTop;
AddComponent(messageLabel); messageLabel->SetMultiline(true);
messagePanel->AddChild(messageLabel);
messagePanel->InnerSize = ui::Point(messagePanel->Size.X, messageLabel->Size.Y+4);
if (messageLabel->Size.Y < messagePanel->Size.Y)
messagePanel->Size.Y = messageLabel->Size.Y+4;
Size.Y += messagePanel->Size.Y+12;
Position.Y = (ui::Engine::Ref().GetHeight()-Size.Y)/2;
} }
ui::Label * titleLabel = new ui::Label(ui::Point(4, 5), ui::Point(Size.X-8, 16), title); ui::Label * titleLabel = new ui::Label(ui::Point(4, 5), ui::Point(Size.X-8, 16), title);

View File

@@ -256,8 +256,10 @@ bool Textbox::CharacterValid(Uint16 character)
{ {
switch(inputType) switch(inputType)
{ {
case Number:
case Numeric: case Numeric:
if (character == '-' && cursor == 0 && backingText[0] != '-')
return true;
case Number:
return (character >= '0' && character <= '9'); return (character >= '0' && character <= '9');
case Multiline: case Multiline:
if (character == '\n') if (character == '\n')