Topbar visibility works now on start as well (no matter the configured screens)
This commit is contained in:
@@ -106,6 +106,8 @@ void loadDefaultLayout()
|
||||
void loadCustomScreens()
|
||||
{
|
||||
unsigned i = 0;
|
||||
auto viewMain = ViewMain::instance();
|
||||
|
||||
while (i < MAX_CUSTOM_SCREENS) {
|
||||
|
||||
auto& screen = customScreens[i];
|
||||
@@ -118,12 +120,14 @@ void loadCustomScreens()
|
||||
}
|
||||
|
||||
// layout is ok, let's add it
|
||||
auto viewMain = ViewMain::instance();
|
||||
screen->attach(viewMain);
|
||||
viewMain->setMainViewsCount(i + 1);
|
||||
screen->setLeft(viewMain->getMainViewLeftPos(i));
|
||||
i++;
|
||||
}
|
||||
|
||||
viewMain->setCurrentMainView(0);
|
||||
viewMain->setTopbarVisible(customScreens[0]->hasTopbar());
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -145,11 +145,13 @@ void ViewMain::setScrollPositionX(coord_t value)
|
||||
auto pageIdx = getPageIndex();
|
||||
if (pageIdx != g_model.view) {
|
||||
g_model.view = pageIdx;
|
||||
// crude on/off for now
|
||||
setTopbarVisible(customScreens[pageIdx]->hasTopbar());
|
||||
customScreens[pageIdx]->decorate();
|
||||
//TODO: compute topbar visibility
|
||||
//auto relativeScrollPosition = getScrollPositionX() % pageWidth;
|
||||
if (customScreens[pageIdx]) {
|
||||
// crude on/off for now
|
||||
setTopbarVisible(customScreens[pageIdx]->hasTopbar());
|
||||
customScreens[pageIdx]->decorate();
|
||||
//TODO: compute topbar visibility
|
||||
//auto relativeScrollPosition = getScrollPositionX() % pageWidth;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -62,6 +62,11 @@ class ViewMain: public Window
|
||||
|
||||
coord_t getMainViewLeftPos(unsigned view) const;
|
||||
|
||||
unsigned getCurrentMainView() const;
|
||||
void setCurrentMainView(unsigned view);
|
||||
void nextMainView();
|
||||
void previousMainView();
|
||||
|
||||
protected:
|
||||
static ViewMain * _instance;
|
||||
|
||||
@@ -70,11 +75,6 @@ class ViewMain: public Window
|
||||
|
||||
friend class SetupWidgetsPage;
|
||||
|
||||
unsigned getCurrentMainView() const;
|
||||
void setCurrentMainView(unsigned view);
|
||||
void nextMainView();
|
||||
void previousMainView();
|
||||
|
||||
void setScrollPositionX(coord_t value) override;
|
||||
void setScrollPositionY(coord_t value) override;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user