fltk  1.3.5-source
About: FLTK (Fast Light Tool Kit) is a cross-platform C++ GUI toolkit for UNIX/Linux (X11), Microsoft Windows, and MacOS X.
  Fossies Dox: fltk-1.3.5-source.tar.bz2  ("inofficial" and yet experimental doxygen-generated source code documentation)  

Fl_File_Icon Class Reference

#include <Fl_File_Icon.H>

Collaboration diagram for Fl_File_Icon:
[legend]

Public Types

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

Public Member Functions

 Fl_File_Icon (const char *p, int t, int nd=0, short *d=0)
 
 ~Fl_File_Icon ()
 
short * add (short d)
 
short * add_color (Fl_Color c)
 
short * add_vertex (int x, int y)
 
short * add_vertex (float x, float y)
 
void clear ()
 
void draw (int x, int y, int w, int h, Fl_Color ic, int active=1)
 
void label (Fl_Widget *w)
 
void load (const char *f)
 
int load_fti (const char *fti)
 
int load_image (const char *i)
 
Fl_File_Iconnext ()
 
const char * pattern ()
 
int size ()
 
int type ()
 
short * value ()
 

Static Public Member Functions

static void labeltype (const Fl_Label *o, int x, int y, int w, int h, Fl_Align a)
 
static Fl_File_Iconfind (const char *filename, int filetype=ANY)
 
static Fl_File_Iconfirst ()
 
static void load_system_icons (void)
 

Private Attributes

Fl_File_Iconnext_
 
const char * pattern_
 
int type_
 
int num_data_
 
int alloc_data_
 
short * data_
 

Static Private Attributes

static Fl_File_Iconfirst_ = (Fl_File_Icon *)0
 

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.

Definition at line 47 of file Fl_File_Icon.H.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
ANY 
PLAIN 
FIFO 
DEVICE 
LINK 
DIRECTORY 

Definition at line 59 of file Fl_File_Icon.H.

◆ anonymous enum

anonymous enum
Enumerator
END 
COLOR 
LINE 
CLOSEDLINE 
POLYGON 
OUTLINEPOLYGON 
VERTEX 

Definition at line 69 of file Fl_File_Icon.H.

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]pfilename pattern
[in]tfile type
[in]ndnumber of data values
[in]ddata values

Definition at line 82 of file Fl_File_Icon.cxx.

References alloc_data_, calloc(), data_, first_, next_, num_data_, p, pattern_, and type_.

Referenced by load_system_icons().

◆ ~Fl_File_Icon()

Fl_File_Icon::~Fl_File_Icon ( )

The destructor destroys the icon and frees all memory that has been allocated for it.

Definition at line 115 of file Fl_File_Icon.cxx.

References alloc_data_, data_, first_, free(), and next_.

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]ddata value

Definition at line 145 of file Fl_File_Icon.cxx.

References alloc_data_, data_, END, malloc(), NULL, and num_data_.

Referenced by load_fti(), and load_image().

◆ 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]ccolor value

Definition at line 89 of file Fl_File_Icon.H.

Referenced by load_fti(), and load_image().

◆ 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,yvertex coordinates

Definition at line 107 of file Fl_File_Icon.H.

References x, and y.

◆ 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,yvertex coordinates

Definition at line 98 of file Fl_File_Icon.H.

References x, and y.

Referenced by load_fti(), and load_image().

◆ clear()

void Fl_File_Icon::clear ( )
inline

Clears all icon data from the icon.

Definition at line 112 of file Fl_File_Icon.H.

◆ 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,hposition and size
[in]icicon color
[in]activestatus, default is active [non-zero]

Definition at line 248 of file Fl_File_Icon.cxx.

References CLOSEDLINE, COLOR, data_, END, fl_begin_complex_polygon(), fl_begin_line(), fl_begin_loop(), fl_color(), fl_end_complex_polygon(), fl_end_line(), fl_end_loop(), fl_end_polygon(), FL_ICON_COLOR, fl_inactive(), fl_pop_matrix(), fl_push_matrix(), fl_scale(), fl_translate(), fl_vertex(), LINE, NULL, num_data_, OUTLINEPOLYGON, POLYGON, VERTEX, x, and y.

◆ 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]filenamename of file
[in]filetypeenumerated file type
Returns
matching file icon or NULL

Definition at line 181 of file Fl_File_Icon.cxx.

References ANY, DEVICE, DIRECTORY, FIFO, filename, first_, fl_filename_isdir(), fl_filename_match(), fl_filename_name(), fl_stat(), LINK, name, next_, pattern_, PLAIN, S_ISBLK, S_ISCHR, S_ISDIR, S_ISFIFO, S_ISLNK, and type_.

Referenced by Fl_File_Chooser::favoritesCB(), and Fl_File_Browser::load().

◆ first()

static Fl_File_Icon* Fl_File_Icon::first ( )
inlinestatic

Returns a pointer to the first icon in the list.

Definition at line 151 of file Fl_File_Icon.H.

Referenced by Fl_File_Browser::item_draw(), Fl_File_Browser::item_height(), and Fl_File_Browser::item_width().

◆ 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]wwidget for which this icon will become the label

Definition at line 450 of file Fl_File_Icon.cxx.

References _FL_ICON_LABEL, Fl_Widget::label(), labeltype(), and Fl::set_labeltype().

◆ 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]olabel data
[in]x,y,w,hposition and size of label
[in]alabel alignment [not used]

Definition at line 464 of file Fl_File_Icon.cxx.

References Fl_Label::color, Fl_Box::draw(), icon, Fl_Label::value, x, and y.

Referenced by label().

◆ load()

void Fl_File_Icon::load ( const char *  f)

Loads the specified icon image. The format is deduced from the filename.

Parameters
[in]ffilename

Definition at line 97 of file Fl_File_Icon2.cxx.

References f, fl_filename_ext(), load_fti(), load_image(), and Fl::warning.

◆ load_fti()

int Fl_File_Icon::load_fti ( const char *  fti)

Loads an SGI icon file.

Parameters
[in]ftiicon filename
Returns
0 on success, non-zero on error

Definition at line 124 of file Fl_File_Icon2.cxx.

References add(), add_color(), add_vertex(), CLOSEDLINE, command(), data_, END, Fl::error, f, FL_BLACK, fl_color_average(), FL_DARK3, fl_fopen(), FL_ICON_COLOR, LINE, NULL, num_data_, OUTLINEPOLYGON, POLYGON, x, and y.

Referenced by load().

◆ load_image()

int Fl_File_Icon::load_image ( const char *  ifile)

Load an image icon file from an image filename.

Parameters
[in]ifileimage filename
Returns
0 on success, non-zero on error

Definition at line 341 of file Fl_File_Icon2.cxx.

References add(), add_color(), add_vertex(), Fl_Image::count(), Fl_Image::d(), Fl_Image::data(), data_, END, FL_BLACK, FL_GRAY, fl_rgb_color(), FL_WHITE, Fl_Shared_Image::get(), Fl_Image::h(), Fl_Image::ld(), ncolors, NULL, num_data_, POLYGON, Fl_Shared_Image::release(), Fl_Image::w(), x, and y.

Referenced by load().

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

Definition at line 596 of file Fl_File_Icon2.cxx.

References COLOR, dir, DIRECTORY, END, filename, first_, FL_BLACK, FL_BLUE, Fl_File_Icon(), FL_GRAY, FL_GREEN, FL_PATH_MAX, FL_RED, fl_register_images(), FL_WHITE, icon, kdedir, LINE, LINK, load_kde_icons(), next_, NULL, OUTLINEPOLYGON, PLAIN, POLYGON, snprintf, and VERTEX.

Referenced by main().

◆ next()

Fl_File_Icon* Fl_File_Icon::next ( )
inline

Returns next file icon object. See Fl_File_Icon::first()

Definition at line 124 of file Fl_File_Icon.H.

◆ pattern()

const char* Fl_File_Icon::pattern ( )
inline

Returns the filename matching pattern for the icon.

Definition at line 127 of file Fl_File_Icon.H.

◆ size()

int Fl_File_Icon::size ( )
inline

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

Definition at line 130 of file Fl_File_Icon.H.

◆ type()

int Fl_File_Icon::type ( )
inline

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

Definition at line 143 of file Fl_File_Icon.H.

◆ value()

short* Fl_File_Icon::value ( )
inline

Returns the data array for the icon.

Definition at line 146 of file Fl_File_Icon.H.

Member Data Documentation

◆ alloc_data_

int Fl_File_Icon::alloc_data_
private

Definition at line 54 of file Fl_File_Icon.H.

Referenced by add(), Fl_File_Icon(), and ~Fl_File_Icon().

◆ data_

short* Fl_File_Icon::data_
private

Definition at line 55 of file Fl_File_Icon.H.

Referenced by add(), draw(), Fl_File_Icon(), load_fti(), load_image(), and ~Fl_File_Icon().

◆ first_

Fl_File_Icon * Fl_File_Icon::first_ = (Fl_File_Icon *)0
staticprivate

Definition at line 49 of file Fl_File_Icon.H.

Referenced by find(), Fl_File_Icon(), load_system_icons(), and ~Fl_File_Icon().

◆ next_

Fl_File_Icon* Fl_File_Icon::next_
private

Definition at line 50 of file Fl_File_Icon.H.

Referenced by find(), Fl_File_Icon(), load_system_icons(), and ~Fl_File_Icon().

◆ num_data_

int Fl_File_Icon::num_data_
private

Definition at line 53 of file Fl_File_Icon.H.

Referenced by add(), draw(), Fl_File_Icon(), load_fti(), and load_image().

◆ pattern_

const char* Fl_File_Icon::pattern_
private

Definition at line 51 of file Fl_File_Icon.H.

Referenced by find(), and Fl_File_Icon().

◆ type_

int Fl_File_Icon::type_
private

Definition at line 52 of file Fl_File_Icon.H.

Referenced by find(), and Fl_File_Icon().


The documentation for this class was generated from the following files:
Fl_File_Icon::load_system_icons
static void load_system_icons(void)
Definition: Fl_File_Icon2.cxx:596