25 #ifndef JUCE_COMPONENT_H_INCLUDED 26 #define JUCE_COMPONENT_H_INCLUDED 83 virtual void setName (
const String& newName);
94 void setComponentID (
const String& newID);
110 virtual void setVisible (
bool shouldBeVisible);
125 virtual void visibilityChanged();
132 bool isShowing()
const;
158 virtual void addToDesktop (
int windowStyleFlags,
159 void* nativeWindowToAttachTo =
nullptr);
168 void removeFromDesktop();
194 virtual void userTriedToCloseWindow();
200 virtual void minimisationStateChanged (
bool isNowMinimised);
209 virtual float getDesktopScaleFactor()
const;
222 void toFront (
bool shouldAlsoGainFocus);
241 void setAlwaysOnTop (
bool shouldStayOnTop);
246 bool isAlwaysOnTop()
const noexcept;
322 int getScreenX()
const;
327 int getScreenY()
const;
346 Point<int> pointRelativeToSourceComponent)
const;
403 void setTopLeftPosition (
int x,
int y);
418 void setTopLeftPosition (
Point<int> newTopLeftPosition);
431 void setTopRightPosition (
int x,
int y);
441 void setSize (
int newWidth,
int newHeight);
457 void setBounds (
int x,
int y,
int width,
int height);
495 void setBounds (
const String& newBoundsExpression);
506 void setBoundsRelative (
float proportionalX,
float proportionalY,
507 float proportionalWidth,
float proportionalHeight);
532 void setBoundsToFit (
int x,
int y,
int width,
int height,
534 bool onlyReduceInSize);
543 void setCentrePosition (
int x,
int y);
551 void setCentreRelative (
float x,
float y);
559 void centreWithSize (
int width,
int height);
591 bool isTransformed()
const noexcept;
597 int proportionOfWidth (
float proportion)
const noexcept;
602 int proportionOfHeight (
float proportion)
const noexcept;
609 int getParentWidth()
const noexcept;
616 int getParentHeight()
const noexcept;
631 int getNumChildComponents()
const noexcept;
676 void addChildComponent (
Component* child,
int zOrder = -1);
694 void addChildComponent (
Component& child,
int zOrder = -1);
701 void addAndMakeVisible (
Component* child,
int zOrder = -1);
708 void addAndMakeVisible (
Component& child,
int zOrder = -1);
726 void removeChildComponent (
Component* childToRemove);
739 Component* removeChildComponent (
int childIndexToRemove);
744 void removeAllChildren();
755 void deleteAllChildren();
770 template <
class TargetClass>
773 for (
Component* p = parentComponent; p !=
nullptr; p = p->parentComponent)
774 if (TargetClass*
const target = dynamic_cast<TargetClass*> (p))
806 virtual void parentHierarchyChanged();
812 virtual void childrenChanged();
851 virtual bool hitTest (
int x,
int y);
870 void setInterceptsMouseClicks (
bool allowClicksOnThisComponent,
871 bool allowClicksOnChildComponents)
noexcept;
880 void getInterceptsMouseClicks (
bool& allowsClicksOnThisComponent,
881 bool& allowsClicksOnChildComponents)
const noexcept;
905 bool reallyContains (
Point<int> localPoint,
bool returnTrueIfWithinAChild);
917 Component* getComponentAt (
int x,
int y);
963 void repaint (
int x,
int y,
int width,
int height);
993 void setBufferedToImage (
bool shouldBeBuffered);
1011 bool clipImageToComponentBounds =
true,
1012 float scaleFactor = 1.0f);
1031 void paintEntireComponent (
Graphics& context,
bool ignoreAlphaLevel);
1045 void setPaintingIsUnclipped (
bool shouldPaintWithoutClipping)
noexcept;
1092 void setLookAndFeel (
LookAndFeel* newLookAndFeel);
1104 virtual void lookAndFeelChanged();
1113 void sendLookAndFeelChange();
1130 void setOpaque (
bool shouldBeOpaque);
1152 void setBroughtToFrontOnMouseClick (
bool shouldBeBroughtToFront)
noexcept;
1157 bool isBroughtToFrontOnMouseClick()
const noexcept;
1172 void setWantsKeyboardFocus (
bool wantsFocus)
noexcept;
1181 bool getWantsKeyboardFocus()
const noexcept;
1190 void setMouseClickGrabsKeyboardFocus (
bool shouldGrabFocus);
1195 bool getMouseClickGrabsKeyboardFocus()
const noexcept;
1217 void grabKeyboardFocus();
1229 bool hasKeyboardFocus (
bool trueIfChildIsFocused)
const;
1251 void moveKeyboardFocusToSibling (
bool moveToNext);
1284 int getExplicitFocusOrder()
const;
1294 void setExplicitFocusOrder (
int newFocusOrderIndex);
1308 void setFocusContainer (
bool shouldBeFocusContainer)
noexcept;
1316 bool isFocusContainer()
const noexcept;
1342 void setEnabled (
bool shouldBeEnabled);
1354 virtual void enablementChanged();
1363 void setAlpha (
float newAlpha);
1368 float getAlpha()
const;
1378 void setMouseCursor (
const MouseCursor& cursorType);
1400 void updateMouseCursor()
const;
1436 virtual void paintOverChildren (
Graphics& g);
1567 virtual void mouseMagnify (
const MouseEvent& event,
float scaleFactor);
1585 static void JUCE_CALLTYPE beginDragAutoRepeat (
int millisecondsBetweenCallbacks);
1598 void setRepaintsOnMouseActivity (
bool shouldRepaint)
noexcept;
1618 bool wantsEventsForAllNestedChildComponents);
1641 void removeKeyListener (
KeyListener* listenerToRemove);
1659 virtual bool keyPressed (
const KeyPress& key);
1683 virtual bool keyStateChanged (
bool isKeyDown);
1698 virtual void modifierKeysChanged (
const ModifierKeys& modifiers);
1706 focusChangedDirectly
1748 bool isMouseOver (
bool includeChildren =
false)
const;
1758 bool isMouseButtonDown()
const;
1764 bool isMouseOverOrDragging()
const;
1774 static bool JUCE_CALLTYPE isMouseButtonDownAnywhere() noexcept;
1797 virtual
void resized();
1814 virtual
void moved();
1823 virtual
void childBoundsChanged (
Component* child);
1832 virtual
void parentSizeChanged();
1841 virtual
void broughtToFront();
1871 void postCommandMessage (
int commandId);
1880 virtual
void handleCommandMessage (
int commandId);
1899 #if JUCE_MODAL_LOOPS_PERMITTED 1924 void enterModalState (
bool takeKeyboardFocus =
true,
1926 bool deleteWhenDismissed =
false);
1935 void exitModalState (
int returnValue);
1945 bool isCurrentlyModal() const noexcept;
1950 static
int JUCE_CALLTYPE getNumCurrentlyModalComponents() noexcept;
1973 bool isCurrentlyBlockedByAnotherModalComponent() const;
1986 virtual
bool canModalEventBeSentToComponent (const
Component* targetComponent);
1999 virtual
void inputAttemptWhenModal();
2029 Colour findColour (
int colourId,
bool inheritFromParent =
false)
const;
2041 void setColour (
int colourId,
Colour newColour);
2046 void removeColour (
int colourId);
2051 bool isColourSpecified (
int colourId)
const;
2056 void copyAllExplicitColoursTo (
Component& target)
const;
2061 virtual void colourChanged();
2076 void* getWindowHandle()
const;
2091 template <
class ComponentType>
2108 SafePointer& operator= (ComponentType* newComponent) { weakRef = newComponent;
return *
this; }
2111 ComponentType*
getComponent() const noexcept {
return dynamic_cast<ComponentType*
> (weakRef.get()); }
2114 operator ComponentType*()
const noexcept {
return getComponent(); }
2120 const ComponentType*
operator->() const noexcept {
return getComponent(); }
2125 bool operator== (ComponentType* component)
const noexcept {
return weakRef == component; }
2126 bool operator!= (ComponentType* component)
const noexcept {
return weakRef != component; }
2146 bool shouldBailOut()
const noexcept;
2179 virtual void applyNewBounds (
const Rectangle<int>& newBounds) = 0;
2198 void setPositioner (
Positioner* newPositioner);
2225 static Component* currentlyFocusedComponent;
2228 String componentName, componentID;
2250 struct ComponentFlags
2252 bool hasHeavyweightPeerFlag : 1;
2253 bool visibleFlag : 1;
2254 bool opaqueFlag : 1;
2255 bool ignoresMouseClicksFlag : 1;
2256 bool allowChildMouseClicksFlag : 1;
2257 bool wantsFocusFlag : 1;
2258 bool isFocusContainerFlag : 1;
2259 bool dontFocusOnMouseClickFlag : 1;
2260 bool alwaysOnTopFlag : 1;
2261 bool bufferToImageFlag : 1;
2262 bool bringToFrontOnClickFlag : 1;
2263 bool repaintOnMouseActivityFlag : 1;
2264 bool currentlyModalFlag : 1;
2265 bool isDisabledFlag : 1;
2266 bool childCompFocusedFlag : 1;
2267 bool dontClipGraphicsFlag : 1;
2268 bool mouseDownWasBlocked : 1;
2269 bool isMoveCallbackPending : 1;
2270 bool isResizeCallbackPending : 1;
2272 bool isInsidePaintCall : 1;
2282 uint8 componentTransparency;
2293 void internalBroughtToFront();
2298 void internalModalInputAttempt();
2299 void internalModifierKeysChanged();
2300 void internalChildrenChanged();
2301 void internalHierarchyChanged();
2304 Component* removeChildComponent (
int index,
bool sendParentEvents,
bool sendChildEvents);
2305 void reorderChildInternal (
int sourceIndex,
int destIndex);
2306 void paintComponentAndChildren (
Graphics&);
2307 void paintWithinParentContext (
Graphics&);
2308 void sendMovedResizedMessages (
bool wasMoved,
bool wasResized);
2309 void sendMovedResizedMessagesIfPending();
2310 void repaintParent();
2311 void sendFakeMouseMove()
const;
2314 static void giveAwayFocus (
bool sendFocusLossEvent);
2315 void sendEnablementChangeMessage();
2316 void sendVisibilityChangeMessage();
2327 #if JUCE_CATCH_DEPRECATED_CODE_MISUSE 2332 virtual void filesDropped (
const StringArray&,
int,
int) {}
2342 virtual ComponentPeer* createNewPeer (
int styleFlags,
void* nativeWindowToAttachTo);
2347 #endif // JUCE_COMPONENT_H_INCLUDED Definition: juce_ComponentListener.h:40
ComponentType * operator->() noexcept
Definition: juce_Component.h:2117
SafePointer() noexcept
Definition: juce_Component.h:2096
Definition: juce_MarkerList.h:36
const String & getName() const noexcept
Definition: juce_Component.h:74
Definition: juce_KeyPress.h:37
Definition: juce_MouseCursor.h:36
int getX() const noexcept
Definition: juce_Component.h:256
#define noexcept
Definition: juce_CompilerSupport.h:141
SafePointer(ComponentType *component)
Definition: juce_Component.h:2099
Definition: juce_Component.h:2092
Definition: juce_Time.h:41
int getWidth() const noexcept
Definition: juce_Component.h:268
Definition: juce_RelativeRectangle.h:37
Definition: juce_LookAndFeel.h:74
Definition: juce_Justification.h:38
FocusChangeType
Definition: juce_Component.h:1702
Definition: juce_ModifierKeys.h:38
virtual void mouseDown(const MouseEvent &event)
Definition: juce_MouseListener.cpp:27
ImageEffectFilter * getComponentEffect() const noexcept
Definition: juce_Component.h:1066
virtual void mouseDoubleClick(const MouseEvent &event)
Definition: juce_MouseListener.cpp:31
Definition: juce_ModalComponentManager.h:53
Definition: juce_String.h:43
Component * getParentComponent() const noexcept
Definition: juce_Component.h:762
Definition: juce_Component.h:2139
int getY() const noexcept
Definition: juce_Component.h:265
virtual void mouseWheelMove(const MouseEvent &event, const MouseWheelDetails &wheel)
Definition: juce_MouseListener.cpp:32
virtual void mouseExit(const MouseEvent &event)
Definition: juce_MouseListener.cpp:26
int getHeight() const noexcept
Definition: juce_Component.h:271
uint32 componentFlags
Definition: juce_Component.h:2278
#define JUCE_API
Definition: juce_StandardHeader.h:139
virtual void mouseMove(const MouseEvent &event)
Definition: juce_MouseListener.cpp:30
int getBottom() const noexcept
Definition: juce_Component.h:292
Definition: juce_Rectangle.h:36
there are legal restrictions on arithmetic coding Invalid progressive parameters caller expects u Cannot quantize more than d color components Adobe APP14 flags
Definition: juce_JPEGLoader.cpp:127
const NamedValueSet & getProperties() const noexcept
Definition: juce_Component.h:2013
Definition: juce_NamedValueSet.h:39
unsigned int uint32
Definition: juce_MathsFunctions.h:51
Definition: juce_Component.h:2163
Definition: juce_Colour.h:35
Definition: juce_Component.cpp:254
virtual void mouseEnter(const MouseEvent &event)
Definition: juce_MouseListener.cpp:25
ComponentFlags flags
Definition: juce_Component.h:2279
virtual void mouseUp(const MouseEvent &event)
Definition: juce_MouseListener.cpp:28
Definition: juce_Component.h:1705
Definition: juce_KeyboardFocusTraverser.h:49
Definition: juce_Component.h:33
Definition: juce_ScopedPointer.h:70
#define JUCE_DELETED_FUNCTION
Definition: juce_CompilerSupport.h:133
Definition: juce_MouseEvent.h:329
Definition: juce_MouseListener.h:36
const Rectangle< int > & getBounds() const noexcept
Definition: juce_Component.h:301
png_const_structrp png_const_inforp int png_fixed_point * width
Definition: juce_PNGLoader.cpp:2339
Definition: juce_StringArray.h:39
bool operator==(const var &v1, const var &v2) noexcept
Definition: juce_Variant.cpp:565
Definition: juce_ContainerDeletePolicy.h:44
Definition: juce_Component.cpp:29
Definition: juce_KeyListener.h:38
int getRight() const noexcept
Definition: juce_Component.h:280
Definition: juce_Array.h:60
Definition: juce_BorderSize.h:39
void deleteAndZero()
Definition: juce_Component.h:2123
Component & getComponent() const noexcept
Definition: juce_Component.h:2172
const String & getComponentID() const noexcept
Definition: juce_Component.h:88
const ComponentType * operator->() const noexcept
Definition: juce_Component.h:2120
Definition: juce_GraphicsContext.h:42
Definition: juce_Image.h:54
ComponentType * getComponent() const noexcept
Definition: juce_Component.h:2111
virtual void mouseDrag(const MouseEvent &event)
Definition: juce_MouseListener.cpp:29
virtual ~Positioner()
Definition: juce_Component.h:2169
TargetClass * findParentComponentOfClass() const
Definition: juce_Component.h:771
CachedComponentImage * getCachedComponentImage() const noexcept
Definition: juce_Component.h:2210
bool isVisible() const noexcept
Definition: juce_Component.h:120
bool operator!=(const var &v1, const var &v2) noexcept
Definition: juce_Variant.cpp:566
unsigned char uint8
Definition: juce_MathsFunctions.h:43
Definition: juce_Component.h:1704
Point< int > getPosition() const noexcept
Definition: juce_Component.h:283
SafePointer(const SafePointer &other) noexcept
Definition: juce_Component.h:2102
Definition: juce_MouseEvent.h:36
Definition: juce_CachedComponentImage.h:39
Definition: juce_ComponentPeer.h:41
Definition: juce_ImageEffectFilter.h:40
Definition: juce_StringRef.h:65