further development
git-svn-id: http://moon:8086/svn/software/trunk/projects/RBM@17 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
@@ -141,7 +141,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
Array <MouseListener*> listeners;
|
||||
Array<MouseListener*> listeners;
|
||||
int numDeepMouseListeners;
|
||||
|
||||
class BailOutChecker2
|
||||
@@ -256,7 +256,7 @@ struct Component::ComponentHelpers
|
||||
#if JUCE_MODAL_LOOPS_PERMITTED
|
||||
static void* runModalLoopCallback (void* userData)
|
||||
{
|
||||
return (void*) (pointer_sized_int) static_cast <Component*> (userData)->runModalLoop();
|
||||
return (void*) (pointer_sized_int) static_cast<Component*> (userData)->runModalLoop();
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -399,16 +399,6 @@ struct Component::ComponentHelpers
|
||||
return convertFromDistantParentSpace (topLevelComp, *target, p);
|
||||
}
|
||||
|
||||
static Rectangle<int> getUnclippedArea (const Component& comp)
|
||||
{
|
||||
Rectangle<int> r (comp.getLocalBounds());
|
||||
|
||||
if (Component* const p = comp.getParentComponent())
|
||||
r = r.getIntersection (convertFromParentSpace (comp, getUnclippedArea (*p)));
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
static bool clipObscuredRegions (const Component& comp, Graphics& g, const Rectangle<int>& clipRect, Point<int> delta)
|
||||
{
|
||||
bool nothingChanged = true;
|
||||
@@ -441,35 +431,6 @@ struct Component::ComponentHelpers
|
||||
return nothingChanged;
|
||||
}
|
||||
|
||||
static void subtractObscuredRegions (const Component& comp, RectangleList<int>& result,
|
||||
Point<int> delta, const Rectangle<int>& clipRect,
|
||||
const Component* const compToAvoid)
|
||||
{
|
||||
for (int i = comp.childComponentList.size(); --i >= 0;)
|
||||
{
|
||||
const Component* const c = comp.childComponentList.getUnchecked(i);
|
||||
|
||||
if (c != compToAvoid && c->isVisible())
|
||||
{
|
||||
if (c->isOpaque() && c->componentTransparency == 0)
|
||||
{
|
||||
Rectangle<int> childBounds (c->bounds.getIntersection (clipRect));
|
||||
childBounds.translate (delta.x, delta.y);
|
||||
|
||||
result.subtract (childBounds);
|
||||
}
|
||||
else
|
||||
{
|
||||
Rectangle<int> newClip (clipRect.getIntersection (c->bounds));
|
||||
newClip.translate (-c->getX(), -c->getY());
|
||||
|
||||
subtractObscuredRegions (*c, result, c->getPosition() + delta,
|
||||
newClip, compToAvoid);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static Rectangle<int> getParentOrMainMonitorBounds (const Component& comp)
|
||||
{
|
||||
if (Component* p = comp.getParentComponent())
|
||||
@@ -480,7 +441,7 @@ struct Component::ComponentHelpers
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
Component::Component()
|
||||
Component::Component() noexcept
|
||||
: parentComponent (nullptr),
|
||||
lookAndFeel (nullptr),
|
||||
effect (nullptr),
|
||||
@@ -489,7 +450,7 @@ Component::Component()
|
||||
{
|
||||
}
|
||||
|
||||
Component::Component (const String& name)
|
||||
Component::Component (const String& name) noexcept
|
||||
: componentName (name),
|
||||
parentComponent (nullptr),
|
||||
lookAndFeel (nullptr),
|
||||
@@ -620,7 +581,6 @@ bool Component::isShowing() const
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//==============================================================================
|
||||
void* Component::getWindowHandle() const
|
||||
{
|
||||
@@ -880,7 +840,7 @@ void Component::setBufferedToImage (const bool shouldBeBuffered)
|
||||
// so by calling setBufferedToImage, you'll be deleting the custom one - this is almost certainly
|
||||
// not what you wanted to happen... If you really do know what you're doing here, and want to
|
||||
// avoid this assertion, just call setCachedComponentImage (nullptr) before setBufferedToImage().
|
||||
jassert (cachedImage == nullptr || dynamic_cast <StandardCachedComponentImage*> (cachedImage.get()) != nullptr);
|
||||
jassert (cachedImage == nullptr || dynamic_cast<StandardCachedComponentImage*> (cachedImage.get()) != nullptr);
|
||||
|
||||
if (shouldBeBuffered)
|
||||
{
|
||||
@@ -1643,7 +1603,7 @@ Component* Component::getChildComponent (const int index) const noexcept
|
||||
|
||||
int Component::getIndexOfChildComponent (const Component* const child) const noexcept
|
||||
{
|
||||
return childComponentList.indexOf (const_cast <Component*> (child));
|
||||
return childComponentList.indexOf (const_cast<Component*> (child));
|
||||
}
|
||||
|
||||
Component* Component::findChildWithID (StringRef targetID) const noexcept
|
||||
@@ -1665,7 +1625,7 @@ Component* Component::getTopLevelComponent() const noexcept
|
||||
while (comp->parentComponent != nullptr)
|
||||
comp = comp->parentComponent;
|
||||
|
||||
return const_cast <Component*> (comp);
|
||||
return const_cast<Component*> (comp);
|
||||
}
|
||||
|
||||
bool Component::isParentOf (const Component* possibleChild) const noexcept
|
||||
@@ -2205,7 +2165,7 @@ void Component::sendLookAndFeelChange()
|
||||
Colour Component::findColour (const int colourId, const bool inheritFromParent) const
|
||||
{
|
||||
if (const var* const v = properties.getVarPointer (ComponentHelpers::getColourPropertyId (colourId)))
|
||||
return Colour ((uint32) static_cast <int> (*v));
|
||||
return Colour ((uint32) static_cast<int> (*v));
|
||||
|
||||
if (inheritFromParent && parentComponent != nullptr
|
||||
&& (lookAndFeel == nullptr || ! lookAndFeel->isColourSpecified (colourId)))
|
||||
@@ -2284,28 +2244,6 @@ Rectangle<int> Component::getBoundsInParent() const noexcept
|
||||
: bounds.transformedBy (*affineTransform);
|
||||
}
|
||||
|
||||
void Component::getVisibleArea (RectangleList<int>& result, const bool includeSiblings) const
|
||||
{
|
||||
result.clear();
|
||||
const Rectangle<int> unclipped (ComponentHelpers::getUnclippedArea (*this));
|
||||
|
||||
if (! unclipped.isEmpty())
|
||||
{
|
||||
result.add (unclipped);
|
||||
|
||||
if (includeSiblings)
|
||||
{
|
||||
const Component* const c = getTopLevelComponent();
|
||||
|
||||
ComponentHelpers::subtractObscuredRegions (*c, result, getLocalPoint (c, Point<int>()),
|
||||
c->getLocalBounds(), this);
|
||||
}
|
||||
|
||||
ComponentHelpers::subtractObscuredRegions (*this, result, Point<int>(), unclipped, nullptr);
|
||||
result.consolidate();
|
||||
}
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
void Component::mouseEnter (const MouseEvent&) {}
|
||||
void Component::mouseExit (const MouseEvent&) {}
|
||||
@@ -2856,7 +2794,7 @@ void Component::grabFocusInternal (const FocusChangeType cause, const bool canTr
|
||||
else
|
||||
{
|
||||
// find the default child component..
|
||||
ScopedPointer <KeyboardFocusTraverser> traverser (createFocusTraverser());
|
||||
ScopedPointer<KeyboardFocusTraverser> traverser (createFocusTraverser());
|
||||
|
||||
if (traverser != nullptr)
|
||||
{
|
||||
@@ -2898,7 +2836,7 @@ void Component::moveKeyboardFocusToSibling (const bool moveToNext)
|
||||
|
||||
if (parentComponent != nullptr)
|
||||
{
|
||||
ScopedPointer <KeyboardFocusTraverser> traverser (createFocusTraverser());
|
||||
ScopedPointer<KeyboardFocusTraverser> traverser (createFocusTraverser());
|
||||
|
||||
if (traverser != nullptr)
|
||||
{
|
||||
@@ -3052,7 +2990,7 @@ Point<int> Component::getMouseXYRelative() const
|
||||
void Component::addKeyListener (KeyListener* const newListener)
|
||||
{
|
||||
if (keyListeners == nullptr)
|
||||
keyListeners = new Array <KeyListener*>();
|
||||
keyListeners = new Array<KeyListener*>();
|
||||
|
||||
keyListeners->addIfNotAlreadyThere (newListener);
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
subclass of Component or use one of the other types of component from
|
||||
the library.
|
||||
*/
|
||||
Component();
|
||||
Component() noexcept;
|
||||
|
||||
/** Destructor.
|
||||
|
||||
@@ -66,7 +66,7 @@ public:
|
||||
/** Creates a component, setting its name at the same time.
|
||||
@see getName, setName
|
||||
*/
|
||||
explicit Component (const String& componentName);
|
||||
explicit Component (const String& componentName) noexcept;
|
||||
|
||||
/** Returns the name of this component.
|
||||
@see setName
|
||||
@@ -315,16 +315,6 @@ public:
|
||||
*/
|
||||
Rectangle<int> getBoundsInParent() const noexcept;
|
||||
|
||||
/** Returns the region of this component that's not obscured by other, opaque components.
|
||||
|
||||
The RectangleList that is returned represents the area of this component
|
||||
which isn't covered by opaque child components.
|
||||
|
||||
If includeSiblings is true, it will also take into account any siblings
|
||||
that may be overlapping the component.
|
||||
*/
|
||||
void getVisibleArea (RectangleList<int>& result, bool includeSiblings) const;
|
||||
|
||||
//==============================================================================
|
||||
/** Returns this component's x coordinate relative the screen's top-left origin.
|
||||
@see getX, localPointToGlobal
|
||||
@@ -807,7 +797,7 @@ public:
|
||||
TargetClass* findParentComponentOfClass() const
|
||||
{
|
||||
for (Component* p = parentComponent; p != nullptr; p = p->parentComponent)
|
||||
if (TargetClass* const target = dynamic_cast <TargetClass*> (p))
|
||||
if (TargetClass* const target = dynamic_cast<TargetClass*> (p))
|
||||
return target;
|
||||
|
||||
return nullptr;
|
||||
@@ -1166,7 +1156,7 @@ public:
|
||||
By default, components are considered transparent, unless this is used to
|
||||
make it otherwise.
|
||||
|
||||
@see isOpaque, getVisibleArea
|
||||
@see isOpaque
|
||||
*/
|
||||
void setOpaque (bool shouldBeOpaque);
|
||||
|
||||
@@ -1757,11 +1747,14 @@ public:
|
||||
*/
|
||||
virtual void focusLost (FocusChangeType cause);
|
||||
|
||||
/** Called to indicate that one of this component's children has been focused or unfocused.
|
||||
/** Called to indicate a change in whether or not this component is the parent of the
|
||||
currently-focused component.
|
||||
|
||||
Essentially this means that the return value of a call to hasKeyboardFocus (true) has
|
||||
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 focusGained, setWantsKeyboardFocus, getCurrentlyFocusedComponent, hasKeyboardFocus
|
||||
*/
|
||||
@@ -1796,9 +1789,7 @@ public:
|
||||
bool isMouseButtonDown() const;
|
||||
|
||||
/** True if the mouse is over this component, or if it's being dragged in this component.
|
||||
|
||||
This is a handy equivalent to (isMouseOver() || isMouseButtonDown()).
|
||||
|
||||
@see isMouseOver, isMouseButtonDown, isMouseButtonDownAnywhere
|
||||
*/
|
||||
bool isMouseOverOrDragging() const;
|
||||
@@ -2136,31 +2127,31 @@ public:
|
||||
SafePointer() noexcept {}
|
||||
|
||||
/** Creates a SafePointer that points at the given component. */
|
||||
SafePointer (ComponentType* const component) : weakRef (component) {}
|
||||
SafePointer (ComponentType* component) : weakRef (component) {}
|
||||
|
||||
/** Creates a copy of another SafePointer. */
|
||||
SafePointer (const SafePointer& other) noexcept : weakRef (other.weakRef) {}
|
||||
SafePointer (const SafePointer& other) noexcept : weakRef (other.weakRef) {}
|
||||
|
||||
/** Copies another pointer to this one. */
|
||||
SafePointer& operator= (const SafePointer& other) { weakRef = other.weakRef; return *this; }
|
||||
SafePointer& operator= (const SafePointer& other) { weakRef = other.weakRef; return *this; }
|
||||
|
||||
/** Copies another pointer to this one. */
|
||||
SafePointer& operator= (ComponentType* const newComponent) { weakRef = newComponent; return *this; }
|
||||
SafePointer& operator= (ComponentType* newComponent) { weakRef = newComponent; return *this; }
|
||||
|
||||
/** Returns the component that this pointer refers to, or null if the component no longer exists. */
|
||||
ComponentType* getComponent() const noexcept { return dynamic_cast <ComponentType*> (weakRef.get()); }
|
||||
ComponentType* getComponent() const noexcept { return dynamic_cast<ComponentType*> (weakRef.get()); }
|
||||
|
||||
/** Returns the component that this pointer refers to, or null if the component no longer exists. */
|
||||
operator ComponentType*() const noexcept { return getComponent(); }
|
||||
operator ComponentType*() const noexcept { return getComponent(); }
|
||||
|
||||
/** Returns the component that this pointer refers to, or null if the component no longer exists. */
|
||||
ComponentType* operator->() noexcept { return getComponent(); }
|
||||
ComponentType* operator->() noexcept { return getComponent(); }
|
||||
|
||||
/** Returns the component that this pointer refers to, or null if the component no longer exists. */
|
||||
const ComponentType* operator->() const noexcept { return getComponent(); }
|
||||
const ComponentType* operator->() const noexcept { return getComponent(); }
|
||||
|
||||
/** If the component is valid, this deletes it and sets this pointer to null. */
|
||||
void deleteAndZero() { delete getComponent(); }
|
||||
void deleteAndZero() { delete getComponent(); }
|
||||
|
||||
bool operator== (ComponentType* component) const noexcept { return weakRef == component; }
|
||||
bool operator!= (ComponentType* component) const noexcept { return weakRef != component; }
|
||||
@@ -2268,20 +2259,20 @@ private:
|
||||
String componentName, componentID;
|
||||
Component* parentComponent;
|
||||
Rectangle<int> bounds;
|
||||
ScopedPointer <Positioner> positioner;
|
||||
ScopedPointer <AffineTransform> affineTransform;
|
||||
Array <Component*> childComponentList;
|
||||
ScopedPointer<Positioner> positioner;
|
||||
ScopedPointer<AffineTransform> affineTransform;
|
||||
Array<Component*> childComponentList;
|
||||
LookAndFeel* lookAndFeel;
|
||||
MouseCursor cursor;
|
||||
ImageEffectFilter* effect;
|
||||
ScopedPointer <CachedComponentImage> cachedImage;
|
||||
ScopedPointer<CachedComponentImage> cachedImage;
|
||||
|
||||
class MouseListenerList;
|
||||
friend class MouseListenerList;
|
||||
friend struct ContainerDeletePolicy<MouseListenerList>;
|
||||
ScopedPointer <MouseListenerList> mouseListeners;
|
||||
ScopedPointer <Array <KeyListener*> > keyListeners;
|
||||
ListenerList <ComponentListener> componentListeners;
|
||||
ScopedPointer<MouseListenerList> mouseListeners;
|
||||
ScopedPointer<Array<KeyListener*> > keyListeners;
|
||||
ListenerList<ComponentListener> componentListeners;
|
||||
NamedValueSet properties;
|
||||
|
||||
friend class WeakReference<Component>;
|
||||
@@ -2308,9 +2299,9 @@ private:
|
||||
bool mouseDownWasBlocked : 1;
|
||||
bool isMoveCallbackPending : 1;
|
||||
bool isResizeCallbackPending : 1;
|
||||
#if JUCE_DEBUG
|
||||
#if JUCE_DEBUG
|
||||
bool isInsidePaintCall : 1;
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
union
|
||||
|
||||
Reference in New Issue
Block a user