openshot-audio
0.1.7
|
#include <juce_ResizableWindow.h>
Classes | |
struct | LookAndFeelMethods |
Public Types | |
enum | ColourIds { backgroundColourId = 0x1005700 } |
![]() | |
enum | FocusChangeType { focusChangedByMouseClick, focusChangedByTabKey, focusChangedDirectly } |
Protected Member Functions | |
void | paint (Graphics &) override |
void | moved () override |
void | resized () override |
void | mouseDown (const MouseEvent &) override |
void | mouseDrag (const MouseEvent &) override |
void | mouseUp (const MouseEvent &) override |
void | lookAndFeelChanged () override |
void | childBoundsChanged (Component *) override |
void | parentSizeChanged () override |
void | visibilityChanged () override |
void | activeWindowStatusChanged () override |
int | getDesktopWindowStyleFlags () const override |
![]() | |
void | focusOfChildComponentChanged (FocusChangeType) override |
void | parentHierarchyChanged () override |
void | recreateDesktopWindow () |
void | visibilityChanged () override |
![]() | |
virtual ComponentPeer * | createNewPeer (int styleFlags, void *nativeWindowToAttachTo) |
Protected Attributes | |
ScopedPointer < ResizableCornerComponent > | resizableCorner |
ScopedPointer < ResizableBorderComponent > | resizableBorder |
Additional Inherited Members | |
![]() | |
static int | getNumTopLevelWindows () noexcept |
static TopLevelWindow * | getTopLevelWindow (int index) noexcept |
static TopLevelWindow * | getActiveTopLevelWindow () noexcept |
![]() | |
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 |
A base class for top-level windows that can be dragged around and resized.
To add content to the window, use its setContentOwned() or setContentNonOwned() methods to give it a component that will remain positioned inside it (leaving a gap around the edges for a border).
It's not advisable to add child components directly to a ResizableWindow: put them inside your content component instead. And overriding methods like resized(), moved(), etc is also not recommended - instead override these methods for your content component. (If for some obscure reason you do need to override these methods, always remember to call the super-class's resized() method too, otherwise it'll fail to lay out the window decorations correctly).
By default resizing isn't enabled - use the setResizable() method to enable it and to choose the style of resizing to use.
A set of colour IDs to use to change the colour of various aspects of the window.
These constants can be used either via the Component::setColour(), or LookAndFeel::setColour() methods.
Enumerator | |
---|---|
backgroundColourId |
A colour to use to fill the window's background. |
Creates a ResizableWindow.
This constructor doesn't specify a background colour, so the LookAndFeel's default background colour will be used.
name | the name to give the component |
addToDesktop | if true, the window will be automatically added to the desktop; if false, you can use it as a child component |
ResizableWindow::ResizableWindow | ( | const String & | name, |
Colour | backgroundColour, | ||
bool | addToDesktop | ||
) |
Creates a ResizableWindow.
name | the name to give the component |
backgroundColour | the colour to use for filling the window's background. |
addToDesktop | if true, the window will be automatically added to the desktop; if false, you can use it as a child component |
ResizableWindow::~ResizableWindow | ( | ) |
Destructor. If a content component has been set with setContentOwned(), it will be deleted.
|
overrideprotectedvirtual |
This callback happens when this window becomes active or inactive.
Reimplemented from TopLevelWindow.
|
overrideprotectedvirtual |
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 ResizableWindow::clearContentComponent | ( | ) |
Removes the current content component. If the previous content component was added with setContentOwned(), it will also be deleted. If it was added with setContentNonOwned(), it will simply be removed from this component.
|
noexcept |
Returns the colour currently being used for the window's background.
As a convenience the window will fill itself with this colour, but you can override the paint() method if you need more customised behaviour.
This method is the same as retrieving the colour for ResizableWindow::backgroundColourId.
|
virtual |
Returns the width of the frame to use around the window.
Reimplemented in DocumentWindow.
|
inlinenoexcept |
Returns the bounds constrainer object that this window is using. You can access this to change its properties.
|
inlinenoexcept |
Returns the current content component.
This will be the component set by setContentOwned() or setContentNonOwned, or nullptr if none has yet been specified.
|
virtual |
Returns the insets to use when positioning the content component.
Reimplemented in DocumentWindow.
|
overrideprotectedvirtual |
Reimplemented from TopLevelWindow.
String ResizableWindow::getWindowStateAsString | ( | ) |
Returns a string which encodes the window's current size and position.
This string will encapsulate the window's size, position, and whether it's in full-screen mode. It's intended for letting your application save and restore a window's position.
Use the restoreWindowStateFromString() to restore from a saved state.
|
inlinenoexcept |
Returns true if the window can be dragged around by the user.
bool ResizableWindow::isFullScreen | ( | ) | const |
Returns true if the window is currently in full-screen mode.
bool ResizableWindow::isKioskMode | ( | ) | const |
Returns true if the window has been placed in kiosk-mode.
bool ResizableWindow::isMinimised | ( | ) | const |
Returns true if the window is currently minimised.
|
noexcept |
Returns true if resizing is enabled.
ResizableWindow::JUCE_DEPRECATED | ( | void | setContentComponentComponent *newContentComponent, bool deleteOldOne=true, bool resizeToFit=false | ) |
|
overrideprotectedvirtual |
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 Component.
|
overrideprotectedvirtual |
Called when a mouse button is pressed.
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.
Once a button is held down, the mouseDrag method will be called when the mouse moves, until the button is released.
event | details about the position and status of the mouse event, including the source component in which it occurred |
Reimplemented from Component.
|
overrideprotectedvirtual |
Called when the mouse is moved while a button is held down.
When a mouse button is pressed inside a component, that component receives mouseDrag callbacks each time the mouse moves, even if the mouse strays outside the component's bounds.
event | details about the position and status of the mouse event, including the source component in which it occurred |
Reimplemented from Component.
|
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.
event | details about the position and status of the mouse event, including the source component in which it occurred |
Reimplemented from Component.
|
overrideprotectedvirtual |
(if overriding this, make sure you call ResizableWindow::moved() in your subclass)
Reimplemented from Component.
|
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().
g | the graphics context that must be used to do the drawing operations. |
Reimplemented from Component.
|
overrideprotectedvirtual |
Called when this component's immediate parent has been resized.
If the component is a top-level window, this indicates that the screen size has changed.
Reimplemented from Component.
|
overrideprotectedvirtual |
(if overriding this, make sure you call ResizableWindow::resized() in your subclass)
Reimplemented from Component.
Restores the window to a previously-saved size and position.
This restores the window's size, positon and full-screen status from an string that was previously created with the getWindowStateAsString() method.
void ResizableWindow::setBackgroundColour | ( | Colour | newColour | ) |
Changes the colour currently being used for the window's background.
As a convenience the window will fill itself with this colour, but you can override the paint() method if you need more customised behaviour.
Note that the opaque state of this window is altered by this call to reflect the opacity of the colour passed-in. On window systems which can't support semi-transparent windows this might cause problems, (though it's unlikely you'll be using this class as a base for a semi-transparent component anyway).
You can also use the ResizableWindow::backgroundColourId colour id to set this colour.
Calls the window's setBounds method, after first checking these bounds with the current constrainer.
void ResizableWindow::setConstrainer | ( | ComponentBoundsConstrainer * | newConstrainer | ) |
Sets the bounds-constrainer object to use for resizing and dragging this window.
A pointer to the object you pass in will be kept, but it won't be deleted by this object, so it's the caller's responsiblity to manage it.
If you pass a nullptr, then no contraints will be placed on the positioning of the window.
Changes the window so that the content component ends up with the specified size.
This is basically a setSize call on the window, but which adds on the borders, so you can specify the content component's target size.
void ResizableWindow::setContentNonOwned | ( | Component * | newContentComponent, |
bool | resizeToFitWhenContentChangesSize | ||
) |
Changes the current content component.
This sets a component that will be placed in the centre of the ResizableWindow, (leaving a space around the edge for the border).
You should never add components directly to a ResizableWindow (or any of its subclasses) with addChildComponent(). Instead, add them to the content component.
newContentComponent | the new component to use - this component will NOT be deleted by this component, so it's the caller's responsibility to manage its lifetime (it's ok to delete it while this window is still using it). To set a content component that the window will delete, call setContentOwned() instead. |
resizeToFitWhenContentChangesSize | if true, then the ResizableWindow will maintain its size such that it always fits around the size of the content component. If false, the new content will be resized to fit the current space available. |
void ResizableWindow::setContentOwned | ( | Component * | newContentComponent, |
bool | resizeToFitWhenContentChangesSize | ||
) |
Changes the current content component.
This sets a component that will be placed in the centre of the ResizableWindow, (leaving a space around the edge for the border).
You should never add components directly to a ResizableWindow (or any of its subclasses) with addChildComponent(). Instead, add them to the content component.
newContentComponent | the new component to use - this component will be deleted when it's no longer needed (i.e. when the window is deleted or a new content component is set for it). To set a component that this window will not delete, call setContentNonOwned() instead. |
resizeToFitWhenContentChangesSize | if true, then the ResizableWindow will maintain its size such that it always fits around the size of the content component. If false, the new content will be resized to fit the current space available. |
|
noexcept |
Can be used to enable or disable user-dragging of the window.
void ResizableWindow::setFullScreen | ( | bool | shouldBeFullScreen | ) |
Puts the window into full-screen mode, or restores it to its normal size.
If true, the window will become full-screen; if false, it will return to the last size it was before being made full-screen.
void ResizableWindow::setMinimised | ( | bool | shouldMinimise | ) |
Minimises the window, or restores it to its previous position and size.
When being un-minimised, it'll return to the last position and size it was in before being minimised.
void ResizableWindow::setResizable | ( | bool | shouldBeResizable, |
bool | useBottomRightCornerResizer | ||
) |
Make the window resizable or fixed.
shouldBeResizable | whether it's resizable at all |
useBottomRightCornerResizer | if true, it'll add a ResizableCornerComponent at the bottom-right; if false, it'll use a ResizableBorderComponent around the edge |
|
noexcept |
This sets the maximum and minimum sizes for the window.
If the window's current size is outside these limits, it will be resized to make sure it's within them.
A direct call to setBounds() will bypass any constraint checks, but when the window is dragged by the user or resized by other indirect means, the constrainer will limit the numbers involved.
|
overrideprotectedvirtual |
Called when this component's visibility changes.
Reimplemented from Component.
|
protected |
|
protected |