openshot-audio  0.1.6
Classes | Public Member Functions | Static Public Member Functions | List of all members
juce::CallOutBox Class Reference

#include <juce_gui_basics.h>

Inheritance diagram for juce::CallOutBox:
juce::Component juce::MouseListener

Classes

struct  LookAndFeelMethods
 

Public Member Functions

 CallOutBox (Component &contentComponent, const Rectangle< int > &areaToPointTo, Component *parentComponent)
 
 ~CallOutBox ()
 
void setArrowSize (float newSize)
 
void updatePosition (const Rectangle< int > &newAreaToPointTo, const Rectangle< int > &newAreaToFitIn)
 
void dismiss ()
 
void setDismissalMouseClicksAreAlwaysConsumed (bool shouldAlwaysBeConsumed) noexcept
 
void paint (Graphics &) override
 
void resized () override
 
void moved () override
 
void childBoundsChanged (Component *) override
 
bool hitTest (int x, int y) override
 
void inputAttemptWhenModal () override
 
bool keyPressed (const KeyPress &) override
 
void handleCommandMessage (int) override
 
int getBorderSize () 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< intgetPosition () const noexcept
 
int getBottom () const noexcept
 
const Rectangle< int > & getBounds () const noexcept
 
Rectangle< intgetLocalBounds () const noexcept
 
Rectangle< intgetBoundsInParent () const noexcept
 
int getScreenX () const
 
int getScreenY () const
 
Point< intgetScreenPosition () const
 
Rectangle< intgetScreenBounds () const
 
Point< intgetLocalPoint (const Component *sourceComponent, Point< int > pointRelativeToSourceComponent) const
 
Point< float > getLocalPoint (const Component *sourceComponent, Point< float > pointRelativeToSourceComponent) const
 
Rectangle< intgetLocalArea (const Component *sourceComponent, const Rectangle< int > &areaRelativeToSourceComponent) const
 
Point< intlocalPointToGlobal (Point< int > localPoint) const
 
Point< float > localPointToGlobal (Point< float > localPoint) const
 
Rectangle< intlocalAreaToGlobal (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< intgetParentMonitorArea () 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 ()
 
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)
 
virtual KeyboardFocusTraversercreateFocusTraverser ()
 
int getExplicitFocusOrder () const
 
void setExplicitFocusOrder (int newFocusOrderIndex)
 
void setFocusContainer (bool shouldBeFocusContainer) noexcept
 
bool isFocusContainer () const noexcept
 
bool isEnabled () const noexcept
 
void setEnabled (bool shouldBeEnabled)
 
virtual void enablementChanged ()
 
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 mouseUp (const MouseEvent &event) override
 
virtual void mouseDoubleClick (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 keyStateChanged (bool isKeyDown)
 
virtual void modifierKeysChanged (const ModifierKeys &modifiers)
 
virtual void focusGained (FocusChangeType cause)
 
virtual void focusLost (FocusChangeType cause)
 
virtual void focusOfChildComponentChanged (FocusChangeType cause)
 
bool isMouseOver (bool includeChildren=false) const
 
bool isMouseButtonDown () const
 
bool isMouseOverOrDragging () const
 
Point< intgetMouseXYRelative () const
 
virtual void parentSizeChanged ()
 
virtual void broughtToFront ()
 
void addComponentListener (ComponentListener *newListener)
 
void removeComponentListener (ComponentListener *listenerToRemove)
 
void postCommandMessage (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 void colourChanged ()
 
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 ()
 

Static Public Member Functions

static CallOutBoxlaunchAsynchronously (Component *contentComponent, const Rectangle< int > &areaToPointTo, Component *parentComponent)
 
- 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
 

Additional Inherited Members

- Public Types inherited from juce::Component
enum  FocusChangeType { focusChangedByMouseClick, focusChangedByTabKey, focusChangedDirectly }
 
- Protected Member Functions inherited from juce::Component
virtual ComponentPeercreateNewPeer (int styleFlags, void *nativeWindowToAttachTo)
 

Detailed Description

A box with a small arrow that can be used as a temporary pop-up window to show extra controls when a button or other component is clicked.

Using one of these is similar to having a popup menu attached to a button or other component - but it looks fancier, and has an arrow that can indicate the object that it applies to.

The class works best when shown modally, but obviously running modal loops is evil and must never be done, so the launchAsynchronously method is provided as a handy way of launching an instance of a CallOutBox and automatically managing its lifetime, e.g.

void mouseUp (const MouseEvent&)
{
FoobarContentComp* content = new FoobarContentComp();
content->setSize (300, 300);
CallOutBox& myBox
}

The call-out will resize and position itself when the content changes size.

Constructor & Destructor Documentation

CallOutBox::CallOutBox ( Component contentComponent,
const Rectangle< int > &  areaToPointTo,
Component parentComponent 
)

Creates a CallOutBox.

Parameters
contentComponentthe component to display inside the call-out. This should already have a size set (although the call-out will also update itself when the component's size is changed later). Obviously this component must not be deleted until the call-out box has been deleted.
areaToPointTothe area that the call-out's arrow should point towards. If a parentComponent is supplied, then this is relative to that parent; otherwise, it's a global screen coord.
parentComponentif non-zero, this is the component to add the call-out to. If this is a nullptr, the call-out will be added to the desktop.
CallOutBox::~CallOutBox ( )

Destructor.

Member Function Documentation

void CallOutBox::childBoundsChanged ( Component child)
overridevirtual

Called when one of this component's children is moved or resized.

If the parent wants to know about changes to its immediate children (not to children of its children), this is the method to override.

See also
moved, resized, parentSizeChanged

Reimplemented from juce::Component.

void CallOutBox::dismiss ( )

Posts a message which will dismiss the callout box asynchronously. NB: it's safe to call this method from any thread.

int CallOutBox::getBorderSize ( ) const
noexcept
void CallOutBox::handleCommandMessage ( int  commandId)
overridevirtual

Called to handle a command that was sent by postCommandMessage().

This is called by the message thread when a command message arrives, and the component can override this method to process it in any way it needs to.

See also
postCommandMessage

Reimplemented from juce::Component.

bool CallOutBox::hitTest ( int  x,
int  y 
)
overridevirtual

Tests whether a given point is inside the component.

Overriding this method allows you to create components which only intercept mouse-clicks within a user-defined area.

This is called to find out whether a particular x, y coordinate is considered to be inside the component or not, and is used by methods such as contains() and getComponentAt() to work out which component the mouse is clicked on.

Components with custom shapes will probably want to override it to perform some more complex hit-testing.

The default implementation of this method returns either true or false, depending on the value that was set by calling setInterceptsMouseClicks() (true is the default return value).

Note that the hit-test region is not related to the opacity with which areas of a component are painted.

Applications should never call hitTest() directly - instead use the contains() method, because this will also test for occlusion by the component's parent.

Note that for components on the desktop, this method will be ignored, because it's not always possible to implement this behaviour on all platforms.

Parameters
xthe x coordinate to test, relative to the left hand edge of this component. This value is guaranteed to be greater than or equal to zero, and less than the component's width
ythe y coordinate to test, relative to the top edge of this component. This value is guaranteed to be greater than or equal to zero, and less than the component's height
Returns
true if the click is considered to be inside the component
See also
setInterceptsMouseClicks, contains

Reimplemented from juce::Component.

void CallOutBox::inputAttemptWhenModal ( )
overridevirtual

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.

bool CallOutBox::keyPressed ( const KeyPress key)
overridevirtual

Called when a key is pressed.

When a key is pressed, the component that has the keyboard focus will have this method called. Remember that a component will only be given the focus if its setWantsKeyboardFocus() method has been used to enable this.

If your implementation returns true, the event will be consumed and not passed on to any other listeners. If it returns false, the key will be passed to any KeyListeners that have been registered with this component. As soon as one of these returns true, the process will stop, but if they all return false, the event will be passed upwards to this component's parent, and so on.

The default implementation of this method does nothing and returns false.

See also
keyStateChanged, getCurrentlyFocusedComponent, addKeyListener

Reimplemented from juce::Component.

CallOutBox & CallOutBox::launchAsynchronously ( Component contentComponent,
const Rectangle< int > &  areaToPointTo,
Component parentComponent 
)
static

This will launch a callout box containing the given content, pointing to the specified target component.

This method will create and display a callout, returning immediately, after which the box will continue to run modally until the user clicks on some other component, at which point it will be dismissed and deleted automatically.

It returns a reference to the newly-created box so that you can customise it, but don't keep a pointer to it, as it'll be deleted at some point when it gets closed.

Parameters
contentComponentthe component to display inside the call-out. This should already have a size set (although the call-out will also update itself when the component's size is changed later). This component will be owned by the callout box and deleted later when the box is dismissed.
areaToPointTothe area that the call-out's arrow should point towards. If a parentComponent is supplied, then this is relative to that parent; otherwise, it's a global screen coord.
parentComponentif non-zero, this is the component to add the call-out to. If this is a nullptr, the call-out will be added to the desktop.
void CallOutBox::moved ( )
overridevirtual

Called when this component's position has been changed.

This is called when the position relative to its parent changes, not when its absolute position on the screen changes (so it won't be called for all child components when a parent component is moved).

The method is called synchronously as a result of the setBounds, setTopLeftPosition or any of the other repositioning methods, and like resized(), it will be called each time those methods are called.

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

See also
resized, setBounds

Reimplemented from juce::Component.

void CallOutBox::paint ( Graphics g)
overridevirtual

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.

void CallOutBox::resized ( )
overridevirtual

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.

void CallOutBox::setArrowSize ( float  newSize)

Changes the length of the arrow.

void CallOutBox::setDismissalMouseClicksAreAlwaysConsumed ( bool  shouldAlwaysBeConsumed)
noexcept

Determines whether the mouse events for clicks outside the calloutbox are consumed, or allowed to arrive at the other component that they were aimed at.

By default this is false, so that when you click on something outside the calloutbox, that event will also be sent to the component that was clicked on. If you set it to true, then the first click will always just dismiss the box and not be sent to anything else.

void CallOutBox::updatePosition ( const Rectangle< int > &  newAreaToPointTo,
const Rectangle< int > &  newAreaToFitIn 
)

Updates the position and size of the box.

You shouldn't normally need to call this, unless you need more precise control over the layout.

Parameters
newAreaToPointTothe rectangle to make the box's arrow point to
newAreaToFitInthe area within which the box's position should be constrained

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