openshot-audio
0.1.6
|
#include <juce_gui_basics.h>
Static Public Member Functions | |
static bool | respondsToKey (const KeyPress &) |
![]() | |
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 Viewport is used to contain a larger child component, and allows the child to be automatically scrolled around.
To use a Viewport, just create one and set the component that goes inside it using the setViewedComponent() method. When the child component changes size, the Viewport will adjust its scrollbars accordingly.
A subclass of the viewport can be created which will receive calls to its visibleAreaChanged() method when the subcomponent changes position or size.
|
explicit |
Creates a Viewport.
The viewport is initially empty - use the setViewedComponent() method to add a child component for it to manage.
Viewport::~Viewport | ( | ) |
Destructor.
bool Viewport::autoScroll | ( | int | mouseX, |
int | mouseY, | ||
int | distanceFromEdge, | ||
int | maximumSpeed | ||
) |
If the specified position is at the edges of the viewport, this method scrolls the viewport to bring that position nearer to the centre.
Call this if you're dragging an object inside a viewport and want to make it scroll when the user approaches an edge. You might also find Component::beginDragAutoRepeat() useful when auto-scrolling.
mouseX | the x position, relative to the Viewport's top-left |
mouseY | the y position, relative to the Viewport's top-left |
distanceFromEdge | specifies how close to an edge the position needs to be before the viewport should scroll in that direction |
maximumSpeed | the maximum number of pixels that the viewport is allowed to scroll by. |
|
overridevirtual |
Called when the component's position or size changes.
component | the component that was moved or resized |
wasMoved | true if the component's top-left corner has just moved |
wasResized | true if the component's width or height has just changed |
Reimplemented from juce::ComponentListener.
|
inlinenoexcept |
Returns a pointer to the scrollbar component being used. Handy if you need to customise the bar somehow.
int Viewport::getMaximumVisibleHeight | ( | ) | const |
Returns the height available within this component for the contents.
This will be the height of the viewport component minus the space taken up by a horizontal scrollbar (if visible).
int Viewport::getMaximumVisibleWidth | ( | ) | const |
Returns the width available within this component for the contents.
This will be the width of the viewport component minus the width of a vertical scrollbar (if visible).
int Viewport::getScrollBarThickness | ( | ) | const |
Returns the thickness of the scrollbars.
|
inlinenoexcept |
Returns a pointer to the scrollbar component being used. Handy if you need to customise the bar somehow.
|
inlinenoexcept |
Returns the visible area of the child component, relative to its top-left
|
inlinenoexcept |
Returns the component that's currently being used inside the Viewport.
|
inlinenoexcept |
Returns the height of the visible area of the child component.
This may be less than the height of this Viewport if there's a horizontal scrollbar or if the child component is itself smaller.
|
inlinenoexcept |
Returns the position within the child component of the top-left of its visible area.
|
inlinenoexcept |
Returns the position within the child component of the top-left of its visible area.
|
inlinenoexcept |
Returns the position within the child component of the top-left of its visible area.
|
inlinenoexcept |
Returns the width of the visible area of the child component.
This may be less than the width of this Viewport if there's a vertical scrollbar or if the child component is itself smaller.
|
inlinenoexcept |
True if the horizontal scrollbar is enabled.
|
inlinenoexcept |
True if the vertical scrollbar is enabled.
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 juce::Component.
|
overridevirtual |
Called to let the component react to a change in the look-and-feel setting.
When the look-and-feel is changed for a component, this will be called in all its child components, recursively.
It can also be triggered manually by the sendLookAndFeelChange() method, in case an application uses a LookAndFeel class that might have changed internally.
Reimplemented from juce::Component.
|
overridevirtual |
Called when the mouse-wheel is moved.
This callback is sent to the component that the mouse is over when the wheel is moved.
If not overridden, a component will forward this message to its parent, so that parent components can collect mouse-wheel messages that happen to child components which aren't interested in them. (Bear in mind that if you attach a component as a mouse-listener to other components, then those wheel moves will also end up calling this method and being passed up to the parents, which may not be what you intended to happen).
event | details about the mouse event |
wheel | details about the mouse wheel movement |
Reimplemented from juce::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 juce::Component.
|
overridevirtual |
Called when a ScrollBar is moved.
scrollBarThatHasMoved | the bar that has moved |
newRangeStart | the new range start of this bar |
Implements juce::ScrollBar::Listener.
void Viewport::setScrollBarsShown | ( | bool | showVerticalScrollbarIfNeeded, |
bool | showHorizontalScrollbarIfNeeded, | ||
bool | allowVerticalScrollingWithoutScrollbar = false , |
||
bool | allowHorizontalScrollingWithoutScrollbar = false |
||
) |
Turns scrollbars on or off.
If set to false, the scrollbars won't ever appear. When true (the default) they will appear only when needed.
The allowVerticalScrollingWithoutScrollbar parameters allow you to enable mouse-wheel scrolling even when there the scrollbars are hidden. When the scrollbars are visible, these parameters are ignored.
void Viewport::setScrollBarThickness | ( | int | thickness | ) |
Changes the width of the scrollbars.
If this isn't specified, the default width from the LookAndFeel class will be used.
void Viewport::setSingleStepSizes | ( | int | stepX, |
int | stepY | ||
) |
Changes the distance that a single-step click on a scrollbar button will move the viewport.
void Viewport::setViewedComponent | ( | Component * | newViewedComponent, |
bool | deleteComponentWhenNoLongerNeeded = true |
||
) |
Sets the component that this viewport will contain and scroll around.
This will add the given component to this Viewport and position it at (0, 0).
(Don't add or remove any child components directly using the normal Component::addChildComponent() methods).
newViewedComponent | the component to add to this viewport, or null to remove the current component. |
deleteComponentWhenNoLongerNeeded | if true, the component will be deleted automatically when the viewport is deleted or when a different component is added. If false, the caller must manage the lifetime of the component |
void Viewport::setViewPosition | ( | int | xPixelsOffset, |
int | yPixelsOffset | ||
) |
Changes the position of the viewed component.
The inner component will be moved so that the pixel at the top left of the viewport will be the pixel at position (xPixelsOffset, yPixelsOffset) within the inner component.
This will update the scrollbars and might cause a call to visibleAreaChanged().
void Viewport::setViewPosition | ( | Point< int > | newPosition | ) |
Changes the position of the viewed component.
The inner component will be moved so that the pixel at the top left of the viewport will be the pixel at the specified coordinates within the inner component.
This will update the scrollbars and might cause a call to visibleAreaChanged().
void Viewport::setViewPositionProportionately | ( | double | proportionX, |
double | proportionY | ||
) |
Changes the view position as a proportion of the distance it can move.
The values here are from 0.0 to 1.0 - where (0, 0) would put the visible area in the top-left, and (1, 1) would put it as far down and to the right as it's possible to go whilst keeping the child component on-screen.
bool Viewport::useMouseWheelMoveIfNeeded | ( | const MouseEvent & | e, |
const MouseWheelDetails & | wheel | ||
) |
|
virtual |
Callback method that is called when the viewed component is added, removed or swapped.
Callback method that is called when the visible area changes.
This will be called when the visible area is moved either be scrolling or by calls to setViewPosition(), etc.
Reimplemented in juce::TextEditorViewport, juce::TreeView::TreeViewport, and juce::ListBox::ListViewport.