mirror of
https://github.com/darlinghq/darling-cocotron.git
synced 2024-10-08 01:53:28 +00:00
- Issue #96-101 fixes by Cedric Luthi, missing NSImageView.h import, NSButtonCell drawInteriorWithFrame:inView:, NSMatrix addColumn, NSPopUpButtonCell setMenu:, NSTableView rectOfRow:, NSTabViewItem setLabel:
- Issue #88, NSOpenGLView now receives mouse events
This commit is contained in:
parent
78c737cd18
commit
4a1cd93e74
@ -60,6 +60,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
#import <AppKit/NSImage.h>
|
||||
#import <AppKit/NSImageCell.h>
|
||||
#import <AppKit/NSImageRep.h>
|
||||
#import <AppKit/NSImageView.h>
|
||||
#import <AppKit/NSInterfaceStyle.h>
|
||||
#import <AppKit/NSObject+BindingSupport.h>
|
||||
#import <AppKit/NSLayoutManager.h>
|
||||
|
@ -539,7 +539,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
if(drawImage){
|
||||
NSRect rect=NSMakeRect(imageOrigin.x,imageOrigin.y,imageSize.width,imageSize.height);
|
||||
|
||||
[[_controlView graphicsStyle] drawButtonImage:image inRect:rect enabled:enabled mixed:mixed];
|
||||
[[controlView graphicsStyle] drawButtonImage:image inRect:rect enabled:enabled mixed:mixed];
|
||||
}
|
||||
|
||||
if(drawTitle){
|
||||
|
@ -530,13 +530,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
}
|
||||
|
||||
-(void)addColumn {
|
||||
int i=_numberOfRows*_numberOfColumns;
|
||||
int i=_numberOfRows;
|
||||
for(;i>0;i--){
|
||||
NSCell *cell=[self makeCellAtRow:i-1 column:_numberOfColumns];
|
||||
|
||||
for(;i>0;i-=_numberOfRows){
|
||||
int row= i/_numberOfColumns;
|
||||
NSCell *cell=[self makeCellAtRow:row column:_numberOfColumns];
|
||||
|
||||
[_cells insertObject:cell atIndex:i];
|
||||
[_cells insertObject:cell atIndex:i*_numberOfColumns];
|
||||
}
|
||||
|
||||
_numberOfColumns++;
|
||||
|
@ -119,8 +119,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
|
||||
-(void)setMenu:(NSMenu *)menu
|
||||
{
|
||||
menu = [menu retain];
|
||||
[_menu release];
|
||||
_menu = [_menu retain];
|
||||
_menu = menu;
|
||||
}
|
||||
|
||||
-(void)addItemWithTitle:(NSString *)title {
|
||||
|
@ -103,7 +103,7 @@ NSString *_NSTruncatedStringWithAttributesInRect(NSString *string, NSDictionary
|
||||
-(void)setLabel:(NSString *)label {
|
||||
label=[label copy];
|
||||
[_label release];
|
||||
_label=[label copy];
|
||||
_label=label;
|
||||
}
|
||||
|
||||
-(void)setView:(NSView *)view {
|
||||
|
@ -297,8 +297,7 @@ NSString *NSTableViewColumnDidResizeNotification=@"NSTableViewColumnDidResizeNot
|
||||
int i = 0;
|
||||
|
||||
if (row < 0 || row >= _numberOfRows) {
|
||||
[NSException raise:NSInternalInconsistencyException
|
||||
format:@"rectOfRow: invalid index %d (valid {%d, %d})", row, 0, _numberOfRows];
|
||||
return NSZeroRect;
|
||||
}
|
||||
|
||||
rect.size.width = 0;
|
||||
|
@ -160,6 +160,17 @@ static void pfdFromPixelFormat(PIXELFORMATDESCRIPTOR *pfd,NSOpenGLPixelFormat *p
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
-(NSWindow *)appkitWindow {
|
||||
return [_view window];
|
||||
}
|
||||
|
||||
-(void)adjustEventLocation:(NSPoint *)location {
|
||||
if(![_view isFlipped])
|
||||
location->y=([_view frame].size.height-1)-location->y;
|
||||
|
||||
*location=[_view convertPoint:*location toView:nil];
|
||||
}
|
||||
|
||||
-(HDC)dc {
|
||||
return _dc;
|
||||
}
|
||||
|
@ -631,18 +631,17 @@ The values should be upgraded to something which is more generic to implement, p
|
||||
|
||||
-(BOOL)postMSG:(MSG)msg {
|
||||
NSEventType type;
|
||||
Win32Window *platformWindow=(id)GetProp(msg.hwnd,"self");
|
||||
NSWindow *window;
|
||||
id platformWindow=(id)GetProp(msg.hwnd,"self");
|
||||
NSWindow *window=nil;
|
||||
POINT deviceLocation;
|
||||
NSPoint location;
|
||||
unsigned modifierFlags;
|
||||
DWORD tickCount=GetTickCount();
|
||||
int lastClickCount=_clickCount;
|
||||
|
||||
if(![platformWindow isKindOfClass:[Win32Window class]])
|
||||
platformWindow=nil;
|
||||
|
||||
window=[platformWindow delegate];
|
||||
if([platformWindow respondsToSelector:@selector(appkitWindow)])
|
||||
window=[platformWindow performSelector:@selector(appkitWindow)];
|
||||
|
||||
if(![window isKindOfClass:[NSWindow class]])
|
||||
window=nil;
|
||||
|
||||
@ -744,8 +743,8 @@ The values should be upgraded to something which is more generic to implement, p
|
||||
|
||||
location.x=deviceLocation.x;
|
||||
location.y=deviceLocation.y;
|
||||
location.y=[window frame].size.height-location.y;
|
||||
|
||||
[platformWindow adjustEventLocation:&location];
|
||||
|
||||
modifierFlags=[self currentModifierFlags];
|
||||
|
||||
switch(type){
|
||||
|
@ -68,6 +68,8 @@ typedef enum {
|
||||
-(NSPoint)convertPOINTLToBase:(POINTL)point;
|
||||
-(NSPoint)mouseLocationOutsideOfEventStream;
|
||||
|
||||
-(void)adjustEventLocation:(NSPoint *)location;
|
||||
|
||||
-(void)sendEvent:(CGEvent *)event;
|
||||
|
||||
@end
|
||||
|
@ -203,6 +203,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
return _delegate;
|
||||
}
|
||||
|
||||
-(NSWindow *)appkitWindow {
|
||||
return _delegate;
|
||||
}
|
||||
|
||||
-(HWND)windowHandle {
|
||||
return _handle;
|
||||
@ -378,6 +381,10 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
return point;
|
||||
}
|
||||
|
||||
-(void)adjustEventLocation:(NSPoint *)location {
|
||||
location->y=(_size.height-1)-location->y;
|
||||
}
|
||||
|
||||
-(void)sendEvent:(CGEvent *)eventX {
|
||||
Win32Event *event=(Win32Event *)eventX;
|
||||
MSG msg=[event msg];
|
||||
|
Loading…
Reference in New Issue
Block a user