JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins

« « « Anklang Documentation
Loading...
Searching...
No Matches
juce_Component.h
Go to the documentation of this file.
1 /*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 By using JUCE, you agree to the terms of both the JUCE 7 End-User License
11 Agreement and JUCE Privacy Policy.
12
13 End User License Agreement: www.juce.com/juce-7-licence
14 Privacy Policy: www.juce.com/juce-privacy-policy
15
16 Or: You may also use this code under the terms of the GPL v3 (see
17 www.gnu.org/licenses).
18
19 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
20 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
21 DISCLAIMED.
22
23 ==============================================================================
24*/
25
26namespace juce
27{
28
29//==============================================================================
35class JUCE_API Component : public MouseListener
36{
37public:
38 //==============================================================================
51 Component() noexcept;
52
65 ~Component() override;
66
67 //==============================================================================
71 explicit Component (const String& componentName) noexcept;
72
76 String getName() const noexcept { return componentName; }
77
85 virtual void setName (const String& newName);
86
90 String getComponentID() const noexcept { return componentID; }
91
96 void setComponentID (const String& newID);
97
98 //==============================================================================
112 virtual void setVisible (bool shouldBeVisible);
113
122 bool isVisible() const noexcept { return flags.visibleFlag; }
123
127 virtual void visibilityChanged();
128
134 bool isShowing() const;
135
136 //==============================================================================
160 virtual void addToDesktop (int windowStyleFlags,
161 void* nativeWindowToAttachTo = nullptr);
162
170 void removeFromDesktop();
171
175 bool isOnDesktop() const noexcept;
176
187 ComponentPeer* getPeer() const;
188
196 virtual void userTriedToCloseWindow();
197
202 virtual void minimisationStateChanged (bool isNowMinimised);
203
211 virtual float getDesktopScaleFactor() const;
212
213 //==============================================================================
225 void toFront (bool shouldAlsoGainKeyboardFocus);
226
234 void toBack();
235
239 void toBehind (Component* other);
240
244 void setAlwaysOnTop (bool shouldStayOnTop);
245
249 bool isAlwaysOnTop() const noexcept;
250
251 //==============================================================================
259 int getX() const noexcept { return boundsRelativeToParent.getX(); }
260
268 int getY() const noexcept { return boundsRelativeToParent.getY(); }
269
271 int getWidth() const noexcept { return boundsRelativeToParent.getWidth(); }
272
274 int getHeight() const noexcept { return boundsRelativeToParent.getHeight(); }
275
283 int getRight() const noexcept { return boundsRelativeToParent.getRight(); }
284
286 Point<int> getPosition() const noexcept { return boundsRelativeToParent.getPosition(); }
287
295 int getBottom() const noexcept { return boundsRelativeToParent.getBottom(); }
296
304 Rectangle<int> getBounds() const noexcept { return boundsRelativeToParent; }
305
310 Rectangle<int> getLocalBounds() const noexcept;
311
319 Rectangle<int> getBoundsInParent() const noexcept;
320
321 //==============================================================================
325 int getScreenX() const;
326
330 int getScreenY() const;
331
335 Point<int> getScreenPosition() const;
336
340 Rectangle<int> getScreenBounds() const;
341
348 Point<int> getLocalPoint (const Component* sourceComponent,
349 Point<int> pointRelativeToSourceComponent) const;
350
357 Point<float> getLocalPoint (const Component* sourceComponent,
358 Point<float> pointRelativeToSourceComponent) const;
359
370 Rectangle<int> getLocalArea (const Component* sourceComponent,
371 Rectangle<int> areaRelativeToSourceComponent) const;
372
383 Rectangle<float> getLocalArea (const Component* sourceComponent,
384 Rectangle<float> areaRelativeToSourceComponent) const;
385
389 Point<int> localPointToGlobal (Point<int> localPoint) const;
390
394 Point<float> localPointToGlobal (Point<float> localPoint) const;
395
403 Rectangle<int> localAreaToGlobal (Rectangle<int> localArea) const;
404
412 Rectangle<float> localAreaToGlobal (Rectangle<float> localArea) const;
413
414 //==============================================================================
428 void setTopLeftPosition (int x, int y);
429
443 void setTopLeftPosition (Point<int> newTopLeftPosition);
444
456 void setTopRightPosition (int x, int y);
457
466 void setSize (int newWidth, int newHeight);
467
482 void setBounds (int x, int y, int width, int height);
483
498 void setBounds (Rectangle<int> newBounds);
499
509 void setBoundsRelative (float proportionalX, float proportionalY,
510 float proportionalWidth, float proportionalHeight);
511
521 void setBoundsRelative (Rectangle<float> proportionalArea);
522
530 void setBoundsInset (BorderSize<int> borders);
531
546 void setBoundsToFit (Rectangle<int> targetArea,
547 Justification justification,
548 bool onlyReduceInSize);
549
557 void setCentrePosition (int x, int y);
558
566 void setCentrePosition (Point<int> newCentrePosition);
567
573 void setCentreRelative (float x, float y);
574
581 void centreWithSize (int width, int height);
582
583 //==============================================================================
601 void setTransform (const AffineTransform& transform);
602
607 AffineTransform getTransform() const;
608
613 bool isTransformed() const noexcept;
614
618 static float JUCE_CALLTYPE getApproximateScaleFactorForComponent (const Component* targetComponent);
619
620 //==============================================================================
624 int proportionOfWidth (float proportion) const noexcept;
625
629 int proportionOfHeight (float proportion) const noexcept;
630
636 int getParentWidth() const noexcept;
637
643 int getParentHeight() const noexcept;
644
651 Rectangle<int> getParentMonitorArea() const;
652
653 //==============================================================================
658 int getNumChildComponents() const noexcept;
659
669 Component* getChildComponent (int index) const noexcept;
670
680 int getIndexOfChildComponent (const Component* child) const noexcept;
681
685 const Array<Component*>& getChildren() const noexcept { return childComponentList; }
686
690 Component* findChildWithID (StringRef componentID) const noexcept;
691
708 void addChildComponent (Component* child, int zOrder = -1);
709
726 void addChildComponent (Component& child, int zOrder = -1);
727
738 void addAndMakeVisible (Component* child, int zOrder = -1);
739
750 void addAndMakeVisible (Component& child, int zOrder = -1);
751
755 void addChildAndSetID (Component* child, const String& componentID);
756
768 void removeChildComponent (Component* childToRemove);
769
781 Component* removeChildComponent (int childIndexToRemove);
782
786 void removeAllChildren();
787
797 void deleteAllChildren();
798
804 Component* getParentComponent() const noexcept { return parentComponent; }
805
812 template <class TargetClass>
813 TargetClass* findParentComponentOfClass() const
814 {
815 for (auto* p = parentComponent; p != nullptr; p = p->parentComponent)
816 if (auto* target = dynamic_cast<TargetClass*> (p))
817 return target;
818
819 return nullptr;
820 }
821
828 Component* getTopLevelComponent() const noexcept;
829
835 bool isParentOf (const Component* possibleChild) const noexcept;
836
837 //==============================================================================
848 virtual void parentHierarchyChanged();
849
854 virtual void childrenChanged();
855
856 //==============================================================================
893 virtual bool hitTest (int x, int y);
894
912 void setInterceptsMouseClicks (bool allowClicksOnThisComponent,
913 bool allowClicksOnChildComponents) noexcept;
914
922 void getInterceptsMouseClicks (bool& allowsClicksOnThisComponent,
923 bool& allowsClicksOnChildComponents) const noexcept;
924
925
937 bool contains (Point<int> localPoint);
938
950 bool contains (Point<float> localPoint);
951
960 bool reallyContains (Point<int> localPoint, bool returnTrueIfWithinAChild);
961
970 bool reallyContains (Point<float> localPoint, bool returnTrueIfWithinAChild);
971
982 Component* getComponentAt (int x, int y);
983
993 Component* getComponentAt (Point<int> position);
994
1004 Component* getComponentAt (Point<float> position);
1005
1006 //==============================================================================
1024 void repaint();
1025
1039 void repaint (int x, int y, int width, int height);
1040
1054 void repaint (Rectangle<int> area);
1055
1056 //==============================================================================
1069 void setBufferedToImage (bool shouldBeBuffered);
1070
1086 Image createComponentSnapshot (Rectangle<int> areaToGrab,
1087 bool clipImageToComponentBounds = true,
1088 float scaleFactor = 1.0f);
1089
1107 void paintEntireComponent (Graphics& context, bool ignoreAlphaLevel);
1108
1121 void setPaintingIsUnclipped (bool shouldPaintWithoutClipping) noexcept;
1122
1126 bool isPaintingUnclipped() const noexcept;
1127
1128 //==============================================================================
1142 void setComponentEffect (ImageEffectFilter* newEffect);
1143
1147 ImageEffectFilter* getComponentEffect() const noexcept { return effect; }
1148
1149 //==============================================================================
1158 LookAndFeel& getLookAndFeel() const noexcept;
1159
1173 void setLookAndFeel (LookAndFeel* newLookAndFeel);
1174
1185 virtual void lookAndFeelChanged();
1186
1192 void sendLookAndFeelChange();
1193
1194 //==============================================================================
1209 void setOpaque (bool shouldBeOpaque);
1210
1216 bool isOpaque() const noexcept;
1217
1218 //==============================================================================
1231 void setBroughtToFrontOnMouseClick (bool shouldBeBroughtToFront) noexcept;
1232
1236 bool isBroughtToFrontOnMouseClick() const noexcept;
1237
1238 //==============================================================================
1239 // Focus methods
1240
1251 void setExplicitFocusOrder (int newFocusOrderIndex);
1252
1260 int getExplicitFocusOrder() const;
1261
1275 {
1281 none,
1282
1293 focusContainer,
1294
1305 keyboardFocusContainer
1306 };
1307
1315 void setFocusContainerType (FocusContainerType containerType) noexcept;
1316
1321 bool isFocusContainer() const noexcept;
1322
1327 bool isKeyboardFocusContainer() const noexcept;
1328
1333 Component* findFocusContainer() const;
1334
1339 Component* findKeyboardFocusContainer() const;
1340
1341 //==============================================================================
1352 void setWantsKeyboardFocus (bool wantsFocus) noexcept;
1353
1361 bool getWantsKeyboardFocus() const noexcept;
1362
1369 void setMouseClickGrabsKeyboardFocus (bool shouldGrabFocus);
1370
1375 bool getMouseClickGrabsKeyboardFocus() const noexcept;
1376
1402 void grabKeyboardFocus();
1403
1411 void giveAwayKeyboardFocus();
1412
1423 bool hasKeyboardFocus (bool trueIfChildIsFocused) const;
1424
1437 void moveKeyboardFocusToSibling (bool moveToNext);
1438
1443 static Component* JUCE_CALLTYPE getCurrentlyFocusedComponent() noexcept;
1444
1446 static void JUCE_CALLTYPE unfocusAllComponents();
1447
1448 //==============================================================================
1460 virtual std::unique_ptr<ComponentTraverser> createFocusTraverser();
1461
1474 virtual std::unique_ptr<ComponentTraverser> createKeyboardFocusTraverser();
1475
1485 void setHasFocusOutline (bool hasFocusOutline) noexcept { flags.hasFocusOutlineFlag = hasFocusOutline; }
1486
1491 bool hasFocusOutline() const noexcept { return flags.hasFocusOutlineFlag; }
1492
1493 //==============================================================================
1505 bool isEnabled() const noexcept;
1506
1517 void setEnabled (bool shouldBeEnabled);
1518
1529 virtual void enablementChanged();
1530
1531 //==============================================================================
1535 float getAlpha() const noexcept;
1536
1544 void setAlpha (float newAlpha);
1545
1550 virtual void alphaChanged();
1551
1552 //==============================================================================
1560 void setMouseCursor (const MouseCursor& cursorType);
1561
1570 virtual MouseCursor getMouseCursor();
1571
1582 void updateMouseCursor() const;
1583
1584 //==============================================================================
1608 virtual void paint (Graphics& g);
1609
1618 virtual void paintOverChildren (Graphics& g);
1619
1620
1621 //==============================================================================
1633 void mouseMove (const MouseEvent& event) override;
1634
1649 void mouseEnter (const MouseEvent& event) override;
1650
1664 void mouseExit (const MouseEvent& event) override;
1665
1679 void mouseDown (const MouseEvent& event) override;
1680
1691 void mouseDrag (const MouseEvent& event) override;
1692
1706 void mouseUp (const MouseEvent& event) override;
1707
1718 void mouseDoubleClick (const MouseEvent& event) override;
1719
1735 void mouseWheelMove (const MouseEvent& event,
1736 const MouseWheelDetails& wheel) override;
1737
1749 void mouseMagnify (const MouseEvent& event, float scaleFactor) override;
1750
1751 //==============================================================================
1767 static void JUCE_CALLTYPE beginDragAutoRepeat (int millisecondsBetweenCallbacks);
1768
1780 void setRepaintsOnMouseActivity (bool shouldRepaint) noexcept;
1781
1799 void addMouseListener (MouseListener* newListener,
1800 bool wantsEventsForAllNestedChildComponents);
1801
1805 void removeMouseListener (MouseListener* listenerToRemove);
1806
1807 //==============================================================================
1818 void addKeyListener (KeyListener* newListener);
1819
1823 void removeKeyListener (KeyListener* listenerToRemove);
1824
1841 virtual bool keyPressed (const KeyPress& key);
1842
1865 virtual bool keyStateChanged (bool isKeyDown);
1866
1883 virtual void modifierKeysChanged (const ModifierKeys& modifiers);
1884
1885 //==============================================================================
1893
1896 {
1897 unknown,
1898 forward,
1899 backward
1900 };
1901
1905 virtual void focusGained (FocusChangeType cause);
1906
1914 virtual void focusGainedWithDirection (FocusChangeType cause, FocusChangeDirection direction);
1915
1919 virtual void focusLost (FocusChangeType cause);
1920
1932 virtual void focusOfChildComponentChanged (FocusChangeType cause);
1933
1934 //==============================================================================
1954 bool isMouseOver (bool includeChildren = false) const;
1955
1964 bool isMouseButtonDown (bool includeChildren = false) const;
1965
1970 bool isMouseOverOrDragging (bool includeChildren = false) const;
1971
1980 static bool JUCE_CALLTYPE isMouseButtonDownAnywhere() noexcept;
1981
1985 Point<int> getMouseXYRelative() const;
1986
1987 //==============================================================================
2003 virtual void resized();
2004
2020 virtual void moved();
2021
2029 virtual void childBoundsChanged (Component* child);
2030
2038 virtual void parentSizeChanged();
2039
2047 virtual void broughtToFront();
2048
2058 void addComponentListener (ComponentListener* newListener);
2059
2063 void removeComponentListener (ComponentListener* listenerToRemove);
2064
2065 //==============================================================================
2077 void postCommandMessage (int commandId);
2078
2086 virtual void handleCommandMessage (int commandId);
2087
2088 //==============================================================================
2089 #if JUCE_MODAL_LOOPS_PERMITTED
2115 int runModalLoop();
2116 #endif
2117
2140 void enterModalState (bool takeKeyboardFocus = true,
2141 ModalComponentManager::Callback* callback = nullptr,
2142 bool deleteWhenDismissed = false);
2143
2151 void exitModalState (int returnValue = 0);
2152
2163 bool isCurrentlyModal (bool onlyConsiderForemostModalComponent = true) const noexcept;
2164
2168 static int JUCE_CALLTYPE getNumCurrentlyModalComponents() noexcept;
2169
2181 static Component* JUCE_CALLTYPE getCurrentlyModalComponent (int index = 0) noexcept;
2182
2191 bool isCurrentlyBlockedByAnotherModalComponent() const;
2192
2204 virtual bool canModalEventBeSentToComponent (const Component* targetComponent);
2205
2217 virtual void inputAttemptWhenModal();
2218
2219
2220 //==============================================================================
2225 NamedValueSet& getProperties() noexcept { return properties; }
2226
2231 const NamedValueSet& getProperties() const noexcept { return properties; }
2232
2233 //==============================================================================
2247 Colour findColour (int colourID, bool inheritFromParent = false) const;
2248
2261 void setColour (int colourID, Colour newColour);
2262
2266 void removeColour (int colourID);
2267
2271 bool isColourSpecified (int colourID) const;
2272
2276 void copyAllExplicitColoursTo (Component& target) const;
2277
2284 virtual void colourChanged();
2285
2286 //==============================================================================
2291 void* getWindowHandle() const;
2292
2293 //==============================================================================
2306 template <class ComponentType>
2308 {
2309 public:
2311 SafePointer() = default;
2312
2314 SafePointer (ComponentType* component) : weakRef (component) {}
2315
2317 SafePointer (const SafePointer& other) noexcept : weakRef (other.weakRef) {}
2318
2320 SafePointer& operator= (const SafePointer& other) { weakRef = other.weakRef; return *this; }
2321
2323 SafePointer& operator= (ComponentType* newComponent) { weakRef = newComponent; return *this; }
2324
2326 ComponentType* getComponent() const noexcept { return dynamic_cast<ComponentType*> (weakRef.get()); }
2327
2329 operator ComponentType*() const noexcept { return getComponent(); }
2330
2332 ComponentType* operator->() const noexcept { return getComponent(); }
2333
2335 void deleteAndZero() { delete getComponent(); }
2336
2337 bool operator== (ComponentType* component) const noexcept { return weakRef == component; }
2338 bool operator!= (ComponentType* component) const noexcept { return weakRef != component; }
2339
2340 private:
2341 WeakReference<Component> weakRef;
2342 };
2343
2344 //==============================================================================
2351 class JUCE_API BailOutChecker
2352 {
2353 public:
2355 BailOutChecker (Component* component);
2356
2358 bool shouldBailOut() const noexcept;
2359
2360 private:
2361 const WeakReference<Component> safePointer;
2362
2364 };
2365
2366 //==============================================================================
2375 class JUCE_API Positioner
2376 {
2377 public:
2379 explicit Positioner (Component& component) noexcept;
2381 virtual ~Positioner() = default;
2382
2384 Component& getComponent() const noexcept { return component; }
2385
2390 virtual void applyNewBounds (const Rectangle<int>& newBounds) = 0;
2391
2392 private:
2393 Component& component;
2394
2396 };
2397
2401 Positioner* getPositioner() const noexcept;
2402
2409 void setPositioner (Positioner* newPositioner);
2410
2416 void setCachedComponentImage (CachedComponentImage* newCachedImage);
2417
2421 CachedComponentImage* getCachedComponentImage() const noexcept { return cachedImage.get(); }
2422
2427 void setViewportIgnoreDragFlag (bool ignoreDrag) noexcept { flags.viewportIgnoreDragFlag = ignoreDrag; }
2428
2432 bool getViewportIgnoreDragFlag() const noexcept { return flags.viewportIgnoreDragFlag; }
2433
2434 //==============================================================================
2439 String getTitle() const noexcept { return componentTitle; }
2440
2449 void setTitle (const String& newTitle);
2450
2455 String getDescription() const noexcept { return componentDescription; }
2456
2465 void setDescription (const String& newDescription);
2466
2471 String getHelpText() const noexcept { return componentHelpText; }
2472
2481 void setHelpText (const String& newHelpText);
2482
2492 void setAccessible (bool shouldBeAccessible);
2493
2498 bool isAccessible() const noexcept;
2499
2508 AccessibilityHandler* getAccessibilityHandler();
2509
2516 void invalidateAccessibilityHandler();
2517
2518 //==============================================================================
2540 virtual std::unique_ptr<AccessibilityHandler> createAccessibilityHandler();
2541
2542 //==============================================================================
2543 #ifndef DOXYGEN
2544 [[deprecated ("Use the setFocusContainerType that takes a more descriptive enum.")]]
2545 void setFocusContainer (bool shouldBeFocusContainer) noexcept
2546 {
2547 setFocusContainerType (shouldBeFocusContainer ? FocusContainerType::keyboardFocusContainer
2548 : FocusContainerType::none);
2549 }
2550
2551 [[deprecated ("Use the contains that takes a Point<int>.")]]
2552 void contains (int, int) = delete;
2553 #endif
2554
2555private:
2556
2557 //==============================================================================
2558 friend class ComponentPeer;
2559 friend class detail::MouseInputSourceImpl;
2560
2561 #ifndef DOXYGEN
2562 static Component* currentlyFocusedComponent;
2563
2564 //==============================================================================
2565 String componentName, componentID, componentTitle, componentDescription, componentHelpText;
2566 Component* parentComponent = nullptr;
2567 Rectangle<int> boundsRelativeToParent;
2568 std::unique_ptr<Positioner> positioner;
2569 std::unique_ptr<AffineTransform> affineTransform;
2570 Array<Component*> childComponentList;
2571 WeakReference<LookAndFeel> lookAndFeel;
2572 MouseCursor cursor;
2573 ImageEffectFilter* effect = nullptr;
2575
2576 class MouseListenerList;
2579 ListenerList<ComponentListener> componentListeners;
2580 NamedValueSet properties;
2581
2582 friend class WeakReference<Component>;
2583 WeakReference<Component>::Master masterReference;
2584
2585 std::unique_ptr<AccessibilityHandler> accessibilityHandler;
2586
2587 struct ComponentFlags
2588 {
2589 bool hasHeavyweightPeerFlag : 1;
2590 bool visibleFlag : 1;
2591 bool opaqueFlag : 1;
2592 bool ignoresMouseClicksFlag : 1;
2593 bool allowChildMouseClicksFlag : 1;
2594 bool wantsKeyboardFocusFlag : 1;
2595 bool isFocusContainerFlag : 1;
2596 bool isKeyboardFocusContainerFlag : 1;
2597 bool childKeyboardFocusedFlag : 1;
2598 bool dontFocusOnMouseClickFlag : 1;
2599 bool hasFocusOutlineFlag : 1;
2600 bool alwaysOnTopFlag : 1;
2601 bool bufferToImageFlag : 1;
2602 bool bringToFrontOnClickFlag : 1;
2603 bool repaintOnMouseActivityFlag : 1;
2604 bool isDisabledFlag : 1;
2605 bool dontClipGraphicsFlag : 1;
2606 bool mouseDownWasBlocked : 1;
2607 bool isMoveCallbackPending : 1;
2608 bool isResizeCallbackPending : 1;
2609 bool viewportIgnoreDragFlag : 1;
2610 bool accessibilityIgnoredFlag : 1;
2611 bool cachedMouseInsideComponent : 1;
2612 #if JUCE_DEBUG
2613 bool isInsidePaintCall : 1;
2614 #endif
2615 };
2616
2617 union
2618 {
2619 uint32 componentFlags;
2620 ComponentFlags flags;
2621 };
2622
2623 uint8 componentTransparency = 0;
2624
2625 //==============================================================================
2626 void internalMouseEnter (MouseInputSource, Point<float>, Time);
2627 void internalMouseExit (MouseInputSource, Point<float>, Time);
2628 void internalMouseDown (MouseInputSource, const detail::PointerState&, Time);
2629 void internalMouseUp (MouseInputSource, const detail::PointerState&, Time, ModifierKeys oldModifiers);
2630 void internalMouseDrag (MouseInputSource, const detail::PointerState&, Time);
2631 void internalMouseMove (MouseInputSource, Point<float>, Time);
2632 void internalMouseWheel (MouseInputSource, Point<float>, Time, const MouseWheelDetails&);
2633 void internalMagnifyGesture (MouseInputSource, Point<float>, Time, float);
2634 void internalBroughtToFront();
2635 void internalKeyboardFocusGain (FocusChangeType, const WeakReference<Component>&, FocusChangeDirection);
2636 void internalKeyboardFocusGain (FocusChangeType);
2637 void internalKeyboardFocusLoss (FocusChangeType);
2638 void internalChildKeyboardFocusChange (FocusChangeType, const WeakReference<Component>&);
2639 void internalModalInputAttempt();
2640 void internalModifierKeysChanged();
2641 void internalChildrenChanged();
2642 void internalHierarchyChanged();
2643 void internalRepaint (Rectangle<int>);
2644 void internalRepaintUnchecked (Rectangle<int>, bool);
2645 Component* removeChildComponent (int index, bool sendParentEvents, bool sendChildEvents);
2646 void reorderChildInternal (int sourceIndex, int destIndex);
2647 void paintComponentAndChildren (Graphics&);
2648 void paintWithinParentContext (Graphics&);
2649 void sendMovedResizedMessages (bool wasMoved, bool wasResized);
2650 void sendMovedResizedMessagesIfPending();
2651 void repaintParent();
2652 void sendFakeMouseMove() const;
2653 void takeKeyboardFocus (FocusChangeType, FocusChangeDirection);
2654 void grabKeyboardFocusInternal (FocusChangeType, bool canTryParent, FocusChangeDirection);
2655 void giveAwayKeyboardFocusInternal (bool sendFocusLossEvent);
2656 void sendEnablementChangeMessage();
2657 void sendVisibilityChangeMessage();
2658
2659 friend struct detail::ComponentHelpers;
2660
2661 /* Components aren't allowed to have copy constructors, as this would mess up parent hierarchies.
2662 You might need to give your subclasses a private dummy constructor to avoid compiler warnings.
2663 */
2665
2666protected:
2667 //==============================================================================
2669 virtual ComponentPeer* createNewPeer (int styleFlags, void* nativeWindowToAttachTo);
2671 static std::unique_ptr<AccessibilityHandler> createIgnoredAccessibilityHandler (Component&);
2672 #endif
2673};
2674
2675} // namespace juce
Base class for accessible Components.
Represents a 2D affine-transformation matrix.
Holds a resizable array of primitive or copy-by-value objects.
Definition juce_Array.h:56
Specifies a set of gaps to be left around the sides of a rectangle.
Base class used internally for structures that can store cached images of component state.
Represents a colour, also including a transparency value.
Definition juce_Colour.h:38
Gets informed about changes to a component's hierarchy or position.
The Component class uses a ComponentPeer internally to create and manage a real operating-system wind...
Base class for traversing components.
A class to keep an eye on a component and check for it being deleted.
Base class for objects that can be used to automatically position a component according to some kind ...
virtual ~Positioner()=default
Destructor.
virtual void applyNewBounds(const Rectangle< int > &newBounds)=0
Attempts to set the component's position to the given rectangle.
Component & getComponent() const noexcept
Returns the component that this positioner controls.
Holds a pointer to some type of Component, which automatically becomes null if the component is delet...
SafePointer()=default
Creates a null SafePointer.
SafePointer(const SafePointer &other) noexcept
Creates a copy of another SafePointer.
ComponentType * operator->() const noexcept
Returns the component that this pointer refers to, or null if the component no longer exists.
SafePointer(ComponentType *component)
Creates a SafePointer that points at the given component.
void deleteAndZero()
If the component is valid, this deletes it and sets this pointer to null.
ComponentType * getComponent() const noexcept
Returns the component that this pointer refers to, or null if the component no longer exists.
The base class for all JUCE user-interface objects.
bool hasFocusOutline() const noexcept
Returns true if this component should have a focus outline.
String getTitle() const noexcept
Returns the title text for this component.
bool isVisible() const noexcept
Tests whether the component is visible or not.
Component * getParentComponent() const noexcept
Returns the component which this component is inside.
int getBottom() const noexcept
Returns the y coordinate of the bottom edge of this component.
Point< int > getPosition() const noexcept
Returns the component's top-left position as a Point.
int getHeight() const noexcept
Returns the component's height in pixels.
const NamedValueSet & getProperties() const noexcept
Returns the set of properties that belong to this component.
FocusChangeType
Enumeration used by the focusGained() and focusLost() methods.
@ focusChangedByTabKey
Means that the user pressed the tab key to move the focus.
@ focusChangedByMouseClick
Means that the user clicked the mouse to change focus.
String getHelpText() const noexcept
Returns the help text for this component.
Rectangle< int > getBounds() const noexcept
Returns this component's bounding box.
FocusContainerType
A focus container type that can be passed to setFocusContainerType().
int getY() const noexcept
Returns the y coordinate of the top of this component.
String getDescription() const noexcept
Returns the description for this component.
FocusChangeDirection
Enumeration used by the focusGainedWithDirection() method.
TargetClass * findParentComponentOfClass() const
Searches the parent components for a component of a specified class.
int getWidth() const noexcept
Returns the component's width in pixels.
bool getViewportIgnoreDragFlag() const noexcept
Retrieves the current state of the Viewport drag-to-scroll functionality flag.
void setViewportIgnoreDragFlag(bool ignoreDrag) noexcept
Sets a flag to indicate whether mouse drag events on this Component should be ignored when it is insi...
String getComponentID() const noexcept
Returns the ID string that was set by setComponentID().
int getRight() const noexcept
Returns the x coordinate of the component's right-hand edge.
String getName() const noexcept
Returns the name of this component.
A graphics context, used for drawing a component or image.
A graphical effect filter that can be applied to components.
Holds a fixed-size bitmap.
Definition juce_Image.h:58
Represents a type of justification to be used when positioning graphical items.
Receives callbacks when keys are pressed.
Represents a key press, including any modifier keys that are needed.
LookAndFeel objects define the appearance of all the JUCE widgets, and subclasses can be used to appl...
Receives callbacks when a modal component is dismissed.
Represents the state of the mouse buttons and modifier keys.
Represents a mouse cursor image.
Contains position and status information about a mouse event.
A MouseListener can be registered with a component to receive callbacks about mouse events that happe...
Holds a set of named var objects.
A pair of (x, y) coordinates.
Definition juce_Point.h:42
Manages a rectangle and allows geometric operations to be performed on it.
A simple class for holding temporary references to a string literal or String.
The JUCE String class!
Definition juce_String.h:53
This class acts as a pointer which will automatically become null if the object to which it points is...
#define JUCE_DECLARE_NON_COPYABLE(className)
This is a shorthand macro for deleting a class's copy constructor and copy assignment operator.
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
This is a shorthand way of writing both a JUCE_DECLARE_NON_COPYABLE and JUCE_LEAK_DETECTOR macro for ...
#define JUCE_CALLTYPE
This macro defines the C calling convention used as the standard for JUCE calls.
ComponentFlags
Component Flags used as classFlags in PClassInfo2.
JUCE Namespace.
Contains status information about a mouse wheel event.