Update the changelog
[opencv] / otherlibs / _fltk / include / FL / Fl_File_Icon.H
1 //
2 // "$Id: Fl_File_Icon.H,v 1.2 2002/12/01 15:38:37 neurosurg Exp $"
3 //
4 // Fl_File_Icon definitions.
5 //
6 // Copyright 1999-2002 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 to "fltk-bugs@fltk.org".
24 //
25
26 //
27 // Include necessary header files...
28 //
29
30 #ifndef _Fl_Fl_File_Icon_H_
31 #  define _Fl_Fl_File_Icon_H_
32
33 #  include "Fl.H"
34
35
36 //
37 // Special color value for the icon color.
38 //
39
40 #  define FL_ICON_COLOR (Fl_Color)0xffffffff
41
42
43 //
44 // Fl_File_Icon class...
45 //
46
47 class FL_EXPORT Fl_File_Icon                    //// Icon data
48 {
49   static Fl_File_Icon *first_;  // Pointer to first icon/filetype
50   Fl_File_Icon  *next_;         // Pointer to next icon/filetype
51   const char    *pattern_;      // Pattern string
52   int           type_;          // Match only if directory or file?
53   int           num_data_;      // Number of data elements
54   int           alloc_data_;    // Number of allocated elements
55   short         *data_;         // Icon data
56
57   public:
58
59   enum                          // File types
60   {
61     ANY,                        // Any kind of file
62     PLAIN,                      // Only plain files
63     FIFO,                       // Only named pipes
64     DEVICE,                     // Only character and block devices
65     LINK,                       // Only symbolic links
66     DIRECTORY                   // Only directories
67   };
68
69   enum                          // Data opcodes
70   {
71     END,                        // End of primitive/icon
72     COLOR,                      // Followed by color value (2 shorts)
73     LINE,                       // Start of line
74     CLOSEDLINE,                 // Start of closed line
75     POLYGON,                    // Start of polygon
76     OUTLINEPOLYGON,             // Followed by outline color (2 shorts)
77     VERTEX                      // Followed by scaled X,Y
78   };
79
80   Fl_File_Icon(const char *p, int t, int nd = 0, short *d = 0);
81   ~Fl_File_Icon();
82
83   short         *add(short d);
84   short         *add_color(Fl_Color c)
85                 { short *d = add((short)COLOR); add((short)(c >> 16)); add((short)c); return (d); }
86   short         *add_vertex(int x, int y)
87                 { short *d = add((short)VERTEX); add((short)x); add((short)y); return (d); }
88   short         *add_vertex(float x, float y)
89                 { short *d = add((short)VERTEX); add((short)(x * 10000.0));
90                   add((short)(y * 10000.0)); return (d); }
91   void          clear() { num_data_ = 0; }
92   void          draw(int x, int y, int w, int h, Fl_Color ic, int active = 1);
93   void          label(Fl_Widget *w);
94   static void   labeltype(const Fl_Label *o, int x, int y, int w, int h, Fl_Align a);
95   void          load(const char *f);
96   int           load_fti(const char *fti);
97   int           load_image(const char *i);
98   Fl_File_Icon  *next() { return (next_); }
99   const char    *pattern() { return (pattern_); }
100   int           size() { return (num_data_); }
101   int           type() { return (type_); }
102   short         *value() { return (data_); }
103
104   static Fl_File_Icon *find(const char *filename, int filetype = ANY);
105   static Fl_File_Icon *first() { return (first_); }
106   static void   load_system_icons(void);
107 };
108
109 #endif // !_Fl_Fl_File_Icon_H_
110
111 //
112 // End of "$Id: Fl_File_Icon.H,v 1.2 2002/12/01 15:38:37 neurosurg Exp $".
113 //