openshot-audio  0.1.5
Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends | List of all members
TopLevelWindow Class Reference

#include <juce_TopLevelWindow.h>

Inheritance diagram for TopLevelWindow:
Component MouseListener AlertWindow ResizableWindow KeyMappingEditorComponent::ChangeKeyButton::KeyEntryWindow DocumentWindow FileChooserDialogBox DialogWindow MultiDocumentPanelWindow DefaultDialogWindow Toolbar::CustomisationDialog

Public Member Functions

 TopLevelWindow (const String &name, bool addToDesktop)
 
 ~TopLevelWindow ()
 
bool isActiveWindow () const noexcept
 
void centreAroundComponent (Component *componentToCentreAround, int width, int height)
 
void setDropShadowEnabled (bool useShadow)
 
bool isDropShadowEnabled () const noexcept
 
void setUsingNativeTitleBar (bool useNativeTitleBar)
 
bool isUsingNativeTitleBar () const noexcept
 
void addToDesktop ()
 
void addToDesktop (int windowStyleFlags, void *nativeWindowToAttachTo=nullptr) override
 
- Public Member Functions inherited from 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
 
bool isShowing () const
 
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 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)
 
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 paint (Graphics &g)
 
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 keyPressed (const KeyPress &key)
 
virtual bool keyStateChanged (bool isKeyDown)
 
virtual void modifierKeysChanged (const ModifierKeys &modifiers)
 
virtual void focusGained (FocusChangeType cause)
 
virtual void focusLost (FocusChangeType cause)
 
bool isMouseOver (bool includeChildren=false) const
 
bool isMouseButtonDown () const
 
bool isMouseOverOrDragging () const
 
Point< int > getMouseXYRelative () const
 
virtual void resized ()
 
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)
 
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)
 
virtual void inputAttemptWhenModal ()
 
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 MouseListener
virtual ~MouseListener ()
 

Static Public Member Functions

static int getNumTopLevelWindows () noexcept
 
static TopLevelWindowgetTopLevelWindow (int index) noexcept
 
static TopLevelWindowgetActiveTopLevelWindow () noexcept
 
- Static Public Member Functions inherited from 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
 

Protected Member Functions

virtual void activeWindowStatusChanged ()
 
void focusOfChildComponentChanged (FocusChangeType) override
 
void parentHierarchyChanged () override
 
virtual int getDesktopWindowStyleFlags () const
 
void recreateDesktopWindow ()
 
void visibilityChanged () override
 
- Protected Member Functions inherited from Component
virtual ComponentPeercreateNewPeer (int styleFlags, void *nativeWindowToAttachTo)
 

Friends

class TopLevelWindowManager
 
class ResizableWindow
 

Additional Inherited Members

- Public Types inherited from Component
enum  FocusChangeType { focusChangedByMouseClick, focusChangedByTabKey, focusChangedDirectly }
 

Detailed Description

A base class for top-level windows.

This class is used for components that are considered a major part of your application - e.g. ResizableWindow, DocumentWindow, DialogWindow, AlertWindow, etc. Things like menus that pop up briefly aren't derived from it.

A TopLevelWindow is probably on the desktop, but this isn't mandatory - it could itself be the child of another component.

The class manages a list of all instances of top-level windows that are in use, and each one is also given the concept of being "active". The active window is one that is actively being used by the user. This isn't quite the same as the component with the keyboard focus, because there may be a popup menu or other temporary window which gets keyboard focus while the active top level window is unchanged.

A top-level window also has an optional drop-shadow.

See also
ResizableWindow, DocumentWindow, DialogWindow

Constructor & Destructor Documentation

◆ TopLevelWindow()

TopLevelWindow::TopLevelWindow ( const String name,
bool  addToDesktop 
)

Creates a TopLevelWindow.

Parameters
namethe name to give the component
addToDesktopif true, the window will be automatically added to the desktop; if false, you can use it as a child component

◆ ~TopLevelWindow()

TopLevelWindow::~TopLevelWindow ( )

Destructor.

Member Function Documentation

◆ activeWindowStatusChanged()

void TopLevelWindow::activeWindowStatusChanged ( )
protectedvirtual

This callback happens when this window becomes active or inactive.

See also
isActiveWindow

Reimplemented in ResizableWindow, DocumentWindow, and MultiDocumentPanelWindow.

◆ addToDesktop() [1/2]

void TopLevelWindow::addToDesktop ( )

Adds the window to the desktop using the default flags.

◆ addToDesktop() [2/2]

void TopLevelWindow::addToDesktop ( int  windowStyleFlags,
void *  nativeWindowToAttachTo = nullptr 
)
overridevirtual

Makes this component appear as a window on the desktop.

Note that before calling this, you should make sure that the component's opacity is set correctly using setOpaque(). If the component is non-opaque, the windowing system will try to create a special transparent window for it, which will generally take a lot more CPU to operate (and might not even be possible on some platforms).

If the component is inside a parent component at the time this method is called, it will be first be removed from that parent. Likewise if a component on the desktop is subsequently added to another component, it'll be removed from the desktop.

Parameters
windowStyleFlagsa combination of the flags specified in the ComponentPeer::StyleFlags enum, which define the window's characteristics.
nativeWindowToAttachTothis allows an OS object to be passed-in as the window in which the juce component should place itself. On Windows, this would be a HWND, a HIViewRef on the Mac. Not necessarily supported on all platforms, and best left as 0 unless you know what you're doing
See also
removeFromDesktop, isOnDesktop, userTriedToCloseWindow, getPeer, ComponentPeer::setMinimised, ComponentPeer::StyleFlags, ComponentPeer::getStyleFlags, ComponentPeer::setFullScreen

Reimplemented from Component.

◆ centreAroundComponent()

void TopLevelWindow::centreAroundComponent ( Component componentToCentreAround,
int  width,
int  height 
)

This will set the bounds of the window so that it's centred in front of another window.

If your app has a few windows open and want to pop up a dialog box for one of them, you can use this to show it in front of the relevent parent window, which is a bit neater than just having it appear in the middle of the screen.

If componentToCentreAround is nullptr, then the currently active TopLevelWindow will be used instead. If no window is focused, it'll just default to the middle of the screen.

◆ focusOfChildComponentChanged()

void TopLevelWindow::focusOfChildComponentChanged ( FocusChangeType  cause)
overrideprotectedvirtual

Called to indicate a change in whether or not this component is the parent of the currently-focused component.

Essentially this is called when the return value of a call to hasKeyboardFocus (true) has changed. It happens when focus moves from one of this component's children (at any depth) to a component that isn't contained in this one, (or vice-versa). Note that this method does NOT get called to when focus simply moves from one of its child components to another.

See also
focusGained, setWantsKeyboardFocus, getCurrentlyFocusedComponent, hasKeyboardFocus

Reimplemented from Component.

◆ getActiveTopLevelWindow()

TopLevelWindow * TopLevelWindow::getActiveTopLevelWindow ( )
staticnoexcept

Returns the currently-active top level window. There might not be one, of course, so this can return nullptr.

◆ getDesktopWindowStyleFlags()

int TopLevelWindow::getDesktopWindowStyleFlags ( ) const
protectedvirtual

Reimplemented in AlertWindow, ResizableWindow, and DocumentWindow.

◆ getNumTopLevelWindows()

int TopLevelWindow::getNumTopLevelWindows ( )
staticnoexcept

Returns the number of TopLevelWindow objects currently in use.

See also
getTopLevelWindow

◆ getTopLevelWindow()

TopLevelWindow * TopLevelWindow::getTopLevelWindow ( int  index)
staticnoexcept

Returns one of the TopLevelWindow objects currently in use. The index is 0 to (getNumTopLevelWindows() - 1).

◆ isActiveWindow()

bool TopLevelWindow::isActiveWindow ( ) const
inlinenoexcept

True if this is currently the TopLevelWindow that is actively being used.

This isn't quite the same as having keyboard focus, because the focus may be on a child component or a temporary pop-up menu, etc, while this window is still considered to be active.

See also
activeWindowStatusChanged

◆ isDropShadowEnabled()

bool TopLevelWindow::isDropShadowEnabled ( ) const
inlinenoexcept

True if drop-shadowing is enabled.

◆ isUsingNativeTitleBar()

bool TopLevelWindow::isUsingNativeTitleBar ( ) const
noexcept

Returns true if the window is currently using an OS-native title bar.

See also
setUsingNativeTitleBar

◆ parentHierarchyChanged()

void TopLevelWindow::parentHierarchyChanged ( )
overrideprotectedvirtual

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

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

Subclasses can override this if they need to react to this in some way.

See also
getParentComponent, isShowing, ComponentListener::componentParentHierarchyChanged

Reimplemented from Component.

◆ recreateDesktopWindow()

void TopLevelWindow::recreateDesktopWindow ( )
protected

◆ setDropShadowEnabled()

void TopLevelWindow::setDropShadowEnabled ( bool  useShadow)

Turns the drop-shadow on and off.

◆ setUsingNativeTitleBar()

void TopLevelWindow::setUsingNativeTitleBar ( bool  useNativeTitleBar)

Sets whether an OS-native title bar will be used, or a Juce one.

See also
isUsingNativeTitleBar

◆ visibilityChanged()

void TopLevelWindow::visibilityChanged ( )
overrideprotectedvirtual

Called when this component's visibility changes.

See also
setVisible, isVisible

Reimplemented from Component.

Friends And Related Function Documentation

◆ ResizableWindow

friend class ResizableWindow
friend

◆ TopLevelWindowManager

friend class TopLevelWindowManager
friend

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