NTK 1.3.0
Fl_File_Browser.H
1//
2// "$Id: Fl_File_Browser.H 8306 2011-01-24 17:04:22Z matt $"
3//
4// FileBrowser definitions.
5//
6// Copyright 1999-2010 by Michael Sweet.
7//
8// This library is free software; you can redistribute it and/or
9// modify it under the terms of the GNU Library General Public
10// License as published by the Free Software Foundation; either
11// version 2 of the License, or (at your option) any later version.
12//
13// This library is distributed in the hope that it will be useful,
14// but WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16// Library General Public License for more details.
17//
18// You should have received a copy of the GNU Library General Public
19// License along with this library; if not, write to the Free Software
20// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
21// USA.
22//
23// Please report all bugs and problems on the following page:
24//
25// http://www.fltk.org/str.php
26//
27
28/* \file
29 Fl_File_Browser widget . */
30
31//
32// Include necessary header files...
33//
34
35#ifndef _Fl_File_Browser_H_
36# define _Fl_File_Browser_H_
37
38# include "Fl_Browser.H"
39# include "Fl_File_Icon.H"
40# include "filename.H"
41
42
43//
44// Fl_File_Browser class...
45//
46
48class FL_EXPORT Fl_File_Browser : public Fl_Browser {
49
50 int filetype_;
51 const char *directory_;
52 uchar iconsize_;
53 const char *pattern_;
54
55 int full_height() const;
56 int item_height(void *) const;
57 int item_width(void *) const;
58 void item_draw(void *, int, int, int, int) const;
59 int incr_height() const { return (item_height(0)); }
60
61public:
62 enum { FILES, DIRECTORIES };
63
68 Fl_File_Browser(int, int, int, int, const char * = 0);
69
71 uchar iconsize() const { return (iconsize_); };
73 void iconsize(uchar s) { iconsize_ = s; redraw(); };
74
80 void filter(const char *pattern);
86 const char *filter() const { return (pattern_); };
87
95 int load(const char *directory, Fl_File_Sort_F *sort = fl_numericsort);
96
97 Fl_Fontsize textsize() const { return Fl_Browser::textsize(); };
98 void textsize(Fl_Fontsize s) { Fl_Browser::textsize(s); iconsize_ = (uchar)(3 * s / 2); };
99
106 int filetype() const { return (filetype_); };
113 void filetype(int t) { filetype_ = t; };
114};
115
116#endif // !_Fl_File_Browser_H_
117
118//
119// End of "$Id: Fl_File_Browser.H 8306 2011-01-24 17:04:22Z matt $".
120//
int Fl_Fontsize
Size of a font in pixels.
Definition Enumerations.H:736
Fl_Fontsize textsize() const
Gets the default text size (in pixels) for the lines in the browser.
Definition Fl_Browser_.H:292
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:44
int item_height(void *item) const
Returns height of item in pixels.
Definition Fl_Browser.cxx:371
Fl_Browser(int X, int Y, int W, int H, const char *L=0)
The constructor makes an empty browser.
Definition Fl_Browser.cxx:614
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:516
int incr_height() const
The default 'average' item height (including inter-item spacing) in pixels.
Definition Fl_Browser.cxx:505
int item_width(void *item) const
Returns width of item in pixels.
Definition Fl_Browser.cxx:432
int full_height() const
The height of the entire list of all visible() items in pixels.
Definition Fl_Browser.cxx:494
const char * filter() const
Sets or gets the filename filter.
Definition Fl_File_Browser.H:86
Fl_File_Browser(int, int, int, int, const char *=0)
The constructor creates the Fl_File_Browser widget at the specified position and size.
Definition Fl_File_Browser.cxx:400
void iconsize(uchar s)
Sets or gets the size of the icons.
Definition Fl_File_Browser.H:73
uchar iconsize() const
Sets or gets the size of the icons.
Definition Fl_File_Browser.H:71
int filetype() const
Sets or gets the file browser type, FILES or DIRECTORIES.
Definition Fl_File_Browser.H:106
void filetype(int t)
Sets or gets the file browser type, FILES or DIRECTORIES.
Definition Fl_File_Browser.H:113
void redraw()
Schedules the drawing of the widget.
Definition Fl.cxx:1571
unsigned char uchar
unsigned char
Definition fl_types.h:39
int Fl_File_Sort_F(struct dirent **, struct dirent **)
File sorting function.
Definition filename.H:122