Fl_File_Icon Class Reference

The Fl_File_Icon class manages icon images that can be used as labels in other widgets and as icons in the FileBrowser widget. More...

`#include <Fl_File_Icon.H>`

## Public Types

enum | { ANY, PLAIN, FIFO, DEVICE, LINK, DIRECTORY }
enum | { END, COLOR, LINE, CLOSEDLINE, POLYGON, OUTLINEPOLYGON, VERTEX }

## Public Member Functions

short * | add (short d)
| Adds a keyword value to the icon array, returning a pointer to it. More...
short * | add_color (Fl_Color c)
| Adds a color value to the icon array, returning a pointer to it. More...
short * | add_vertex (int x, int y)
| Adds a vertex value to the icon array, returning a pointer to it. More...
short * | add_vertex (float x, float y)
| Adds a vertex value to the icon array, returning a pointer to it. More...
void | clear ()
| Clears all icon data from the icon. More...
void | draw (int x, int y, int w, int h, Fl_Color ic, int active=1)
| Draws an icon in the indicated area. More...
| Fl_File_Icon (const char *p, int t, int nd=0, short *d=0)
| Creates a new Fl_File_Icon with the specified information. More...
void | label (Fl_Widget *w)
| Applies the icon to the widget, registering the Fl_File_Icon label type as needed. More...
void | load (const char *f)
| Loads the specified icon image. More...
int | load_fti (const char *fti)
| Loads an SGI icon file. More...
int | load_image (const char *i)
| Load an image icon file from an image filename. More...
Fl_File_Icon * | next ()
| Returns next file icon object. More...
const char * | pattern ()
| Returns the filename matching pattern for the icon. More...
int | size ()
| Returns the number of words of data used by the icon. More...
int | type ()
| Returns the filetype associated with the icon, which can be one of the following: More...
short * | value ()
| Returns the data array for the icon. More...
| ~Fl_File_Icon ()
| The destructor destroys the icon and frees all memory that has been allocated for it.

## Static Public Member Functions

static Fl_File_Icon * | find (const char *filename, int filetype=ANY)
| Finds an icon that matches the given filename and file type. More...
static Fl_File_Icon * | first ()
| Returns a pointer to the first icon in the list. More...
static void | labeltype (const Fl_Label *o, int x, int y, int w, int h, Fl_Align a)
| Draw the icon label. More...
static void | load_system_icons (void)
| Loads all system-defined icons. More...

## Detailed Description

The Fl_File_Icon class manages icon images that can be used as labels in other widgets and as icons in the FileBrowser widget.

## Constructor & Destructor Documentation

Fl_File_Icon::Fl_File_Icon | ( | const char * | p,
|  | int | t,
|  | int | nd = `0`,
|  | short * | d = `0`
| ) |  |

Creates a new Fl_File_Icon with the specified information.

Parameters

  [in] | p | filename pattern
  [in] | t | file type
  [in] | nd | number of data values
  [in] | d | data values

## Member Function Documentation

short * Fl_File_Icon::add | ( | short | d | ) |

Adds a keyword value to the icon array, returning a pointer to it.

Parameters

  [in] | d | data value

short* Fl_File_Icon::add_color | ( | Fl_Color | c | ) |

inline

Adds a color value to the icon array, returning a pointer to it.

Parameters

  [in] | c | color value

short* Fl_File_Icon::add_vertex | ( | int | x,
|  | int | y
| ) |  |

inline

Adds a vertex value to the icon array, returning a pointer to it.

The integer version accepts coordinates from 0 to 10000. The origin (0.0) is in the lower-lefthand corner of the icon.

Parameters

  [in] | x,y | vertex coordinates

short* Fl_File_Icon::add_vertex | ( | float | x,
|  | float | y
| ) |  |

inline

Adds a vertex value to the icon array, returning a pointer to it.

The floating point version goes from 0.0 to 1.0. The origin (0.0) is in the lower-lefthand corner of the icon.

Parameters

  [in] | x,y | vertex coordinates

void Fl_File_Icon::clear | ( |  | ) |

inline

Clears all icon data from the icon.

void Fl_File_Icon::draw | ( | int | x,
|  | int | y,
|  | int | w,
|  | int | h,
|  | Fl_Color | ic,
|  | int | active = `1`
| ) |  |

Draws an icon in the indicated area.

Parameters

  [in] | x,y,w,h | position and size
  [in] | ic | icon color
  [in] | active | status, default is active [non-zero]

Fl_File_Icon * Fl_File_Icon::find | ( | const char * | filename,
|  | int | filetype = `ANY`
| ) |  |

static

Finds an icon that matches the given filename and file type.

Parameters

  [in] | filename | name of file
  [in] | filetype | enumerated file type

Returns
  matching file icon or NULL

static Fl_File_Icon* Fl_File_Icon::first | ( |  | ) |

inlinestatic

Returns a pointer to the first icon in the list.

void Fl_File_Icon::label | ( | Fl_Widget * | w | ) |

Applies the icon to the widget, registering the Fl_File_Icon label type as needed.

Parameters

  [in] | w | widget for which this icon will become the label

void Fl_File_Icon::labeltype | ( | const Fl_Label * | o,
|  | int | x,
|  | int | y,
|  | int | w,
|  | int | h,
|  | Fl_Align | a
| ) |  |

static

Draw the icon label.

Parameters

  [in] | o | label data
  [in] | x,y,w,h | position and size of label
  [in] | a | label alignment [not used]

void Fl_File_Icon::load | ( | const char * | f | ) |

Loads the specified icon image.

The format is deduced from the filename.

Parameters

  [in] | f | filename

int Fl_File_Icon::load_fti | ( | const char * | fti | ) |

Loads an SGI icon file.

Parameters

  [in] | fti | icon filename

Returns
  0 on success, non-zero on error

int Fl_File_Icon::load_image | ( | const char * | ifile | ) |

Load an image icon file from an image filename.

Parameters

  [in] | ifile | image filename

Returns
  0 on success, non-zero on error

void Fl_File_Icon::load_system_icons | ( | void |  | ) |

static

Loads all system-defined icons.

This call is useful when using the FileChooser widget and should be used when the application starts:

Fl_File_Icon::load_system_icons();

Fl_File_Icon* Fl_File_Icon::next | ( |  | ) |

inline

Returns next file icon object.

See Fl_File_Icon::first()

const char* Fl_File_Icon::pattern | ( |  | ) |

inline

Returns the filename matching pattern for the icon.

int Fl_File_Icon::size | ( |  | ) |

inline

Returns the number of words of data used by the icon.

int Fl_File_Icon::type | ( |  | ) |

inline

Returns the filetype associated with the icon, which can be one of the following:

- Fl_File_Icon::ANY, any kind of file.
- Fl_File_Icon::PLAIN, plain files.
- Fl_File_Icon::FIFO, named pipes.
- Fl_File_Icon::DEVICE, character and block devices.
- Fl_File_Icon::LINK, symbolic links.
- Fl_File_Icon::DIRECTORY, directories.

short* Fl_File_Icon::value | ( |  | ) |

inline

Returns the data array for the icon.

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

- Fl_File_Icon.H
- Fl_File_Icon.cxx
- Fl_File_Icon2.cxx

- © 1998-2012 by Bill Spitzak and others.