nswindow

Cocoa/OSX - NSWindow standardWindowButton behaving strangely once copied and added again

夙愿已清 提交于 2019-11-28 23:07:49
问题 In my app I change the position of the standardWindowButtons close / miniturize / expand like so: //Create the buttons NSButton *minitButton = [NSWindow standardWindowButton:NSWindowMiniaturizeButton forStyleMask:window.styleMask]; NSButton *closeButton = [NSWindow standardWindowButton:NSWindowCloseButton forStyleMask:window.styleMask]; NSButton *fullScreenButton = [NSWindow standardWindowButton:NSWindowZoomButton forStyleMask:window.styleMask]; //set their location [closeButton setFrame

Change to other space (MacOSX) programmatically

对着背影说爱祢 提交于 2019-11-28 21:38:14
I am making a customised window (a NSWindow with NSBorderlessWindowMask) So far I have been able to handle dragging, resizing, cmd+click and even miniaturize with double click if allowed (see here ) so my window resembles as much as possible to a normal NSWindow. However when I drag my window to the corner of my screen the user will expect to move that window to the next space. (In case you have Spaces enabled in "SystemPreferences" > "Expose and Spaces" > "Spaces" > "Enable Spaces") I wonder how can I change to other space programmatically and move my window there? BendiLow Unfortunately

Resize NSWindows with easing animation

血红的双手。 提交于 2019-11-28 18:05:57
问题 I'm trying to resize an NSWindow (the main one) with a nice easing animation (EaseOut). I can use the [NSWindow animator] but I havn't found a way to add the easing effect. Do you have an idea or code sample which can help me to do that? 回答1: Option 1 float Y = 100; float X = 200; NSRect frame = [window frame]; frame.origin.y -= Y; frame.size.height += Y; frame.size.width += X; [window setFrame:frame display:YES animate:YES]; Option 2 float Y = 100; float X = 200; NSRect frame = [window frame

Hide NSWindow title bar

早过忘川 提交于 2019-11-28 17:18:42
Is there a way to hide the titlebar in an NSWindow? I don't want to have to completely write a new custom window. I can't use NSBorderlessWindowMask because I have a bottom bar on my window, and using NSBorderlessWindowMask makes that disappear. I also tried using setContentBorderThickness:forEdge: with NSMaxYEdge and setting it to 0, that didn't work either. Any help is appreciated user257587 [yourWindow setStyleMask:NSBorderlessWindowMask]; Starting from OS X 10.10, you can hide title bar. window1.titlebarAppearsTransparent = true window1.titleVisibility = .Hidden Maybe you want to override

How to Change Color of NSWindow Title Bar in OSX

一曲冷凌霜 提交于 2019-11-28 17:05:41
After a Long search regarding the NSWindow title bar color and title color, i have found a easy drawing solution. I posting this to share my knowledge. Sub class a NSView with name MyTitleView and add the following code - (void)drawString:(NSString *)string inRect:(NSRect)rect { static NSDictionary *att = nil; if (!att) { NSMutableParagraphStyle *style = [[NSParagraphStyle defaultParagraphStyle] mutableCopy]; [style setLineBreakMode:NSLineBreakByTruncatingTail]; [style setAlignment:NSCenterTextAlignment]; att = [[NSDictionary alloc] initWithObjectsAndKeys: style, NSParagraphStyleAttributeName,

NSWindow with round corners and shadow

倾然丶 夕夏残阳落幕 提交于 2019-11-28 16:02:48
问题 I'm trying to crate a NSWindow without title bar ( NSBorderlessWindowMask ) with round corners and a shadow, similar to the below "Welcome to Xcode" window. I make a subclass of NSWindow : @implementation FlatWindow - (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)aStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)flag { self = [super initWithContentRect:contentRect styleMask:NSBorderlessWindowMask backing:bufferingType defer:flag]; if ( self ) { [self setOpaque

iTunes-style NSWindow subclass?

我只是一个虾纸丫 提交于 2019-11-28 06:38:57
Is there an open-source library for Cocoa to create a window following iTunes' style? That is the window controls are laid out vertically instead of horizontally: I find it space-saving and good for utility-type applications that doesn't need a window title. This quickly hacked away NSWindow delegate should get you started: //VerticalTrafficLightsWindowDelegate.h #import <Cocoa/Cocoa.h> @interface VerticalTrafficLightsWindowDelegate : NSObject <NSWindowDelegate> { NSWindow *window; } @property (assign) IBOutlet NSWindow *window; - (void)verticalizeButtonsForWindow:(NSWindow *)aWindow; @end /

NSWindow Mac App Store like Title Bar

此生再无相见时 提交于 2019-11-28 05:33:17
How could I make an NSWindow 's title bar look like that of the Mac App Store or of the app Feeder where it's height is increased and other controls are show in it. To see what I mean just check out the website for the Mac App Store : http://www.apple.com/mac/app-store/ . Is it a custom NSWindow or is it a completely borderless window with an NSView made to look like the title bar? afriend https://github.com/indragiek/INAppStoreWindow Title bar and traffic light customization for NSWindow INAppStoreWindow is an NSWindow subclass that was originally developed to mimic the appearance of the main

Put a transparent NSWindow permanently on top of another NSWindow

情到浓时终转凉″ 提交于 2019-11-27 21:37:14
I want to have some UI controls on top of a NSWebView and because of this problem " https://stackoverflow.com/questions/9120868/video-in-nswebview-hides-views-on-top-of-the-nswebview " I now want to add a "transparent" NSWindow , so without the close buttons etc., on top of my NSWebView , hence, on top of my current NSWindow . How can I achieve this and make sure that this "overlay window" stays in place, even if I move the underlying window? EDIT: : While @dzolanta's approach works fine, I wonder if it is possible to do it by using an NSWindowController which would allow me to properly use

Change to other space (MacOSX) programmatically

时光总嘲笑我的痴心妄想 提交于 2019-11-27 20:47:30
问题 I am making a customised window (a NSWindow with NSBorderlessWindowMask) So far I have been able to handle dragging, resizing, cmd+click and even miniaturize with double click if allowed (see here) so my window resembles as much as possible to a normal NSWindow. However when I drag my window to the corner of my screen the user will expect to move that window to the next space. (In case you have Spaces enabled in "SystemPreferences" > "Expose and Spaces" > "Spaces" > "Enable Spaces") I wonder