Implement Raise()/Lower() using [NSVIew sortSubviewsUsingFunction:context:]
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@22776 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -536,20 +536,45 @@ void wxWindow::Clear()
|
|||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int CocoaRaiseWindowCompareFunction(id first, id second, void *target)
|
||||||
|
{
|
||||||
|
// first should be ordered higher
|
||||||
|
if(first==target)
|
||||||
|
return NSOrderedDescending;
|
||||||
|
// second should be ordered higher
|
||||||
|
if(second==target)
|
||||||
|
return NSOrderedAscending;
|
||||||
|
return NSOrderedSame;
|
||||||
|
}
|
||||||
|
|
||||||
// Raise the window to the top of the Z order
|
// Raise the window to the top of the Z order
|
||||||
void wxWindow::Raise()
|
void wxWindow::Raise()
|
||||||
{
|
{
|
||||||
wxAutoNSAutoreleasePool pool;
|
// wxAutoNSAutoreleasePool pool;
|
||||||
NSView *nsview = GetNSViewForSuperview();
|
NSView *nsview = GetNSViewForSuperview();
|
||||||
NSView *superview = [nsview superview];
|
[[nsview superview] sortSubviewsUsingFunction:
|
||||||
[nsview removeFromSuperview];
|
CocoaRaiseWindowCompareFunction
|
||||||
[superview addSubview:nsview];
|
context: nsview];
|
||||||
|
}
|
||||||
|
|
||||||
|
static int CocoaLowerWindowCompareFunction(id first, id second, void *target)
|
||||||
|
{
|
||||||
|
// first should be ordered lower
|
||||||
|
if(first==target)
|
||||||
|
return NSOrderedAscending;
|
||||||
|
// second should be ordered lower
|
||||||
|
if(second==target)
|
||||||
|
return NSOrderedDescending;
|
||||||
|
return NSOrderedSame;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lower the window to the bottom of the Z order
|
// Lower the window to the bottom of the Z order
|
||||||
void wxWindow::Lower()
|
void wxWindow::Lower()
|
||||||
{
|
{
|
||||||
// TODO
|
NSView *nsview = GetNSViewForSuperview();
|
||||||
|
[[nsview superview] sortSubviewsUsingFunction:
|
||||||
|
CocoaLowerWindowCompareFunction
|
||||||
|
context: nsview];
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxWindow::DoPopupMenu(wxMenu *menu, int x, int y)
|
bool wxWindow::DoPopupMenu(wxMenu *menu, int x, int y)
|
||||||
|
Reference in New Issue
Block a user