Loading...
Searching...
No Matches
ml::Controller Class Referenceabstract

Abstract interface for application initialization and event registration. More...

#include <Controller.h>

Inheritance diagram for ml::Controller:

Public Member Functions

virtual ~Controller ()=default
virtual void initialization ()=0
 Create and register all components and resources.
virtual void registerEvents ()=0
 Attach event callbacks to components and framework objects.

Detailed Description

Abstract interface for application initialization and event registration.

Controller defines the two-phase lifecycle contract that every Malena application entry point must fulfill:

  1. initialization() — called once at startup to create and register components, load resources, and set up initial state.
  2. registerEvents() — called immediately after initialization() to attach event callbacks (onClick, onHover, onMessage, etc.) to the components created in the first phase.

Separating these two phases ensures that all objects exist before any callback tries to reference them, avoiding order-of-initialization issues.

UIController extends Controller with a CoreAdapter proxy and an onUpdate convenience method. Application inherits from both AppManager and UIController, collapsing the full lifecycle into a single subclass.

See also
UIController, Application

Definition at line 35 of file Controller.h.

Constructor & Destructor Documentation

◆ ~Controller()

virtual ml::Controller::~Controller ( )
virtualdefault

Member Function Documentation

◆ initialization()

virtual void ml::Controller::initialization ( )
pure virtual

Create and register all components and resources.

Implement this method to construct the objects your application needs and register them with the appropriate managers (e.g., via addComponent). This method runs before registerEvents(), so every object you plan to subscribe to will already exist by the time callbacks are attached.

Implemented in ml::Application, ml::ApplicationWith< Manifest >, and ml::UIController.

◆ registerEvents()

virtual void ml::Controller::registerEvents ( )
pure virtual

Attach event callbacks to components and framework objects.

Implement this method to wire up onClick, onHover, onUpdate, onMessage, and any other subscriptions. Called immediately after initialization() by AppManager before the main loop begins.

Implemented in ml::Application, ml::ApplicationWith< Manifest >, and ml::UIController.


The documentation for this class was generated from the following file: