diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp index dffb0414078..b5ba735605b 100644 --- a/gui/ThemeEngine.cpp +++ b/gui/ThemeEngine.cpp @@ -152,10 +152,19 @@ static const DrawDataInfo kDrawDataDefaults[] = { {kDDCheckboxSelected, "checkbox_selected", kDrawLayerForeground, kDDCheckboxDefault}, {kDDCheckboxDisabledSelected, "checkbox_disabled_selected", kDrawLayerForeground, kDDCheckboxDisabled}, + {kDDCheckboxDefaultRTL, "checkbox_default_rtl", kDrawLayerBackground, kDDNone}, + {kDDCheckboxDisabledRTL, "checkbox_disabled_rtl", kDrawLayerBackground, kDDNone}, + {kDDCheckboxSelectedRTL, "checkbox_selected_rtl", kDrawLayerForeground, kDDCheckboxDefaultRTL}, + {kDDCheckboxDisabledSelectedRTL, "checkbox_disabled_selected_rtl", kDrawLayerForeground, kDDCheckboxDisabledRTL}, + {kDDRadiobuttonDefault, "radiobutton_default", kDrawLayerBackground, kDDNone}, {kDDRadiobuttonDisabled, "radiobutton_disabled", kDrawLayerBackground, kDDNone}, {kDDRadiobuttonSelected, "radiobutton_selected", kDrawLayerForeground, kDDRadiobuttonDefault}, + {kDDRadiobuttonDefaultRTL, "radiobutton_default_rtl", kDrawLayerBackground, kDDNone}, + {kDDRadiobuttonDisabledRTL, "radiobutton_disabled_rtl", kDrawLayerBackground, kDDNone}, + {kDDRadiobuttonSelectedRTL, "radiobutton_selected_rtl", kDrawLayerForeground, kDDRadiobuttonDefaultRTL}, + {kDDTabActive, "tab_active", kDrawLayerForeground, kDDTabInactive}, {kDDTabInactive, "tab_inactive", kDrawLayerBackground, kDDNone}, {kDDTabBackground, "tab_background", kDrawLayerBackground, kDDNone}, @@ -995,59 +1004,79 @@ void ThemeEngine::drawLineSeparator(const Common::Rect &r) { drawDD(kDDSeparator, r); } -void ThemeEngine::drawCheckbox(const Common::Rect &r, const Common::String &str, bool checked, WidgetStateInfo state) { +void ThemeEngine::drawCheckbox(const Common::Rect &r, const Common::String &str, bool checked, WidgetStateInfo state, bool rtl) { if (!ready()) return; Common::Rect r2 = r; - DrawData dd = kDDCheckboxDefault; + DrawData dd = rtl ? kDDCheckboxDefaultRTL : kDDCheckboxDefault; if (checked) - dd = kDDCheckboxSelected; + dd = rtl ? kDDCheckboxSelectedRTL : kDDCheckboxSelected; if (state == kStateDisabled) - dd = checked ? kDDCheckboxDisabledSelected : kDDCheckboxDisabled; + dd = checked ? rtl ? kDDCheckboxDisabledSelectedRTL : kDDCheckboxDisabledSelected : rtl ? kDDCheckboxDisabledRTL : kDDCheckboxDisabled; const int checkBoxSize = MIN((int)r.height(), getFontHeight()); - r2.bottom = r2.top + checkBoxSize; - r2.right = r2.left + checkBoxSize; + + if (rtl) { + r2.left = r.right - checkBoxSize; + r2.right = r.right; + } else { + r2.right = r2.left + checkBoxSize; + } drawDD(dd, r2); - r2.left = r2.right + checkBoxSize; - r2.right = r.right; + if (rtl) { + r2.left = r.left; + r2.right = r.right - (checkBoxSize * 2); + } else { + r2.left = r2.right + checkBoxSize; + r2.right = r.right; + } if (r2.right > r2.left) { - drawDDText(getTextData(dd), getTextColor(dd), r2, str, true, false, _widgets[kDDCheckboxDefault]->_textAlignH, + drawDDText(getTextData(dd), getTextColor(dd), r2, str, true, false, _widgets[dd]->_textAlignH, _widgets[dd]->_textAlignV); } } -void ThemeEngine::drawRadiobutton(const Common::Rect &r, const Common::String &str, bool checked, WidgetStateInfo state) { +void ThemeEngine::drawRadiobutton(const Common::Rect &r, const Common::String &str, bool checked, WidgetStateInfo state, bool rtl) { if (!ready()) return; Common::Rect r2 = r; - DrawData dd = kDDRadiobuttonDefault; + DrawData dd = rtl ? kDDRadiobuttonDefaultRTL : kDDRadiobuttonDefault; if (checked) - dd = kDDRadiobuttonSelected; + dd = rtl ? kDDRadiobuttonSelectedRTL : kDDRadiobuttonSelected; if (state == kStateDisabled) - dd = kDDRadiobuttonDisabled; + dd = rtl ? kDDRadiobuttonDisabledRTL : kDDRadiobuttonDisabled; const int radioButtonSize = MIN((int)r.height(), getFontHeight()); - r2.bottom = r2.top + radioButtonSize; - r2.right = r2.left + radioButtonSize; + + if (rtl) { + r2.left = r.right - radioButtonSize; + r2.right = r.right; + } else { + r2.right = r2.left + radioButtonSize; + } drawDD(dd, r2); - r2.left = r2.right + radioButtonSize; - r2.right = MAX(r2.left, r.right); + if (rtl) { + r2.left = r.left; + r2.right = r.right - (radioButtonSize * 2); + } else { + r2.left = r2.right + radioButtonSize; + r2.right = MAX(r2.left, r.right); + } - drawDDText(getTextData(dd), getTextColor(dd), r2, str, true, false, _widgets[kDDRadiobuttonDefault]->_textAlignH, + drawDDText(getTextData(dd), getTextColor(dd), r2, str, true, false, _widgets[dd]->_textAlignH, _widgets[dd]->_textAlignV); } diff --git a/gui/ThemeEngine.h b/gui/ThemeEngine.h index 46cdbfdcdc1..965af5d04fc 100644 --- a/gui/ThemeEngine.h +++ b/gui/ThemeEngine.h @@ -102,10 +102,19 @@ enum DrawData { kDDCheckboxSelected, kDDCheckboxDisabledSelected, + kDDCheckboxDefaultRTL, + kDDCheckboxDisabledRTL, + kDDCheckboxSelectedRTL, + kDDCheckboxDisabledSelectedRTL, + kDDRadiobuttonDefault, kDDRadiobuttonDisabled, kDDRadiobuttonSelected, + kDDRadiobuttonDefaultRTL, + kDDRadiobuttonDisabledRTL, + kDDRadiobuttonSelectedRTL, + kDDTabActive, kDDTabInactive, kDDTabBackground, @@ -422,10 +431,10 @@ public: void drawSlider(const Common::Rect &r, int width, WidgetStateInfo state = kStateEnabled); void drawCheckbox(const Common::Rect &r, const Common::String &str, bool checked, - WidgetStateInfo state = kStateEnabled); + WidgetStateInfo state = kStateEnabled, bool rtl = false); void drawRadiobutton(const Common::Rect &r, const Common::String &str, bool checked, - WidgetStateInfo state = kStateEnabled); + WidgetStateInfo state = kStateEnabled, bool rtl = false); void drawTab(const Common::Rect &r, int tabHeight, const Common::Array &tabWidths, const Common::Array &tabs, int active); diff --git a/gui/themes/scummremastered/remastered_gfx.stx b/gui/themes/scummremastered/remastered_gfx.stx index 2aa9a28c48c..6c0d7077a66 100644 --- a/gui/themes/scummremastered/remastered_gfx.stx +++ b/gui/themes/scummremastered/remastered_gfx.stx @@ -1264,6 +1264,16 @@ file = 'checkbox_disabled.bmp' /> + + + + @@ -1276,6 +1286,16 @@ file = 'checkbox_empty.bmp' /> + + + + @@ -1288,6 +1308,16 @@ file = 'checkbox.bmp' /> + + + + @@ -1300,6 +1330,16 @@ file = 'checkbox_empty.bmp' /> + + + + @@ -1312,6 +1352,16 @@ file = 'radiobutton_empty.bmp' /> + + + + @@ -1324,6 +1374,16 @@ file = 'radiobutton.bmp' /> + + + + @@ -1336,6 +1396,16 @@ file = 'radiobutton_empty.bmp' /> + + + + diff --git a/gui/widget.cpp b/gui/widget.cpp index 55f2b436048..63816e153e2 100644 --- a/gui/widget.cpp +++ b/gui/widget.cpp @@ -649,7 +649,7 @@ void CheckboxWidget::setState(bool state) { } void CheckboxWidget::drawWidget() { - g_gui.theme()->drawCheckbox(Common::Rect(_x, _y, _x + _w, _y + _h), _label, _state, Widget::_state); + g_gui.theme()->drawCheckbox(Common::Rect(_x, _y, _x + _w, _y + _h), _label, _state, Widget::_state, (g_gui.useRTL() && _useRTL)); } #pragma mark - @@ -718,7 +718,7 @@ void RadiobuttonWidget::setState(bool state, bool setGroup) { } void RadiobuttonWidget::drawWidget() { - g_gui.theme()->drawRadiobutton(Common::Rect(_x, _y, _x + _w, _y + _h), _label, _state, Widget::_state); + g_gui.theme()->drawRadiobutton(Common::Rect(_x, _y, _x + _w, _y + _h), _label, _state, Widget::_state, (g_gui.useRTL() && _useRTL)); } #pragma mark -