跳转到主要内容

MVPApplication

mvp/MVPApplication.hpp

A specialization of the TouchGFX Application class that provides the necessary glue for transitioning between presenter/view pairs. It maintains a callback for transitioning and evaluates this at each tick.

See: Application

Inherits from: Application, UIEventListener

Public Functions

virtual voidhandlePendingScreenTransition()
Handles the pending screen transition.
MVPApplication()
Initializes a new instance of the MVPApplication class.

Protected Functions

voidevaluatePendingScreenTransition()
Evaluates the pending Callback instances.

Protected Attributes

Presenter *currentPresenter
Pointer to the currently active presenter.
GenericCallback *pendingScreenTransitionCallback
Callback for screen transitions. Will be set to something valid when a transition request is made.

Additional inherited members

Protected Classes inherited from Application

classTimerWidgets
A class to handle and manage timer widgets.

Protected Types inherited from Application

typedef Vector< Rect, 8 >RectVector_t
Type to ensure the same number of rects are in the Vector.

Public Functions inherited from Application

Screen *getCurrentScreen()
Gets the current screen.
DebugPrinter *getDebugPrinter()
Returns the DebugPrinter object associated with the application.
Application *getInstance()
Gets the single instance application.
voidinvalidateDebugRegion()
Sets the debug string to be displayed onscreen on top of the framebuffer.
voidsetDebugPrinter(DebugPrinter * printer)
Sets the DebugPrinter object to be used by the application to print debug messages.
voidsetDebugString(const char * string)
Sets the debug string to be displayed onscreen on top of the framebuffer.
virtual voidappSwitchScreen(uint8_t screenId)
An application specific function for switching screen.
virtual voidchangeToStartScreen()
This function can be called to send your application back to the start screen.
voidclearAllTimerWidgets()
Clears all currently registered timer widgets.
virtual voidclearCachedAreas()
Clears the cached areas so coming calls to invalidate are collected for future drawing.
voidcopyInvalidatedAreasFromTFTToClientBuffer()
This function copies the parts that were updated in the previous frame (in the TFT buffer) to the active framebuffer (client buffer).
virtual voiddrawCachedAreas()
Draws all cached, invalidated areas on the screen.
uint16_tgetNumberOfRegisteredTimerWidgets() const
gets the number of timer widgets that are registered and active.
uint16_tgetTimerWidgetCountForDrawable(const Drawable * w) const
Gets the number of timer events registered to a widget, i.e.
virtual voidhandleClickEvent(const ClickEvent & event)
Handle a click event.
virtual voidhandleDragEvent(const DragEvent & event)
Handle drag events.
virtual voidhandleGestureEvent(const GestureEvent & event)
Handle gestures.
virtual voidhandleKeyEvent(uint8_t c)
Handle an incoming character received by the HAL layer.
virtual voidhandleTickEvent()
Handle tick.
voidinvalidate()
Invalidates the entire screen.
voidinvalidateArea(Rect area)
Invalidates the given area.
voidregisterTimerWidget(Drawable * w)
Adds a widget to the list of widgets receiving ticks every frame (typically 16.67ms)
virtual voidrequestRedraw()
An application specific function for requesting redraw of entire screen.
virtual voidrequestRedraw(Rect & rect)
An application specific function for requesting redraw of given Rect.
virtual voidswitchScreen(Screen * newScreen)
Switch to another Screen.
voidunregisterTimerWidget(const Drawable * w)
Removes a widget from the list of widgets receiving ticks every frame (typically 16.67ms) milliseconds.

Protected Functions inherited from Application

Application()
Protected constructor.
virtual voiddraw()
Initiate a draw operation of the entire screen.
virtual voiddraw(Rect & rect)
Initiate a draw operation of the specified region of the screen.

Public Attributes inherited from Application

const uint8_tMAX_TIMER_WIDGETS
Maximum number of widgets receiving ticks.
const uint16_tTICK_INTERVAL_MS
Deprecated, do not use this constant. Tick interval depends on VSYNC of your target platform.

Protected Attributes inherited from Application

RectVector_tcachedDirtyAreas
When draw caching is enabled, these rects keeps track of the dirty screen area.
RectVector_tlastRects
The dirty areas from last frame that needs to be redrawn because we have swapped frame buffers.
Rectredraw
Rect describing application requested invalidate area.
class touchgfx::Application::TimerWidgetstimerWidgets
The timer widgets.
booltransitionHandled
True if the transition is done and Screen::afterTransition has been called.
Screen *currentScreen
Pointer to currently displayed Screen.
Transition *currentTransition
Pointer to current transition.
DebugPrinter *debugPrinter
Pointer to the DebugPrinter instance.
RectdebugRegionInvalidRect
Invalidated Debug Region.
Application *instance
Pointer to the instance of the Application-derived subclass.

Public Functions inherited from UIEventListener

virtual voidhandleClickEvent(const ClickEvent & event)
This handler is invoked when a mouse click or display touch event has been detected by the system.
virtual voidhandleDragEvent(const DragEvent & event)
This handler is invoked when a drag event has been detected by the system.
virtual voidhandleGestureEvent(const GestureEvent & event)
This handler is invoked when a gesture event has been detected by the system.
virtual voidhandleKeyEvent(uint8_t c)
This handler is invoked when a key (or button) event has been detected by the system.
virtual voidhandleTickEvent()
This handler is invoked when a system tick event has been generated.
virtual ~UIEventListener()
Finalizes an instance of the UIEventListener class.

Public Functions Documentation

handlePendingScreenTransition

Handles the pending screen transition.

Delegates the work to evaluatePendingScreenTransition()

Reimplements: touchgfx::Application::handlePendingScreenTransition

MVPApplication

Initializes a new instance of the MVPApplication class.

Protected Functions Documentation

evaluatePendingScreenTransition

Evaluates the pending Callback instances.

If a callback is valid, it is executed and a Screen transition is executed.

Protected Attributes Documentation

currentPresenter

Presenter * currentPresenter

Pointer to the currently active presenter.

pendingScreenTransitionCallback

GenericCallback * pendingScreenTransitionCallback

Callback for screen transitions. Will be set to something valid when a transition request is made.