2025-01-22 05:41 AM
Hello,
I am trying to learn a structure that is provided for MVP implementation. I dont understand where is Screen1View and every other class instance placed. I see that definitions are in .hpp files and implementations of .cpp file. Also, I am really curious where is the Screen1Presenter(Screen1View& v) function called.
#ifndef SCREEN1PRESENTER_HPP
#define SCREEN1PRESENTER_HPP
#include <gui/model/ModelListener.hpp>
#include <mvp/Presenter.hpp>
using namespace touchgfx;
class Screen1View;
class Screen1Presenter : public touchgfx::Presenter, public ModelListener
{
public:
Screen1Presenter(Screen1View& v);
/**
* The activate function is called automatically when this screen is "switched in"
* (ie. made active). Initialization logic can be placed here.
*/
virtual void activate();
/**
* The deactivate function is called automatically when this screen is "switched out"
* (ie. made inactive). Teardown functionality can be placed here.
*/
virtual void deactivate();
virtual ~Screen1Presenter() {};
virtual void setLight (bool state);
private:
Screen1Presenter();
Screen1View& view;
};
#endif // SCREEN1PRESENTER_HPP
Solved! Go to Solution.
2025-01-22 07:28 AM
I found the answer the instances are provided
RectVector_t cachedDirtyAreas; ///< When draw caching is enabled, these rects keeps track of the dirty screen area.
RectVector_t lastRects; ///< The dirty areas from last frame that needs to be redrawn because we have swapped frame buffers.
Rect redraw; ///< Rect describing application requested invalidate area
bool transitionHandled; ///< True if the transition is done and Screen::afterTransition has been called.
static Screen* currentScreen; ///< Pointer to currently displayed Screen.
static Transition* currentTransition; ///< Pointer to current transition.
static Application* instance; ///< Pointer to the instance of the Application-derived subclass. @note Must be set by subclass constructor!
static DebugPrinter* debugPrinter; ///< Pointer to the DebugPrinter instance.
static Rect debugRegionInvalidRect; ///< Invalidated Debug Region
};
in Application.hpp file at the end of the file.
2025-01-22 05:52 AM
Within touchGFX you can right click in any screen in the list and you would have this menu:
if you select Edit Source Files, it would then open all related files to that screen and you can also see the direction where it is when you open it in something like Notepad++ for example.
greetings
2025-01-22 06:03 AM
I see what you are trying to say, thank you, however that does not answer my question because in Screen1ViewBase there is no call of the
Screen1Presenter(Screen1View& v);
I want to know where is this function being called or maybe better where is instance of Screen1View defined.
Regards,
2025-01-22 07:28 AM
I found the answer the instances are provided
RectVector_t cachedDirtyAreas; ///< When draw caching is enabled, these rects keeps track of the dirty screen area.
RectVector_t lastRects; ///< The dirty areas from last frame that needs to be redrawn because we have swapped frame buffers.
Rect redraw; ///< Rect describing application requested invalidate area
bool transitionHandled; ///< True if the transition is done and Screen::afterTransition has been called.
static Screen* currentScreen; ///< Pointer to currently displayed Screen.
static Transition* currentTransition; ///< Pointer to current transition.
static Application* instance; ///< Pointer to the instance of the Application-derived subclass. @note Must be set by subclass constructor!
static DebugPrinter* debugPrinter; ///< Pointer to the DebugPrinter instance.
static Rect debugRegionInvalidRect; ///< Invalidated Debug Region
};
in Application.hpp file at the end of the file.