ImFusion C++ SDK 4.5.0
ImFusion::GUI::TypedViewObject< ObjectType, EventHandlerType > Class Template Reference

#include <ImFusion/GUI/ViewObject.h>

Specialization of a ViewObject where the concrete types of the underlying GlObject and EventHandler are defined by the template parameters. More...

Inheritance diagram for ImFusion::GUI::TypedViewObject< ObjectType, EventHandlerType >:

Detailed Description

template<typename ObjectType, typename EventHandlerType = ViewObject::EventHandler>
class ImFusion::GUI::TypedViewObject< ObjectType, EventHandlerType >

Specialization of a ViewObject where the concrete types of the underlying GlObject and EventHandler are defined by the template parameters.

This can be useful if you know them in advance, don't need to rely on polymorphism, and want to avoid manually casting repeatedly.

Public Member Functions

 TypedViewObject (std::unique_ptr< ObjectType > glObject, std::unique_ptr< EventHandlerType > eventHandler=nullptr)
const ObjectType & glObject () const
 Get the underlying typed GlObject.
ObjectType & glObject ()
const EventHandlerType * eventHandler () const
 Get the optionally attached EventHandler.
EventHandlerType * eventHandler ()
EventResult handleInputEvent (const InputEvent &event, const View &view) override
 Gets called by the parent view in order to handle user input events.
Public Member Functions inherited from ImFusion::GUI::ViewObject
 ViewObject (std::unique_ptr< GlObject > glObject)
 Instantiate a new ViewObject taking ownership of the underlying GlObject which must not be null.
const GlObjectglObject () const
 Get the underlying abstract GlObject.
GlObjectglObject ()
const GlObjectgl () const
 Original API methods for the underlying abstract GlObject.
GlObjectgl ()

Protected Attributes

std::unique_ptr< EventHandlerType > m_eventHandler
Protected Attributes inherited from ImFusion::GUI::ViewObject
std::unique_ptr< GlObjectm_glObject

Member Function Documentation

◆ handleInputEvent()

template<typename ObjectType, typename EventHandlerType>
EventResult ImFusion::GUI::TypedViewObject< ObjectType, EventHandlerType >::handleInputEvent ( const InputEvent & event,
const View & view )
overridevirtual

Gets called by the parent view in order to handle user input events.

It returns an EventResult to indicated if and how event propagation should continue.

Parameters
eventUser input event to handle.
viewParent View where the event originates from. This additional payload enables you to add the same ViewObject to multiple views and still implement view-specific handling logic.

Implements ImFusion::GUI::ViewObject.


The documentation for this class was generated from the following file:
  • ImFusion/GUI/ViewObject.h
Search Tab / S to search, Esc to close