![]() |
ImFusion SDK 4.3
|
#include <ImFusion/GUI/ViewObject.h>
Wraps a GlObject pairing it with an optional EventHandler in order to attach it to a View. More...
Wraps a GlObject pairing it with an optional EventHandler in order to attach it to a View.
Creating a ViewObject and attaching it to a View (in contrast to attaching a plain GlObject to a GlView) allows for receiving and handling user input events (e.g. mouse events). Usually, event handling logic is implemented by the EventHandler and the ViewObject is merely supposed to coordinate.
In contrast to a ViewOverlay a ViewObject resides in world space and is rendered as part of the scene of the parent View.
Classes | |
class | EventHandler |
Interface to be used as base class for event handlers of ViewObjects. More... | |
Public Member Functions | |
ViewObject (std::unique_ptr< GlObject > glObject) | |
Instantiate a new ViewObject taking ownership of the underlying GlObject which must not be null. | |
virtual EventResult | handleInputEvent (const InputEvent &event, const View &view)=0 |
Gets called by the parent view in order to handle user input events. | |
const GlObject & | glObject () const |
Get the underlying abstract GlObject. | |
GlObject & | glObject () |
const GlObject * | gl () const |
Original API methods for the underlying abstract GlObject. | |
GlObject * | gl () |
Protected Attributes | |
std::unique_ptr< GlObject > | m_glObject |
|
explicit |
Instantiate a new ViewObject taking ownership of the underlying GlObject which must not be null.
std::runtime_error | if glObject is nullptr |
|
pure virtual |
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.
event | User input event to handle. |
view | Parent 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. |
Implemented in SliceIndicator, TypedViewObject< ObjectType, EventHandlerType >, TypedViewObject< GlBox, GUI::BoxAnnotationEventHandler >, TypedViewObject< ImFusion::GlCircle, ImFusion::LabelingManipulator >, and InteractiveObject.