FLTK 1.4.5: Fl_File_Browser.H Source File

FLTK 1.4.5

Loading...
Searching...
No Matches
Fl_File_Browser.H
1//
2// FileBrowser definitions.
3//
4// Copyright 1999-2010 by Michael Sweet.
5//
6// This library is free software. Distribution and use rights are outlined in
7// the file "COPYING" which should have been included with this file. If this
8// file is missing or damaged, see the license at:
9//
10// https://www.fltk.org/COPYING.php
11//
12// Please see the following page on how to report bugs and issues:
13//
14// https://www.fltk.org/bugs.php
15//
16
17/* \file
18 Fl_File_Browser widget . */
19
20//
21// Include necessary header files...
22//
23
24#ifndef _Fl_File_Browser_H_
25# define _Fl_File_Browser_H_
26
27# include "Fl_Browser.H"
28# include "Fl_File_Icon.H"
29# include "filename.H"
30
31
32//
33// Fl_File_Browser class...
34//
35
37 class FL_EXPORT Fl_File_Browser : public Fl_Browser {
38
39 int filetype_;
40 const char *directory_;
41 uchar iconsize_;
42 const char *pattern_;
43 const char *errmsg_;
44
45 int full_height() const FL_OVERRIDE;
46 int item_height(void *) const FL_OVERRIDE;
47 int item_width(void *) const FL_OVERRIDE;
48 void item_draw(void *, int, int, int, int) const FL_OVERRIDE;
49 int incr_height() const FL_OVERRIDE { return (item_height(0) + linespacing()); }
50
51public:
52 enum { FILES, DIRECTORIES };
53
54 Fl_File_Browser(int, int, int, int, const char * = 0);
55 ~Fl_File_Browser();
56
58 uchar iconsize() const { return (iconsize_); }
60 void iconsize(uchar s) { iconsize_ = s; redraw(); }
61
67 void filter(const char *pattern);
73 const char *filter() const { return (pattern_); }
74 int load(const char *directory, Fl_File_Sort_F *sort = fl_numericsort);
75 Fl_Fontsize textsize() const { return Fl_Browser::textsize(); }
76 void textsize(Fl_Fontsize s) { Fl_Browser::textsize(s); iconsize_ = (uchar)(3 * s / 2); }
77
84 int filetype() const { return (filetype_); }
91 void filetype(int t) { filetype_ = t; }
92 void errmsg(const char *emsg);
96 const char* errmsg() const { return errmsg_; }
97};
98
99#endif // !_Fl_File_Browser_H_
Fl_Fontsize
int Fl_Fontsize
Size of a font in pixels.
Definition Enumerations.H:1092
Fl_Browser_::linespacing
int linespacing() const
Return the height of additional spacing between browser lines.
Definition Fl_Browser_.H:414
Fl_Browser::load
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:33
Fl_Browser::item_width
int item_width(void *item) const FL_OVERRIDE
Returns width of item in pixels.
Definition Fl_Browser.cxx:421
Fl_Browser::incr_height
int incr_height() const FL_OVERRIDE
The default 'average' item height (including inter-item spacing) in pixels.
Definition Fl_Browser.cxx:491
Fl_Browser::Fl_Browser
Fl_Browser(int X, int Y, int W, int H, const char *L=0)
The constructor makes an empty browser.
Definition Fl_Browser.cxx:599
Fl_Browser::textsize
Fl_Fontsize textsize() const
Gets the default text size (in pixels) for the lines in the browser.
Definition Fl_Browser.H:153
Fl_Browser::item_draw
void item_draw(void *item, int X, int Y, int W, int H) const FL_OVERRIDE
Draws item at the position specified by X Y W H.
Definition Fl_Browser.cxx:502
Fl_Browser::item_height
int item_height(void *item) const FL_OVERRIDE
Returns height of item in pixels.
Definition Fl_Browser.cxx:361
Fl_Browser::full_height
int full_height() const FL_OVERRIDE
The height of the entire list of all visible() items in pixels.
Definition Fl_Browser.cxx:480
Fl_File_Browser::errmsg
const char * errmsg() const
Returns OS error messages, or NULL if none.
Definition Fl_File_Browser.H:96
Fl_File_Browser::filter
const char * filter() const
Sets or gets the filename filter.
Definition Fl_File_Browser.H:73
Fl_File_Browser::Fl_File_Browser
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:360
Fl_File_Browser::iconsize
void iconsize(uchar s)
Sets or gets the size of the icons.
Definition Fl_File_Browser.H:60
Fl_File_Browser::iconsize
uchar iconsize() const
Sets or gets the size of the icons.
Definition Fl_File_Browser.H:58
Fl_File_Browser::filetype
int filetype() const
Sets or gets the file browser type, FILES or DIRECTORIES.
Definition Fl_File_Browser.H:84
Fl_File_Browser::filetype
void filetype(int t)
Sets or gets the file browser type, FILES or DIRECTORIES.
Definition Fl_File_Browser.H:91
Fl_Widget::redraw
void redraw()
Schedules the drawing of the widget.
Definition Fl.cxx:1668
filename.H
File names and URI utility functions.
FL_OVERRIDE
#define FL_OVERRIDE
This macro makes it safe to use the C++11 keyword override with older compilers.
Definition fl_attr.h:46
uchar
unsigned char uchar
unsigned char
Definition fl_types.h:30
Fl_File_Sort_F
int Fl_File_Sort_F(struct dirent **, struct dirent **)
File sorting function.
Definition filename.H:114
fl_numericsort
int fl_numericsort(struct dirent **A, struct dirent **B)
Compares directory entries alphanumerically (case-sensitive).
Definition numericsort.c:127