Laxkit  0.0.7.1
Public Member Functions | Protected Member Functions | Protected Attributes
Laxkit::IconManager Class Reference

Simplify maintenance of icons with this stack of IconNode objects. More...

Inheritance diagram for Laxkit::IconManager:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 IconManager ()
int InstallIcon (const char *nname, int nid, const char *file)
 Return -1 for fail to load file.
int InstallIcon (const char *nname, int nid, Laxkit::LaxImage *img)
Laxkit::LaxImageGetIconByIndex (int index)
 Returns the icon. The icon's count is incremented.
Laxkit::LaxImageGetIcon (int id)
 Returns the icon. The icon's count is incremented.
Laxkit::LaxImageGetIcon (const char *name)
 Returns the icon. The icon's count is incremented.
int HowMany ()
 Return how many icons are currently installed.
void addpath (const char *newpath)
 Add path to index 0 position of the path stack.
- Public Member Functions inherited from Laxkit::PtrStack< IconNode >
 PtrStack (char nar=1)
virtual IconNodeoperator[] (int i)
virtual void flush ()
virtual int howmany ()
virtual void swap (int i1, int i2)
virtual int push (IconNode *nd, char local=-1, int where=-1)
virtual int popp (IconNode *topop, int *local=NULL)
virtual int pop (IconNode *&popped, int which=-1, int *local=NULL)
virtual IconNodepop (int which=-1, int *local=NULL)
virtual int findindex (IconNode *t)
virtual int remove (int which=-1)
virtual int pushnodup (IconNode *nd, char local, int where=-1)
virtual void Delta (int ndelta)
virtual int Delta ()
virtual IconNode ** extractArrays (char **local=NULL, int *nn=NULL)
virtual int insertArrays (IconNode **a, char *nl, int nn)

Protected Member Functions

Laxkit::LaxImagefindicon (const char *name)
 Search for a icon file "name.png" in all the icon paths.

Protected Attributes

Laxkit::PtrStack< charicon_path
- Protected Attributes inherited from Laxkit::PtrStack< IconNode >
int max
int delta
char arrays

Additional Inherited Members

- Public Attributes inherited from Laxkit::PtrStack< IconNode >
charislocal
int n
IconNode ** e

Detailed Description

Simplify maintenance of icons with this stack of IconNode objects.

This is essentially a Laxkit::RefStackPtr<IconNode> with some helper functions to ease lookup of icons as button boxes come and go. The stack is sorted by id.

Todo:
Eventually, it might be in charge of generating pixmap icons from an icons.svg or icons.laidout or something of the kind.

Constructor & Destructor Documentation

Laxkit::IconManager::IconManager ( )

Icons are added only when needed by GetIcon(), which uses findicon().


Member Function Documentation

void Laxkit::IconManager::addpath ( const char newpath)

Add path to index 0 position of the path stack.

When passed a name that is unrecognized, then the all the icon paths are searched for a loadable image named name.png.

References newstr(), and Laxkit::PtrStack< T >::push().

LaxImage * Laxkit::IconManager::findicon ( const char name)
protected

Search for a icon file "name.png" in all the icon paths.

Install and return the icon if found, else NULL.

This function assumes that name is not already in the stack.

References appendstr(), Laxkit::PtrStack< T >::e, Laxkit::anObject::inc_count(), InstallIcon(), Laxkit::load_image, Laxkit::PtrStack< T >::n, and newstr().

Referenced by GetIcon().

Laxkit::LaxImage * Laxkit::IconManager::GetIcon ( const char name)

Returns the icon. The icon's count is incremented.

If name does not exist, then the icon is searched for in the icon paths, and the first one found is installed.

References findicon().

int Laxkit::IconManager::InstallIcon ( const char nname,
int  nid,
Laxkit::LaxImage img 
)

If nid<=0, then make the id one more than the maximum nid in stack.

Todo:
*** must check that the icon is not already installed

References Laxkit::PtrStack< IconNode >::e, Laxkit::PtrStack< IconNode >::n, and Laxkit::PtrStack< IconNode >::push().


The documentation for this class was generated from the following files:

Mon Feb 17 2014 11:52:59, Laxkit