LMMS
Loading...
Searching...
No Matches
juce::NativeScaleFactorNotifier Class Reference

#include <juce_NativeScaleFactorNotifier.h>

Inheritance diagram for juce::NativeScaleFactorNotifier:
juce::ComponentMovementWatcher juce::ComponentPeer::ScaleFactorListener

Public Member Functions

 NativeScaleFactorNotifier (Component *comp, std::function< void(float)> onScaleChanged)
 ~NativeScaleFactorNotifier () override

Private Member Functions

void nativeScaleFactorChanged (double newScaleFactor) override
void componentPeerChanged () override
void componentVisibilityChanged () override
void componentMovedOrResized (bool, bool) override
void componentVisibilityChanged (Component &) override
void componentMovedOrResized (Component &, bool wasMoved, bool wasResized) override
Private Member Functions inherited from juce::ComponentMovementWatcher
 ComponentMovementWatcher (Component *componentToWatch)
 ~ComponentMovementWatcher () override
ComponentgetComponent () const noexcept
void componentParentHierarchyChanged (Component &) override
void componentBeingDeleted (Component &) override
Private Member Functions inherited from juce::ComponentListener
virtual ~ComponentListener ()=default
virtual void componentBroughtToFront (Component &component)
virtual void componentChildrenChanged (Component &component)
virtual void componentNameChanged (Component &component)
virtual void componentEnablementChanged (Component &component)
Private Member Functions inherited from juce::ComponentPeer::ScaleFactorListener
virtual ~ScaleFactorListener ()=default

Private Attributes

ComponentPeerpeer = nullptr
std::function< void(float)> scaleChanged

Detailed Description

Calls a function every time the native scale factor of a component's peer changes.

This is used in the VST and VST3 wrappers to ensure that the editor's scale is kept in sync with the scale of its containing component.

Constructor & Destructor Documentation

◆ NativeScaleFactorNotifier()

juce::NativeScaleFactorNotifier::NativeScaleFactorNotifier ( Component * comp,
std::function< void(float)> onScaleChanged )

Constructs an instance.

While the instance is alive, it will listen for changes to the scale factor of the comp's peer, and will call onScaleChanged whenever this scale factor changes.

Parameters
compThe component to observe
onScaleChangedA function that will be called when the backing scale factor changes

◆ ~NativeScaleFactorNotifier()

juce::NativeScaleFactorNotifier::~NativeScaleFactorNotifier ( )
override

Member Function Documentation

◆ componentMovedOrResized() [1/2]

void juce::NativeScaleFactorNotifier::componentMovedOrResized ( bool wasMoved,
bool wasResized )
inlineoverrideprivatevirtual

This callback happens when the component that is being watched is moved relative to its top-level peer window, or when it is resized.

Implements juce::ComponentMovementWatcher.

◆ componentMovedOrResized() [2/2]

void juce::ComponentMovementWatcher::componentMovedOrResized ( Component & component,
bool wasMoved,
bool wasResized )
overrideprivatevirtual

Called when the component's position or size changes.

Parameters
componentthe component that was moved or resized
wasMovedtrue if the component's top-left corner has just moved
wasResizedtrue if the component's width or height has just changed
See also
Component::setBounds, Component::resized, Component::moved

Reimplemented from juce::ComponentMovementWatcher.

◆ componentPeerChanged()

void juce::NativeScaleFactorNotifier::componentPeerChanged ( )
overrideprivatevirtual

This callback happens when the component's top-level peer is changed.

Implements juce::ComponentMovementWatcher.

◆ componentVisibilityChanged() [1/2]

void juce::NativeScaleFactorNotifier::componentVisibilityChanged ( )
inlineoverrideprivatevirtual

This callback happens when the component's visibility state changes, possibly due to one of its parents being made visible or invisible.

Implements juce::ComponentMovementWatcher.

◆ componentVisibilityChanged() [2/2]

void juce::ComponentMovementWatcher::componentVisibilityChanged ( Component & component)
overrideprivatevirtual

Called when the component is made visible or invisible.

Parameters
componentthe component that changed
See also
Component::setVisible

Reimplemented from juce::ComponentMovementWatcher.

◆ nativeScaleFactorChanged()

void juce::NativeScaleFactorNotifier::nativeScaleFactorChanged ( double newScaleFactor)
overrideprivatevirtual

Called when the scale factor changes.

Implements juce::ComponentPeer::ScaleFactorListener.

Member Data Documentation

◆ peer

ComponentPeer* juce::NativeScaleFactorNotifier::peer = nullptr
private

◆ scaleChanged

std::function<void (float)> juce::NativeScaleFactorNotifier::scaleChanged
private

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