mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-02-08 04:20:09 +00:00
Internal tidying-up.
This commit is contained in:
parent
4718026b47
commit
5a69cc6ce2
12 changed files with 158 additions and 167 deletions
|
|
@ -94,7 +94,7 @@ ProjectContentComponent::ProjectContentComponent()
|
|||
setOpaque (true);
|
||||
setWantsKeyboardFocus (true);
|
||||
|
||||
treeSizeConstrainer.setMinimumWidth (100);
|
||||
treeSizeConstrainer.setMinimumWidth (200);
|
||||
treeSizeConstrainer.setMaximumWidth (500);
|
||||
|
||||
treeViewTabs.setOutline (0);
|
||||
|
|
@ -203,7 +203,7 @@ void ProjectContentComponent::setProject (Project* newProject)
|
|||
|
||||
int lastTreeWidth = settings.getValue ("projectTreeviewWidth_" + project->getProjectUID()).getIntValue();
|
||||
if (lastTreeWidth < 150)
|
||||
lastTreeWidth = 250;
|
||||
lastTreeWidth = 240;
|
||||
|
||||
treeViewTabs.setBounds (0, 0, lastTreeWidth, getHeight());
|
||||
|
||||
|
|
|
|||
|
|
@ -64,12 +64,12 @@ public:
|
|||
|
||||
if (peer != nullptr)
|
||||
{
|
||||
Component* const comp = peer->getComponent();
|
||||
const Point<int> relativePos (comp->getLocalPoint (nullptr, screenPos));
|
||||
Component& comp = peer->getComponent();
|
||||
const Point<int> relativePos (comp.getLocalPoint (nullptr, screenPos));
|
||||
|
||||
// (the contains() call is needed to test for overlapping desktop windows)
|
||||
if (comp->contains (relativePos))
|
||||
return comp->getComponentAt (relativePos);
|
||||
if (comp.contains (relativePos))
|
||||
return comp.getComponentAt (relativePos);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
|
|
|
|||
|
|
@ -104,8 +104,8 @@ DECLARE_JNI_CLASS (ComponentPeerView, JUCE_ANDROID_ACTIVITY_CLASSPATH "$Componen
|
|||
class AndroidComponentPeer : public ComponentPeer
|
||||
{
|
||||
public:
|
||||
AndroidComponentPeer (Component* const component, const int windowStyleFlags)
|
||||
: ComponentPeer (component, windowStyleFlags),
|
||||
AndroidComponentPeer (Component& comp, const int windowStyleFlags)
|
||||
: ComponentPeer (comp, windowStyleFlags),
|
||||
usingAndroidGraphics (false),
|
||||
fullScreen (false),
|
||||
sizeAllocated (0)
|
||||
|
|
@ -113,7 +113,7 @@ public:
|
|||
// NB: must not put this in the initialiser list, as it invokes a callback,
|
||||
// which will fail if the peer is only half-constructed.
|
||||
view = GlobalRef (android.activity.callObjectMethod (JuceAppActivity.createNewView,
|
||||
component->isOpaque()));
|
||||
component.isOpaque()));
|
||||
|
||||
if (isFocused())
|
||||
handleFocusGain();
|
||||
|
|
@ -285,7 +285,7 @@ public:
|
|||
if (! r.isEmpty())
|
||||
setBounds (r.getX(), r.getY(), r.getWidth(), r.getHeight(), shouldBeFullScreen);
|
||||
|
||||
component->repaint();
|
||||
component.repaint();
|
||||
}
|
||||
|
||||
bool isFullScreen() const
|
||||
|
|
@ -300,8 +300,8 @@ public:
|
|||
|
||||
bool contains (const Point<int>& position, bool trueIfInAChildWindow) const
|
||||
{
|
||||
return isPositiveAndBelow (position.x, component->getWidth())
|
||||
&& isPositiveAndBelow (position.y, component->getHeight())
|
||||
return isPositiveAndBelow (position.x, component.getWidth())
|
||||
&& isPositiveAndBelow (position.y, component.getHeight())
|
||||
&& ((! trueIfInAChildWindow) || view.callBooleanMethod (ComponentPeerView.containsPoint,
|
||||
position.x, position.y));
|
||||
}
|
||||
|
|
@ -406,7 +406,7 @@ public:
|
|||
{
|
||||
{
|
||||
Image temp (new PreallocatedImage (clip.getWidth(), clip.getHeight(),
|
||||
dest, ! component->isOpaque()));
|
||||
dest, ! component.isOpaque()));
|
||||
|
||||
{
|
||||
LowLevelGraphicsSoftwareRenderer g (temp);
|
||||
|
|
@ -563,7 +563,7 @@ JUCE_VIEW_CALLBACK (void, focusChanged, (JNIEnv* env, jobject view, jboolean
|
|||
//==============================================================================
|
||||
ComponentPeer* Component::createNewPeer (int styleFlags, void*)
|
||||
{
|
||||
return new AndroidComponentPeer (this, styleFlags);
|
||||
return new AndroidComponentPeer (*this, styleFlags);
|
||||
}
|
||||
|
||||
jobject createOpenGLView (ComponentPeer* peer)
|
||||
|
|
|
|||
|
|
@ -81,10 +81,7 @@ class UIViewComponentPeer : public ComponentPeer,
|
|||
public FocusChangeListener
|
||||
{
|
||||
public:
|
||||
UIViewComponentPeer (Component* const component,
|
||||
const int windowStyleFlags,
|
||||
UIView* viewToAttachTo);
|
||||
|
||||
UIViewComponentPeer (Component& comp, int windowStyleFlags, UIView* viewToAttachTo);
|
||||
~UIViewComponentPeer();
|
||||
|
||||
//==============================================================================
|
||||
|
|
@ -377,10 +374,8 @@ namespace juce
|
|||
{
|
||||
|
||||
//==============================================================================
|
||||
UIViewComponentPeer::UIViewComponentPeer (Component* const component,
|
||||
const int windowStyleFlags,
|
||||
UIView* viewToAttachTo)
|
||||
: ComponentPeer (component, windowStyleFlags),
|
||||
UIViewComponentPeer::UIViewComponentPeer (Component& comp, const int windowStyleFlags, UIView* viewToAttachTo)
|
||||
: ComponentPeer (comp, windowStyleFlags),
|
||||
window (nil),
|
||||
view (nil),
|
||||
controller (nil),
|
||||
|
|
@ -388,13 +383,13 @@ UIViewComponentPeer::UIViewComponentPeer (Component* const component,
|
|||
fullScreen (false),
|
||||
insideDrawRect (false)
|
||||
{
|
||||
CGRect r = convertToCGRect (component->getLocalBounds());
|
||||
CGRect r = convertToCGRect (component.getLocalBounds());
|
||||
|
||||
view = [[JuceUIView alloc] initWithOwner: this withFrame: r];
|
||||
|
||||
view.multipleTouchEnabled = YES;
|
||||
view.hidden = ! component->isVisible();
|
||||
view.opaque = component->isOpaque();
|
||||
view.hidden = ! component.isVisible();
|
||||
view.opaque = component.isOpaque();
|
||||
view.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent: 0];
|
||||
|
||||
if (isSharedWindow)
|
||||
|
|
@ -407,17 +402,17 @@ UIViewComponentPeer::UIViewComponentPeer (Component* const component,
|
|||
controller = [[JuceUIViewController alloc] init];
|
||||
controller.view = view;
|
||||
|
||||
r = convertToCGRect (rotatedScreenPosToReal (component->getBounds()));
|
||||
r = convertToCGRect (rotatedScreenPosToReal (component.getBounds()));
|
||||
r.origin.y = [UIScreen mainScreen].bounds.size.height - (r.origin.y + r.size.height);
|
||||
|
||||
window = [[JuceUIWindow alloc] init];
|
||||
window.frame = r;
|
||||
window.opaque = component->isOpaque();
|
||||
window.opaque = component.isOpaque();
|
||||
window.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent: 0];
|
||||
|
||||
[((JuceUIWindow*) window) setOwner: this];
|
||||
|
||||
if (component->isAlwaysOnTop())
|
||||
if (component.isAlwaysOnTop())
|
||||
window.windowLevel = UIWindowLevelAlert;
|
||||
|
||||
[window addSubview: view];
|
||||
|
|
@ -426,7 +421,7 @@ UIViewComponentPeer::UIViewComponentPeer (Component* const component,
|
|||
window.hidden = view.hidden;
|
||||
}
|
||||
|
||||
setTitle (component->getName());
|
||||
setTitle (component.getName());
|
||||
|
||||
Desktop::getInstance().addFocusChangeListener (this);
|
||||
}
|
||||
|
|
@ -468,12 +463,12 @@ void UIViewComponentPeer::setTitle (const String& title)
|
|||
|
||||
void UIViewComponentPeer::setPosition (int x, int y)
|
||||
{
|
||||
setBounds (x, y, component->getWidth(), component->getHeight(), false);
|
||||
setBounds (x, y, component.getWidth(), component.getHeight(), false);
|
||||
}
|
||||
|
||||
void UIViewComponentPeer::setSize (int w, int h)
|
||||
{
|
||||
setBounds (component->getX(), component->getY(), w, h, false);
|
||||
setBounds (component.getX(), component.getY(), w, h, false);
|
||||
}
|
||||
|
||||
void UIViewComponentPeer::setBounds (int x, int y, int w, int h, const bool isNowFullScreen)
|
||||
|
|
@ -595,7 +590,7 @@ void UIViewComponentPeer::setFullScreen (bool shouldBeFullScreen)
|
|||
if (! r.isEmpty())
|
||||
setBounds (r.getX(), r.getY(), r.getWidth(), r.getHeight(), shouldBeFullScreen);
|
||||
|
||||
component->repaint();
|
||||
component.repaint();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -642,7 +637,7 @@ BOOL UIViewComponentPeer::shouldRotate (UIInterfaceOrientation interfaceOrientat
|
|||
void UIViewComponentPeer::displayRotated()
|
||||
{
|
||||
Desktop& desktop = Desktop::getInstance();
|
||||
const Rectangle<int> oldArea (component->getBounds());
|
||||
const Rectangle<int> oldArea (component.getBounds());
|
||||
const Rectangle<int> oldDesktop (desktop.getDisplays().getMainDisplay().userArea);
|
||||
|
||||
const_cast <Desktop::Displays&> (desktop.getDisplays()).refresh();
|
||||
|
|
@ -672,8 +667,8 @@ void UIViewComponentPeer::displayRotated()
|
|||
|
||||
bool UIViewComponentPeer::contains (const Point<int>& position, bool trueIfInAChildWindow) const
|
||||
{
|
||||
if (! (isPositiveAndBelow (position.getX(), component->getWidth())
|
||||
&& isPositiveAndBelow (position.getY(), component->getHeight())))
|
||||
if (! (isPositiveAndBelow (position.getX(), component.getWidth())
|
||||
&& isPositiveAndBelow (position.getY(), component.getHeight())))
|
||||
return false;
|
||||
|
||||
UIView* v = [view hitTest: CGPointMake ((CGFloat) position.getX(), (CGFloat) position.getY())
|
||||
|
|
@ -703,7 +698,7 @@ void UIViewComponentPeer::toFront (bool makeActiveWindow)
|
|||
if (isSharedWindow)
|
||||
[[view superview] bringSubviewToFront: view];
|
||||
|
||||
if (window != nil && component->isVisible())
|
||||
if (window != nil && component.isVisible())
|
||||
[window makeKeyAndVisible];
|
||||
}
|
||||
|
||||
|
|
@ -876,7 +871,7 @@ void UIViewComponentPeer::globalFocusChanged (Component*)
|
|||
{
|
||||
Component* comp = dynamic_cast<Component*> (target);
|
||||
|
||||
Point<int> pos (component->getLocalPoint (comp, Point<int>()));
|
||||
Point<int> pos (component.getLocalPoint (comp, Point<int>()));
|
||||
view->hiddenTextView.frame = CGRectMake (pos.getX(), pos.getY(), 0, 0);
|
||||
|
||||
updateHiddenTextContent (target);
|
||||
|
|
@ -897,7 +892,7 @@ void UIViewComponentPeer::drawRect (CGRect r)
|
|||
|
||||
CGContextRef cg = UIGraphicsGetCurrentContext();
|
||||
|
||||
if (! component->isOpaque())
|
||||
if (! component.isOpaque())
|
||||
CGContextClearRect (cg, CGContextGetClipBoundingBox (cg));
|
||||
|
||||
CGContextConcatCTM (cg, CGAffineTransformMake (1, 0, 0, -1, 0, view.bounds.size.height));
|
||||
|
|
@ -978,7 +973,7 @@ void UIViewComponentPeer::performAnyPendingRepaintsNow()
|
|||
|
||||
ComponentPeer* Component::createNewPeer (int styleFlags, void* windowToAttachTo)
|
||||
{
|
||||
return new UIViewComponentPeer (this, styleFlags, (UIView*) windowToAttachTo);
|
||||
return new UIViewComponentPeer (*this, styleFlags, (UIView*) windowToAttachTo);
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -741,8 +741,8 @@ namespace PixmapHelpers
|
|||
class LinuxComponentPeer : public ComponentPeer
|
||||
{
|
||||
public:
|
||||
LinuxComponentPeer (Component* const component, const int windowStyleFlags, Window parentToAddTo)
|
||||
: ComponentPeer (component, windowStyleFlags),
|
||||
LinuxComponentPeer (Component& comp, const int windowStyleFlags, Window parentToAddTo)
|
||||
: ComponentPeer (comp, windowStyleFlags),
|
||||
windowH (0), parentWindow (0),
|
||||
fullScreen (false), mapped (false),
|
||||
visual (0), depth (0)
|
||||
|
|
@ -754,7 +754,7 @@ public:
|
|||
|
||||
createWindow (parentToAddTo);
|
||||
|
||||
setTitle (component->getName());
|
||||
setTitle (component.getName());
|
||||
}
|
||||
|
||||
~LinuxComponentPeer()
|
||||
|
|
@ -847,7 +847,7 @@ public:
|
|||
{
|
||||
bounds.setBounds (x, y, jmax (1, w), jmax (1, h));
|
||||
|
||||
WeakReference<Component> deletionChecker (component);
|
||||
WeakReference<Component> deletionChecker (&component);
|
||||
ScopedXLock xlock;
|
||||
|
||||
XSizeHints* const hints = XAllocSizeHints();
|
||||
|
|
@ -964,7 +964,7 @@ public:
|
|||
if (! r.isEmpty())
|
||||
setBounds (r.getX(), r.getY(), r.getWidth(), r.getHeight(), shouldBeFullScreen);
|
||||
|
||||
getComponent()->repaint();
|
||||
component.repaint();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1029,7 +1029,7 @@ public:
|
|||
{
|
||||
Component* const c = Desktop::getInstance().getComponent (i);
|
||||
|
||||
if (c == getComponent())
|
||||
if (c == &component)
|
||||
break;
|
||||
|
||||
if (c->contains (position + bounds.getPosition() - c->getScreenPosition()))
|
||||
|
|
@ -1089,7 +1089,7 @@ public:
|
|||
XWindowAttributes attr;
|
||||
XGetWindowAttributes (display, windowH, &attr);
|
||||
|
||||
if (component->isAlwaysOnTop())
|
||||
if (component.isAlwaysOnTop())
|
||||
XRaiseWindow (display, windowH);
|
||||
|
||||
XSync (display, False);
|
||||
|
|
@ -1145,7 +1145,7 @@ public:
|
|||
|
||||
void repaint (const Rectangle<int>& area)
|
||||
{
|
||||
repainter->repaint (area.getIntersection (getComponent()->getLocalBounds()));
|
||||
repainter->repaint (area.getIntersection (component.getLocalBounds()));
|
||||
}
|
||||
|
||||
void performAnyPendingRepaintsNow()
|
||||
|
|
@ -1569,7 +1569,7 @@ public:
|
|||
|
||||
// if the native title bar is dragged, need to tell any active menus, etc.
|
||||
if ((styleFlags & windowHasTitleBar) != 0
|
||||
&& component->isCurrentlyBlockedByAnotherModalComponent())
|
||||
&& component.isCurrentlyBlockedByAnotherModalComponent())
|
||||
{
|
||||
Component* const currentModalComp = Component::getCurrentlyModalComponent();
|
||||
|
||||
|
|
@ -1796,7 +1796,7 @@ private:
|
|||
}
|
||||
|
||||
{
|
||||
ScopedPointer<LowLevelGraphicsContext> context (peer->getComponent()->getLookAndFeel()
|
||||
ScopedPointer<LowLevelGraphicsContext> context (peer->component.getLookAndFeel()
|
||||
.createGraphicsContext (image, -totalArea.getPosition(), adjustedList));
|
||||
peer->handlePaint (*context);
|
||||
}
|
||||
|
|
@ -2081,7 +2081,7 @@ private:
|
|||
if ((styleFlags & windowAppearsOnTaskbar) == 0)
|
||||
netHints [numHints++] = Atoms::getIfExists ("_NET_WM_STATE_SKIP_TASKBAR");
|
||||
|
||||
if (component->isAlwaysOnTop())
|
||||
if (component.isAlwaysOnTop())
|
||||
netHints [numHints++] = Atoms::getIfExists ("_NET_WM_STATE_ABOVE");
|
||||
|
||||
if (numHints > 0)
|
||||
|
|
@ -2116,7 +2116,7 @@ private:
|
|||
swa.border_pixel = 0;
|
||||
swa.background_pixmap = None;
|
||||
swa.colormap = colormap;
|
||||
swa.override_redirect = (getComponent()->isAlwaysOnTop() && (styleFlags & windowIsTemporary) != 0) ? True : False;
|
||||
swa.override_redirect = (component.isAlwaysOnTop() && (styleFlags & windowIsTemporary) != 0) ? True : False;
|
||||
swa.event_mask = getAllEventsMask();
|
||||
|
||||
windowH = XCreateWindow (display, parentToAddTo != 0 ? parentToAddTo : root,
|
||||
|
|
@ -2157,7 +2157,7 @@ private:
|
|||
else
|
||||
addWindowButtons (windowH);
|
||||
|
||||
setTitle (getComponent()->getName());
|
||||
setTitle (component.getName());
|
||||
|
||||
// Associate the PID, allowing to be shut down when something goes wrong
|
||||
unsigned long pid = getpid();
|
||||
|
|
@ -2594,7 +2594,7 @@ void Desktop::setKioskComponent (Component* kioskModeComponent, bool enableOrDis
|
|||
//==============================================================================
|
||||
ComponentPeer* Component::createNewPeer (int styleFlags, void* nativeWindowToAttachTo)
|
||||
{
|
||||
return new LinuxComponentPeer (this, styleFlags, (Window) nativeWindowToAttachTo);
|
||||
return new LinuxComponentPeer (*this, styleFlags, (Window) nativeWindowToAttachTo);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ namespace juce {
|
|||
class NSViewComponentPeer : public ComponentPeer
|
||||
{
|
||||
public:
|
||||
NSViewComponentPeer (Component* const comp, const int windowStyleFlags, NSView* viewToAttachTo)
|
||||
NSViewComponentPeer (Component& comp, const int windowStyleFlags, NSView* viewToAttachTo)
|
||||
: ComponentPeer (comp, windowStyleFlags),
|
||||
window (nil),
|
||||
view (nil),
|
||||
|
|
@ -66,7 +66,7 @@ public:
|
|||
appFocusChangeCallback = appFocusChanged;
|
||||
isEventBlockedByModalComps = checkEventBlockedByModalComps;
|
||||
|
||||
NSRect r = NSMakeRect (0, 0, (CGFloat) component->getWidth(), (CGFloat) component->getHeight());
|
||||
NSRect r = NSMakeRect (0, 0, (CGFloat) component.getWidth(), (CGFloat) component.getHeight());
|
||||
|
||||
view = [createViewInstance() initWithFrame: r];
|
||||
setOwner (view, this);
|
||||
|
|
@ -95,8 +95,8 @@ public:
|
|||
}
|
||||
else
|
||||
{
|
||||
r.origin.x = (CGFloat) component->getX();
|
||||
r.origin.y = (CGFloat) component->getY();
|
||||
r.origin.x = (CGFloat) component.getX();
|
||||
r.origin.y = (CGFloat) component.getY();
|
||||
r.origin.y = [[[NSScreen screens] objectAtIndex: 0] frame].size.height - (r.origin.y + r.size.height);
|
||||
|
||||
window = [createWindowInstance() initWithContentRect: r
|
||||
|
|
@ -111,10 +111,10 @@ public:
|
|||
#else
|
||||
[window setDelegate: window];
|
||||
#endif
|
||||
[window setOpaque: component->isOpaque()];
|
||||
[window setOpaque: component.isOpaque()];
|
||||
[window setHasShadow: ((windowStyleFlags & windowHasDropShadow) != 0)];
|
||||
|
||||
if (component->isAlwaysOnTop())
|
||||
if (component.isAlwaysOnTop())
|
||||
[window setLevel: NSFloatingWindowLevel];
|
||||
|
||||
[window setContentView: view];
|
||||
|
|
@ -135,11 +135,11 @@ public:
|
|||
#endif
|
||||
}
|
||||
|
||||
const float alpha = component->getAlpha();
|
||||
const float alpha = component.getAlpha();
|
||||
if (alpha < 1.0f)
|
||||
setAlpha (alpha);
|
||||
|
||||
setTitle (component->getName());
|
||||
setTitle (component.getName());
|
||||
}
|
||||
|
||||
~NSViewComponentPeer()
|
||||
|
|
@ -190,12 +190,12 @@ public:
|
|||
|
||||
void setPosition (int x, int y)
|
||||
{
|
||||
setBounds (x, y, component->getWidth(), component->getHeight(), false);
|
||||
setBounds (x, y, component.getWidth(), component.getHeight(), false);
|
||||
}
|
||||
|
||||
void setSize (int w, int h)
|
||||
{
|
||||
setBounds (component->getX(), component->getY(), w, h, false);
|
||||
setBounds (component.getX(), component.getY(), w, h, false);
|
||||
}
|
||||
|
||||
void setBounds (int x, int y, int w, int h, bool isNowFullScreen)
|
||||
|
|
@ -330,10 +330,10 @@ public:
|
|||
else
|
||||
{
|
||||
if (shouldBeFullScreen)
|
||||
r = component->getParentMonitorArea();
|
||||
r = component.getParentMonitorArea();
|
||||
|
||||
// (can't call the component's setBounds method because that'll reset our fullscreen flag)
|
||||
if (r != getComponent()->getBounds() && ! r.isEmpty())
|
||||
if (r != component.getBounds() && ! r.isEmpty())
|
||||
setBounds (r.getX(), r.getY(), r.getWidth(), r.getHeight(), shouldBeFullScreen);
|
||||
}
|
||||
}
|
||||
|
|
@ -347,8 +347,8 @@ public:
|
|||
|
||||
bool contains (const Point<int>& position, bool trueIfInAChildWindow) const
|
||||
{
|
||||
if (! (isPositiveAndBelow (position.getX(), component->getWidth())
|
||||
&& isPositiveAndBelow (position.getY(), component->getHeight())))
|
||||
if (! (isPositiveAndBelow (position.getX(), component.getWidth())
|
||||
&& isPositiveAndBelow (position.getY(), component.getHeight())))
|
||||
return false;
|
||||
|
||||
NSRect frameRect = [view frame];
|
||||
|
|
@ -384,8 +384,8 @@ public:
|
|||
{
|
||||
if (hasNativeTitleBar())
|
||||
{
|
||||
const Rectangle<int> screen (getFrameSize().subtractedFrom (component->getParentMonitorArea()));
|
||||
const Rectangle<int> window (component->getScreenBounds());
|
||||
const Rectangle<int> screen (getFrameSize().subtractedFrom (component.getParentMonitorArea()));
|
||||
const Rectangle<int> window (component.getScreenBounds());
|
||||
|
||||
fullScreen = window.expanded (2, 2).contains (screen);
|
||||
}
|
||||
|
|
@ -411,7 +411,7 @@ public:
|
|||
positioned: NSWindowAbove
|
||||
relativeTo: nil];
|
||||
|
||||
if (window != nil && component->isVisible())
|
||||
if (window != nil && component.isVisible())
|
||||
{
|
||||
if (makeActiveWindow)
|
||||
[window makeKeyAndOrderFront: nil];
|
||||
|
|
@ -681,7 +681,7 @@ public:
|
|||
|
||||
bool isOpaque()
|
||||
{
|
||||
return component == nullptr || component->isOpaque();
|
||||
return component.isOpaque();
|
||||
}
|
||||
|
||||
void drawRect (NSRect r)
|
||||
|
|
@ -691,7 +691,7 @@ public:
|
|||
|
||||
CGContextRef cg = (CGContextRef) [[NSGraphicsContext currentContext] graphicsPort];
|
||||
|
||||
if (! component->isOpaque())
|
||||
if (! component.isOpaque())
|
||||
CGContextClearRect (cg, CGContextGetClipBoundingBox (cg));
|
||||
|
||||
#if USE_COREGRAPHICS_RENDERING
|
||||
|
|
@ -724,11 +724,11 @@ public:
|
|||
|
||||
if (! clip.isEmpty())
|
||||
{
|
||||
Image temp (getComponent()->isOpaque() ? Image::RGB : Image::ARGB,
|
||||
clipW, clipH, ! getComponent()->isOpaque());
|
||||
Image temp (component.isOpaque() ? Image::RGB : Image::ARGB,
|
||||
clipW, clipH, ! component.isOpaque());
|
||||
|
||||
{
|
||||
ScopedPointer<LowLevelGraphicsContext> context (component->getLookAndFeel()
|
||||
ScopedPointer<LowLevelGraphicsContext> context (component.getLookAndFeel()
|
||||
.createGraphicsContext (temp, Point<int> (xOffset, yOffset), clip));
|
||||
|
||||
insideDrawRect = true;
|
||||
|
|
@ -1708,7 +1708,7 @@ private:
|
|||
frameRect = owner->constrainRect (frameRect);
|
||||
|
||||
if (juce::Component::getCurrentlyModalComponent() != nullptr
|
||||
&& owner->getComponent()->isCurrentlyBlockedByAnotherModalComponent()
|
||||
&& owner->getComponent().isCurrentlyBlockedByAnotherModalComponent()
|
||||
&& owner->hasNativeTitleBar())
|
||||
juce::Component::getCurrentlyModalComponent()->inputAttemptWhenModal();
|
||||
|
||||
|
|
@ -1732,7 +1732,7 @@ private:
|
|||
NSViewComponentPeer* const owner = getOwner (self);
|
||||
|
||||
if (juce::Component::getCurrentlyModalComponent() != nullptr
|
||||
&& owner->getComponent()->isCurrentlyBlockedByAnotherModalComponent()
|
||||
&& owner->getComponent().isCurrentlyBlockedByAnotherModalComponent()
|
||||
&& owner->hasNativeTitleBar())
|
||||
juce::Component::getCurrentlyModalComponent()->inputAttemptWhenModal();
|
||||
}
|
||||
|
|
@ -1827,7 +1827,7 @@ void Desktop::setKioskComponent (Component* kioskModeComponent, bool enableOrDis
|
|||
if (peer->hasNativeTitleBar())
|
||||
{
|
||||
[peer->window setStyleMask: (NSViewComponentPeer::getNSWindowStyleMask (peer->getStyleFlags()))];
|
||||
peer->setTitle (peer->component->getName()); // required to force the OS to update the title
|
||||
peer->setTitle (peer->component.getName()); // required to force the OS to update the title
|
||||
}
|
||||
|
||||
[NSApp setPresentationOptions: NSApplicationPresentationDefault];
|
||||
|
|
@ -1853,7 +1853,7 @@ void Desktop::setKioskComponent (Component* kioskModeComponent, bool enableOrDis
|
|||
//==============================================================================
|
||||
ComponentPeer* Component::createNewPeer (int styleFlags, void* windowToAttachTo)
|
||||
{
|
||||
return new NSViewComponentPeer (this, styleFlags, (NSView*) windowToAttachTo);
|
||||
return new NSViewComponentPeer (*this, styleFlags, (NSView*) windowToAttachTo);
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -463,10 +463,8 @@ public:
|
|||
};
|
||||
|
||||
//==============================================================================
|
||||
HWNDComponentPeer (Component* const component,
|
||||
const int windowStyleFlags,
|
||||
HWND parentToAddTo_)
|
||||
: ComponentPeer (component, windowStyleFlags),
|
||||
HWNDComponentPeer (Component& comp, const int windowStyleFlags, HWND parentToAddTo_)
|
||||
: ComponentPeer (comp, windowStyleFlags),
|
||||
dontRepaint (false),
|
||||
currentRenderingEngine (softwareRenderingEngine),
|
||||
fullScreen (false),
|
||||
|
|
@ -481,15 +479,15 @@ public:
|
|||
{
|
||||
callFunctionIfNotLocked (&createWindowCallback, this);
|
||||
|
||||
setTitle (component->getName());
|
||||
setTitle (component.getName());
|
||||
|
||||
if ((windowStyleFlags & windowHasDropShadow) != 0
|
||||
&& Desktop::canUseSemiTransparentWindows())
|
||||
{
|
||||
shadower = component->getLookAndFeel().createDropShadowerForComponent (component);
|
||||
shadower = component.getLookAndFeel().createDropShadowerForComponent (&component);
|
||||
|
||||
if (shadower != nullptr)
|
||||
shadower->setOwner (component);
|
||||
shadower->setOwner (&component);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -641,7 +639,7 @@ public:
|
|||
{
|
||||
const uint8 intAlpha = (uint8) jlimit (0, 255, (int) (newAlpha * 255.0f));
|
||||
|
||||
if (component->isOpaque())
|
||||
if (component.isOpaque())
|
||||
{
|
||||
if (newAlpha < 1.0f)
|
||||
{
|
||||
|
|
@ -657,7 +655,7 @@ public:
|
|||
else
|
||||
{
|
||||
updateLayeredWindowAlpha = intAlpha;
|
||||
component->repaint();
|
||||
component.repaint();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -683,7 +681,7 @@ public:
|
|||
if (isFullScreen() != shouldBeFullScreen)
|
||||
{
|
||||
fullScreen = shouldBeFullScreen;
|
||||
const WeakReference<Component> deletionChecker (component);
|
||||
const WeakReference<Component> deletionChecker (&component);
|
||||
|
||||
if (! fullScreen)
|
||||
{
|
||||
|
|
@ -740,8 +738,8 @@ public:
|
|||
|
||||
bool contains (const Point<int>& position, bool trueIfInAChildWindow) const
|
||||
{
|
||||
return isPositiveAndBelow (position.x, component->getWidth())
|
||||
&& isPositiveAndBelow (position.y, component->getHeight())
|
||||
return isPositiveAndBelow (position.x, component.getWidth())
|
||||
&& isPositiveAndBelow (position.y, component.getHeight())
|
||||
&& isWindowAtPoint (position, trueIfInAChildWindow);
|
||||
}
|
||||
|
||||
|
|
@ -797,12 +795,10 @@ public:
|
|||
|
||||
// Must be careful not to try to put a topmost window behind a normal one, or Windows
|
||||
// promotes the normal one to be topmost!
|
||||
if (getComponent()->isAlwaysOnTop() == otherPeer->getComponent()->isAlwaysOnTop())
|
||||
SetWindowPos (hwnd, otherPeer->hwnd, 0, 0, 0, 0,
|
||||
SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOSENDCHANGING);
|
||||
else if (otherPeer->getComponent()->isAlwaysOnTop())
|
||||
SetWindowPos (hwnd, HWND_TOP, 0, 0, 0, 0,
|
||||
SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOSENDCHANGING);
|
||||
if (component.isAlwaysOnTop() == otherPeer->component.isAlwaysOnTop())
|
||||
SetWindowPos (hwnd, otherPeer->hwnd, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOSENDCHANGING);
|
||||
else if (otherPeer->component.isAlwaysOnTop())
|
||||
SetWindowPos (hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOSENDCHANGING);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -847,7 +843,7 @@ public:
|
|||
void performAnyPendingRepaintsNow()
|
||||
{
|
||||
MSG m;
|
||||
if (component->isVisible()
|
||||
if (component.isVisible()
|
||||
&& (PeekMessage (&m, hwnd, WM_PAINT, WM_PAINT, PM_REMOVE) || isUsingUpdateLayeredWindow()))
|
||||
handlePaintMessage();
|
||||
}
|
||||
|
|
@ -1308,7 +1304,7 @@ private:
|
|||
// correctly enable the menu items that we specify in the wm_initmenu message.
|
||||
GetSystemMenu (hwnd, false);
|
||||
|
||||
const float alpha = component->getAlpha();
|
||||
const float alpha = component.getAlpha();
|
||||
if (alpha < 1.0f)
|
||||
setAlpha (alpha);
|
||||
}
|
||||
|
|
@ -1366,7 +1362,7 @@ private:
|
|||
|
||||
bool isUsingUpdateLayeredWindow() const
|
||||
{
|
||||
return ! component->isOpaque();
|
||||
return ! component.isOpaque();
|
||||
}
|
||||
|
||||
inline bool hasTitleBar() const noexcept { return (styleFlags & windowHasTitleBar) != 0; }
|
||||
|
|
@ -1514,12 +1510,12 @@ private:
|
|||
}
|
||||
|
||||
// if the component's not opaque, this won't draw properly unless the platform can support this
|
||||
jassert (Desktop::canUseSemiTransparentWindows() || component->isOpaque());
|
||||
jassert (Desktop::canUseSemiTransparentWindows() || component.isOpaque());
|
||||
|
||||
updateCurrentModifiers();
|
||||
|
||||
{
|
||||
ScopedPointer<LowLevelGraphicsContext> context (component->getLookAndFeel()
|
||||
ScopedPointer<LowLevelGraphicsContext> context (component.getLookAndFeel()
|
||||
.createGraphicsContext (offscreenImage, Point<int> (-x, -y), contextClip));
|
||||
handlePaint (*context);
|
||||
}
|
||||
|
|
@ -1579,7 +1575,7 @@ private:
|
|||
{
|
||||
currentRenderingEngine = index == 1 ? direct2DRenderingEngine : softwareRenderingEngine;
|
||||
updateDirect2DContext();
|
||||
repaint (component->getLocalBounds());
|
||||
repaint (component.getLocalBounds());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
@ -2002,7 +1998,7 @@ private:
|
|||
{
|
||||
Rectangle<int> pos (rectangleFromRECT (*r));
|
||||
|
||||
constrainer->checkBounds (pos, windowBorder.addedTo (component->getBounds()),
|
||||
constrainer->checkBounds (pos, windowBorder.addedTo (component.getBounds()),
|
||||
Desktop::getInstance().getDisplays().getTotalBounds (true),
|
||||
wParam == WMSZ_TOP || wParam == WMSZ_TOPLEFT || wParam == WMSZ_TOPRIGHT,
|
||||
wParam == WMSZ_LEFT || wParam == WMSZ_TOPLEFT || wParam == WMSZ_BOTTOMLEFT,
|
||||
|
|
@ -2025,7 +2021,7 @@ private:
|
|||
&& ! Component::isMouseButtonDownAnywhere())
|
||||
{
|
||||
Rectangle<int> pos (wp->x, wp->y, wp->cx, wp->cy);
|
||||
const Rectangle<int> current (windowBorder.addedTo (component->getBounds()));
|
||||
const Rectangle<int> current (windowBorder.addedTo (component.getBounds()));
|
||||
|
||||
constrainer->checkBounds (pos, current,
|
||||
Desktop::getInstance().getDisplays().getTotalBounds (true),
|
||||
|
|
@ -2050,17 +2046,17 @@ private:
|
|||
|
||||
if (isMinimised())
|
||||
{
|
||||
component->repaint();
|
||||
component.repaint();
|
||||
handleMovedOrResized();
|
||||
|
||||
if (! ComponentPeer::isValidPeer (this))
|
||||
return;
|
||||
}
|
||||
|
||||
Component* underMouse = component->getComponentAt (component->getMouseXYRelative());
|
||||
Component* underMouse = component.getComponentAt (component.getMouseXYRelative());
|
||||
|
||||
if (underMouse == nullptr)
|
||||
underMouse = component;
|
||||
underMouse = &component;
|
||||
|
||||
if (underMouse->isCurrentlyBlockedByAnotherModalComponent())
|
||||
{
|
||||
|
|
@ -2125,7 +2121,7 @@ private:
|
|||
|
||||
if (fullScreen && ! isMinimised())
|
||||
{
|
||||
const Rectangle<int> r (component->getParentMonitorArea());
|
||||
const Rectangle<int> r (component.getParentMonitorArea());
|
||||
|
||||
SetWindowPos (hwnd, 0, r.getX(), r.getY(), r.getWidth(), r.getHeight(),
|
||||
SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER | SWP_NOSENDCHANGING);
|
||||
|
|
@ -2333,7 +2329,7 @@ private:
|
|||
break;
|
||||
|
||||
case WM_MOUSEACTIVATE:
|
||||
if (! component->getMouseClickGrabsKeyboardFocus())
|
||||
if (! component.getMouseClickGrabsKeyboardFocus())
|
||||
return MA_NOACTIVATE;
|
||||
|
||||
break;
|
||||
|
|
@ -2345,7 +2341,7 @@ private:
|
|||
break;
|
||||
|
||||
case WM_CLOSE:
|
||||
if (! component->isCurrentlyBlockedByAnotherModalComponent())
|
||||
if (! component.isCurrentlyBlockedByAnotherModalComponent())
|
||||
handleUserClosingWindow();
|
||||
|
||||
return 0;
|
||||
|
|
@ -2467,7 +2463,7 @@ private:
|
|||
|
||||
bool sendInputAttemptWhenModalMessage()
|
||||
{
|
||||
if (component->isCurrentlyBlockedByAnotherModalComponent())
|
||||
if (component.isCurrentlyBlockedByAnotherModalComponent())
|
||||
{
|
||||
Component* const current = Component::getCurrentlyModalComponent();
|
||||
|
||||
|
|
@ -2695,8 +2691,7 @@ private:
|
|||
|
||||
if (targetComp != nullptr)
|
||||
{
|
||||
const Rectangle<int> area (peer.getComponent()
|
||||
->getLocalArea (targetComp, target->getCaretRectangle()));
|
||||
const Rectangle<int> area (peer.getComponent().getLocalArea (targetComp, target->getCaretRectangle()));
|
||||
|
||||
CANDIDATEFORM pos = { 0, CFS_CANDIDATEPOS, { area.getX(), area.getBottom() }, { 0, 0, 0, 0 } };
|
||||
ImmSetCandidateWindow (hImc, &pos);
|
||||
|
|
@ -2717,12 +2712,14 @@ ModifierKeys HWNDComponentPeer::modifiersAtLastCallback;
|
|||
|
||||
ComponentPeer* Component::createNewPeer (int styleFlags, void* nativeWindowToAttachTo)
|
||||
{
|
||||
return new HWNDComponentPeer (this, styleFlags, (HWND) nativeWindowToAttachTo);
|
||||
return new HWNDComponentPeer (*this, styleFlags, (HWND) nativeWindowToAttachTo);
|
||||
}
|
||||
|
||||
ComponentPeer* createNonRepaintingEmbeddedWindowsPeer (Component* component, void* parent)
|
||||
{
|
||||
HWNDComponentPeer* const p = new HWNDComponentPeer (component, ComponentPeer::windowIgnoresMouseClicks, (HWND) parent);
|
||||
jassert (component != nullptr);
|
||||
|
||||
HWNDComponentPeer* const p = new HWNDComponentPeer (*component, ComponentPeer::windowIgnoresMouseClicks, (HWND) parent);
|
||||
p->dontRepaint = true;
|
||||
return p;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ static Array <ComponentPeer*> heavyweightPeers;
|
|||
static uint32 lastUniqueID = 1;
|
||||
|
||||
//==============================================================================
|
||||
ComponentPeer::ComponentPeer (Component* const component_, const int styleFlags_)
|
||||
ComponentPeer::ComponentPeer (Component& component_, const int styleFlags_)
|
||||
: component (component_),
|
||||
styleFlags (styleFlags_),
|
||||
lastPaintTime (0),
|
||||
|
|
@ -66,7 +66,7 @@ ComponentPeer* ComponentPeer::getPeerFor (const Component* const component) noex
|
|||
{
|
||||
ComponentPeer* const peer = heavyweightPeers.getUnchecked(i);
|
||||
|
||||
if (peer->getComponent() == component)
|
||||
if (&(peer->getComponent()) == component)
|
||||
return peer;
|
||||
}
|
||||
|
||||
|
|
@ -111,7 +111,7 @@ void ComponentPeer::handlePaint (LowLevelGraphicsContext& contextToPaintTo)
|
|||
|
||||
JUCE_TRY
|
||||
{
|
||||
component->paintEntireComponent (g, true);
|
||||
component.paintEntireComponent (g, true);
|
||||
}
|
||||
JUCE_CATCH_EXCEPTION
|
||||
|
||||
|
|
@ -135,13 +135,21 @@ void ComponentPeer::handlePaint (LowLevelGraphicsContext& contextToPaintTo)
|
|||
jassert (roundToInt (10.1f) == 10);
|
||||
}
|
||||
|
||||
Component* ComponentPeer::getTargetForKeyPress()
|
||||
{
|
||||
Component* c = Component::getCurrentlyFocusedComponent();
|
||||
|
||||
if (c == nullptr)
|
||||
c = &component;
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
bool ComponentPeer::handleKeyPress (const int keyCode, const juce_wchar textCharacter)
|
||||
{
|
||||
updateCurrentModifiers();
|
||||
|
||||
Component* target = Component::getCurrentlyFocusedComponent() != nullptr
|
||||
? Component::getCurrentlyFocusedComponent()
|
||||
: component;
|
||||
Component* target = getTargetForKeyPress();
|
||||
|
||||
if (target->isCurrentlyBlockedByAnotherModalComponent())
|
||||
{
|
||||
|
|
@ -206,9 +214,7 @@ bool ComponentPeer::handleKeyUpOrDown (const bool isKeyDown)
|
|||
{
|
||||
updateCurrentModifiers();
|
||||
|
||||
Component* target = Component::getCurrentlyFocusedComponent() != nullptr
|
||||
? Component::getCurrentlyFocusedComponent()
|
||||
: component;
|
||||
Component* target = getTargetForKeyPress();
|
||||
|
||||
if (target->isCurrentlyBlockedByAnotherModalComponent())
|
||||
{
|
||||
|
|
@ -260,7 +266,7 @@ void ComponentPeer::handleModifierKeysChange()
|
|||
target = Component::getCurrentlyFocusedComponent();
|
||||
|
||||
if (target == nullptr)
|
||||
target = component;
|
||||
target = &component;
|
||||
|
||||
if (target != nullptr)
|
||||
target->internalModifierKeysChanged();
|
||||
|
|
@ -269,7 +275,7 @@ void ComponentPeer::handleModifierKeysChange()
|
|||
TextInputTarget* ComponentPeer::findCurrentTextInputTarget()
|
||||
{
|
||||
Component* const c = Component::getCurrentlyFocusedComponent();
|
||||
if (component->isParentOf (c))
|
||||
if (component.isParentOf (c))
|
||||
{
|
||||
TextInputTarget* const ti = dynamic_cast <TextInputTarget*> (c);
|
||||
if (ti != nullptr && ti->isTextInputActive())
|
||||
|
|
@ -287,9 +293,7 @@ void ComponentPeer::dismissPendingTextInput()
|
|||
void ComponentPeer::handleBroughtToFront()
|
||||
{
|
||||
updateCurrentModifiers();
|
||||
|
||||
if (component != nullptr)
|
||||
component->internalBroughtToFront();
|
||||
component.internalBroughtToFront();
|
||||
}
|
||||
|
||||
void ComponentPeer::setConstrainer (ComponentBoundsConstrainer* const newConstrainer) noexcept
|
||||
|
|
@ -303,22 +307,22 @@ void ComponentPeer::handleMovedOrResized()
|
|||
|
||||
const bool nowMinimised = isMinimised();
|
||||
|
||||
if (component->flags.hasHeavyweightPeerFlag && ! nowMinimised)
|
||||
if (component.flags.hasHeavyweightPeerFlag && ! nowMinimised)
|
||||
{
|
||||
const WeakReference<Component> deletionChecker (component);
|
||||
const WeakReference<Component> deletionChecker (&component);
|
||||
|
||||
const Rectangle<int> newBounds (getBounds());
|
||||
const bool wasMoved = (component->getPosition() != newBounds.getPosition());
|
||||
const bool wasResized = (component->getWidth() != newBounds.getWidth() || component->getHeight() != newBounds.getHeight());
|
||||
const bool wasMoved = (component.getPosition() != newBounds.getPosition());
|
||||
const bool wasResized = (component.getWidth() != newBounds.getWidth() || component.getHeight() != newBounds.getHeight());
|
||||
|
||||
if (wasMoved || wasResized)
|
||||
{
|
||||
component->bounds = newBounds;
|
||||
component.bounds = newBounds;
|
||||
|
||||
if (wasResized)
|
||||
component->repaint();
|
||||
component.repaint();
|
||||
|
||||
component->sendMovedResizedMessages (wasMoved, wasResized);
|
||||
component.sendMovedResizedMessages (wasMoved, wasResized);
|
||||
|
||||
if (deletionChecker == nullptr)
|
||||
return;
|
||||
|
|
@ -328,19 +332,19 @@ void ComponentPeer::handleMovedOrResized()
|
|||
if (isWindowMinimised != nowMinimised)
|
||||
{
|
||||
isWindowMinimised = nowMinimised;
|
||||
component->minimisationStateChanged (nowMinimised);
|
||||
component->sendVisibilityChangeMessage();
|
||||
component.minimisationStateChanged (nowMinimised);
|
||||
component.sendVisibilityChangeMessage();
|
||||
}
|
||||
|
||||
if (! isFullScreen())
|
||||
lastNonFullscreenBounds = component->getBounds();
|
||||
lastNonFullscreenBounds = component.getBounds();
|
||||
}
|
||||
|
||||
void ComponentPeer::handleFocusGain()
|
||||
{
|
||||
updateCurrentModifiers();
|
||||
|
||||
if (component->isParentOf (lastFocusedComponent))
|
||||
if (component.isParentOf (lastFocusedComponent))
|
||||
{
|
||||
Component::currentlyFocusedComponent = lastFocusedComponent;
|
||||
Desktop::getInstance().triggerFocusCallback();
|
||||
|
|
@ -348,8 +352,8 @@ void ComponentPeer::handleFocusGain()
|
|||
}
|
||||
else
|
||||
{
|
||||
if (! component->isCurrentlyBlockedByAnotherModalComponent())
|
||||
component->grabKeyboardFocus();
|
||||
if (! component.isCurrentlyBlockedByAnotherModalComponent())
|
||||
component.grabKeyboardFocus();
|
||||
else
|
||||
ModalComponentManager::getInstance()->bringModalComponentsToFront();
|
||||
}
|
||||
|
|
@ -359,7 +363,7 @@ void ComponentPeer::handleFocusLoss()
|
|||
{
|
||||
updateCurrentModifiers();
|
||||
|
||||
if (component->hasKeyboardFocus (true))
|
||||
if (component.hasKeyboardFocus (true))
|
||||
{
|
||||
lastFocusedComponent = Component::currentlyFocusedComponent;
|
||||
|
||||
|
|
@ -374,16 +378,16 @@ void ComponentPeer::handleFocusLoss()
|
|||
|
||||
Component* ComponentPeer::getLastFocusedSubcomponent() const noexcept
|
||||
{
|
||||
return (component->isParentOf (lastFocusedComponent) && lastFocusedComponent->isShowing())
|
||||
return (component.isParentOf (lastFocusedComponent) && lastFocusedComponent->isShowing())
|
||||
? static_cast <Component*> (lastFocusedComponent)
|
||||
: component;
|
||||
: &component;
|
||||
}
|
||||
|
||||
void ComponentPeer::handleScreenSizeChange()
|
||||
{
|
||||
updateCurrentModifiers();
|
||||
|
||||
component->parentSizeChanged();
|
||||
component.parentSizeChanged();
|
||||
handleMovedOrResized();
|
||||
}
|
||||
|
||||
|
|
@ -468,7 +472,7 @@ bool ComponentPeer::handleDragMove (const ComponentPeer::DragInfo& info)
|
|||
{
|
||||
updateCurrentModifiers();
|
||||
|
||||
Component* const compUnderMouse = component->getComponentAt (info.position);
|
||||
Component* const compUnderMouse = component.getComponentAt (info.position);
|
||||
|
||||
Component* const lastTarget = dragAndDropTargetComponent.get();
|
||||
Component* newTarget = nullptr;
|
||||
|
|
@ -493,7 +497,7 @@ bool ComponentPeer::handleDragMove (const ComponentPeer::DragInfo& info)
|
|||
if (DragHelpers::isSuitableTarget (info, newTarget))
|
||||
{
|
||||
dragAndDropTargetComponent = newTarget;
|
||||
const Point<int> pos (newTarget->getLocalPoint (component, info.position));
|
||||
const Point<int> pos (newTarget->getLocalPoint (&component, info.position));
|
||||
|
||||
if (DragHelpers::isFileDrag (info))
|
||||
dynamic_cast <FileDragAndDropTarget*> (newTarget)->fileDragEnter (info.files, pos.x, pos.y);
|
||||
|
|
@ -510,7 +514,7 @@ bool ComponentPeer::handleDragMove (const ComponentPeer::DragInfo& info)
|
|||
if (! DragHelpers::isSuitableTarget (info, newTarget))
|
||||
return false;
|
||||
|
||||
const Point<int> pos (newTarget->getLocalPoint (component, info.position));
|
||||
const Point<int> pos (newTarget->getLocalPoint (&component, info.position));
|
||||
|
||||
if (DragHelpers::isFileDrag (info))
|
||||
dynamic_cast <FileDragAndDropTarget*> (newTarget)->fileDragMove (info.files, pos.x, pos.y);
|
||||
|
|
@ -553,7 +557,7 @@ bool ComponentPeer::handleDragDrop (const ComponentPeer::DragInfo& info)
|
|||
}
|
||||
|
||||
ComponentPeer::DragInfo info2 (info);
|
||||
info2.position = targetComp->getLocalPoint (component, info.position);
|
||||
info2.position = targetComp->getLocalPoint (&component, info.position);
|
||||
|
||||
(new DragHelpers::AsyncDropMessage (targetComp, info2))->post();
|
||||
return true;
|
||||
|
|
@ -567,7 +571,7 @@ bool ComponentPeer::handleDragDrop (const ComponentPeer::DragInfo& info)
|
|||
void ComponentPeer::handleUserClosingWindow()
|
||||
{
|
||||
updateCurrentModifiers();
|
||||
component->userTriedToCloseWindow();
|
||||
component.userTriedToCloseWindow();
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -86,14 +86,14 @@ public:
|
|||
The component is the one that we intend to represent, and the style flags are
|
||||
a combination of the values in the StyleFlags enum
|
||||
*/
|
||||
ComponentPeer (Component* component, int styleFlags);
|
||||
ComponentPeer (Component& component, int styleFlags);
|
||||
|
||||
/** Destructor. */
|
||||
virtual ~ComponentPeer();
|
||||
|
||||
//==============================================================================
|
||||
/** Returns the component being represented by this peer. */
|
||||
Component* getComponent() const noexcept { return component; }
|
||||
Component& getComponent() noexcept { return component; }
|
||||
|
||||
/** Returns the set of style flags that were set when the window was created.
|
||||
|
||||
|
|
@ -324,10 +324,7 @@ public:
|
|||
|
||||
//==============================================================================
|
||||
/** Resets the masking region.
|
||||
|
||||
The subclass should call this every time it's about to call the handlePaint
|
||||
method.
|
||||
|
||||
The subclass should call this every time it's about to call the handlePaint method.
|
||||
@see addMaskedRegion
|
||||
*/
|
||||
void clearMaskedRegion();
|
||||
|
|
@ -345,19 +342,16 @@ public:
|
|||
|
||||
//==============================================================================
|
||||
/** Returns the number of currently-active peers.
|
||||
|
||||
@see getPeer
|
||||
*/
|
||||
static int getNumPeers() noexcept;
|
||||
|
||||
/** Returns one of the currently-active peers.
|
||||
|
||||
@see getNumPeers
|
||||
*/
|
||||
static ComponentPeer* getPeer (int index) noexcept;
|
||||
|
||||
/** Checks if this peer object is valid.
|
||||
|
||||
@see getNumPeers
|
||||
*/
|
||||
static bool isValidPeer (const ComponentPeer* peer) noexcept;
|
||||
|
|
@ -370,7 +364,7 @@ public:
|
|||
|
||||
protected:
|
||||
//==============================================================================
|
||||
Component* const component;
|
||||
Component& component;
|
||||
const int styleFlags;
|
||||
RectangleList maskedRegion;
|
||||
Rectangle<int> lastNonFullscreenBounds;
|
||||
|
|
@ -388,9 +382,10 @@ private:
|
|||
|
||||
friend class Component;
|
||||
friend class Desktop;
|
||||
static ComponentPeer* getPeerFor (const Component* component) noexcept;
|
||||
static ComponentPeer* getPeerFor (const Component*) noexcept;
|
||||
Component* getTargetForKeyPress();
|
||||
|
||||
void setLastDragDropTarget (Component* comp);
|
||||
void setLastDragDropTarget (Component*);
|
||||
bool finishDrag (bool);
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ComponentPeer);
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ public:
|
|||
|
||||
if (peer != nullptr)
|
||||
{
|
||||
SystemTrayIconComponent* const iconComp = dynamic_cast<SystemTrayIconComponent*> (peer->getComponent());
|
||||
SystemTrayIconComponent* const iconComp = dynamic_cast<SystemTrayIconComponent*> (&(peer->getComponent()));
|
||||
|
||||
if (iconComp != nullptr)
|
||||
return iconComp->pimpl;
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ public:
|
|||
ComponentPeer* const peer = component.getPeer();
|
||||
jassert (peer != nullptr);
|
||||
|
||||
const Rectangle<int> bounds (peer->getComponent()->getLocalArea (&component, component.getLocalBounds()));
|
||||
const Rectangle<int> bounds (peer->getComponent().getLocalArea (&component, component.getLocalBounds()));
|
||||
lastWidth = bounds.getWidth();
|
||||
lastHeight = bounds.getHeight();
|
||||
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ public:
|
|||
ComponentPeer* const peer = component.getPeer();
|
||||
|
||||
if (peer != nullptr)
|
||||
peer->addMaskedRegion (peer->getComponent()->getLocalArea (&component, component.getLocalBounds()));
|
||||
peer->addMaskedRegion (peer->getComponent().getLocalArea (&component, component.getLocalBounds()));
|
||||
}
|
||||
|
||||
void invalidateAll()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue