mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-29 19:00:33 +02:00
InformationMessage expands like the other dialogs, "numeric" textboxes now allow negative numbers
This commit is contained in:
@@ -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);
|
||||||
|
@@ -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')
|
||||||
|
Reference in New Issue
Block a user