GUI: U32: Shift most widgets to draw with u32

- ButtonWidgets (Button, Radio, Checkbox, dropdown)
- StaticTextWidgets
- PopUpWidgets
- Tabs
- Add a temporary overloaded drawDDText function to make other widgets draw normally
This commit is contained in:
aryanrawlani28 2020-06-10 21:37:51 +05:30 committed by Eugene Sandulenko
parent 2745d51fe7
commit aafade4507
25 changed files with 486 additions and 445 deletions

View file

@ -940,10 +940,44 @@ void ThemeEngine::drawDDText(TextData type, TextColor color, const Common::Rect
addDirtyRect(dirty);
}
void ThemeEngine::drawDDText(TextData type, TextColor color, const Common::Rect &r, const Common::U32String &text,
bool restoreBg, bool ellipsis, Graphics::TextAlign alignH, TextAlignVertical alignV,
int deltax, const Common::Rect &drawableTextArea) {
if (type == kTextDataNone || !_texts[type] || _layerToDraw == kDrawLayerBackground)
return;
Common::Rect area = r;
area.clip(_screen.w, _screen.h);
Common::Rect dirty = drawableTextArea;
if (dirty.isEmpty()) dirty = area;
else dirty.clip(area);
if (!_clip.isEmpty()) {
dirty.clip(_clip);
}
// HACK: One small pixel should be invisible enough
if (dirty.isEmpty()) dirty = Common::Rect(0, 0, 1, 1);
if (restoreBg)
restoreBackground(dirty);
_vectorRenderer->setFgColor(_textColors[color]->r, _textColors[color]->g, _textColors[color]->b);
#ifdef USE_TRANSLATION
_vectorRenderer->drawString(_texts[type]->_fontPtr, TransMan.convertBiDiString(text), area, alignH, alignV, deltax, ellipsis, dirty);
#else
_vectorRenderer->drawString(_texts[type]->_fontPtr, text, area, alignH, alignV, deltax, ellipsis, dirty);
#endif
addDirtyRect(dirty);
}
/**********************************************************
* Widget drawing functions
*********************************************************/
void ThemeEngine::drawButton(const Common::Rect &r, const Common::String &str, WidgetStateInfo state, uint16 hints) {
void ThemeEngine::drawButton(const Common::Rect &r, const Common::U32String &str, WidgetStateInfo state, uint16 hints) {
if (!ready())
return;
@ -963,7 +997,7 @@ void ThemeEngine::drawButton(const Common::Rect &r, const Common::String &str, W
_widgets[dd]->_textAlignV);
}
void ThemeEngine::drawDropDownButton(const Common::Rect &r, uint32 dropdownWidth, const Common::String &str,
void ThemeEngine::drawDropDownButton(const Common::Rect &r, uint32 dropdownWidth, const Common::U32String &str,
ThemeEngine::WidgetStateInfo buttonState, bool inButton, bool inDropdown, bool rtl) {
if (!ready())
return;
@ -1000,7 +1034,7 @@ 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, bool rtl) {
void ThemeEngine::drawCheckbox(const Common::Rect &r, const Common::U32String &str, bool checked, WidgetStateInfo state, bool rtl) {
if (!ready())
return;
@ -1035,7 +1069,7 @@ void ThemeEngine::drawCheckbox(const Common::Rect &r, const Common::String &str,
}
}
void ThemeEngine::drawRadiobutton(const Common::Rect &r, const Common::String &str, bool checked, WidgetStateInfo state, bool rtl) {
void ThemeEngine::drawRadiobutton(const Common::Rect &r, const Common::U32String &str, bool checked, WidgetStateInfo state, bool rtl) {
if (!ready())
return;
@ -1161,7 +1195,7 @@ 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, bool rtl) {
void ThemeEngine::drawPopUpWidget(const Common::Rect &r, const Common::U32String &sel, int deltax, WidgetStateInfo state, bool rtl) {
if (!ready())
return;
@ -1228,7 +1262,7 @@ void ThemeEngine::drawWidgetBackground(const Common::Rect &r, WidgetBackground b
}
void ThemeEngine::drawTab(const Common::Rect &r, int tabHeight, const Common::Array<int> &tabWidths,
const Common::Array<Common::String> &tabs, int active, bool rtl) {
const Common::Array<Common::U32String> &tabs, int active, bool rtl) {
if (!ready())
return;
@ -1279,7 +1313,7 @@ void ThemeEngine::drawTab(const Common::Rect &r, int tabHeight, const Common::Ar
}
}
void ThemeEngine::drawText(const Common::Rect &r, const Common::String &str, WidgetStateInfo state,
void ThemeEngine::drawText(const Common::Rect &r, const Common::U32String &str, WidgetStateInfo state,
Graphics::TextAlign align, TextInversionState inverted, int deltax, bool useEllipsis,
FontStyle font, FontColor color, bool restore, const Common::Rect &drawableTextArea) {
if (!ready())