openshot-audio
0.1.7
|
#include <juce_CallOutBox.h>
Classes | |
struct | LookAndFeelMethods |
Static Public Member Functions | |
static CallOutBox & | launchAsynchronously (Component *contentComponent, const Rectangle< int > &areaToPointTo, Component *parentComponent) |
![]() | |
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 | |
![]() | |
enum | FocusChangeType { focusChangedByMouseClick, focusChangedByTabKey, focusChangedDirectly } |
![]() | |
virtual ComponentPeer * | createNewPeer (int styleFlags, void *nativeWindowToAttachTo) |
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.
The call-out will resize and position itself when the content changes size.
CallOutBox::CallOutBox | ( | Component & | contentComponent, |
const Rectangle< int > & | areaToPointTo, | ||
Component * | parentComponent | ||
) |
Creates a CallOutBox.
contentComponent | the 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. |
areaToPointTo | the 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. |
parentComponent | if 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.
|
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.
Reimplemented from 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.
|
noexcept |
|
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.
Reimplemented from Component.
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.
x | the 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 |
y | the 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 |
Reimplemented from Component.
|
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.
Reimplemented from Component.
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.
Reimplemented from Component.
|
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.
contentComponent | the 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. |
areaToPointTo | the 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. |
parentComponent | if 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. |
|
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.
Reimplemented from Component.
|
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().
g | the graphics context that must be used to do the drawing operations. |
Reimplemented from Component.
|
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.
Reimplemented from Component.
void CallOutBox::setArrowSize | ( | float | newSize | ) |
Changes the length of the arrow.
|
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.
newAreaToPointTo | the rectangle to make the box's arrow point to |
newAreaToFitIn | the area within which the box's position should be constrained |