FLTK 1.3.0
Fl_File_Browser.H
00001 //
00002 // "$Id: Fl_File_Browser.H 8306 2011-01-24 17:04:22Z matt $"
00003 //
00004 // FileBrowser definitions.
00005 //
00006 // Copyright 1999-2010 by Michael Sweet.
00007 //
00008 // This library is free software; you can redistribute it and/or
00009 // modify it under the terms of the GNU Library General Public
00010 // License as published by the Free Software Foundation; either
00011 // version 2 of the License, or (at your option) any later version.
00012 //
00013 // This library is distributed in the hope that it will be useful,
00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016 // Library General Public License for more details.
00017 //
00018 // You should have received a copy of the GNU Library General Public
00019 // License along with this library; if not, write to the Free Software
00020 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00021 // USA.
00022 //
00023 // Please report all bugs and problems on the following page:
00024 //
00025 //     http://www.fltk.org/str.php
00026 //
00027 
00028 /* \file
00029    Fl_File_Browser widget . */
00030 
00031 //
00032 // Include necessary header files...
00033 //
00034 
00035 #ifndef _Fl_File_Browser_H_
00036 #  define _Fl_File_Browser_H_
00037 
00038 #  include "Fl_Browser.H"
00039 #  include "Fl_File_Icon.H"
00040 #  include "filename.H"
00041 
00042 
00043 //
00044 // Fl_File_Browser class...
00045 //
00046 
00048 class FL_EXPORT Fl_File_Browser : public Fl_Browser {
00049   
00050   int           filetype_;
00051   const char    *directory_;
00052   uchar         iconsize_;
00053   const char    *pattern_;
00054 
00055   int           full_height() const;
00056   int           item_height(void *) const;
00057   int           item_width(void *) const;
00058   void          item_draw(void *, int, int, int, int) const;
00059   int           incr_height() const { return (item_height(0)); }
00060 
00061 public:
00062   enum { FILES, DIRECTORIES };
00063 
00068   Fl_File_Browser(int, int, int, int, const char * = 0);
00069 
00071   uchar         iconsize() const { return (iconsize_); };
00073   void          iconsize(uchar s) { iconsize_ = s; redraw(); };
00074 
00080   void  filter(const char *pattern);
00086   const char    *filter() const { return (pattern_); };
00087 
00095   int           load(const char *directory, Fl_File_Sort_F *sort = fl_numericsort);
00096 
00097   Fl_Fontsize  textsize() const { return Fl_Browser::textsize(); };
00098   void          textsize(Fl_Fontsize s) { Fl_Browser::textsize(s); iconsize_ = (uchar)(3 * s / 2); };
00099 
00106   int           filetype() const { return (filetype_); };
00113   void          filetype(int t) { filetype_ = t; };
00114 };
00115 
00116 #endif // !_Fl_File_Browser_H_
00117 
00118 //
00119 // End of "$Id: Fl_File_Browser.H 8306 2011-01-24 17:04:22Z matt $".
00120 //