fltk::FileBrowser Class Reference

Inherits fltk::Browser.

List of all members.

Public Types


Public Member Functions

void add (const char *line, FileIcon *icon)
const char * directory () const
 FileBrowser (int, int, int, int, const char *=0)
int filetype () const
void filetype (int t)
void filter (const char *pattern)
const char * filter () const
float icon_size () const
void icon_size (float f)
void insert (int n, const char *label, void *data)
void insert (int n, const char *label, FileIcon *icon)
int load (const char *directory, FileSortF *sort=(FileSortF *) fltk::numericsort)
bool show_hidden () const
void show_hidden (bool show)
void textsize (float s)
float textsize () const

Private Attributes

const char * directory_
int filetype_
float icon_size_
const char * pattern_
bool show_hidden_

Detailed Description

The fltk::FileBrowser widget displays a list of filenames, optionally with file-specific icons.

Member Enumeration Documentation

anonymous enum

The types of items this browser can show


Show all files


Show only directories

Constructor & Destructor Documentation

FileBrowser::FileBrowser ( int  X,
int  Y,
int  W,
int  H,
const char *  l = 0 

Create a FileBrowser widget

XUpper left-hand X coordinate
YUpper right-hand Y coordinate
WWidth in pixels
HHeight in pixels
lLabel text

Member Function Documentation

void FileBrowser::add ( const char *  line,
FileIcon *  icon 

Add a line to the filebrowser

lineName of the line to add
iconOptional icon to add to this item
const char* fltk::FileBrowser::directory ( ) const [inline]
The current directory
int fltk::FileBrowser::filetype ( ) const [inline]
The browser's current filetype
void fltk::FileBrowser::filetype ( int  t) [inline]

Sets the filetype

tThe new filetype. Can be either FileBrowser::DIRECTORIES or FileBrowser::FILES
void FileBrowser::filter ( const char *  pattern)

Set the filename filter.

patternPattern to filter with. Eventually should deal with proper regex!
const char* fltk::FileBrowser::filter ( ) const [inline]
The filter pattern
void fltk::FileBrowser::icon_size ( float  f) [inline]

Sets the icon size and redraws the browser

fThe new icon size
float fltk::FileBrowser::icon_size ( ) const [inline]
The icon size as a float
void FileBrowser::insert ( int  n,
const char *  label,
FileIcon *  icon 

Insert an item into the file browser at the 'n'th position

This shifts everything up to and including this position back and then places the current item in this spot.

nThe position to insert at. This will append if necessary
labelThe name of the line to add
iconOptional icon to add to this item
void fltk::FileBrowser::insert ( int  n,
const char *  label,
void *  data 
) [inline]

Inserts a line at the 'n'th position with Callback data set. This will not attempt to split the label at '/' characters

nThe position to insert at. This will append if necessary
labelThe label of the widget
dataThe callback data of the widget

Reimplemented from fltk::Menu.

int FileBrowser::load ( const char *  directory,
FileSortF *  sort = (FileSortF*) fltk::numericsort 

Load a directory into the browser.

directoryDirectory to load
sortSorting function to use
Number of files loaded
bool fltk::FileBrowser::show_hidden ( ) const [inline]
Whether or not we're currently showing hidden files
void fltk::FileBrowser::show_hidden ( bool  show) [inline]

Set this flag if you want to see the hidden files in the browser

showA flag to determine whether or not to show hidden files
void fltk::FileBrowser::textsize ( float  s) [inline]

Sets the current Browser's textsize and scales the icon size accordingly

sThe new text size

Reimplemented from fltk::Widget.

float fltk::FileBrowser::textsize ( ) const [inline]
the current Browser's textsize

Reimplemented from fltk::Widget.

Member Data Documentation

const char* fltk::FileBrowser::directory_ [private]

The current directory

The FileBrowser's icon sizes

const char* fltk::FileBrowser::pattern_ [private]

The filename glob pattern


Used to determine whether to show hidden files or not

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