Custom Cocoa Windows?

Discussion in 'Mac Programming' started by simX, Jan 5, 2006.

  1. macrumors 6502a

    simX

    Joined:
    May 28, 2002
    Location:
    Bay Area, CA
    #1
    I'd like to figure out a way to create those cool black-looking style floating palettes that Apple often creates, like the transparent black palette in iPhoto 5 that allows you to adjust brightness, contrast, color levels, etc. I believe these are also used in Motion as well.

    Basically it's like those bezel "windows" that come up when you increase or decrease the volume via the keyboard -- they come up for about 3 seconds and are transparent, and they fade away after about a second or so. The "windows" for my Xcode project are going to act similarly and look similar (i.e.: black/gray, partially transparent, all four corners are rounded), except that the delay to fade is going to be different -- on the order of 10 seconds.

    Ideally these windows would also be easily accessible via Cocoa methods (and not Carbon, because I'm not entirely familiar with Carbon).

    Anyone have any ideas? Thanks in advance.
     
  2. macrumors 68030

    Catfish_Man

    Joined:
    Sep 13, 2001
    Location:
    Portland, OR
    #2
    Apple's developer page has sample code for a round transparent window. You can probably work from there, although it might be somewhat tricky to duplicate the black Motion/Aperture/iPhoto style windows.
     
  3. macrumors regular

    Joined:
    Sep 12, 2005
    Location:
    SE London
    #3
    quicksilver have done it. maybe you could e-mail the developers and see how they did it
     
  4. Guest

    caveman_uk

    Joined:
    Feb 17, 2003
    Location:
    Hitchin, Herts, UK
    #4
  5. macrumors 603

    whooleytoo

    Joined:
    Aug 2, 2002
    Location:
    Cork, Ireland.
    #5
    Yup, work from this example to create a custom window with no title bar or border, then you can use

    Code:
    	// Make the window translucent
    	NSColor*	translucent = [NSColor colorWithDeviceRed:0.0 green:0.0 blue:0.0 alpha:0.6] ;
    	[myWindow setBackgroundColor:translucent];
    
    To set the window's colour and degree of translucency (tinker with the alpha parameter to suit your needs).
     
  6. thread starter macrumors 6502a

    simX

    Joined:
    May 28, 2002
    Location:
    Bay Area, CA
    #6
    Can you give me a URL? The FunkyOverlayWindow example doesn't show how to modify the shape of a window -- the "funky overlay window" is still rectangular in shape. The cited example of the round window seems to be exactly the thing I need, but I can't find it.

    [UPDATE: Found it!]
     

Share This Page