openshot-audio  0.1.4
Classes | Public Types | Public Member Functions | Protected Member Functions | List of all members
juce::Label Class Reference

#include <juce_gui_basics.h>

Inheritance diagram for juce::Label:
juce::Component juce::SettableTooltipClient juce::TextEditor::Listener juce::ComponentListener juce::Value::Listener juce::MouseListener juce::TooltipClient juce::LookAndFeel_V2::SliderLabelComp juce::TextPropertyComponent::LabelComp

Classes

class  Listener
 
struct  LookAndFeelMethods
 

Public Types

enum  ColourIds {
  backgroundColourId = 0x1000280, textColourId = 0x1000281, outlineColourId = 0x1000282, backgroundWhenEditingColourId = 0x1000283,
  textWhenEditingColourId = 0x1000284, outlineWhenEditingColourId = 0x1000285
}
 
- Public Types inherited from juce::Component
enum  FocusChangeType { focusChangedByMouseClick, focusChangedByTabKey, focusChangedDirectly }
 

Public Member Functions

 Label (const String &componentName=String::empty, const String &labelText=String::empty)
 
 ~Label ()
 
void setText (const String &newText, NotificationType notification)
 
String getText (bool returnActiveEditorContents=false) const
 
ValuegetTextValue () noexcept
 
void setFont (const Font &newFont)
 
Font getFont () const noexcept
 
void setJustificationType (Justification justification)
 
Justification getJustificationType () const noexcept
 
void setBorderSize (BorderSize< int > newBorderSize)
 
BorderSize< int > getBorderSize () const noexcept
 
void attachToComponent (Component *owner, bool onLeft)
 
ComponentgetAttachedComponent () const
 
bool isAttachedOnLeft () const noexcept
 
void setMinimumHorizontalScale (float newScale)
 
float getMinimumHorizontalScale () const noexcept
 
void setKeyboardType (TextInputTarget::VirtualKeyboardType type) noexcept
 
void addListener (Listener *listener)
 
void removeListener (Listener *listener)
 
void setEditable (bool editOnSingleClick, bool editOnDoubleClick=false, bool lossOfFocusDiscardsChanges=false)
 
bool isEditableOnSingleClick () const noexcept
 
bool isEditableOnDoubleClick () const noexcept
 
bool doesLossOfFocusDiscardChanges () const noexcept
 
bool isEditable () const noexcept
 
void showEditor ()
 
void hideEditor (bool discardCurrentEditorContents)
 
bool isBeingEdited () const noexcept
 
TextEditorgetCurrentTextEditor () const noexcept
 
- Public Member Functions inherited from juce::Component
 Component () noexcept
 
virtual ~Component ()
 
 Component (const String &componentName) noexcept
 
const StringgetName () const noexcept
 
virtual void setName (const String &newName)
 
const StringgetComponentID () const noexcept
 
void setComponentID (const String &newID)
 
virtual void setVisible (bool shouldBeVisible)
 
bool isVisible () const noexcept
 
virtual void visibilityChanged ()
 
bool isShowing () const
 
virtual void addToDesktop (int windowStyleFlags, void *nativeWindowToAttachTo=nullptr)
 
void removeFromDesktop ()
 
bool isOnDesktop () const noexcept
 
ComponentPeergetPeer () const
 
virtual void userTriedToCloseWindow ()
 
virtual void minimisationStateChanged (bool isNowMinimised)
 
virtual float getDesktopScaleFactor () const
 
void toFront (bool shouldAlsoGainFocus)
 
void toBack ()
 
void toBehind (Component *other)
 
void setAlwaysOnTop (bool shouldStayOnTop)
 
bool isAlwaysOnTop () const noexcept
 
int getX () const noexcept
 
int getY () const noexcept
 
int getWidth () const noexcept
 
int getHeight () const noexcept
 
int getRight () const noexcept
 
Point< int > getPosition () const noexcept
 
int getBottom () const noexcept
 
const Rectangle< int > & getBounds () const noexcept
 
Rectangle< int > getLocalBounds () const noexcept
 
Rectangle< int > getBoundsInParent () const noexcept
 
int getScreenX () const
 
int getScreenY () const
 
Point< int > getScreenPosition () const
 
Rectangle< int > getScreenBounds () const
 
Point< int > getLocalPoint (const Component *sourceComponent, Point< int > pointRelativeToSourceComponent) const
 
Point< float > getLocalPoint (const Component *sourceComponent, Point< float > pointRelativeToSourceComponent) const
 
Rectangle< int > getLocalArea (const Component *sourceComponent, const Rectangle< int > &areaRelativeToSourceComponent) const
 
Point< int > localPointToGlobal (Point< int > localPoint) const
 
Point< float > localPointToGlobal (Point< float > localPoint) const
 
Rectangle< int > localAreaToGlobal (const Rectangle< int > &localArea) const
 
void setTopLeftPosition (int x, int y)
 
void setTopLeftPosition (Point< int > newTopLeftPosition)
 
void setTopRightPosition (int x, int y)
 
void setSize (int newWidth, int newHeight)
 
void setBounds (int x, int y, int width, int height)
 
void setBounds (const Rectangle< int > &newBounds)
 
void setBounds (const RelativeRectangle &newBounds)
 
void setBounds (const String &newBoundsExpression)
 
void setBoundsRelative (float proportionalX, float proportionalY, float proportionalWidth, float proportionalHeight)
 
void setBoundsInset (const BorderSize< int > &borders)
 
void setBoundsToFit (int x, int y, int width, int height, Justification justification, bool onlyReduceInSize)
 
void setCentrePosition (int x, int y)
 
void setCentreRelative (float x, float y)
 
void centreWithSize (int width, int height)
 
void setTransform (const AffineTransform &transform)
 
AffineTransform getTransform () const
 
bool isTransformed () const noexcept
 
int proportionOfWidth (float proportion) const noexcept
 
int proportionOfHeight (float proportion) const noexcept
 
int getParentWidth () const noexcept
 
int getParentHeight () const noexcept
 
Rectangle< int > getParentMonitorArea () const
 
int getNumChildComponents () const noexcept
 
ComponentgetChildComponent (int index) const noexcept
 
int getIndexOfChildComponent (const Component *child) const noexcept
 
ComponentfindChildWithID (StringRef componentID) const noexcept
 
void addChildComponent (Component *child, int zOrder=-1)
 
void addChildComponent (Component &child, int zOrder=-1)
 
void addAndMakeVisible (Component *child, int zOrder=-1)
 
void addAndMakeVisible (Component &child, int zOrder=-1)
 
void addChildAndSetID (Component *child, const String &componentID)
 
void removeChildComponent (Component *childToRemove)
 
ComponentremoveChildComponent (int childIndexToRemove)
 
void removeAllChildren ()
 
void deleteAllChildren ()
 
ComponentgetParentComponent () const noexcept
 
template<class TargetClass >
TargetClass * findParentComponentOfClass () const
 
ComponentgetTopLevelComponent () const noexcept
 
bool isParentOf (const Component *possibleChild) const noexcept
 
virtual void parentHierarchyChanged ()
 
virtual void childrenChanged ()
 
virtual bool hitTest (int x, int y)
 
void setInterceptsMouseClicks (bool allowClicksOnThisComponent, bool allowClicksOnChildComponents) noexcept
 
void getInterceptsMouseClicks (bool &allowsClicksOnThisComponent, bool &allowsClicksOnChildComponents) const noexcept
 
bool contains (Point< int > localPoint)
 
bool reallyContains (Point< int > localPoint, bool returnTrueIfWithinAChild)
 
ComponentgetComponentAt (int x, int y)
 
ComponentgetComponentAt (Point< int > position)
 
void repaint ()
 
void repaint (int x, int y, int width, int height)
 
void repaint (const Rectangle< int > &area)
 
void setBufferedToImage (bool shouldBeBuffered)
 
Image createComponentSnapshot (const Rectangle< int > &areaToGrab, bool clipImageToComponentBounds=true, float scaleFactor=1.0f)
 
void paintEntireComponent (Graphics &context, bool ignoreAlphaLevel)
 
void setPaintingIsUnclipped (bool shouldPaintWithoutClipping) noexcept
 
void setComponentEffect (ImageEffectFilter *newEffect)
 
ImageEffectFiltergetComponentEffect () const noexcept
 
LookAndFeelgetLookAndFeel () const noexcept
 
void setLookAndFeel (LookAndFeel *newLookAndFeel)
 
virtual void lookAndFeelChanged ()
 
void sendLookAndFeelChange ()
 
void setOpaque (bool shouldBeOpaque)
 
bool isOpaque () const noexcept
 
void setBroughtToFrontOnMouseClick (bool shouldBeBroughtToFront) noexcept
 
bool isBroughtToFrontOnMouseClick () const noexcept
 
void setWantsKeyboardFocus (bool wantsFocus) noexcept
 
bool getWantsKeyboardFocus () const noexcept
 
void setMouseClickGrabsKeyboardFocus (bool shouldGrabFocus)
 
bool getMouseClickGrabsKeyboardFocus () const noexcept
 
void grabKeyboardFocus ()
 
bool hasKeyboardFocus (bool trueIfChildIsFocused) const
 
void moveKeyboardFocusToSibling (bool moveToNext)
 
int getExplicitFocusOrder () const
 
void setExplicitFocusOrder (int newFocusOrderIndex)
 
void setFocusContainer (bool shouldBeFocusContainer) noexcept
 
bool isFocusContainer () const noexcept
 
bool isEnabled () const noexcept
 
void setEnabled (bool shouldBeEnabled)
 
void setAlpha (float newAlpha)
 
float getAlpha () const
 
void setMouseCursor (const MouseCursor &cursorType)
 
virtual MouseCursor getMouseCursor ()
 
void updateMouseCursor () const
 
virtual void paintOverChildren (Graphics &g)
 
virtual void mouseMove (const MouseEvent &event) override
 
virtual void mouseEnter (const MouseEvent &event) override
 
virtual void mouseExit (const MouseEvent &event) override
 
virtual void mouseDown (const MouseEvent &event) override
 
virtual void mouseDrag (const MouseEvent &event) override
 
virtual void mouseWheelMove (const MouseEvent &event, const MouseWheelDetails &wheel) override
 
virtual void mouseMagnify (const MouseEvent &event, float scaleFactor)
 
void setRepaintsOnMouseActivity (bool shouldRepaint) noexcept
 
void addMouseListener (MouseListener *newListener, bool wantsEventsForAllNestedChildComponents)
 
void removeMouseListener (MouseListener *listenerToRemove)
 
void addKeyListener (KeyListener *newListener)
 
void removeKeyListener (KeyListener *listenerToRemove)
 
virtual bool keyPressed (const KeyPress &key)
 
virtual bool keyStateChanged (bool isKeyDown)
 
virtual void modifierKeysChanged (const ModifierKeys &modifiers)
 
virtual void focusLost (FocusChangeType cause)
 
virtual void focusOfChildComponentChanged (FocusChangeType cause)
 
bool isMouseOver (bool includeChildren=false) const
 
bool isMouseButtonDown () const
 
bool isMouseOverOrDragging () const
 
Point< int > getMouseXYRelative () const
 
virtual void moved ()
 
virtual void childBoundsChanged (Component *child)
 
virtual void parentSizeChanged ()
 
virtual void broughtToFront ()
 
void addComponentListener (ComponentListener *newListener)
 
void removeComponentListener (ComponentListener *listenerToRemove)
 
void postCommandMessage (int commandId)
 
virtual void handleCommandMessage (int commandId)
 
int runModalLoop ()
 
void enterModalState (bool takeKeyboardFocus=true, ModalComponentManager::Callback *callback=nullptr, bool deleteWhenDismissed=false)
 
void exitModalState (int returnValue)
 
bool isCurrentlyModal () const noexcept
 
bool isCurrentlyBlockedByAnotherModalComponent () const
 
virtual bool canModalEventBeSentToComponent (const Component *targetComponent)
 
NamedValueSetgetProperties () noexcept
 
const NamedValueSetgetProperties () const noexcept
 
Colour findColour (int colourId, bool inheritFromParent=false) const
 
void setColour (int colourId, Colour newColour)
 
void removeColour (int colourId)
 
bool isColourSpecified (int colourId) const
 
void copyAllExplicitColoursTo (Component &target) const
 
virtual MarkerListgetMarkers (bool xAxis)
 
void * getWindowHandle () const
 
PositionergetPositioner () const noexcept
 
void setPositioner (Positioner *newPositioner)
 
void setCachedComponentImage (CachedComponentImage *newCachedImage)
 
CachedComponentImagegetCachedComponentImage () const noexcept
 
 JUCE_DEPRECATED (Point< int > relativePositionToGlobal(Point< int >) const)
 
 JUCE_DEPRECATED (Point< int > globalPositionToRelative(Point< int >) const)
 
 JUCE_DEPRECATED (Point< int > relativePositionToOtherComponent(const Component *, Point< int >) const)
 
- Public Member Functions inherited from juce::MouseListener
virtual ~MouseListener ()
 
- Public Member Functions inherited from juce::SettableTooltipClient
virtual ~SettableTooltipClient ()
 
virtual void setTooltip (const String &newTooltip)
 
virtual String getTooltip ()
 
- Public Member Functions inherited from juce::TooltipClient
virtual ~TooltipClient ()
 

Protected Member Functions

virtual TextEditorcreateEditorComponent ()
 
virtual void textWasEdited ()
 
virtual void textWasChanged ()
 
virtual void editorShown (TextEditor *)
 
virtual void editorAboutToBeHidden (TextEditor *)
 
void paint (Graphics &) override
 
void resized () override
 
void mouseUp (const MouseEvent &) override
 
void mouseDoubleClick (const MouseEvent &) override
 
void componentMovedOrResized (Component &, bool wasMoved, bool wasResized) override
 
void componentParentHierarchyChanged (Component &) override
 
void componentVisibilityChanged (Component &) override
 
void inputAttemptWhenModal () override
 
void focusGained (FocusChangeType) override
 
void enablementChanged () override
 
KeyboardFocusTraversercreateFocusTraverser () override
 
void textEditorTextChanged (TextEditor &) override
 
void textEditorReturnKeyPressed (TextEditor &) override
 
void textEditorEscapeKeyPressed (TextEditor &) override
 
void textEditorFocusLost (TextEditor &) override
 
void colourChanged () override
 
void valueChanged (Value &) override
 
void callChangeListeners ()
 
- Protected Member Functions inherited from juce::Component
virtual ComponentPeercreateNewPeer (int styleFlags, void *nativeWindowToAttachTo)
 
- Protected Member Functions inherited from juce::SettableTooltipClient
 SettableTooltipClient ()
 
- Protected Member Functions inherited from juce::TextEditor::Listener
virtual ~Listener ()
 

Additional Inherited Members

- Static Public Member Functions inherited from juce::Component
static Component *JUCE_CALLTYPE getCurrentlyFocusedComponent () noexcept
 
static void JUCE_CALLTYPE unfocusAllComponents ()
 
static void JUCE_CALLTYPE beginDragAutoRepeat (int millisecondsBetweenCallbacks)
 
static bool JUCE_CALLTYPE isMouseButtonDownAnywhere () noexcept
 
static int JUCE_CALLTYPE getNumCurrentlyModalComponents () noexcept
 
static Component *JUCE_CALLTYPE getCurrentlyModalComponent (int index=0) noexcept
 

Detailed Description

A component that displays a text string, and can optionally become a text editor when clicked.

Member Enumeration Documentation

◆ ColourIds

A set of colour IDs to use to change the colour of various aspects of the label.

These constants can be used either via the Component::setColour(), or LookAndFeel::setColour() methods.

Note that you can also use the constants from TextEditor::ColourIds to change the colour of the text editor that is opened when a label is editable.

See also
Component::setColour, Component::findColour, LookAndFeel::setColour, LookAndFeel::findColour
Enumerator
backgroundColourId 

The background colour to fill the label with.

textColourId 

The colour for the text.

outlineColourId 

An optional colour to use to draw a border around the label. Leave this transparent to not have an outline.

backgroundWhenEditingColourId 

The background colour when the label is being edited.

textWhenEditingColourId 

The colour for the text when the label is being edited.

outlineWhenEditingColourId 

An optional border colour when the label is being edited.

Constructor & Destructor Documentation

◆ Label()

Label::Label ( const String componentName = String::empty,
const String labelText = String::empty 
)

Creates a Label.

Parameters
componentNamethe name to give the component
labelTextthe text to show in the label

◆ ~Label()

Label::~Label ( )

Destructor.

Member Function Documentation

◆ addListener()

void Label::addListener ( Listener listener)

Registers a listener that will be called when the label's text changes.

◆ attachToComponent()

void Label::attachToComponent ( Component owner,
bool  onLeft 
)

Makes this label "stick to" another component.

This will cause the label to follow another component around, staying either to its left or above it.

Parameters
ownerthe component to follow
onLeftif true, the label will stay on the left of its component; if false, it will stay above it.

◆ callChangeListeners()

void Label::callChangeListeners ( )
protected

◆ colourChanged()

void Label::colourChanged ( )
overrideprotectedvirtual

This method is called when a colour is changed by the setColour() method.

See also
setColour, findColour

Reimplemented from juce::Component.

◆ componentMovedOrResized()

void Label::componentMovedOrResized ( Component component,
bool  wasMoved,
bool  wasResized 
)
overrideprotectedvirtual

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::ComponentListener.

◆ componentParentHierarchyChanged()

void Label::componentParentHierarchyChanged ( Component component)
overrideprotectedvirtual

Called to indicate that the component's parents have changed.

When a component is added or removed from its parent, all of its children will produce this notification (recursively - so all children of its children will also be called as well).

Parameters
componentthe component that this listener is registered with
See also
Component::parentHierarchyChanged

Reimplemented from juce::ComponentListener.

◆ componentVisibilityChanged()

void Label::componentVisibilityChanged ( Component component)
overrideprotectedvirtual

Called when the component is made visible or invisible.

Parameters
componentthe component that changed
See also
Component::setVisible

Reimplemented from juce::ComponentListener.

◆ createEditorComponent()

TextEditor * Label::createEditorComponent ( )
protectedvirtual

Creates the TextEditor component that will be used when the user has clicked on the label. Subclasses can override this if they need to customise this component in some way.

Reimplemented in juce::TextPropertyComponent::LabelComp.

◆ createFocusTraverser()

KeyboardFocusTraverser * Label::createFocusTraverser ( )
overrideprotectedvirtual

Creates a KeyboardFocusTraverser object to use to determine the logic by which focus should be passed from this component.

The default implementation of this method will return a default KeyboardFocusTraverser if this component is a focus container (as determined by the setFocusContainer() method). If the component isn't a focus container, then it will recursively ask its parents for a KeyboardFocusTraverser.

If you overrride this to return a custom KeyboardFocusTraverser, then this component and all its sub-components will use the new object to make their focusing decisions.

The method should return a new object, which the caller is required to delete when no longer needed.

Reimplemented from juce::Component.

◆ doesLossOfFocusDiscardChanges()

bool juce::Label::doesLossOfFocusDiscardChanges ( ) const
inlinenoexcept

Returns true if this option has been set in a call to setEditable().

◆ editorAboutToBeHidden()

void Label::editorAboutToBeHidden ( TextEditor textEditor)
protectedvirtual

Called when the text editor is going to be deleted, after editing has finished.

◆ editorShown()

void Label::editorShown ( TextEditor textEditor)
protectedvirtual

Called when the text editor has just appeared, due to a user click or other focus change.

◆ enablementChanged()

void Label::enablementChanged ( )
overrideprotectedvirtual

Callback to indicate that this component has been enabled or disabled.

This can be triggered by one of the component's parent components being enabled or disabled, as well as changes to the component itself.

The default implementation of this method does nothing; your class may wish to repaint itself or something when this happens.

See also
setEnabled, isEnabled

Reimplemented from juce::Component.

◆ focusGained()

void Label::focusGained ( FocusChangeType  cause)
overrideprotectedvirtual

Called to indicate that this component has just acquired the keyboard focus.

See also
focusLost, setWantsKeyboardFocus, getCurrentlyFocusedComponent, hasKeyboardFocus

Reimplemented from juce::Component.

◆ getAttachedComponent()

Component * Label::getAttachedComponent ( ) const

If this label has been attached to another component using attachToComponent, this returns the other component.

Returns nullptr if the label is not attached.

◆ getBorderSize()

BorderSize<int> juce::Label::getBorderSize ( ) const
inlinenoexcept

Returns the size of the border to be left around the text.

◆ getCurrentTextEditor()

TextEditor * Label::getCurrentTextEditor ( ) const
noexcept

Returns the currently-visible text editor, or nullptr if none is open.

◆ getFont()

Font Label::getFont ( ) const
noexcept

Returns the font currently being used. This may be the one set by setFont(), unless it has been overridden by the current LookAndFeel

See also
setFont

◆ getJustificationType()

Justification juce::Label::getJustificationType ( ) const
inlinenoexcept

Returns the type of justification, as set in setJustificationType().

◆ getMinimumHorizontalScale()

float juce::Label::getMinimumHorizontalScale ( ) const
inlinenoexcept

Specifies the amount that the font can be squashed horizontally.

◆ getText()

String Label::getText ( bool  returnActiveEditorContents = false) const

Returns the label's current text.

Parameters
returnActiveEditorContentsif this is true and the label is currently being edited, then this method will return the text as it's being shown in the editor. If false, then the value returned here won't be updated until the user has finished typing and pressed the return key.

◆ getTextValue()

Value& juce::Label::getTextValue ( )
inlinenoexcept

Returns the text content as a Value object. You can call Value::referTo() on this object to make the label read and control a Value object that you supply.

◆ hideEditor()

void Label::hideEditor ( bool  discardCurrentEditorContents)

Hides the editor if it was being shown.

Parameters
discardCurrentEditorContentsif true, the label's text will be reset to whatever it was before the editor was shown; if false, the current contents of the editor will be used to set the label's text before it is hidden.

◆ inputAttemptWhenModal()

void Label::inputAttemptWhenModal ( )
overrideprotectedvirtual

Called when the user tries to click on a component that is blocked by another modal component.

When a component is modal and the user clicks on one of the other components, the modal component will receive this callback.

The default implementation of this method will play a beep, and bring the currently modal component to the front, but it can be overridden to do other tasks.

See also
isCurrentlyBlockedByAnotherModalComponent, canModalEventBeSentToComponent

Reimplemented from juce::Component.

◆ isAttachedOnLeft()

bool juce::Label::isAttachedOnLeft ( ) const
inlinenoexcept

If the label is attached to the left of another component, this returns true.

Returns false if the label is above the other component. This is only relevent if attachToComponent() has been called.

◆ isBeingEdited()

bool Label::isBeingEdited ( ) const
noexcept

Returns true if the editor is currently focused and active.

◆ isEditable()

bool juce::Label::isEditable ( ) const
inlinenoexcept

Returns true if the user can edit this label's text.

◆ isEditableOnDoubleClick()

bool juce::Label::isEditableOnDoubleClick ( ) const
inlinenoexcept

Returns true if this option was set using setEditable().

◆ isEditableOnSingleClick()

bool juce::Label::isEditableOnSingleClick ( ) const
inlinenoexcept

Returns true if this option was set using setEditable().

◆ mouseDoubleClick()

void Label::mouseDoubleClick ( const MouseEvent event)
overrideprotectedvirtual

Called when a mouse button has been double-clicked on a component.

The MouseEvent object passed in contains lots of methods for finding out which button was pressed, as well as which modifier keys (e.g. shift, ctrl) were held down at the time.

Parameters
eventdetails about the position and status of the mouse event, including the source component in which it occurred
See also
mouseDown, mouseUp

Reimplemented from juce::Component.

◆ mouseUp()

void Label::mouseUp ( const MouseEvent event)
overrideprotectedvirtual

Called when a mouse button is released.

A mouseUp callback is sent to the component in which a button was pressed even if the mouse is actually over a different component when the button is released.

The MouseEvent object passed in contains lots of methods for finding out which buttons were down just before they were released.

Parameters
eventdetails about the position and status of the mouse event, including the source component in which it occurred
See also
mouseDown, mouseDrag, mouseDoubleClick, contains

Reimplemented from juce::Component.

◆ paint()

void Label::paint ( Graphics g)
overrideprotectedvirtual

Components can override this method to draw their content.

The paint() method gets called when a region of a component needs redrawing, either because the component's repaint() method has been called, or because something has happened on the screen that means a section of a window needs to be redrawn.

Any child components will draw themselves over whatever this method draws. If you need to paint over the top of your child components, you can also implement the paintOverChildren() method to do this.

If you want to cause a component to redraw itself, this is done asynchronously - calling the repaint() method marks a region of the component as "dirty", and the paint() method will automatically be called sometime later, by the message thread, to paint any bits that need refreshing. In Juce (and almost all modern UI frameworks), you never redraw something synchronously.

You should never need to call this method directly - to take a snapshot of the component you could use createComponentSnapshot() or paintEntireComponent().

Parameters
gthe graphics context that must be used to do the drawing operations.
See also
repaint, paintOverChildren, Graphics

Reimplemented from juce::Component.

◆ removeListener()

void Label::removeListener ( Listener listener)

Deregisters a previously-registered listener.

◆ resized()

void Label::resized ( )
overrideprotectedvirtual

Called when this component's size has been changed.

A component can implement this method to do things such as laying out its child components when its width or height changes.

The method is called synchronously as a result of the setBounds or setSize methods, so repeatedly changing a components size will repeatedly call its resized method (unlike things like repainting, where multiple calls to repaint are coalesced together).

If the component is a top-level window on the desktop, its size could also be changed by operating-system factors beyond the application's control.

See also
moved, setSize

Reimplemented from juce::Component.

◆ setBorderSize()

void Label::setBorderSize ( BorderSize< int >  newBorderSize)

Changes the border that is left between the edge of the component and the text. By default there's a small gap left at the sides of the component to allow for the drawing of the border, but you can change this if necessary.

◆ setEditable()

void Label::setEditable ( bool  editOnSingleClick,
bool  editOnDoubleClick = false,
bool  lossOfFocusDiscardsChanges = false 
)

Makes the label turn into a TextEditor when clicked.

By default this is turned off.

If turned on, then single- or double-clicking will turn the label into an editor. If the user then changes the text, then the ChangeBroadcaster base class will be used to send change messages to any listeners that have registered.

If the user changes the text, the textWasEdited() method will be called afterwards, and subclasses can override this if they need to do anything special.

Parameters
editOnSingleClickif true, just clicking once on the label will start editing the text
editOnDoubleClickif true, a double-click is needed to start editing
lossOfFocusDiscardsChangesif true, clicking somewhere else while the text is being edited will discard any changes; if false, then this will commit the changes.
See also
showEditor, setEditorColours, TextEditor

◆ setFont()

void Label::setFont ( const Font newFont)

Changes the font to use to draw the text.

See also
getFont

◆ setJustificationType()

void Label::setJustificationType ( Justification  justification)

Sets the style of justification to be used for positioning the text. (The default is Justification::centredLeft)

◆ setKeyboardType()

void juce::Label::setKeyboardType ( TextInputTarget::VirtualKeyboardType  type)
inlinenoexcept

Set a keyboard type for use when the text editor is shown.

◆ setMinimumHorizontalScale()

void Label::setMinimumHorizontalScale ( float  newScale)

Specifies the minimum amount that the font can be squashed horizontally before it starts using ellipsis. Use a value of 0 for a default value.

See also
Graphics::drawFittedText

◆ setText()

void Label::setText ( const String newText,
NotificationType  notification 
)

Changes the label text.

The NotificationType parameter indicates whether to send a change message to any Label::Listener objects if the new text is different.

◆ showEditor()

void Label::showEditor ( )

Makes the editor appear as if the label had been clicked by the user.

See also
textWasEdited, setEditable

◆ textEditorEscapeKeyPressed()

void Label::textEditorEscapeKeyPressed ( TextEditor )
overrideprotectedvirtual

Called when the user presses the escape key.

Reimplemented from juce::TextEditor::Listener.

◆ textEditorFocusLost()

void Label::textEditorFocusLost ( TextEditor )
overrideprotectedvirtual

Called when the text editor loses focus.

Reimplemented from juce::TextEditor::Listener.

◆ textEditorReturnKeyPressed()

void Label::textEditorReturnKeyPressed ( TextEditor )
overrideprotectedvirtual

Called when the user presses the return key.

Reimplemented from juce::TextEditor::Listener.

◆ textEditorTextChanged()

void Label::textEditorTextChanged ( TextEditor )
overrideprotectedvirtual

Called when the user changes the text in some way.

Reimplemented from juce::TextEditor::Listener.

◆ textWasChanged()

void Label::textWasChanged ( )
protectedvirtual

Called when the text has been altered.

◆ textWasEdited()

void Label::textWasEdited ( )
protectedvirtual

Called after the user changes the text.

Reimplemented in juce::TextPropertyComponent::LabelComp.

◆ valueChanged()

void Label::valueChanged ( Value value)
overrideprotectedvirtual

Called when a Value object is changed.

Note that the Value object passed as a parameter may not be exactly the same object that you registered the listener with - it might be a copy that refers to the same underlying ValueSource. To find out, you can call Value::refersToSameSourceAs().

Implements juce::Value::Listener.


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