• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSSegmentedControl Display Bug?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSSegmentedControl Display Bug?


  • Subject: Re: NSSegmentedControl Display Bug?
  • From: Shaun Wexler <email@hidden>
  • Date: Sun, 31 Jul 2005 08:13:32 -0700

On Jul 31, 2005, at 4:11 AM, Ruediger Hanke wrote:

I'm lost here ... basically I want to have a segmented control in the regular
style in a unified title/toolbar window. Anybody knows how DevonThink
achieves this?

// "It's Not Nice To Fool Mother Nature"... but often necessary:

@interface SKWSegmentedControlWindowProxy : NSProxy
{
    id realWindow;
}

- (id)initWithWindow:(id)window;
- (id)window;
- (void)setWindow:(NSWindow *)window;
- (unsigned int)styleMask;

@end

@implementation SKWSegmentedControlWindowProxy

- (id)initWithWindow:(id)window
{
    [self setWindow:window];
    return self;
}

- (void)dealloc
{
    if (realWindow) {
        [self setWindow:nil];
    }
    [super dealloc];
}

- (void)windowWillClose:(NSNotification *)notification
{
    if (realWindow) {
        [self setWindow:nil];
    }
}

- (id)window
{
    return realWindow;
}

- (void)setWindow:(NSWindow *)window
{
if (realWindow != window) {
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
if ((realWindow = window)) {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowWillClose:) name:NSWindowWillCloseNotification object:window];
}
}


- (unsigned int)styleMask
{
    return ([realWindow styleMask] &~ NSTexturedBackgroundWindowMask);
}

- (NSMethodSignature *)methodSignatureForSelector:(SEL)selector
{
    if (realWindow) {
        return [realWindow methodSignatureForSelector:selector];
    } else {
        return [NSWindow instanceMethodSignatureForSelector:selector];
    }
}

- (void)forwardInvocation:(NSInvocation *)invocation
{
    if (realWindow) {
        [invocation invokeWithTarget:realWindow];
    }
}

@end

@interface SKWSegmentedControl : NSSegmentedControl
{
    SKWSegmentedControlWindowProxy *windowProxy;
}

@end

@implementation SKWSegmentedControl

- (NSWindow *)window
{
if (!windowProxy) {
windowProxy = [[SKWSegmentedControlWindowProxy allocWithZone:NULL] initWithWindow:[super window]];
}
else if (![windowProxy window]) {
return [super window];
}
return (NSWindow *)windowProxy;
}


- (void)viewWillMoveToWindow:(NSWindow *)window
{
    [super viewWillMoveToWindow:window];
    [windowProxy setWindow:window];
}

- (void)dealloc
{
    [windowProxy setWindow:nil];
    [windowProxy release];
    windowProxy = nil;

    [super dealloc];
}

@end
--
Shaun Wexler
MacFOH
http://www.macfoh.com

"If God dropped acid, would he see people?" - Steven Wright


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: NSSegmentedControl Display Bug?
      • From: Ruediger Hanke <email@hidden>
References: 
 >Re: NSSegmentedControl Display Bug? (From: Ruediger Hanke <email@hidden>)

  • Prev by Date: Re: Catching a click during a loop
  • Next by Date: Re: Hiding a control on MacOS10.2
  • Previous by thread: Re: NSSegmentedControl Display Bug?
  • Next by thread: Re: NSSegmentedControl Display Bug?
  • Index(es):
    • Date
    • Thread