GUI: RTL: Align fixes for text in Load game dialog

This commit is contained in:
aryanrawlani28 2020-05-16 20:31:07 +05:30 committed by Eugene Sandulenko
parent 5e39545653
commit d6c2d4b809
2 changed files with 24 additions and 4 deletions

View File

@ -376,7 +376,9 @@ SaveLoadChooserSimple::SaveLoadChooserSimple(const String &title, const String &
_container(nullptr) {
_backgroundType = ThemeEngine::kDialogBackgroundSpecial;
new StaticTextWidget(this, "SaveLoadChooser.Title", title);
_pageTitle = new StaticTextWidget(this, "SaveLoadChooser.Title", title);
if(g_gui.useRTL())
_pageTitle->setAlign(Graphics::kTextAlignRight);
// Add choice list
_list = new ListWidget(this, "SaveLoadChooser.List");
@ -757,7 +759,9 @@ SaveLoadChooserGrid::SaveLoadChooserGrid(const Common::String &title, bool saveM
_curPage(0), _newSaveContainer(nullptr), _nextFreeSaveSlot(0), _buttons() {
_backgroundType = ThemeEngine::kDialogBackgroundSpecial;
new StaticTextWidget(this, "SaveLoadChooser.Title", title);
_pageTitle = new StaticTextWidget(this, "SaveLoadChooser.Title", title);
if(g_gui.useRTL())
_pageTitle->setAlign(Graphics::kTextAlignRight);
// The list widget needs to be bound so it takes space in the layout
ContainerWidget *list = new ContainerWidget(this, "SaveLoadChooser.List");
@ -773,10 +777,17 @@ SaveLoadChooserGrid::SaveLoadChooserGrid(const Common::String &title, bool saveM
// Page display
_pageDisplay = new StaticTextWidget(this, "SaveLoadChooser.PageDisplay", Common::String());
_pageDisplay->setAlign(Graphics::kTextAlignRight);
if (g_gui.useRTL()) {
_pageDisplay->setAlign(Graphics::kTextAlignLeft);
} else {
_pageDisplay->setAlign(Graphics::kTextAlignRight);
}
}
SaveLoadChooserGrid::~SaveLoadChooserGrid() {
removeWidget(_pageTitle);
delete _pageTitle;
removeWidget(_pageDisplay);
delete _pageDisplay;
}
@ -944,6 +955,8 @@ void SaveLoadChooserGrid::reflowLayout() {
_lines = MAX<uint>(1, availableHeight / slotAreaHeight);
_entriesPerPage = _columns * _lines;
Graphics::TextAlign alignment = Graphics::kTextAlignLeft;
// In save mode the first button is always "New Save", thus we need to
// adjust the entries per page here.
if (_saveMode) {
@ -991,10 +1004,15 @@ void SaveLoadChooserGrid::reflowLayout() {
buttonCmd += 1;
}
if (g_gui.useRTL()) {
alignment = Graphics::kTextAlignRight;
// GUI TODO: 1st and 3rd row pictures not being displayed.
}
PicButtonWidget *button = new PicButtonWidget(container, dstX, dstY, buttonWidth, buttonHeight, nullptr, buttonCmd);
dstY += buttonHeight;
StaticTextWidget *description = new StaticTextWidget(container, dstX, dstY, buttonWidth, kLineHeight, Common::String(), Graphics::kTextAlignLeft);
StaticTextWidget *description = new StaticTextWidget(container, dstX, dstY, buttonWidth, kLineHeight, Common::String(), alignment);
_buttons.push_back(SlotButton(container, button, description));
}

View File

@ -161,6 +161,7 @@ private:
StaticTextWidget *_date;
StaticTextWidget *_time;
StaticTextWidget *_playtime;
StaticTextWidget *_pageTitle;
String _resultString;
@ -218,6 +219,7 @@ private:
ButtonWidget *_nextButton;
ButtonWidget *_prevButton;
StaticTextWidget *_pageTitle;
StaticTextWidget *_pageDisplay;
ContainerWidget *_newSaveContainer;