GUI: Code cleanup and small issue fixes

This commit is contained in:
aryanrawlani28 2020-05-18 23:46:20 +05:30 committed by Eugene Sandulenko
parent c7469a1145
commit d968665110
4 changed files with 11 additions and 20 deletions

View File

@ -586,11 +586,7 @@ void GuiManager::processEvent(const Common::Event &event, Dialog *const activeDi
Common::Point mouse(event.mouse.x - activeDialog->_x, event.mouse.y - activeDialog->_y);
if (g_gui.useRTL()) {
mouse.x = g_system->getOverlayWidth() - event.mouse.x - activeDialog->_x;
if (g_gui.getOverlayOffset() != 0) {
mouse.x = g_gui.getOverlayOffset() + mouse.x;
}
mouse.x = g_system->getOverlayWidth() - event.mouse.x - activeDialog->_x + g_gui.getOverlayOffset();
}
switch (event.type) {
@ -602,10 +598,7 @@ void GuiManager::processEvent(const Common::Event &event, Dialog *const activeDi
break;
case Common::EVENT_MOUSEMOVE:
if (g_gui.useRTL()) {
_globalMousePosition.x = g_system->getOverlayWidth() - event.mouse.x;
if (g_gui.getOverlayOffset() != 0) {
_globalMousePosition.x = g_gui.getOverlayOffset() + _globalMousePosition.x;
}
_globalMousePosition.x = g_system->getOverlayWidth() - event.mouse.x + g_gui.getOverlayOffset();
} else {
_globalMousePosition.x = event.mouse.x;
}

View File

@ -1827,13 +1827,8 @@ void GlobalOptionsDialog::build() {
addAccessibilityControls(tab, "GlobalOptions_Accessibility.");
#endif // USE_TTS
// GUI TODO: Incomplete implementation, currently just switches to last tab.
if (g_gui.useRTL()) {
tab->setActiveTab(tab->getTabsSize() - 1);
} else {
// Activate the first tab
tab->setActiveTab(0);
}
// Activate the first tab
tab->setActiveTab(0);
_tabWidget = tab;
// Add OK & Cancel buttons

View File

@ -526,8 +526,8 @@ void DropdownButtonWidget::clearEntries() {
_entries.clear();
}
void DropdownButtonWidget::drawWidget() { // These are okay, no need to flip again.
if (_entries.empty()) { // GUI TODO: However, down arrow should be to the right. Figure out a way to flip the widget internally?
void DropdownButtonWidget::drawWidget() {
if (_entries.empty()) {
// Degrade to a regular button
g_gui.theme()->drawButton(Common::Rect(_x, _y, _x + _w, _y + _h), _label, _state);
} else {

View File

@ -142,8 +142,11 @@ void ScrollContainerWidget::reflowLayout() {
void ScrollContainerWidget::drawWidget() {
// GUI TODO: Recheck what the below line does.
if (this->_name.contains("GameOptions") || this->_name.contains("GlobalOptions"))
_x = g_system->getOverlayWidth() - _w - _x;
if (g_gui.useRTL()) {
if (this->_name.contains("GameOptions") || this->_name.contains("GlobalOptions")) {
_x = g_system->getOverlayWidth() - _x - _w + g_gui.getOverlayOffset();
}
}
g_gui.theme()->drawWidgetBackground(Common::Rect(_x, _y, _x + _w, _y + getHeight()), _backgroundType);
}