Loading...
Searching...
No Matches
ml::ScrollPane Class Reference

#include <Malena/Graphics/Controls/ScrollPane.h>

Inheritance diagram for ml::ScrollPane:
[legend]

Public Types

using App = ml::ManifestResources<ScrollPaneManifest>
using Flag = ScrollPaneManifest::Flag
using State = ScrollPaneManifest::State

Public Member Functions

 ScrollPane (float width, float height)
void addComponent (ml::Core &component)
void embed ()
 Silence this ScrollPane from the event system entirely.
sf::FloatRect getGlobalBounds () const override
sf::Vector2f getPosition () const override
sf::RenderStates getRenderStates () const override
float getScrollOffsetY () const
 Return the current vertical scroll offset in pixels.
void removeComponent (ml::Core &component)
void setBackgroundColor (sf::Color color)
void setContentHeight (float height)
 Override the content height used for scroll calculations.
void setPosition (const sf::Vector2f &position) override
void setScrollBarColor (sf::Color color)
void setScrollBarWidth (float width)
void setScrollOffsetY (float y)
 Programmatically set the vertical scroll offset (clamped).
void setSize (float width, float height)

Protected Member Functions

void draw (sf::RenderTarget &target, sf::RenderStates states) const override

Detailed Description

Definition at line 14 of file ScrollPane.h.

Member Typedef Documentation

◆ App

◆ Flag

Definition at line 19 of file ScrollPane.h.

◆ State

Definition at line 18 of file ScrollPane.h.

Constructor & Destructor Documentation

◆ ScrollPane()

ml::ScrollPane::ScrollPane ( float width,
float height )

Member Function Documentation

◆ addComponent()

void ml::ScrollPane::addComponent ( ml::Core & component)

◆ draw()

void ml::ScrollPane::draw ( sf::RenderTarget & target,
sf::RenderStates states ) const
overrideprotected

◆ embed()

void ml::ScrollPane::embed ( )

Silence this ScrollPane from the event system entirely.

Call this when using ScrollPane as a private member of another component rather than as a standalone addComponent() citizen. Removes ALL event subscriptions from both the pane and its internal scrollbar thumb so they cannot steal focus or intercept events from the host component.

ScrollPane remains fully functional as a draw helper — setPosition, setSize, setScrollOffsetY, setContentHeight, and draw() all continue to work normally.

Scroll wheel and thumb drag become the host component's responsibility when embedded.

Usage

class MyWidget : public ml::Component<>
{
ml::ScrollPane _pane{400.f, 300.f};
MyWidget() {
_pane.embed(); // silence before registering any other events
}
};
Primary base class for all user-facing Malena components.
Definition Component.h:275
void embed()
Silence this ScrollPane from the event system entirely.
See also
unsubscribeAll

◆ getGlobalBounds()

sf::FloatRect ml::ScrollPane::getGlobalBounds ( ) const
override

◆ getPosition()

sf::Vector2f ml::ScrollPane::getPosition ( ) const
override

◆ getRenderStates()

sf::RenderStates ml::ScrollPane::getRenderStates ( ) const
override

◆ getScrollOffsetY()

float ml::ScrollPane::getScrollOffsetY ( ) const
nodiscard

Return the current vertical scroll offset in pixels.

◆ removeComponent()

void ml::ScrollPane::removeComponent ( ml::Core & component)

◆ setBackgroundColor()

void ml::ScrollPane::setBackgroundColor ( sf::Color color)

◆ setContentHeight()

void ml::ScrollPane::setContentHeight ( float height)

Override the content height used for scroll calculations.

Use when content is rendered externally (e.g. TextArea canvas). Pass 0 to revert to summing children heights.

◆ setPosition()

void ml::ScrollPane::setPosition ( const sf::Vector2f & position)
override

◆ setScrollBarColor()

void ml::ScrollPane::setScrollBarColor ( sf::Color color)

◆ setScrollBarWidth()

void ml::ScrollPane::setScrollBarWidth ( float width)

◆ setScrollOffsetY()

void ml::ScrollPane::setScrollOffsetY ( float y)

Programmatically set the vertical scroll offset (clamped).

◆ setSize()

void ml::ScrollPane::setSize ( float width,
float height )

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