mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-30 07:23:05 +00:00
GUI: RTL: Popup RTL Layout and Correctly draw them
GUI: RTL: Correctly draw popups
This commit is contained in:
parent
143b9fb13c
commit
f55654f1bc
@ -181,6 +181,10 @@ static const DrawDataInfo kDrawDataDefaults[] = {
|
||||
{kDDPopUpHover, "popup_hover", kDrawLayerForeground, kDDPopUpIdle},
|
||||
{kDDPopUpDisabled, "popup_disabled", kDrawLayerBackground, kDDNone},
|
||||
|
||||
{kDDPopUpIdleRTL, "popup_idle_rtl", kDrawLayerBackground, kDDNone},
|
||||
{kDDPopUpHoverRTL, "popup_hover_rtl", kDrawLayerForeground, kDDPopUpIdleRTL},
|
||||
{kDDPopUpDisabledRTL, "popup_disabled_rtl", kDrawLayerBackground, kDDNone},
|
||||
|
||||
{kDDCaret, "caret", kDrawLayerForeground, kDDNone},
|
||||
{kDDSeparator, "separator", kDrawLayerBackground, kDDNone},
|
||||
};
|
||||
@ -1168,18 +1172,18 @@ void ThemeEngine::drawCaret(const Common::Rect &r, bool erase) {
|
||||
drawDD(kDDCaret, r);
|
||||
}
|
||||
|
||||
void ThemeEngine::drawPopUpWidget(const Common::Rect &r, const Common::String &sel, int deltax, WidgetStateInfo state) {
|
||||
void ThemeEngine::drawPopUpWidget(const Common::Rect &r, const Common::String &sel, int deltax, WidgetStateInfo state, bool rtl) {
|
||||
if (!ready())
|
||||
return;
|
||||
|
||||
DrawData dd = kDDPopUpIdle;
|
||||
DrawData dd = rtl ? kDDPopUpIdleRTL : kDDPopUpIdle;
|
||||
|
||||
if (state == kStateEnabled)
|
||||
dd = kDDPopUpIdle;
|
||||
dd = rtl ? kDDPopUpIdleRTL : kDDPopUpIdle;
|
||||
else if (state == kStateHighlight)
|
||||
dd = kDDPopUpHover;
|
||||
dd = rtl ? kDDPopUpHoverRTL : kDDPopUpHover;
|
||||
else if (state == kStateDisabled)
|
||||
dd = kDDPopUpDisabled;
|
||||
dd = rtl ? kDDPopUpDisabledRTL : kDDPopUpDisabled;
|
||||
|
||||
drawDD(dd, r);
|
||||
|
||||
|
@ -129,6 +129,10 @@ enum DrawData {
|
||||
kDDPopUpHover,
|
||||
kDDPopUpDisabled,
|
||||
|
||||
kDDPopUpIdleRTL,
|
||||
kDDPopUpHoverRTL,
|
||||
kDDPopUpDisabledRTL,
|
||||
|
||||
kDDCaret,
|
||||
kDDSeparator,
|
||||
kDrawDataMAX,
|
||||
@ -442,7 +446,7 @@ public:
|
||||
void drawScrollbar(const Common::Rect &r, int sliderY, int sliderHeight, ScrollbarState scrollState);
|
||||
|
||||
void drawPopUpWidget(const Common::Rect &r, const Common::String &sel, int deltax,
|
||||
WidgetStateInfo state = kStateEnabled);
|
||||
WidgetStateInfo state = kStateEnabled, bool rtl = false);
|
||||
|
||||
void drawCaret(const Common::Rect &r, bool erase);
|
||||
|
||||
|
@ -524,6 +524,44 @@
|
||||
horizontal_align = 'left'
|
||||
/>
|
||||
</drawdata>
|
||||
<drawdata id = 'popup_idle_rtl' cache = 'false' resolution = 'y>399'>
|
||||
<drawstep func = 'roundedsq'
|
||||
radius = '5'
|
||||
stroke = '1'
|
||||
fg_color = 'lightgray2'
|
||||
fill = 'background'
|
||||
bg_color = 'dialog_background'
|
||||
shadow = '1'
|
||||
/>
|
||||
|
||||
<drawstep func = 'triangle'
|
||||
bg_color = 'shadowcolor'
|
||||
fill = 'background'
|
||||
width = '10'
|
||||
height = '5'
|
||||
xpos = 'left'
|
||||
ypos = '10'
|
||||
padding = '2, 0, 6, 0'
|
||||
orientation = 'bottom'
|
||||
/>
|
||||
|
||||
<drawstep func = 'triangle'
|
||||
bg_color = 'shadowcolor'
|
||||
fill = 'background'
|
||||
width = '10'
|
||||
height = '5'
|
||||
xpos = 'left'
|
||||
ypos = '4'
|
||||
padding = '2, 0, 6, 0'
|
||||
orientation = 'top'
|
||||
/>
|
||||
|
||||
<text font = 'text_default'
|
||||
text_color = 'color_normal'
|
||||
vertical_align = 'center'
|
||||
horizontal_align = 'right'
|
||||
/>
|
||||
</drawdata>
|
||||
|
||||
<drawdata id = 'popup_idle' cache = 'false' resolution ='y<400'>
|
||||
<drawstep func = 'roundedsq'
|
||||
@ -603,6 +641,44 @@
|
||||
horizontal_align = 'left'
|
||||
/>
|
||||
</drawdata>
|
||||
<drawdata id = 'popup_disabled_rtl' cache = 'false' resolution = 'y>399'>
|
||||
<drawstep func = 'roundedsq'
|
||||
stroke = '1'
|
||||
fg_color = 'lightgray'
|
||||
radius = '5'
|
||||
fill = 'gradient'
|
||||
gradient_start = 'dialog_background'
|
||||
gradient_end = 'dialog_background'
|
||||
shadow = '0'
|
||||
/>
|
||||
<drawstep func = 'triangle'
|
||||
bg_color = 'shadowcolor'
|
||||
fill = 'background'
|
||||
width = '10'
|
||||
height = '5'
|
||||
xpos = 'left'
|
||||
ypos = '10'
|
||||
padding = '2, 0, 6, 0'
|
||||
orientation = 'bottom'
|
||||
/>
|
||||
|
||||
<drawstep func = 'triangle'
|
||||
bg_color = 'shadowcolor'
|
||||
fill = 'background'
|
||||
width = '10'
|
||||
height = '5'
|
||||
xpos = 'left'
|
||||
ypos = '4'
|
||||
padding = '2, 0, 6, 0'
|
||||
orientation = 'top'
|
||||
/>
|
||||
|
||||
<text font = 'text_default'
|
||||
text_color = 'color_normal_disabled'
|
||||
vertical_align = 'center'
|
||||
horizontal_align = 'right'
|
||||
/>
|
||||
</drawdata>
|
||||
|
||||
<drawdata id = 'popup_disabled' cache = 'false' resolution = 'y<400'>
|
||||
<drawstep func = 'roundedsq'
|
||||
@ -682,6 +758,44 @@
|
||||
horizontal_align = 'left'
|
||||
/>
|
||||
</drawdata>
|
||||
<drawdata id = 'popup_hover_rtl' cache = 'false' resolution = 'y>399'>
|
||||
<drawstep func = 'roundedsq'
|
||||
stroke = '1'
|
||||
fg_color = 'lightgray'
|
||||
radius = '5'
|
||||
fill = 'gradient'
|
||||
gradient_start = 'dialog_background'
|
||||
gradient_end = 'dialog_background'
|
||||
shadow = '0'
|
||||
/>
|
||||
<drawstep func = 'triangle'
|
||||
bg_color = 'shadowcolor'
|
||||
fill = 'background'
|
||||
width = '10'
|
||||
height = '5'
|
||||
xpos = 'left'
|
||||
ypos = '10'
|
||||
padding = '2, 0, 6, 0'
|
||||
orientation = 'bottom'
|
||||
/>
|
||||
|
||||
<drawstep func = 'triangle'
|
||||
bg_color = 'shadowcolor'
|
||||
fill = 'background'
|
||||
width = '10'
|
||||
height = '5'
|
||||
xpos = 'left'
|
||||
ypos = '4'
|
||||
padding = '2, 0, 6, 0'
|
||||
orientation = 'top'
|
||||
/>
|
||||
|
||||
<text font = 'text_default'
|
||||
text_color = 'color_normal_hover'
|
||||
vertical_align = 'center'
|
||||
horizontal_align = 'right'
|
||||
/>
|
||||
</drawdata>
|
||||
|
||||
<drawdata id = 'popup_hover' cache = 'false' resolution = 'y<400'>
|
||||
<drawstep func = 'roundedsq'
|
||||
|
@ -528,10 +528,7 @@ void PopUpWidget::drawWidget() {
|
||||
if (_selectedItem >= 0)
|
||||
sel = _entries[_selectedItem].name;
|
||||
|
||||
if (g_gui.useRTL())
|
||||
_x = g_system->getOverlayWidth() - _x - _w;
|
||||
|
||||
g_gui.theme()->drawPopUpWidget(Common::Rect(_x, _y, _x + _w, _y + _h), sel, _leftPadding, _state);
|
||||
g_gui.theme()->drawPopUpWidget(Common::Rect(_x, _y, _x + _w, _y + _h), sel, _leftPadding, _state, (g_gui.useRTL() && _useRTL));
|
||||
}
|
||||
|
||||
} // End of namespace GUI
|
||||
|
Loading…
x
Reference in New Issue
Block a user