source: NonGTP/include/fltk/FileIcon.h @ 769

Revision 769, 3.1 KB checked in by gumbau, 18 years ago (diff)

FLTK imported to SVN repository to be linked agains the GeoTool? application

Line 
1//
2// "$Id: FileIcon.h 2871 2002-12-10 02:01:07Z easysw $"
3//
4// Fl_FileIcon definitions for the Fast Light Tool Kit (FLTK).
5//
6// Copyright 1997-1999 by Easy Software Products.
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 to "fltk-bugs@fltk.org".
24//
25
26#ifndef fltk_FileIcon_h
27#define fltk_FileIcon_h
28
29#include "FL_API.h"
30#include "Color.h"
31
32namespace fltk {
33
34  // This should be some kind of subclass of Image
35
36class FL_API FileIcon
37{
38  static FileIcon *first_;      // Pointer to first icon/filetype
39  FileIcon      *next_;         // Pointer to next icon/filetype
40  const char    *pattern_;      // Pattern string
41  int           type_;          // Match only if directory or file?
42  int           num_data_;      // Number of data elements
43  int           alloc_data_;    // Number of allocated elements
44  short         *data_;         // Icon data
45
46  public:
47
48  enum                          // File types
49  {
50    ANY,                        // Any kind of file
51    PLAIN,                      // Only plain files
52    FIFO,                       // Only named pipes
53    DEVICE,                     // Only character and block devices
54    LINK,                       // Only symbolic links
55    DIR                         // Only directories
56  };
57
58  enum                          // Data opcodes
59  {
60    END,                        // End of primitive/icon
61    COLOR,                      // Followed by color index
62    LINE,                       // Start of line
63    CLOSEDLINE,                 // Start of closed line
64    POLYGON,                    // Start of polygon
65    OUTLINEPOLYGON,             // Followed by outline color
66    VERTEX                      // Followed by scaled X,Y
67  };
68
69  FileIcon(const char *p, int t, int nd = 0, short *d = 0);
70  ~FileIcon();
71
72  short         *add(short d);
73  short         *add_color(short c)
74                { short *d = add(COLOR); add(c); return (d); }
75  short         *add_vertex(int x, int y)
76                { short *d = add(VERTEX); add(x); add(y); return (d); }
77  short         *add_vertex(float x, float y)
78                { short *d = add(VERTEX); add((int)(x * 10000.0));
79                  add((int)(y * 10000.0)); return (d); }
80  void          clear() { num_data_ = 0; }
81  void          draw(int x, int y, int w, int h, Color ic, int active = 1);
82  //  void              label(Widget *w);
83//  static void labeltype(const Label *o, int x, int y, int w, int h, Align a);
84  void          load(const char *f);
85  void          load_fti(const char *fti);
86  void          load_xpm(const char *xpm);
87  const char    *pattern() { return (pattern_); }
88  int           size() { return (num_data_); }
89  int           type() { return (type_); }
90  short         *value() { return (data_); }
91
92  static FileIcon *find(const char *filename, int filetype = ANY);
93  static FileIcon *first() { return (first_); }
94  static void   load_system_icons(void);
95};
96
97}
98
99#endif
100
101//
102// End of "$Id: FileIcon.h 2871 2002-12-10 02:01:07Z easysw $".
103//
Note: See TracBrowser for help on using the repository browser.