nsdocktile

How do I draw a badge on my Dock icon using Cocoa?

狂风中的少年 提交于 2019-12-17 22:34:29
问题 How do I add a badge to the Dock icon for my app using Cocoa? Is there any roughly "standardized" way to do this? (I'm referring to the kind of badges that show up in Mail, iChat etc. to indicate the number of unread messages and the like.) Cocoa Touch does provide one such method, but I haven't been able to find any equivalent for a regular Cocoa application. 回答1: Use [[[NSApplication sharedApplication] dockTile] setBadgeLabel:@"2234"]; This method, and the NSDockTile class, has been

How to create a binding for NSApp.dockTile's

社会主义新天地 提交于 2019-12-08 01:35:55
问题 In IB it is easy to bind a label or text field to some controller's keyPath. The NSDockTile (available via [[NSApp dockTile] setBadgeLabel:@"123"]) doesn't appear in IB, and I cannot figure out how to programmatically bind its "badgeLabel" property like you might bind a label/textfield/table column. Any ideas? 回答1: NSDockTile doesn't have any bindings, so your controller will have to update the dock tile manually. You could do this using KVO which would have the same effect as binding it.

How to create a binding for NSApp.dockTile's

倾然丶 夕夏残阳落幕 提交于 2019-12-06 12:27:14
In IB it is easy to bind a label or text field to some controller's keyPath. The NSDockTile (available via [[NSApp dockTile] setBadgeLabel:@"123"]) doesn't appear in IB, and I cannot figure out how to programmatically bind its "badgeLabel" property like you might bind a label/textfield/table column. Any ideas? NSDockTile doesn't have any bindings, so your controller will have to update the dock tile manually. You could do this using KVO which would have the same effect as binding it. Create a context as a global: static void* MyContext=(void*)@"MyContext"; Then, in your init method:

Adding an NSProgressIndicator to the dock icon

僤鯓⒐⒋嵵緔 提交于 2019-12-04 19:37:35
问题 I'm creating an application which should show a progress bar in the dock icon. Currently I have this, but it's not working: NSProgressIndicator *progressIndicator = [[NSProgressIndicator alloc] initWithFrame:NSMakeRect(0.0f, 0.0f, 10.0f, 20.0f)]; [progressIndicator setStyle:NSProgressIndicatorBarStyle]; [progressIndicator setIndeterminate:NO]; [[[[NSApplication sharedApplication] dockTile] contentView] addSubview:progressIndicator]; [progressIndicator release]; Or must I draw it on the dock

Adding an NSProgressIndicator to the dock icon

徘徊边缘 提交于 2019-12-03 12:51:07
I'm creating an application which should show a progress bar in the dock icon. Currently I have this, but it's not working: NSProgressIndicator *progressIndicator = [[NSProgressIndicator alloc] initWithFrame:NSMakeRect(0.0f, 0.0f, 10.0f, 20.0f)]; [progressIndicator setStyle:NSProgressIndicatorBarStyle]; [progressIndicator setIndeterminate:NO]; [[[[NSApplication sharedApplication] dockTile] contentView] addSubview:progressIndicator]; [progressIndicator release]; Or must I draw it on the dock myself? Can anyone help me? Thanks. In the finish I had to use the following code as the contentView was

How can I get the screen position of the DockTile in OSX?

谁说我不能喝 提交于 2019-12-02 08:33:29
问题 I need a window to 'point' to the icon that was clicked on in the dock, similar to the way the context menu has the little callout-arrow pointing to it. This means I need to get the screen location of the dock, or more accurately the DockTile. (Yes I could use the mouse coordinates, but that doesn't look as good as it 'moves'.) Now my thought is to get the associated view (I already have that), then use view-to-screen coordinate conversions, but that's becoming problematic as the x/left and y

How can I get the screen position of the DockTile in OSX?

社会主义新天地 提交于 2019-12-02 06:02:40
I need a window to 'point' to the icon that was clicked on in the dock, similar to the way the context menu has the little callout-arrow pointing to it. This means I need to get the screen location of the dock, or more accurately the DockTile. (Yes I could use the mouse coordinates, but that doesn't look as good as it 'moves'.) Now my thought is to get the associated view (I already have that), then use view-to-screen coordinate conversions, but that's becoming problematic as the x/left and y/top values of the bounding rectangle always say zero. I know that's because there's a nested hierarchy

finder file icon badging (icon overlay) on mac osx >=10.6

不问归期 提交于 2019-11-30 07:52:48
I search a solution to do File icon overlays (icon badging) (like Dropbox does it on mac) with cocoa on mac. Does anyone knows a way to do this? I've searched the Xcode docs as well i look into scpplugins source code which is kind of old carbon code. Thanks for any help Since the Finder was reworked in Snow Leopard, the older Carbon methods will no longer work. The route I've taken to be able to badge icons in Finder involves writing a custom bundle which then needs to be injected into the Finder. Look into Wolf Rentzsch's mach_inject (https://github.com/rentzsch/mach_star/tree/master/mach

finder file icon badging (icon overlay) on mac osx >=10.6

南笙酒味 提交于 2019-11-29 10:18:14
问题 I search a solution to do File icon overlays (icon badging) (like Dropbox does it on mac) with cocoa on mac. Does anyone knows a way to do this? I've searched the Xcode docs as well i look into scpplugins source code which is kind of old carbon code. Thanks for any help 回答1: Since the Finder was reworked in Snow Leopard, the older Carbon methods will no longer work. The route I've taken to be able to badge icons in Finder involves writing a custom bundle which then needs to be injected into

How do I draw a badge on my Dock icon using Cocoa?

本小妞迷上赌 提交于 2019-11-28 17:53:46
How do I add a badge to the Dock icon for my app using Cocoa? Is there any roughly "standardized" way to do this? (I'm referring to the kind of badges that show up in Mail, iChat etc. to indicate the number of unread messages and the like.) Cocoa Touch does provide one such method, but I haven't been able to find any equivalent for a regular Cocoa application. Use [[[NSApplication sharedApplication] dockTile] setBadgeLabel:@"2234"]; This method, and the NSDockTile class, has been available since Leopard. It should be noted that NSDockTile is only available on Leopard. If you need to target