Re: Icon in window title
Re: Icon in window title
- Subject: Re: Icon in window title
- From: Tom Waters <email@hidden>
- Date: Tue, 29 May 2001 17:01:00 -0700
Thanks so much for replying.
It is definitely a bug that you can't at least remove the proxy icon. I
would be happy to simply set the title to a plain string when it wasn't
representing a filename, but even then, it keeps the last set proxy icon.
I believe it will be generally useful to allow developers to set the
proxy icon explicitly, as opposed to requiring it to be the icon from
the file... for example, one could composite an indicator for read only,
or modified onto the icon and dynamically update the title.
Here's a couple of methods that would be nice in NSWindow's delegate.
- (NSImage*)proxyImageForWindow:(NSWindow *)window;
- (BOOL)window:(NSWindow *)window
writeProxyToPasteboard:(NSPasteboard*)pboard
This would allow the delegate to dynamically change the icon AND the
contents of the pasteboard.
On Tuesday, May 29, 2001, at 04:24 PM, kristin wrote:
I'm afraid there is no good way to do what you are attempting to do,
right now. Even if it were possible to get a WindowRef from an
arbitrary NSWindow, you would not get the behavior you expect from
SetWindowProxyIcon. The AppKit is responsible for drawing the titlebar
of AppKit windows, and it does not know about any call you may have
made to this function.
I am looking into adding API to NSWindow to allow you to set the icon
in the window title.
Kristin
On Saturday, May 26, 2001, at 01:34 PM, Tom Waters wrote:
I just noticed that windowRef is always returning nil.
If you read the comment below carefully, it seems that windowRef only
works when you created the window with initWithWindowRef.
Is there no way to get a windowRef back from a window created from a
NIB? (mine is a document window).
On Saturday, May 26, 2001, at 12:37 PM, Andreas Monitzer wrote:
On Saturday, May 26, 2001, at 09:18 , Tom Waters wrote:
I found this in MacWindows.h
extern OSStatus SetWindowProxyIcon(WindowRef window, IconRef icon);
It might solve my problem if I knew how to convert an NSWindow to a
WindowRef and an NSImage to an IconRef.
Anybody know how to do this?
From NSWindow.h:
@interface NSWindow(NSCarbonExtensions)
// create an NSWindow for a Carbon window - windowRef must be a
Carbon WindowRef - see MacWindows.h
- (NSWindow *)initWithWindowRef:(void * /* WindowRef */)windowRef;
// return the Carbon WindowRef passed into initWithWindowRef: - see
MacWindows.h
- (void * /* WindowRef */)windowRef;
@end