Louvre  v1.2.1-2
C++ library for Wayland compositors
List of all members | Classes | Public Types | Public Member Functions
LView Class Referenceabstract

#include <LView.h>

Base class for LScene views. More...

Detailed Description

Base class for LScene views.

The LView class provides a base interface for creating views that can be shown in an LScene.
This class should be used for creating custom views that are different from those shipped with the library.
Louvre provides a pre-made set of views for most common purposes:

Stacking

Each view can have a parent and multiple children. This hierarchy and the order given by their children views list determine the stacking order in which they are rendered.
Children views are always stacked on top of its parent, and the last view in a children list is the one stacked on top the rest.

Creating custom views

To create a custom view, you must implement several virtual methods. In summary, for an LScene or LSceneView to be able to render an LView, it must provide the following information:

Position

The position of the view in surface coordinates must be returned by the nativePos() virtual method.
This method is used by the pos() method, which returns the position equal to nativePos(), or transformed if parent offset or parent scaling is enabled.

Size

The size of the view in surface coordinates should be implemented in the nativeSize() virtual method. This size is then returned by the size() method if no transformation is applied, or may differ if scaling or parent scaling is enabled.

Mapping

To tell a scene if the view is visible, the nativeMapped() bool method must be implemented. This is then returned by the mapped() method, which may differ from nativeMapped() if the visible() property is different, or if the view has no parent, or if its parent is mapped. In summary, a view can only be mapped if nativeMapped() is true, the visible() property is true, it has a parent, and the parent is also mapped.

Renderable

If the view has content that can be rendered, for example, a texture, then the isRenderable() method must return true. On the other hand, if the view is simply a container for other views and is not renderable on its own, then it should return false.

Intersected Outputs

The outputs() virtual method must return a vector with the outputs where the view is currently visible. When the view changes, repaint() is called, and all those intersected outputs are scheduled for repainting. The scene informs which outputs a view is currently on based on its rect through the enteredOutput() and leftOutput() virtual methods. So, those methods must be used to update the intersected outputs vector.

Painting

If the view is renderable, the paintEvent() method must be implemented. This method is called by the scene to request the view to render itself into the current framebuffer. It provides an LPainter, the region of the view to be rendered in global compositor coordinates, and a boolean variable indicating whether blending is enabled. The paintEvent() method is called twice per frame: once for drawing only the opaque regions of the view (blending disabled), and a second pass for the translucent regions (blending enabled).

Damage

To inform the scene about which rects within the view must be re-rendered (due to changes), the damage() virtual method must return an LRegion containing the damaged rects. If nullptr is returned, the entire view is considered damaged.
The scene automatically damages the entire view if its position, size, or stacking order changes from one frame to another, so it's not necessary to add damage in those cases. Usually, the damage should be cleared once the view has been rendered. To determine if a view was rendered on a specific output, the requestNextFrame() method is invoked by the scene. So within that method, the damage should be cleared.

Opaque and Translucent region

To prevent the scene view from rendering views occluded by opaque regions, the translucentRegion() and opaqueRegion() must be implemented. They must return an LRegion with the translucent and opaque regions, respectively, in surface coordinates.
If translucentRegion() returns nullptr, the entire view is considered translucent. On the other hand, if opaqueRegion is nullptr, the opaque region is considered the inverse of the translucentRegion(). So normally, it's only needed to specify the translucent region. The opaque region must be specified if it has been calculated before so that the scene can use that information and prevent re-calculating the inverse translucent region.

Input region

To define which parts of the view can receive pointer or touch events, the inputRegion() must be implemented. If nullptr is returned, the entire view is considered capable of receiving events.

Input events

Scenes can trigger specific input events on views through the pointerEnterEvent(), pointerMoveEvent(), keyEvent(), and other related methods. Implement these virtual methods to listen and respond to those events if needed.

Classes

struct  PaintEventParams
 Parameters used within a paintEvent(). More...
 

Public Types

enum  Type : UInt32
 Types of views included with Louvre. More...
 

Public Member Functions

 LView (UInt32 type, LView *parent=nullptr)
 Construct an LView object. More...
 
virtual ~LView ()
 Destructor for the LView class. More...
 
void damageAll ()
 Forces a complete repaint of the view in the next rendering frame. More...
 
LScenescene () const
 Get the scene in which this view is currently embedded. More...
 
LSceneViewparentSceneView () const
 Get the LSceneView in which this view is currently embedded. More...
 
UInt32 type () const
 Get the identifier for the type of view. More...
 
void repaint ()
 Schedule a repaint for all outputs where this view is currently visible. More...
 
LViewparent () const
 Get the parent of the view. More...
 
void setParent (LView *view)
 Set the new parent for the view and insert it at the end of its children list. More...
 
void insertAfter (LView *prev, bool switchParent=true)
 Insert the view after the 'prev' view. More...
 
std::list< LView * > & children () const
 Get the list of child views. More...
 
bool parentOffsetEnabled () const
 Check if the parent's offset is applied to the view position. More...
 
void enableParentOffset (bool enabled)
 Enable or disable the parent's offset for the view position. More...
 
const LPointpos () const
 Get the current position of the view with applied transformations. More...
 
const LSizesize () const
 Get the current size of the view with applied transformations. More...
 
bool clippingEnabled () const
 Check if the view is currently being clipped to the clippingRect() property. More...
 
void enableClipping (bool enabled)
 Enable or disable clipping of the view to the clippingRect() property. More...
 
const LRectclippingRect () const
 Get the current clipping rectangle defined by the clippingRect() property. More...
 
void setClippingRect (const LRect &rect)
 Set the clipping rectangle for the view using the clippingRect() property. More...
 
bool parentClippingEnabled () const
 Check if the view clipping to the current parent view rect is enabled. More...
 
void enableParentClipping (bool enabled)
 Enable or disable clipping of the view to the current parent view rect. More...
 
bool inputEnabled () const
 Check if the view receives pointer and touch events. More...
 
void enableInput (bool enabled)
 Enable or disable pointer and touch events for the view. More...
 
bool scalingEnabled () const
 Check if scaling is enabled for the view's size. More...
 
void enableScaling (bool enabled)
 Enable or disable scaling for the view's size. More...
 
bool parentScalingEnabled () const
 Check if the size and position are scaled by the parent scaling vector. More...
 
void enableParentScaling (bool enabled)
 Enable or disable scaling of the size and position by the parent's scaling vector. More...
 
const LSizeFscalingVector (bool forceIgnoreParent=false) const
 Get the scaling vector for the view's size. More...
 
void setScalingVector (const LSizeF &scalingVector)
 Set the scaling vector for the view's size. More...
 
bool visible () const
 Check if the view is marked as visible. More...
 
void setVisible (bool visible)
 Toggle the view visibility. More...
 
bool mapped () const
 Check if the view should be rendered, taking into consideration several conditions. More...
 
Float32 opacity (bool forceIgnoreParent=false) const
 Get the current view opacity. More...
 
void setOpacity (Float32 opacity)
 Set the view opacity. More...
 
bool parentOpacityEnabled () const
 Check if the view's opacity is multiplied by its parent's opacity. More...
 
void enableParentOpacity (bool enabled)
 Enable or disable the view's opacity being multiplied by its parent's opacity. More...
 
bool forceRequestNextFrameEnabled () const
 Check if the requestNextFrame() is enabled. More...
 
void enableForceRequestNextFrame (bool enabled) const
 Enable or disable the requestNextFrame() to be called always. More...
 
void setBlendFunc (GLenum sRGBFactor, GLenum dRGBFactor, GLenum sAlphaFactor, GLenum dAlphaFactor)
 Set the alpha blending function for the view. More...
 
void enableAutoBlendFunc (bool enabled)
 Enable or disable automatic blend function adjustment. More...
 
bool autoBlendFuncEnabled () const
 Check whether the automatic blend function adjustment is enabled. More...
 
void setColorFactor (Float32 r, Float32 g, Float32 b, Float32 a)
 Set the color factor. More...
 
const LRGBAFcolorFactor ()
 Get the color factor. More...
 
bool pointerIsOver () const
 Checks if the pointer/cursor is inside the view's input region. More...
 
void enableBlockPointer (bool enabled)
 Enable or disable blocking of pointer or touch events to views behind the view's input region. More...
 
bool blockPointerEnabled () const
 Checks if blocking of pointer or touch events to views behind the view's input region is enabled. More...
 
LBox boundingBox () const
 Get the bounding box of the view and all its mapped children. More...
 
virtual bool nativeMapped () const =0
 Tells whether the view should be rendered. More...
 
virtual const LPointnativePos () const =0
 Get the position of the view without any transformations applied. More...
 
virtual const LSizenativeSize () const =0
 Get the size of the view without any transformations applied. More...
 
virtual Float32 bufferScale () const =0
 Get the scale of the view buffer content. More...
 
virtual void enteredOutput (LOutput *output)=0
 Indicate that the view is visible on the given output. More...
 
virtual void leftOutput (LOutput *output)=0
 Indicate that the view is no longer visible on the given output. More...
 
virtual const std::vector< LOutput * > & outputs () const =0
 Get a vector of output pointers on which the view is currently visible. More...
 
virtual bool isRenderable () const =0
 Check if the view is itself renderable. More...
 
virtual void requestNextFrame (LOutput *output)=0
 Notify that the view has been rendered on the given output. More...
 
virtual const LRegiondamage () const =0
 Get the region within the view rect that needs to be repainted. More...
 
virtual const LRegiontranslucentRegion () const =0
 Returns the translucent region within the view rectangle. More...
 
virtual const LRegionopaqueRegion () const =0
 Returns the opaque region within the view rectangle. More...
 
virtual const LRegioninputRegion () const =0
 Region within the view rect that can receive input events (when the inputEnabled() property is enabled). More...
 
virtual void paintEvent (const PaintEventParams &params)=0
 Request to paint a region of the view to the current framebuffer. More...
 
virtual void pointerEnterEvent (const LPoint &localPos)
 Handle the pointer enter event within the view. More...
 
virtual void pointerMoveEvent (const LPoint &localPos)
 Handle the pointer move event within the view. More...
 
virtual void pointerLeaveEvent ()
 Handle the pointer leave event within the view. More...
 
virtual void pointerButtonEvent (LPointer::Button button, LPointer::ButtonState state)
 Handle the pointer button event within the view. More...
 
virtual void pointerAxisEvent (Float64 axisX, Float64 axisY, Int32 discreteX, Int32 discreteY, UInt32 source)
 Handle the pointer axis event within the view. More...
 
virtual void keyModifiersEvent (UInt32 depressed, UInt32 latched, UInt32 locked, UInt32 group)
 Handle the key modifiers event within the view. More...
 
virtual void keyEvent (UInt32 keyCode, UInt32 keyState)
 Handle the key event within the view. More...
 
- Public Member Functions inherited from LObject
 LObject ()=default
 Constructor of the LObject class. More...
 
 ~LObject ()
 Destructor of the LObject class. More...
 
std::shared_ptr< const bool > isAlive () const
 Object's liveness status. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from LObject
static LCompositorcompositor ()
 Quick access to the global compositor instance. More...
 
static LSeatseat ()
 Quick access to the global seat instance. More...
 
static LCursorcursor ()
 Quick access to the global cursor instance. More...
 

Member Enumeration Documentation

◆ Type

enum Type : UInt32

Types of views included with Louvre.

Enumerator
Layer 

LLayerView.

Surface 

LSurfaceView.

Texture 

LTextureView.

SolidColor 

LSolidColorView.

Scene 

LSceneView.

Constructor & Destructor Documentation

◆ LView()

LView ( UInt32  type,
LView parent = nullptr 
)

Construct an LView object.

Parameters
typeType ID of the view, such as those listed in LView::Type.
parentParent view.

◆ ~LView()

~LView ( )
virtual

Destructor for the LView class.

Member Function Documentation

◆ damageAll()

void damageAll ( )

Forces a complete repaint of the view in the next rendering frame.

◆ scene()

LScene * scene ( ) const

Get the scene in which this view is currently embedded.

Returns
A pointer to the scene that contains this view, or nullptr if the view is not part of any scene.

◆ parentSceneView()

LSceneView * parentSceneView ( ) const

Get the LSceneView in which this view is currently embedded.

Returns
A pointer to the LSceneView that contains this view, or nullptr if the view is not part of any LSceneView.

◆ type()

UInt32 type ( ) const

Get the identifier for the type of view.

This method returns a number used to identify the type of view that was passed in the LView constructor.
For additional information about view types, refer to the LView::Type enumeration.

Returns
The identifier representing the type of view.

◆ repaint()

void repaint ( )

Schedule a repaint for all outputs where this view is currently visible.

This method triggers a repaint for all outputs where this view is currently visible.
Outputs are those returned by the LView::outputs() method.

◆ parent()

LView * parent ( ) const

Get the parent of the view.

Returns
A pointer to the parent view, or nullptr if no parent is assigned to the view.

◆ setParent()

void setParent ( LView view)

Set the new parent for the view and insert it at the end of its children list.

This method sets the new parent for the view and inserts it at the end of its parent's children list. If 'view' is set to nullptr, the parent is unset, and the view is unmapped.

Parameters
viewThe new parent view to be set.

◆ insertAfter()

void insertAfter ( LView prev,
bool  switchParent = true 
)

Insert the view after the 'prev' view.

This method inserts the view after the 'prev' view in the parent's children list. If 'switchParent' is true, the view will be assigned the same parent as the 'prev' view. If 'switchParent' is false, the view will only be reinserted if it shares the same parent with the 'prev' view. If 'prev' is set to nullptr, the view will be inserted at the beginning of its current parent's children list, regardless of the value of 'switchParent'.

Parameters
prevThe view after which this view will be inserted.
switchParentIf true, the view will be assigned the same parent as the 'prev' view.

◆ children()

std::list< Louvre::LView * > & children ( ) const

Get the list of child views.

This method returns a reference to the list of child views of the current view.

Returns
A reference to the list of child views.

◆ parentOffsetEnabled()

bool parentOffsetEnabled ( ) const

Check if the parent's offset is applied to the view position.

If this method returns true, the position returned by pos() includes the parent's offset (parent()->pos()).

The default value is true.

Returns
true if the parent's offset is applied to the view position, false otherwise.

◆ enableParentOffset()

void enableParentOffset ( bool  enabled)

Enable or disable the parent's offset for the view position.

If enabled, the position returned by pos() will include the parent's offset (parent()->pos()).

The default value is true.

Parameters
enabledIf true, the parent's offset will be applied to the view position.

◆ pos()

const LPoint & pos ( ) const

Get the current position of the view with applied transformations.

This method returns the current position of the view with any applied transformations.

Returns
The position of the view.

◆ size()

const LSize & size ( ) const

Get the current size of the view with applied transformations.

This method returns the current size of the view with any applied transformations.

Returns
The size of the view.

◆ clippingEnabled()

bool clippingEnabled ( ) const

Check if the view is currently being clipped to the clippingRect() property.

This method returns true if the view is currently being clipped to the specified clipping rectangle, which is defined by the clippingRect() property. If the view is not clipped to the clipping rectangle, the method returns false.

The default value is false.

Returns
true if the view is being clipped to the clipping rectangle, false otherwise.

◆ enableClipping()

void enableClipping ( bool  enabled)

Enable or disable clipping of the view to the clippingRect() property.

If enabled, the view will be clipped to the current clipping rectangle defined by the clippingRect() property. If disabled, the view will not be clipped, allowing its entire content to be visible.

The default value is false.

Parameters
enabledIf true, the view will be clipped to the clippingRect() property. If false, clipping will be disabled, and the full view will be visible.

◆ clippingRect()

const LRect & clippingRect ( ) const

Get the current clipping rectangle defined by the clippingRect() property.

This method returns a constant reference to the current clipping rectangle that is being used to clip the view. The clipping rectangle is defined by the clippingRect() property.

Returns
A constant reference to the current clipping rectangle.

◆ setClippingRect()

void setClippingRect ( const LRect rect)

Set the clipping rectangle for the view using the clippingRect() property.

This method sets the clipping rectangle for the view using the clippingRect() property. When clipping is enabled, the view's content outside this rectangle will be clipped (not visible).

Note
The rect is not local to the view's position, if you need to clip the view without having to update the rect pos each time the view moves, use parent clipping instead.
Parameters
rectThe clipping rectangle to set for the view using the clippingRect() property.

◆ parentClippingEnabled()

bool parentClippingEnabled ( ) const

Check if the view clipping to the current parent view rect is enabled.

This method returns true if the view clipping to the current parent view rect is enabled, false otherwise.

The default value is false.

Returns
true if the view is clipped to the current parent view rect, false otherwise.

◆ enableParentClipping()

void enableParentClipping ( bool  enabled)

Enable or disable clipping of the view to the current parent view rect.

If enabled, the view will be clipped to the current parent view rect.

The default value is false.

Parameters
enabledIf true, the view will be clipped to the current parent view rect.

◆ inputEnabled()

bool inputEnabled ( ) const

Check if the view receives pointer and touch events.

This method returns true if the view receives pointer and touch events. However, keyboard events are always received regardless of this setting.

Returns
true if the view receives pointer and touch events, false otherwise.

◆ enableInput()

void enableInput ( bool  enabled)

Enable or disable pointer and touch events for the view.

If enabled, the view will receive pointer and touch events. However, keyboard events are always received regardless of this setting.

Parameters
enabledIf true, the view will receive pointer and touch events.

◆ scalingEnabled()

bool scalingEnabled ( ) const

Check if scaling is enabled for the view's size.

This method returns true if the view's size is scaled using the scalingVector(), false otherwise.

The default value is false.

Returns
true if the view's size is scaled, false otherwise.

◆ enableScaling()

void enableScaling ( bool  enabled)

Enable or disable scaling for the view's size.

If enabled, the view's size will be scaled using the scalingVector().

Disabled by default.

Parameters
enabledIf true, the view's size will be scaled.

◆ parentScalingEnabled()

bool parentScalingEnabled ( ) const

Check if the size and position are scaled by the parent scaling vector.

This method returns true if the view's size and position are scaled by the parent's scaling vector, false otherwise.

The default value is false.

Returns
true if the size and position are scaled by the parent's scaling vector, false otherwise.

◆ enableParentScaling()

void enableParentScaling ( bool  enabled)

Enable or disable scaling of the size and position by the parent's scaling vector.

If enabled, the view's size and position will be scaled by the parent's scaling vector.

The default value is false.

Parameters
enabledIf true, the view's size and position will be scaled by the parent's scaling vector.

◆ scalingVector()

const LSizeF & scalingVector ( bool  forceIgnoreParent = false) const

Get the scaling vector for the view's size.

This method returns the scaling vector for the view's size.

Parameters
forceIgnoreParentIf set to false, the vector is multiplied by the parent scaling vector.
Returns
The scaling vector for the view's size.

◆ setScalingVector()

void setScalingVector ( const LSizeF scalingVector)

Set the scaling vector for the view's size.

If scalingEnabled() returns true, the view's size will be scaled using the provided scaling vector (nativeSize() * scalingVector()). Setting a value to 1 disables scaling for that axis.

Parameters
scalingVectorThe (width, height) scaling vector for the view's size.
Warning
Scaling should be used with moderation, preferably during animations, as damage tracking is disabled due to precision loss caused by scaling. This means the entire view is repainted if changes occur, which can be inefficient.

◆ visible()

bool visible ( ) const

Check if the view is marked as visible.

This method indicates whether the view is marked as visible. However, it does not directly indicate if the view will be rendered. To check if the view will be rendered, use the mapped() property instead.

Returns
true if the view is marked as visible, false otherwise.

◆ setVisible()

void setVisible ( bool  visible)

Toggle the view visibility.

Enabling visibility does not guarantee that the view will be rendered. On the other hand, disabling it directly indicates that it is not mapped and will not be rendered.

See also
mapped()
Parameters
visibleIf true, the view will be marked as visible, if false, it will be marked as not visible.

◆ mapped()

bool mapped ( ) const

Check if the view should be rendered, taking into consideration several conditions.

This method indicates whether the view should be rendered, considering the nativeMapped() && visible() && parent() && parent()->mapped() boolean operation.

Returns
true if the view should be rendered, false otherwise.

◆ opacity()

Float32 opacity ( bool  forceIgnoreParent = false) const

Get the current view opacity.

This method returns the current view opacity.

Parameters
forceIgnoreParentIf set to false, the opacity is multiplied by the parent's opacity.
Returns
The view's opacity value in the range [0.0, 1.0].

◆ setOpacity()

void setOpacity ( Float32  opacity)

Set the view opacity.

This method sets the view's opacity. Setting the value to 1.0 disables opacity.

Warning
Opacity should be used with moderation, for example, only on animations, as the opaqueRegion() is not considered in the scenario, so the content behind the view is always repainted when the view changes.
Parameters
opacityThe opacity value in the range [0.0, 1.0].

◆ parentOpacityEnabled()

bool parentOpacityEnabled ( ) const

Check if the view's opacity is multiplied by its parent's opacity.

This method returns true if the view's opacity is multiplied by its parent's opacity, false otherwise.

The default value is true.

Returns
true if the view's opacity is multiplied by its parent's opacity, false otherwise.

◆ enableParentOpacity()

void enableParentOpacity ( bool  enabled)

Enable or disable the view's opacity being multiplied by its parent's opacity.

If enabled, the view's opacity will be multiplied by its parent's opacity.

The default value is true.

Parameters
enabledIf true, the view's opacity will be multiplied by its parent's opacity, if false, it will not be affected by the parent's opacity.

◆ forceRequestNextFrameEnabled()

bool forceRequestNextFrameEnabled ( ) const

Check if the requestNextFrame() is enabled.

If this method returns true, requestNextFrame() will be called even if the view is occluded by other views or not mapped.

Returns
true if requestNextFrame() is forced to be called, otherwise, false.

◆ enableForceRequestNextFrame()

void enableForceRequestNextFrame ( bool  enabled) const

Enable or disable the requestNextFrame() to be called always.

When enabled, requestNextFrame() will be called even if the view is occluded by other view or not mapped.

Parameters
enabledtrue to enable requestNextFrame(), false to disable.

◆ setBlendFunc()

void setBlendFunc ( GLenum  sRGBFactor,
GLenum  dRGBFactor,
GLenum  sAlphaFactor,
GLenum  dAlphaFactor 
)

Set the alpha blending function for the view.

This method sets the OpenGL blend function for the view. Refer to the documentation of glBlendFuncSeparate() for more information.

Note
This only works when the autoBlendFuncEnabled() property is disabled.
Parameters
sRGBFactorSource RGB factor for blending.
dRGBFactorDestination RGB factor for blending.
sAlphaFactorSource alpha factor for blending.
dAlphaFactorDestination alpha factor for blending.

◆ enableAutoBlendFunc()

void enableAutoBlendFunc ( bool  enabled)

Enable or disable automatic blend function adjustment.

When the automatic blend function is enabled, the blend function dynamically adjusts based on whether rendering occurs in an output framebuffer or a custom framebuffer (e.g., an LRenderBuffer or LSceneView).

By default, automatic blend function adjustment is enabled. When enabled, the blend function set with setBlendFunc() is ignored.

Parameters
enabledtrue to enable automatic blend function adjustment, false to disable.

◆ autoBlendFuncEnabled()

bool autoBlendFuncEnabled ( ) const

Check whether the automatic blend function adjustment is enabled.

Returns
true if automatic blend function adjustment is enabled, false otherwise.

◆ setColorFactor()

void setColorFactor ( Float32  r,
Float32  g,
Float32  b,
Float32  a 
)

Set the color factor.

This method allows you to set a color factor that influences the resulting color of every painting operation. By default, the color factor is (1.0, 1.0, 1.0, 1.0), which has no effect on the colors.

Parameters
rValue of the red component (range [0.0, 1.0]).
gValue of the green component (range [0.0, 1.0]).
bValue of the blue component (range [0.0, 1.0]).
aValue of the alpha component (range [0.0, 1.0]).

◆ colorFactor()

const LRGBAF & colorFactor ( )

Get the color factor.

This method returns the current color factor of the view set with setColorFactor().

◆ pointerIsOver()

bool pointerIsOver ( ) const

Checks if the pointer/cursor is inside the view's input region.

Warning
Even if the pointer is over the input region it may return false if another view with block pointer enabled is in front.
Returns
true if the pointer/cursor is inside the input region; otherwise, false.

◆ enableBlockPointer()

void enableBlockPointer ( bool  enabled)

Enable or disable blocking of pointer or touch events to views behind the view's input region.

If set to true, pointer or touch events will not be sent to views behind the view's input region.

Parameters
enabledtrue to enable blocking; false to disable.

◆ blockPointerEnabled()

bool blockPointerEnabled ( ) const

Checks if blocking of pointer or touch events to views behind the view's input region is enabled.

Returns
true if blocking is enabled; otherwise, false.

◆ boundingBox()

LBox boundingBox ( ) const

Get the bounding box of the view and all its mapped children.

This method returns a box containing the view and all its mapped children, even if the children are outside or clipped by the view's rect.

Returns
The bounding box of the view and its mapped children.

◆ nativeMapped()

virtual bool nativeMapped ( ) const
pure virtual

Tells whether the view should be rendered.

Returns
true if the view should be rendered without considering visible(), otherwise false.

Implemented in LTextureView, LSurfaceView, LSolidColorView, LSceneView, and LLayerView.

◆ nativePos()

virtual const LPoint& nativePos ( ) const
pure virtual

Get the position of the view without any transformations applied.

Must return the position of the view in surface coordinates.

Returns
The position of the view as an LPoint object.

Implemented in LTextureView, LSurfaceView, LSolidColorView, LSceneView, and LLayerView.

◆ nativeSize()

virtual const LSize& nativeSize ( ) const
pure virtual

Get the size of the view without any transformations applied.

Must return the size of the view in surface coordinates.

Returns
The size of the view as an LSize object.

Implemented in LTextureView, LSurfaceView, LSolidColorView, LSceneView, and LLayerView.

◆ bufferScale()

virtual Float32 bufferScale ( ) const
pure virtual

Get the scale of the view buffer content.

This property is primarily used by views that contain a buffer like for example the LSceneView, LSurfaceView and LTextureView types.

Returns
The buffer scale as an Int32 value.

Implemented in LTextureView, LSurfaceView, LSolidColorView, LSceneView, and LLayerView.

◆ enteredOutput()

virtual void enteredOutput ( LOutput output)
pure virtual

Indicate that the view is visible on the given output.

This method is invoked by a LScene when the view's rect intersects an output.

Parameters
outputThe LOutput where the view is visible.

Implemented in LTextureView, LSurfaceView, LSolidColorView, LSceneView, and LLayerView.

◆ leftOutput()

virtual void leftOutput ( LOutput output)
pure virtual

Indicate that the view is no longer visible on the given output.

This method is invoked by a LScene when the view's rect no longer intersects an output.

Parameters
outputThe LOutput from which the view is no longer visible.

Implemented in LTextureView, LSurfaceView, LSolidColorView, LSceneView, and LLayerView.

◆ outputs()

virtual const std::vector<LOutput*>& outputs ( ) const
pure virtual

Get a vector of output pointers on which the view is currently visible.

Must return a vector of output pointers where the view is currently visible. Use the enteredOutput() and leftOutput() methods to update the vector.

Returns
A reference to a vector of LOutput pointers representing the outputs where the view is visible.

Implemented in LTextureView, LSurfaceView, LSolidColorView, LSceneView, and LLayerView.

◆ isRenderable()

virtual bool isRenderable ( ) const
pure virtual

Check if the view is itself renderable.

This property indicates whether the view is capable of rendering its content (check paintEvent()). For example, all view types included in Louvre are renderable, except for LLayerView, which serves as a container for other views but does not produce any output by itself.

Returns
true if the view is renderable; otherwise, false.

Implemented in LTextureView, LSurfaceView, LSolidColorView, LSceneView, and LLayerView.

◆ requestNextFrame()

virtual void requestNextFrame ( LOutput output)
pure virtual

Notify that the view has been rendered on the given output.

This method is called by LScene and should be used to clear the previous view damage or update its content. If forceRequestNextFrameEnabled() is true, this method is always called.

Parameters
outputThe LOutput on which the view is rendered.

Implemented in LTextureView, LSurfaceView, LSolidColorView, LSceneView, and LLayerView.

◆ damage()

virtual const LRegion* damage ( ) const
pure virtual

Get the region within the view rect that needs to be repainted.

The region rects are specified in surface coordinates within the view, without any scaling, clipping, or offset transformations applied. The damage may be cleared after requestNextFrame() is called. If nullptr is returned, the entire view rect will be considered damaged. If the view has no damage, simply pass an empty LRegion (not nullptr).

Returns
A pointer to the LRegion specifying the damaged area within the view, or nullptr if the entire view rect is damaged.

Implemented in LTextureView, LSurfaceView, LSolidColorView, LSceneView, and LLayerView.

◆ translucentRegion()

virtual const LRegion* translucentRegion ( ) const
pure virtual

Returns the translucent region within the view rectangle.


The region rects are specified in surface coordinates within the view, without any scaling, clipping, or offset transformations.
If nullptr is returned, the entire view rect will be considered translucent.

Implemented in LTextureView, LSurfaceView, LSolidColorView, LSceneView, and LLayerView.

◆ opaqueRegion()

virtual const LRegion* opaqueRegion ( ) const
pure virtual

Returns the opaque region within the view rectangle.

The region rects are specified in surface coordinates within the view, without any scaling, clipping, or offset transformations.
If nullptr is returned, the inverse of the translucent region will be considered opaque.

Implemented in LTextureView, LSurfaceView, LSolidColorView, LSceneView, and LLayerView.

◆ inputRegion()

virtual const LRegion* inputRegion ( ) const
pure virtual

Region within the view rect that can receive input events (when the inputEnabled() property is enabled).


The region rects are specified in surface coordinates within the view, without any scaling, clipping, or offset transformations.
If nullptr is returned, the entire view rect will receive input.

Implemented in LTextureView, LSurfaceView, LSolidColorView, LSceneView, and LLayerView.

◆ paintEvent()

virtual void paintEvent ( const PaintEventParams params)
pure virtual

Request to paint a region of the view to the current framebuffer.

This method is used by LSceneView to request the view to paint a specified region on the current framebuffer. The painting is performed using the provided LPainter object.

Note
Alternatively, you have the option to use your own custom OpenGL shaders/program for rendering, in place of the provided LPainter.

Implemented in LTextureView, LSurfaceView, LSolidColorView, LSceneView, and LLayerView.

◆ pointerEnterEvent()

void pointerEnterEvent ( const LPoint localPos)
virtual

Handle the pointer enter event within the view.

Parameters
localPosThe local position of the pointer within the view.

◆ pointerMoveEvent()

void pointerMoveEvent ( const LPoint localPos)
virtual

Handle the pointer move event within the view.

This event is only called if pointerEnterEvent() was called before, and therefore when pointerIsOver() returns true.

Parameters
localPosThe local position of the pointer within the view.

◆ pointerLeaveEvent()

void pointerLeaveEvent ( )
virtual

Handle the pointer leave event within the view.

◆ pointerButtonEvent()

void pointerButtonEvent ( LPointer::Button  button,
LPointer::ButtonState  state 
)
virtual

Handle the pointer button event within the view.

This event is only called if pointerEnterEvent() was called before, and therefore when pointerIsOver() returns true.

Parameters
buttonThe button that triggered the event (e.g., left button, right button, etc.).
stateThe state of the button (e.g., pressed, released, etc.).

◆ pointerAxisEvent()

void pointerAxisEvent ( Float64  axisX,
Float64  axisY,
Int32  discreteX,
Int32  discreteY,
UInt32  source 
)
virtual

Handle the pointer axis event within the view.

This event is only called if pointerEnterEvent() was called before, and therefore when pointerIsOver() returns true.

Parameters
axisXThe x-coordinate of the axis movement.
axisYThe y-coordinate of the axis movement.
discreteXThe discrete x-coordinate of the axis movement.
discreteYThe discrete y-coordinate of the axis movement.
sourceThe source of the axis event (e.g., mouse wheel, touchpad, etc.).

◆ keyModifiersEvent()

void keyModifiersEvent ( UInt32  depressed,
UInt32  latched,
UInt32  locked,
UInt32  group 
)
virtual

Handle the key modifiers event within the view.

Keyboard events are allways called, even if inputEnabled() is set to false.

Parameters
depressedThe state of the depressed key modifiers.
latchedThe state of the latched key modifiers.
lockedThe state of the locked key modifiers.
groupThe key group state.

◆ keyEvent()

void keyEvent ( UInt32  keyCode,
UInt32  keyState 
)
virtual

Handle the key event within the view.

Keyboard events are allways called, even if inputEnabled() is set to false.

Parameters
keyCodeThe code of the key that triggered the event.
keyStateThe state of the key (e.g., pressed, released, etc.).