Browse Source

fixed a missing TableListBox method; added a workaround to the mac code to ensure correct behaviour when repaint() is called during a paint() method

tags/2021-05-28
Julian Storer 15 years ago
parent
commit
2d0600d594
3 changed files with 64 additions and 10 deletions
  1. +32
    -5
      juce_amalgamated.cpp
  2. +5
    -0
      src/gui/components/controls/juce_TableListBox.cpp
  3. +27
    -5
      src/native/mac/juce_mac_NSViewComponentPeer.mm

+ 32
- 5
juce_amalgamated.cpp View File

@@ -48077,6 +48077,11 @@ void TableListBoxModel::listWasScrolled()
{
}

const String TableListBoxModel::getCellTooltip (int /*rowNumber*/, int /*columnId*/)
{
return String::empty;
}

const String TableListBoxModel::getDragSourceDescription (const SparseSet<int>&)
{
return String::empty;
@@ -262439,6 +262444,8 @@ END_JUCE_NAMESPACE
- (BOOL) resignFirstResponder;
- (BOOL) acceptsFirstResponder;

- (void) asyncRepaint: (id) rect;

- (NSArray*) getSupportedDragTypes;
- (BOOL) sendDragCallback: (int) type sender: (id <NSDraggingInfo>) sender;
- (NSDragOperation) draggingEntered: (id <NSDraggingInfo>) sender;
@@ -262559,7 +262566,7 @@ public:

NSWindow* window;
JuceNSView* view;
bool isSharedWindow, fullScreen;
bool isSharedWindow, fullScreen, insideDrawRect;
};

END_JUCE_NAMESPACE
@@ -262718,6 +262725,12 @@ END_JUCE_NAMESPACE
owner->redirectMovedOrResized();
}

- (void) asyncRepaint: (id) rect
{
NSRect* r = (NSRect*) [((NSData*) rect) bytes];
[self setNeedsDisplayInRect: *r];
}

- (void) keyDown: (NSEvent*) ev
{
if (owner == 0 || ! owner->redirectKeyDown (ev))
@@ -263111,7 +263124,8 @@ NSViewComponentPeer::NSViewComponentPeer (Component* const component,
window (0),
view (0),
isSharedWindow (viewToAttachTo != 0),
fullScreen (false)
fullScreen (false),
insideDrawRect (false)
{
NSRect r;
r.origin.x = 0;
@@ -263792,7 +263806,10 @@ void NSViewComponentPeer::drawRect (NSRect r)

if (context.reduceClipRegion (clip))
{
insideDrawRect = true;
handlePaint (context);
insideDrawRect = false;

temp.draw (r.origin.x, r.origin.y, clip, originX, originY);
}
}
@@ -263834,9 +263851,19 @@ void juce_setKioskComponent (Component* kioskModeComponent, bool enableOrDisable

void NSViewComponentPeer::repaint (int x, int y, int w, int h)
{
[view setNeedsDisplayInRect:
NSMakeRect ((float) x, (float) ([view frame].size.height - (y + h)),
(float) w, (float) h)];
NSRect r = NSMakeRect ((float) x, (float) ([view frame].size.height - (y + h)),
(float) w, (float) h);

if (insideDrawRect)
{
[view performSelectorOnMainThread: @selector (asyncRepaint:)
withObject: [NSData dataWithBytes: &r length: sizeof (r)]
waitUntilDone: NO];
}
else
{
[view setNeedsDisplayInRect: r];
}
}

void NSViewComponentPeer::performAnyPendingRepaintsNow()


+ 5
- 0
src/gui/components/controls/juce_TableListBox.cpp View File

@@ -566,6 +566,11 @@ void TableListBoxModel::listWasScrolled()
{
}
const String TableListBoxModel::getCellTooltip (int /*rowNumber*/, int /*columnId*/)
{
return String::empty;
}
const String TableListBoxModel::getDragSourceDescription (const SparseSet<int>&)
{
return String::empty;


+ 27
- 5
src/native/mac/juce_mac_NSViewComponentPeer.mm View File

@@ -76,6 +76,8 @@ END_JUCE_NAMESPACE
- (BOOL) resignFirstResponder;
- (BOOL) acceptsFirstResponder;
- (void) asyncRepaint: (id) rect;
- (NSArray*) getSupportedDragTypes;
- (BOOL) sendDragCallback: (int) type sender: (id <NSDraggingInfo>) sender;
- (NSDragOperation) draggingEntered: (id <NSDraggingInfo>) sender;
@@ -202,7 +204,7 @@ public:
NSWindow* window;
JuceNSView* view;
bool isSharedWindow, fullScreen;
bool isSharedWindow, fullScreen, insideDrawRect;
};
//==============================================================================
@@ -364,6 +366,12 @@ END_JUCE_NAMESPACE
owner->redirectMovedOrResized();
}
- (void) asyncRepaint: (id) rect
{
NSRect* r = (NSRect*) [((NSData*) rect) bytes];
[self setNeedsDisplayInRect: *r];
}
//==============================================================================
- (void) keyDown: (NSEvent*) ev
{
@@ -765,7 +773,8 @@ NSViewComponentPeer::NSViewComponentPeer (Component* const component,
window (0),
view (0),
isSharedWindow (viewToAttachTo != 0),
fullScreen (false)
fullScreen (false),
insideDrawRect (false)
{
NSRect r;
r.origin.x = 0;
@@ -1450,7 +1459,10 @@ void NSViewComponentPeer::drawRect (NSRect r)
if (context.reduceClipRegion (clip))
{
insideDrawRect = true;
handlePaint (context);
insideDrawRect = false;
temp.draw (r.origin.x, r.origin.y, clip, originX, originY);
}
}
@@ -1494,9 +1506,19 @@ void juce_setKioskComponent (Component* kioskModeComponent, bool enableOrDisable
//==============================================================================
void NSViewComponentPeer::repaint (int x, int y, int w, int h)
{
[view setNeedsDisplayInRect:
NSMakeRect ((float) x, (float) ([view frame].size.height - (y + h)),
(float) w, (float) h)];
NSRect r = NSMakeRect ((float) x, (float) ([view frame].size.height - (y + h)),
(float) w, (float) h);
if (insideDrawRect)
{
[view performSelectorOnMainThread: @selector (asyncRepaint:)
withObject: [NSData dataWithBytes: &r length: sizeof (r)]
waitUntilDone: NO];
}
else
{
[view setNeedsDisplayInRect: r];
}
}
void NSViewComponentPeer::performAnyPendingRepaintsNow()


Loading…
Cancel
Save