FLTK 1.4.4

Loading...
Searching...
No Matches
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 | { END , COLOR , LINE , CLOSEDLINE , POLYGON , OUTLINEPOLYGON , VERTEX }
enum | { ANY , PLAIN , FIFO , DEVICE , LINK , DIRECTORY }

## Public Member Functions
short * | add (short d)
| Adds a keyword value to the icon array, returning a pointer to it.
short * | add_color (Fl_Color c)
| Adds a color value to the icon array, returning a pointer to it.
short * | add_vertex (float x, float y)
| Adds a vertex value to the icon array, returning a pointer to it.
short * | add_vertex (int x, int y)
| Adds a vertex value to the icon array, returning a pointer to it.
void | clear ()
| Clears all icon data from the icon.
void | draw (int x, int y, int w, int h, Fl_Color ic, int active=1)
| Draws an icon in the indicated area.
| Fl_File_Icon (const char *p, int t, int nd=0, short *d=0)
| Creates a new Fl_File_Icon with the specified information.
void | label (Fl_Widget *w)
| Applies the icon to the widget, registering the Fl_File_Icon label type as needed.
void | load (const char *f)
| Loads the specified icon image.
int | load_fti (const char *fti)
| Loads an SGI icon file.
int | load_image (const char *i)
| Load an image icon file from an image filename.
Fl_File_Icon * | next ()
| Returns next file icon object.
const char * | pattern ()
| Returns the filename matching pattern for the icon.
int | size ()
| Returns the number of words of data used by the icon.
int | type ()
| Returns the filetype associated with the icon, which can be one of the following:
short * | value ()
| Returns the data array for the icon.
| ~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.
static Fl_File_Icon * | first ()
| Returns a pointer to the first icon in the list.
static void | labeltype (const Fl_Label *o, int x, int y, int w, int h, Fl_Align a)
| Draw the icon label.
static void | load_system_icons (void)
| Loads all system-defined icons.

## 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::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

## ◆ add()

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

## ◆ add_color()

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

## ◆ add_vertex() [1/2]

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

## ◆ add_vertex() [2/2]

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

## ◆ draw()

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]

## ◆ find()

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

## ◆ label()

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

## ◆ labeltype()

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]

## ◆ load()

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

Loads the specified icon image.

The format is deduced from the filename.

Parameters

  [in] | f | filename

## ◆ load_fti()

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

## ◆ load_image()

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

## ◆ load_system_icons()

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::load_system_icons
static void load_system_icons(void)
Loads all system-defined icons.
Definition Fl_File_Icon2.cxx:572

## ◆ next()

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

Returns next file icon object.

See Fl_File_Icon::first()

## ◆ type()

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.

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

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