Permalink
Browse files

InformationMessage expands like the other dialogs, "numeric" textboxe…

…s now allow negative numbers
  • Loading branch information...
jacob1 committed Apr 1, 2016
1 parent db9d739 commit 535ade0ec49e8dac4949547fbe312f61f9b03fae
Showing with 18 additions and 5 deletions.
  1. +15 −4 src/gui/dialogues/InformationMessage.cpp
  2. +3 −1 src/gui/interface/Textbox.cpp
@@ -5,12 +5,12 @@
#include "gui/interface/ScrollPanel.h"
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?
{
Size.X += 200;
Size.Y += 175;
Size.Y += 215;
}
if (large)
@@ -28,10 +28,21 @@ InformationMessage::InformationMessage(std::string title, std::string message, b
}
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.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);
@@ -256,8 +256,10 @@ bool Textbox::CharacterValid(Uint16 character)
{
switch(inputType)
{
case Number:
case Numeric:
if (character == '-' && cursor == 0 && backingText[0] != '-')
return true;
case Number:
return (character >= '0' && character <= '9');
case Multiline:
if (character == '\n')

0 comments on commit 535ade0

Please sign in to comment.