Skip to content

Commit

Permalink
InformationMessage expands like the other dialogs, "numeric" textboxe…
Browse files Browse the repository at this point in the history
…s now allow negative numbers
  • Loading branch information
jacob1 committed Apr 1, 2016
1 parent db9d739 commit 535ade0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
19 changes: 15 additions & 4 deletions src/gui/dialogues/InformationMessage.cpp
Expand Up @@ -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)
Expand All @@ -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);
Expand Down
4 changes: 3 additions & 1 deletion src/gui/interface/Textbox.cpp
Expand Up @@ -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')
Expand Down

0 comments on commit 535ade0

Please sign in to comment.