mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-25 15:45:38 +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);
|
||||
row.addElement(spacer, false);
|
||||
|
||||
ed = std::make_shared<DateTimeEditComponent>(window);
|
||||
ed = std::make_shared<DateTimeEditComponent>(window, true);
|
||||
ed->setOriginalColor(DEFAULT_TEXTCOLOR);
|
||||
ed->setChangedColor(TEXTCOLOR_USERMARKED);
|
||||
row.addElement(ed, false);
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
DateTimeEditComponent::DateTimeEditComponent(
|
||||
Window* window,
|
||||
bool alignRight,
|
||||
DisplayMode dispMode)
|
||||
: GuiComponent(window),
|
||||
mEditing(false),
|
||||
|
@ -22,7 +23,8 @@ DateTimeEditComponent::DateTimeEditComponent(
|
|||
mColor(0x777777FF),
|
||||
mFont(Font::get(FONT_SIZE_SMALL, FONT_PATH_LIGHT)),
|
||||
mUppercase(false),
|
||||
mAutoSize(true)
|
||||
mAutoSize(true),
|
||||
mAlignRight(alignRight)
|
||||
{
|
||||
updateTextCache();
|
||||
}
|
||||
|
@ -170,8 +172,8 @@ void DateTimeEditComponent::render(const Transform4x4f& parentTrans)
|
|||
|
||||
// Vertically center.
|
||||
Vector3f off(0, (mSize.y() - mTextCache->metrics.size.y()) / 2.0f, 0.0f);
|
||||
// Right align.
|
||||
off.x() += referenceSize - mTextCache->metrics.size.x();
|
||||
if (mAlignRight)
|
||||
off.x() += referenceSize - mTextCache->metrics.size.x();
|
||||
trans.translate(off);
|
||||
|
||||
Renderer::setMatrix(trans);
|
||||
|
|
|
@ -24,7 +24,8 @@ public:
|
|||
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;
|
||||
std::string getValue() const override;
|
||||
|
@ -86,6 +87,7 @@ private:
|
|||
unsigned int mColorChangedValue;
|
||||
|
||||
std::shared_ptr<Font> mFont;
|
||||
bool mAlignRight;
|
||||
bool mUppercase;
|
||||
bool mAutoSize;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue