PDA

View Full Version : NSColorPanel setSize?




Darkroom
Jun 27, 2008, 05:17 AM
is it possible to set the size of the NSColorPanel, pull down the swatches drawer and hide the toolbar all set to the app's defaults? i'd like to set it's default to the 2nd image...the 1st image is what the color panel looks like by default.



robbieduncan
Jun 27, 2008, 05:24 AM
I think you can, but it's up to you as the developer to manage it yourself: NSColourPanel won't save/restore for you. If you check the state every time the picker is closed via the normal NSWindow methods for size/position (-frame: (http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSWindow_Class/Reference/Reference.html#//apple_ref/occ/instm/NSWindow/frame)), toolbar visibility (-visible: (http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSToolbar_Class/Reference/Reference.html#//apple_ref/occ/instm/NSToolbar/isVisible)) and the mode of the NSColourPanel (-mode: (http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSColorPanel_Class/Reference/Reference.html#//apple_ref/occ/instm/NSColorPanel/mode)) you can save these to defaults. Whenever you create a new NSColourPanel simply use the correct methods to reset the panel to the defaults...