FLTK 1.3.3
Fl_File_Browser.H
1 //
2 // "$Id: Fl_File_Browser.H 8864 2011-07-19 04:49:30Z greg.ercolano $"
3 //
4 // FileBrowser definitions.
5 //
6 // Copyright 1999-2010 by Michael Sweet.
7 //
8 // This library is free software. Distribution and use rights are outlined in
9 // the file "COPYING" which should have been included with this file. If this
10 // file is missing or damaged, see the license at:
11 //
12 // http://www.fltk.org/COPYING.php
13 //
14 // Please report all bugs and problems on the following page:
15 //
16 // http://www.fltk.org/str.php
17 //
18 
19 /* \file
20  Fl_File_Browser widget . */
21 
22 //
23 // Include necessary header files...
24 //
25 
26 #ifndef _Fl_File_Browser_H_
27 # define _Fl_File_Browser_H_
28 
29 # include "Fl_Browser.H"
30 # include "Fl_File_Icon.H"
31 # include "filename.H"
32 
33 
34 //
35 // Fl_File_Browser class...
36 //
37 
39 class FL_EXPORT Fl_File_Browser : public Fl_Browser {
40 
41  int filetype_;
42  const char *directory_;
43  uchar iconsize_;
44  const char *pattern_;
45 
46  int full_height() const;
47  int item_height(void *) const;
48  int item_width(void *) const;
49  void item_draw(void *, int, int, int, int) const;
50  int incr_height() const { return (item_height(0)); }
51 
52 public:
53  enum { FILES, DIRECTORIES };
54 
59  Fl_File_Browser(int, int, int, int, const char * = 0);
60 
62  uchar iconsize() const { return (iconsize_); };
64  void iconsize(uchar s) { iconsize_ = s; redraw(); };
65 
71  void filter(const char *pattern);
77  const char *filter() const { return (pattern_); };
78 
86  int load(const char *directory, Fl_File_Sort_F *sort = fl_numericsort);
87 
88  Fl_Fontsize textsize() const { return Fl_Browser::textsize(); };
89  void textsize(Fl_Fontsize s) { Fl_Browser::textsize(s); iconsize_ = (uchar)(3 * s / 2); };
90 
97  int filetype() const { return (filetype_); };
104  void filetype(int t) { filetype_ = t; };
105 };
106 
107 #endif // !_Fl_File_Browser_H_
108 
109 //
110 // End of "$Id: Fl_File_Browser.H 8864 2011-07-19 04:49:30Z greg.ercolano $".
111 //
Fl_Fontsize textsize() const
Gets the default text size (in pixels) for the lines in the browser.
Definition: Fl_Browser_.H:301
void iconsize(uchar s)
Sets or gets the size of the icons.
Definition: Fl_File_Browser.H:64
void redraw()
Schedules the drawing of the widget.
Definition: Fl.cxx:1706
int item_height(void *item) const
Returns height of item in pixels.
Definition: Fl_Browser.cxx:361
File names and URI utility functions.
int load(const char *filename)
Clears the browser and reads the file, adding each line from the file to the browser.
Definition: Fl_Browser_load.cxx:35
The Fl_File_Browser widget displays a list of filenames, optionally with file-specific icons...
Definition: Fl_File_Browser.H:39
int item_width(void *item) const
Returns width of item in pixels.
Definition: Fl_Browser.cxx:421
void item_draw(void *item, int X, int Y, int W, int H) const
Draws item at the position specified by X Y W H.
Definition: Fl_Browser.cxx:504
uchar iconsize() const
Sets or gets the size of the icons.
Definition: Fl_File_Browser.H:62
int( Fl_File_Sort_F)(struct dirent **, struct dirent **)
File sorting function.
Definition: filename.H:116
int full_height() const
The height of the entire list of all visible() items in pixels.
Definition: Fl_Browser.cxx:482
void filetype(int t)
Sets or gets the file browser type, FILES or DIRECTORIES.
Definition: Fl_File_Browser.H:104
int Fl_Fontsize
Size of a font in pixels.
Definition: Enumerations.H:768
int filetype() const
Sets or gets the file browser type, FILES or DIRECTORIES.
Definition: Fl_File_Browser.H:97
The Fl_Browser widget displays a scrolling list of text lines, and manages all the storage for the te...
Definition: Fl_Browser.H:80
const char * filter() const
Sets or gets the filename filter.
Definition: Fl_File_Browser.H:77
int incr_height() const
The default 'average' item height (including inter-item spacing) in pixels.
Definition: Fl_Browser.cxx:493
unsigned char uchar
unsigned char
Definition: fl_types.h:30