mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-04-10 19:15:13 +00:00
Left aligned DateTimeEditComponent in the scraper GUI.
This commit is contained in:
parent
9d9aaa30d7
commit
552368d2f6
|
@ -158,7 +158,7 @@ GuiMetaDataEd::GuiMetaDataEd(
|
||||||
spacer->setSize(Renderer::getScreenWidth() * 0.0025f, 0);
|
spacer->setSize(Renderer::getScreenWidth() * 0.0025f, 0);
|
||||||
row.addElement(spacer, false);
|
row.addElement(spacer, false);
|
||||||
|
|
||||||
ed = std::make_shared<DateTimeEditComponent>(window);
|
ed = std::make_shared<DateTimeEditComponent>(window, true);
|
||||||
ed->setOriginalColor(DEFAULT_TEXTCOLOR);
|
ed->setOriginalColor(DEFAULT_TEXTCOLOR);
|
||||||
ed->setChangedColor(TEXTCOLOR_USERMARKED);
|
ed->setChangedColor(TEXTCOLOR_USERMARKED);
|
||||||
row.addElement(ed, false);
|
row.addElement(ed, false);
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
DateTimeEditComponent::DateTimeEditComponent(
|
DateTimeEditComponent::DateTimeEditComponent(
|
||||||
Window* window,
|
Window* window,
|
||||||
|
bool alignRight,
|
||||||
DisplayMode dispMode)
|
DisplayMode dispMode)
|
||||||
: GuiComponent(window),
|
: GuiComponent(window),
|
||||||
mEditing(false),
|
mEditing(false),
|
||||||
|
@ -22,7 +23,8 @@ DateTimeEditComponent::DateTimeEditComponent(
|
||||||
mColor(0x777777FF),
|
mColor(0x777777FF),
|
||||||
mFont(Font::get(FONT_SIZE_SMALL, FONT_PATH_LIGHT)),
|
mFont(Font::get(FONT_SIZE_SMALL, FONT_PATH_LIGHT)),
|
||||||
mUppercase(false),
|
mUppercase(false),
|
||||||
mAutoSize(true)
|
mAutoSize(true),
|
||||||
|
mAlignRight(alignRight)
|
||||||
{
|
{
|
||||||
updateTextCache();
|
updateTextCache();
|
||||||
}
|
}
|
||||||
|
@ -170,8 +172,8 @@ void DateTimeEditComponent::render(const Transform4x4f& parentTrans)
|
||||||
|
|
||||||
// Vertically center.
|
// Vertically center.
|
||||||
Vector3f off(0, (mSize.y() - mTextCache->metrics.size.y()) / 2.0f, 0.0f);
|
Vector3f off(0, (mSize.y() - mTextCache->metrics.size.y()) / 2.0f, 0.0f);
|
||||||
// Right align.
|
if (mAlignRight)
|
||||||
off.x() += referenceSize - mTextCache->metrics.size.x();
|
off.x() += referenceSize - mTextCache->metrics.size.x();
|
||||||
trans.translate(off);
|
trans.translate(off);
|
||||||
|
|
||||||
Renderer::setMatrix(trans);
|
Renderer::setMatrix(trans);
|
||||||
|
|
|
@ -24,7 +24,8 @@ public:
|
||||||
DISP_RELATIVE_TO_NOW
|
DISP_RELATIVE_TO_NOW
|
||||||
};
|
};
|
||||||
|
|
||||||
DateTimeEditComponent(Window* window, DisplayMode dispMode = DISP_DATE);
|
DateTimeEditComponent(Window* window, bool alignRight = false,
|
||||||
|
DisplayMode dispMode = DISP_DATE);
|
||||||
|
|
||||||
void setValue(const std::string& val) override;
|
void setValue(const std::string& val) override;
|
||||||
std::string getValue() const override;
|
std::string getValue() const override;
|
||||||
|
@ -86,6 +87,7 @@ private:
|
||||||
unsigned int mColorChangedValue;
|
unsigned int mColorChangedValue;
|
||||||
|
|
||||||
std::shared_ptr<Font> mFont;
|
std::shared_ptr<Font> mFont;
|
||||||
|
bool mAlignRight;
|
||||||
bool mUppercase;
|
bool mUppercase;
|
||||||
bool mAutoSize;
|
bool mAutoSize;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue