开发者

Creating a custom capture window in Cocoa

I am trying to make a custom transparent bordered window(without tittle bar) to capture a part of the screen.This window should be resizeable from the bottom right corner area,and could be moved by dragging any of the border lines.This wind开发者_如何学运维ow should be such that, it could also be moved over the apple menu.

I am very new to Cocoa, Can you please suggest me some guide or tutorial to understand creating custom windows and the event handling in custom window.

I have seen the example given in the link below and it was pretty helpful,but I am not able to understand the whole code.

http://cocoawithlove.com/2008/12/drawing-custom-window-on-mac-os-x.html

Please give me pointers to how to make such a window or what all to refer to have sufficient knowledge to be able to do it.

Thanks :)


The reason that you can't go over the Menu Bar is that NSWindow automatically constrains itself to prevent it from covering that area (along with the dock). In your NSWindow subclass, add this:

- (NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen *)screen
{
    return frameRect;
}

This will override the constrainFrameRect that prevents you from covering the Menu Bar and Dock.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜