protected:
FrontendApplication& application() {
return *static_cast<FrontendApplication*>(touchgfx::Application::getInstance());
class FrontendApplication : public FrontendApplicationBase
{
public:
class FrontendApplicationBase : public touchgfx::MVPApplication
{
public:
class MVPApplication : public Application
{
public:
class Application : public UIEventListener
{
public:
static Application* getInstance();
所以 static_cast 是把父类 转化为 子类!
void Screen1ViewBase::buttonCallbackHandler(const touchgfx::AbstractButton& src)
{
if (&src == &button1)
{
//Interaction1
//When button1 clicked change screen to Screen2
//Go to Screen2 with screen transition towards East
application().gotoScreen2ScreenSlideTransitionEast();
}
}
void FrontendApplicationBase::gotoScreen2ScreenSlideTransitionEast()
{
transitionCallback = touchgfx::Callback<FrontendApplicationBase>(this, &FrontendApplication::gotoScreen2ScreenSlideTransitionEastImpl);
pendingScreenTransitionCallback = &transitionCallback;
}