mirror of
https://github.com/darlinghq/darling-cocotron.git
synced 2024-12-03 01:30:44 +00:00
- Issue #54, Rolf Jansen's NSTextFieldCell inset fix
- Issue #53, Rolf Jansen's -[NSVew mouse:inRect:] implementation - Issue #52, Rolf Jansen's NSTabView fix - Issue #51, partial fix, prepareOpenGL only called once now
This commit is contained in:
parent
e1fa4c4c25
commit
b10c5e4282
@ -388,19 +388,19 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
|
||||
[style drawTabPaneInRect:[self rectForBorder]];
|
||||
|
||||
if((i=[_items indexOfObjectIdenticalTo:_selectedItem])!=NSNotFound){
|
||||
// now do selected item
|
||||
i = [_items indexOfObject:_selectedItem];
|
||||
[style drawTabInRect:[self rectForItemBorderAtIndex:i] clipRect:rect color:[_selectedItem color] selected:YES];
|
||||
{
|
||||
if((i=[_items indexOfObjectIdenticalTo:_selectedItem])!=NSNotFound) {
|
||||
// now do selected item
|
||||
i = [_items indexOfObject:_selectedItem];
|
||||
[style drawTabInRect:[self rectForItemBorderAtIndex:i] clipRect:rect color:[_selectedItem color] selected:YES];
|
||||
[[_selectedItem view] setNeedsDisplay:YES];
|
||||
|
||||
NSRect labelRect=[self rectForItemLabelAtIndex:i];
|
||||
labelRect.origin.y+=2;
|
||||
|
||||
[_selectedItem drawLabel:_allowsTruncatedLabels inRect: labelRect];
|
||||
[_selectedItem drawLabel:_allowsTruncatedLabels inRect: labelRect];
|
||||
|
||||
if ([[self window] firstResponder] == self)
|
||||
NSDottedFrameRect(NSInsetRect(labelRect,-1,0));
|
||||
}
|
||||
if ([[self window] firstResponder] == self)
|
||||
NSDottedFrameRect(NSInsetRect(labelRect,-1,0));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -95,6 +95,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
rect=NSInsetRect(rect,3,3);
|
||||
else if([self isBordered])
|
||||
rect=NSInsetRect(rect,2,2);
|
||||
else
|
||||
rect=NSInsetRect(rect,2,0);
|
||||
|
||||
return rect;
|
||||
}
|
||||
|
@ -164,6 +164,7 @@ APPKIT_EXPORT NSString *NSViewFocusDidChangeNotification;
|
||||
|
||||
-(void)scrollPoint:(NSPoint)point;
|
||||
-(BOOL)scrollRectToVisible:(NSRect)rect;
|
||||
-(BOOL)mouse:(NSPoint)point inRect:(NSRect)rect;
|
||||
|
||||
-(void)allocateGState;
|
||||
-(void)releaseGState;
|
||||
|
@ -877,6 +877,10 @@ static inline void buildTransformsIfNeeded(NSView *self) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
-(BOOL)mouse:(NSPoint)point inRect:(NSRect)rect {
|
||||
return NSMouseInRect(point, rect, [self isFlipped]);
|
||||
}
|
||||
|
||||
-(void)allocateGState {
|
||||
// unimplemented
|
||||
}
|
||||
@ -1061,9 +1065,10 @@ static inline void buildTransformsIfNeeded(NSView *self) {
|
||||
point.x+=delta.width;
|
||||
point.y+=delta.height;
|
||||
|
||||
[self lockFocus];
|
||||
NSCopyBits([self gState],rect,point);
|
||||
[self unlockFocus];
|
||||
if([self lockFocusIfCanDraw]){
|
||||
NSCopyBits([self gState],rect,point);
|
||||
[self unlockFocus];
|
||||
}
|
||||
}
|
||||
|
||||
-(void)print:sender {
|
||||
|
@ -84,8 +84,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
|
||||
if((_glContext=opengl_wglCreateContext([_drawable dc]))==NULL){
|
||||
NSLog(@"unable to create _glContext");
|
||||
[self dealloc];
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
}
|
||||
[_drawable makeCurrentWithGLContext:_glContext];
|
||||
|
@ -20,7 +20,6 @@
|
||||
[_view drawRect:[_view bounds]];
|
||||
[_view unlockFocus];
|
||||
EndPaint(_windowHandle,&paintStruct);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
@ -135,7 +134,6 @@ static void pfdFromPixelFormat(PIXELFORMATDESCRIPTOR *pfd,NSOpenGLPixelFormat *p
|
||||
|
||||
pfdFromPixelFormat(&pfd,pixelFormat);
|
||||
|
||||
_view=view;
|
||||
_windowHandle=CreateWindowEx(WS_EX_TOOLWINDOW,"NSWin32OpenGLWindow", "", WS_CLIPCHILDREN | WS_CLIPSIBLINGS| WS_POPUP|WS_CHILD,
|
||||
0, 0, 500, 500,
|
||||
NULL,NULL, GetModuleHandle (NULL),NULL);
|
||||
@ -147,10 +145,12 @@ static void pfdFromPixelFormat(PIXELFORMATDESCRIPTOR *pfd,NSOpenGLPixelFormat *p
|
||||
|
||||
if(!SetPixelFormat(_dc,pfIndex,&pfd))
|
||||
NSLog(@"SetPixelFormat failed");
|
||||
|
||||
|
||||
SetWindowPos(_windowHandle,HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE|SWP_SHOWWINDOW);
|
||||
|
||||
_view=view;
|
||||
[self updateWithView:view];
|
||||
|
||||
SetWindowPos(_windowHandle,HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE|SWP_SHOWWINDOW);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
@interface NSOpenGLView : NSView {
|
||||
NSOpenGLPixelFormat *_pixelFormat;
|
||||
NSOpenGLContext *_context;
|
||||
BOOL _needsPrepare;
|
||||
BOOL _needsReshape;
|
||||
}
|
||||
|
||||
|
@ -60,6 +60,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
if(_context==nil){
|
||||
_context=[[NSOpenGLContext alloc] initWithFormat:_pixelFormat shareContext:nil];
|
||||
[_context setView:self];
|
||||
_needsPrepare=YES;
|
||||
}
|
||||
|
||||
return _context;
|
||||
@ -96,12 +97,15 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
}
|
||||
|
||||
-(void)lockFocus {
|
||||
[super lockFocus];
|
||||
|
||||
[[self openGLContext] makeCurrentContext];
|
||||
[self prepareOpenGL];
|
||||
if(_needsReshape)
|
||||
[self reshape];
|
||||
[super lockFocus];
|
||||
|
||||
[[self openGLContext] makeCurrentContext];
|
||||
if(_needsPrepare){
|
||||
[self prepareOpenGL];
|
||||
_needsPrepare=NO;
|
||||
}
|
||||
if(_needsReshape)
|
||||
[self reshape];
|
||||
}
|
||||
|
||||
-(void)unlockFocus {
|
||||
|
Loading…
Reference in New Issue
Block a user