On Jan 2, 2010, at 10:44 AM, PCWiz wrote:

The only reason I dont want to completely draw the whole window is that resizing is not easily implemented with a custom window.

Sure it is.  This is how I did it in the "Core Data Stickies" example:

#import "StickyResizeCornerView.h"

@implementation StickyResizeCornerView

- (void)drawRect:(NSRect)rect
{
        NSRect bounds = [self bounds];
        [[NSColor brownColor] set];
[NSBezierPath strokeLineFromPoint:NSZeroPoint toPoint:NSMakePoint(NSMaxX(bounds), NSMaxY(bounds))];
}

- (BOOL)acceptsFirstMouse:(NSEvent *)theEvent
{
    return YES;
}

- (void)mouseDragged:(NSEvent *)theEvent
{
        NSWindow *window = [self window];
        NSRect frame = [window frame];
    float newHeight = frame.size.height + [theEvent deltaY];
    float newWidth  = frame.size.width  + [theEvent deltaX];
    NSSize minSize = [window minSize];
    if (newHeight >= minSize.height) {
        frame.size.height = newHeight;
        frame.origin.y -= [theEvent deltaY];
    }
    if (newWidth >= minSize.width)
        frame.size.width = newWidth;
    [window setFrame:frame display:YES];
}


-jcr
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to