Giter Club home page Giter Club logo

dfcolorwell's Introduction

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.

dfcolorwell's People

Contributors

danieljfarrell avatar insidegui avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.