Fixed an issue where the default textlist size and position properties were not set for the system view.

Also moved some default value assignments to the TextListComponent itself.
This commit is contained in:
Leon Styhre 2022-11-13 11:56:18 +01:00
parent 48111ce5e4
commit ed6b23a2c6
3 changed files with 10 additions and 9 deletions

View file

@ -140,9 +140,6 @@ void GamelistView::onThemeChanged(const std::shared_ptr<ThemeData>& theme)
mTextList = std::make_unique<TextListComponent<FileData*>>(); mTextList = std::make_unique<TextListComponent<FileData*>>();
mPrimary = mTextList.get(); mPrimary = mTextList.get();
} }
mPrimary->setPosition(0.0f, mSize.y * 0.1f);
mPrimary->setSize(mSize.x, mSize.y * 0.8f);
mPrimary->setAlignment(TextListComponent<FileData*>::PrimaryAlignment::ALIGN_LEFT);
mPrimary->setCursorChangedCallback( mPrimary->setCursorChangedCallback(
[&](const CursorState& state) { updateView(state); }); [&](const CursorState& state) { updateView(state); });
mPrimary->setDefaultZIndex(50.0f); mPrimary->setDefaultZIndex(50.0f);
@ -357,9 +354,6 @@ void GamelistView::onThemeChanged(const std::shared_ptr<ThemeData>& theme)
if (mPrimary == nullptr) { if (mPrimary == nullptr) {
mTextList = std::make_unique<TextListComponent<FileData*>>(); mTextList = std::make_unique<TextListComponent<FileData*>>();
mPrimary = mTextList.get(); mPrimary = mTextList.get();
mPrimary->setPosition(0.0f, mSize.y * 0.1f);
mPrimary->setSize(mSize.x, mSize.y * 0.8f);
mPrimary->setAlignment(TextListComponent<FileData*>::PrimaryAlignment::ALIGN_LEFT);
mPrimary->setCursorChangedCallback([&](const CursorState& state) { updateView(state); }); mPrimary->setCursorChangedCallback([&](const CursorState& state) { updateView(state); });
mPrimary->setDefaultZIndex(50.0f); mPrimary->setDefaultZIndex(50.0f);
mPrimary->setZIndex(50.0f); mPrimary->setZIndex(50.0f);

View file

@ -914,9 +914,6 @@ void CarouselComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
const std::string& element, const std::string& element,
unsigned int properties) unsigned int properties)
{ {
using namespace ThemeFlags;
const ThemeData::ThemeElement* elem {theme->getElement(view, element, "carousel")};
mSize.x = Renderer::getScreenWidth(); mSize.x = Renderer::getScreenWidth();
mSize.y = Renderer::getScreenHeight() * 0.23240f; mSize.y = Renderer::getScreenHeight() * 0.23240f;
GuiComponent::mPosition.x = 0.0f; GuiComponent::mPosition.x = 0.0f;
@ -925,6 +922,9 @@ void CarouselComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
mCarouselColorEnd = 0xFFFFFFD8; mCarouselColorEnd = 0xFFFFFFD8;
mZIndex = mDefaultZIndex; mZIndex = mDefaultZIndex;
using namespace ThemeFlags;
const ThemeData::ThemeElement* elem {theme->getElement(view, element, "carousel")};
if (!elem) if (!elem)
return; return;

View file

@ -482,7 +482,14 @@ void TextListComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
const std::string& element, const std::string& element,
unsigned int properties) unsigned int properties)
{ {
mSize.x = Renderer::getScreenWidth();
mSize.y = Renderer::getScreenHeight() * 0.8f;
GuiComponent::mPosition.x = 0.0f;
GuiComponent::mPosition.y = Renderer::getScreenHeight() * 0.1;
setAlignment(PrimaryAlignment::ALIGN_LEFT);
GuiComponent::applyTheme(theme, view, element, properties); GuiComponent::applyTheme(theme, view, element, properties);
using namespace ThemeFlags; using namespace ThemeFlags;
const ThemeData::ThemeElement* elem {theme->getElement(view, element, "textlist")}; const ThemeData::ThemeElement* elem {theme->getElement(view, element, "textlist")};