Skip to content

An implementation of the colour well seen in Pages 5, Numbers 3 and Keynote 6 (iWork).

License

Notifications You must be signed in to change notification settings

insidegui/DFColorWell

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DFColorWell

DFColorWell example.

An implementation of the colour well seen in Pages 5, Numbers 3 and Keynote 6.

All custom drawing is done with NSBezierPath (cached where possible), the usual NSEvent methods (-mouseDown:, -mouseUp:, -mouseDrag) are implemented to keep track of the control's state and turn on or off different drawing options. Colours can be dragged and dropped into or out of the colour well using the systems NSColorPanel. Delegate methods should be implemented to fill the popover grid with colour cells.

Any improvements welcomed.

Things that need adding & improvements

  • I wrote this on rMBP running OSX 10.10 so there may be some retina specific code which does not look good on other screens.

  • Want to add the ability to display custom views in the popover (from a user specified content view controller), this will enable users to design their own layout of colour cells etc.

Usage

  1. Drag out an NSView into a XIB

  2. Change the class to DFColorWell

    Changing the custom class screenshot

  3. Add placeholder intrinsic size to 67 by 23.

    NB DFColorWell sets the intrinsicContentSize because the control will always have a fixed size, so size constraints should not be used.

    Setting the placeholder intrinsic content size

  4. Implement all the required delegate methods which fills the pop over with different colours:

    - (NSUInteger) numberOfRowsInColorWell:(DFColorWell*)colorWell;
    - (NSUInteger) numberOfColumnsInColorWell:(DFColorWell*)colorWell;
    - (NSColor*) colorWell:(DFColorWell*)colorWell colorAtColumn:(NSUInteger)column row:(NSUInteger)row;

Contact

Licensing

DFColorWell is licensed under the BSD license.

About

An implementation of the colour well seen in Pages 5, Numbers 3 and Keynote 6 (iWork).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Objective-C 100.0%