Commit bf7cf894 authored by WINTZ Julien's avatar WINTZ Julien

Adding convenience callbacks.

parent fd8cbfaa
......@@ -140,6 +140,14 @@ void setup(dtkApplication *application)
application->window()->setCentralWidget(area);
application->window()->menubar()->touch();
QObject::connect(application->window()->menubar(), &dtkWidgetsMenuBar::entered, [=] (dtkWidgetsMenu *target) {
qDebug() << "Entered:" << target->title();
});
QObject::connect(application->window()->menubar(), &dtkWidgetsMenuBar::left, [=] (dtkWidgetsMenu *source) {
qDebug() << "Left:" << source->title();
});
}
//
......
......@@ -57,7 +57,7 @@ protected:
emit clicked();
}
private:
public:
dtkWidgetsMenu *menu = nullptr;
};
......
......@@ -399,6 +399,8 @@ void dtkWidgetsMenuBarContainer::switchToRoot(std::function<void(void)> &callbac
void dtkWidgetsMenuBarContainer::switchToPrevSlide(dtkWidgetsMenu *m)
{
emit q->left(m);
if (::stack.count())
this->navigator->setMenu(::stack.last());
else
......@@ -416,16 +418,24 @@ void dtkWidgetsMenuBarContainer::switchToPrevSlide(dtkWidgetsMenu *m)
} else {
this->slider->slideToPrevious(callback);
}
if(::stack.count())
emit q->entered(::stack.last());
}
void dtkWidgetsMenuBarContainer::switchToNextSlide(dtkWidgetsMenu *m)
{
if(::stack.count())
emit q->left(::stack.last());
this->slider->addSlide(fa::cogs, this->slides[m]);
this->slider->slideToNext();
this->navigator->setMenu(m);
::stack << m;
emit q->entered(m);
}
void dtkWidgetsMenuBarContainer::touch(dtkWidgetsMenuBar *mb)
......
......@@ -79,6 +79,9 @@ public:
signals:
void clicked(int);
void entered(dtkWidgetsMenu *);
void left(dtkWidgetsMenu *);
#pragma mark - Menu management
public:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment