Happy !

peteruhnak / IconFactory

Project infos

License MIT
Tags icons
Creation date 2015-04-04
Website

Monticello registration

About IconFactory

IconFactory is a utility for creating icons from files ala ThemeIcons.

usage-demo selectors

1. Installation

Install me from Catalog Browser

alternatively you can load me manually

Gofer new
    smalltalkhubUser: 'peteruhnak' project: 'IconFactory';
    package: 'IconFactory';
    load.

2. Preparing an Icons Class

If you wish to have support for:

  • GTInspector support listing the icons
  • icon cache
  • singleton icon class

Then run (MyIcons class must already exist)

IconFactory new setup: MyIcons.

Note that this will create/override initialize method in MyIcons!

3. Loading the Icons and Creating Selectors

To create the selectors you need to run

IconFactory new 
    createIconsFromDirectory: '/my/directory/containing/png/icons'
    inClass: MyIcons.

If you skipped the first step and do not want to use cache, use this instead

IconFactory new
    noCache;
    createIconsFromDirectory: '/my/directory/containing/png/icons'
    inClass: MyIcons.

4. Using the icons

The name of the selector is based on the file name, so for file /my/directory/logo.png you can use MyIcons current logoIcon.

(Or MyIcons new logoIcon if you don't use cache.)