Permalink
Browse files

use a ScrollPanel in ConfirmPrompt (supports longer changelogs)

  • Loading branch information...
jacob1 committed Oct 2, 2015
1 parent 91cf20e commit cd3d54d3bd135a480fd761f3532db481ddc12f4c
Showing with 23 additions and 8 deletions.
  1. +23 −8 src/gui/dialogues/ConfirmPrompt.cpp
@@ -2,6 +2,7 @@
#include "gui/Style.h"
#include "gui/interface/Label.h"
#include "gui/interface/Button.h"
#include "gui/interface/ScrollPanel.h"
#include "PowderToy.h"
ConfirmPrompt::ConfirmPrompt(std::string title, std::string message, ConfirmDialogueCallback * callback_):
@@ -15,13 +16,20 @@ ConfirmPrompt::ConfirmPrompt(std::string title, std::string message, ConfirmDial
AddComponent(titleLabel);
ui::Label * messageLabel = new ui::Label(ui::Point(4, 25), ui::Point(Size.X-8, -1), message);
messageLabel->SetMultiline(true);
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-28, -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);
Size.Y += messageLabel->Size.Y+12;
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;
class CloseAction: public ui::ButtonAction
@@ -70,13 +78,20 @@ ConfirmPrompt::ConfirmPrompt(std::string title, std::string message, std::string
AddComponent(titleLabel);
ui::Label * messageLabel = new ui::Label(ui::Point(4, 25), ui::Point(Size.X-8, -1), message);
messageLabel->SetMultiline(true);
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-28, -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);
Size.Y += messageLabel->Size.Y+12;
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;
class CloseAction: public ui::ButtonAction

0 comments on commit cd3d54d

Please sign in to comment.