FLTK 1.3.9
Loading...
Searching...
No Matches
Fl_File_Browser.H
1//
2// "$Id$"
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
39class 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
52public:
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$".
111//
int Fl_Fontsize
Size of a font in pixels.
Definition Enumerations.H:904
The Fl_Browser widget displays a scrolling list of text lines, and manages all the storage for the te...
Definition Fl_Browser.H:80
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
int item_height(void *item) const
Returns height of item in pixels.
Definition Fl_Browser.cxx:363
Fl_Fontsize textsize() const
Gets the default text size (in pixels) for the lines in the browser.
Definition Fl_Browser.H:147
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:506
int incr_height() const
The default 'average' item height (including inter-item spacing) in pixels.
Definition Fl_Browser.cxx:495
int item_width(void *item) const
Returns width of item in pixels.
Definition Fl_Browser.cxx:423
int full_height() const
The height of the entire list of all visible() items in pixels.
Definition Fl_Browser.cxx:484
The Fl_File_Browser widget displays a list of filenames, optionally with file-specific icons.
Definition Fl_File_Browser.H:39
const char * filter() const
Sets or gets the filename filter.
Definition Fl_File_Browser.H:77
void iconsize(uchar s)
Sets or gets the size of the icons.
Definition Fl_File_Browser.H:64
uchar iconsize() const
Sets or gets the size of the icons.
Definition Fl_File_Browser.H:62
int filetype() const
Sets or gets the file browser type, FILES or DIRECTORIES.
Definition Fl_File_Browser.H:97
void filetype(int t)
Sets or gets the file browser type, FILES or DIRECTORIES.
Definition Fl_File_Browser.H:104
void redraw()
Schedules the drawing of the widget.
Definition Fl.cxx:1786
File names and URI utility functions.
unsigned char uchar
unsigned char
Definition fl_types.h:30
int() Fl_File_Sort_F(struct dirent **, struct dirent **)
File sorting function.
Definition filename.H:116