29constexpr char colourPropertyPrefix[] =
"jcclr_";
36 #if JUCE_MODAL_LOOPS_PERMITTED
43 static Identifier getColourPropertyID (
int colourID)
50 for (
auto v = (
uint32) colourID;;)
52 *--t =
"0123456789abcdef" [v & 15];
59 for (
int i = (
int)
sizeof (colourPropertyPrefix) - 1; --i >= 0;)
60 *--t = colourPropertyPrefix[i];
74 template <
typename Po
intOrRect>
80 return SH::unscaledScreenPosToScaled (comp, pos);
84 template <
typename Po
intOrRect>
90 return SH::scaledScreenPosToUnscaled (comp, pos);
93 template <
typename Po
intOrRect>
96 const auto transformed = comp.affineTransform !=
nullptr ?
pointInParentSpace.transformedBy (comp.affineTransform->inverted())
101 if (
auto* peer = comp.
getPeer())
102 return SH::unscaledScreenPosToScaled (comp, peer->globalToLocal (SH::scaledScreenPosToUnscaled (transformed)));
109 return SH::subtractPosition (SH::unscaledScreenPosToScaled (comp, SH::scaledScreenPosToUnscaled (transformed)), comp);
111 return SH::subtractPosition (transformed, comp);
114 template <
typename Po
intOrRect>
121 if (
auto* peer = comp.
getPeer())
122 return SH::unscaledScreenPosToScaled (peer->localToGlobal (SH::scaledScreenPosToUnscaled (comp,
pointInLocalSpace)));
129 return SH::unscaledScreenPosToScaled (SH::scaledScreenPosToUnscaled (comp, SH::addPosition (
pointInLocalSpace, comp)));
134 return comp.affineTransform !=
nullptr ?
preTransform.transformedBy (*comp.affineTransform)
138 template <
typename Po
intOrRect>
147 JUCE_BEGIN_IGNORE_WARNINGS_MSVC (6011)
149 JUCE_END_IGNORE_WARNINGS_MSVC
152 template <
typename Po
intOrRect>
155 while (source !=
nullptr)
157 if (source == target)
160 JUCE_BEGIN_IGNORE_WARNINGS_MSVC (6011)
163 return convertFromDistantParentSpace (source, *target, p);
165 JUCE_END_IGNORE_WARNINGS_MSVC
167 p = convertToParentSpace (*source, p);
172 if (target ==
nullptr)
182 return convertFromDistantParentSpace (
topLevelComp, *target, p);
190 for (
int i = comp.childComponentList.size(); --i >= 0;)
192 auto& child = *comp.childComponentList.getUnchecked (i);
194 if (child.isVisible() && ! child.isTransformed())
196 auto newClip =
clipRect.getIntersection (child.boundsRelativeToParent);
200 if (child.isOpaque() && child.componentTransparency == 0)
207 auto childPos = child.getPosition();
222 return p->getLocalBounds();
227 static void releaseAllCachedImageResources (
Component& c)
230 cached->releaseResources();
232 for (
auto* child : c.childComponentList)
233 releaseAllCachedImageResources (*child);
239 return modal !=
nullptr
245 template <
typename Function>
246 static void sendMouseEventToComponentsThatAreBlockedByModal (
Component&
modal, Function&& function)
249 if (
auto* c =
ms.getComponentUnderMouse())
250 if (modalWouldBlockComponent (*c, &
modal))
257 static auto& getInstance()
265 return listeners.addListener (std::move (
l));
268 void modalComponentManagerChanged()
The base class for all JUCE user-interface objects.
AffineTransform getTransform() const
Returns the transform that is currently being applied to this component.
Component * getTopLevelComponent() const noexcept
Returns the highest-level component which contains this one or its parents.
Component * getParentComponent() const noexcept
Returns the component which this component is inside.
int getHeight() const noexcept
Returns the component's height in pixels.
bool isTransformed() const noexcept
Returns true if a non-identity transform is being applied to this component.
bool isOnDesktop() const noexcept
Returns true if this component is currently showing on the desktop.
virtual bool hitTest(int x, int y)
Tests whether a given point is inside the component.
bool isParentOf(const Component *possibleChild) const noexcept
Checks whether a component is anywhere inside this component or its children.
int getWidth() const noexcept
Returns the component's width in pixels.
CachedComponentImage * getCachedComponentImage() const noexcept
Returns the object that was set by setCachedComponentImage().
ComponentPeer * getPeer() const
Returns the heavyweight window that contains this component.
Point< int > getScreenPosition() const
Returns the position of this component's top-left corner relative to the screen's top-left.
const Displays & getDisplays() const noexcept
Returns the Displays object representing the connected displays.
static Desktop &JUCE_CALLTYPE getInstance()
There's only one desktop object, and this method will return it.
const Array< MouseInputSource > & getMouseSources() const noexcept
Provides access to the array of mouse sources, for iteration.
Rectangle< int > userArea
The total area of this display in logical pixels which isn't covered by OS-dependent objects like the...
const Display * getPrimaryDisplay() const noexcept
Returns the Display object representing the display acting as the user's main screen,...
A ScopeGuard that uses a std::function internally to allow type erasure.
A graphics context, used for drawing a component or image.
void excludeClipRegion(Rectangle< int > rectangleToExclude)
Excludes a rectangle to stop it being drawn into.
Represents a string identifier, designed for accessing properties by name.
A pair of (x, y) coordinates.
Manages a rectangle and allows geometric operations to be performed on it.
static Time JUCE_CALLTYPE getCurrentTime() noexcept
Returns a Time object that is set to the current system time.
int pointer_sized_int
A signed integer type that's guaranteed to be large enough to hold a pointer without truncating it.
RangedDirectoryIterator end(const RangedDirectoryIterator &)
Returns a default-constructed sentinel value.
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...
unsigned int uint32
A platform-independent 32-bit unsigned integer type.
constexpr int numElementsInArray(Type(&)[N]) noexcept
Handy function for getting the number of elements in a simple const C array.