2001-08-02 01:24:49 +04:00
|
|
|
//
|
2001-11-25 19:38:11 +03:00
|
|
|
// "$Id: Fl_File_Icon.H,v 1.1.2.4 2001/11/25 16:38:10 easysw Exp $"
|
2001-08-02 01:24:49 +04:00
|
|
|
//
|
2001-09-29 18:38:59 +04:00
|
|
|
// Fl_File_Icon definitions.
|
2001-08-02 01:24:49 +04:00
|
|
|
//
|
2001-08-02 20:17:04 +04:00
|
|
|
// Copyright 1999-2001 by Michael Sweet.
|
2001-08-02 01:24:49 +04:00
|
|
|
//
|
|
|
|
// This library is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Library General Public
|
|
|
|
// License as published by the Free Software Foundation; either
|
|
|
|
// version 2 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This library is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// Library General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Library General Public
|
|
|
|
// License along with this library; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
|
|
// USA.
|
|
|
|
//
|
2001-08-02 20:17:04 +04:00
|
|
|
// Please report all bugs and problems to "fltk-bugs@fltk.org".
|
2001-08-02 01:24:49 +04:00
|
|
|
//
|
|
|
|
|
|
|
|
//
|
|
|
|
// Include necessary header files...
|
|
|
|
//
|
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
#ifndef _Fl_Fl_File_Icon_H_
|
|
|
|
# define _Fl_Fl_File_Icon_H_
|
2001-08-02 01:24:49 +04:00
|
|
|
|
2001-08-02 20:17:04 +04:00
|
|
|
# include "Fl.H"
|
2001-08-02 01:24:49 +04:00
|
|
|
|
|
|
|
|
2001-10-29 06:44:33 +03:00
|
|
|
//
|
|
|
|
// Special color value for the icon color.
|
|
|
|
//
|
|
|
|
|
|
|
|
# define FL_ICON_COLOR (Fl_Color)0xffffffff
|
|
|
|
|
|
|
|
|
2001-08-02 01:24:49 +04:00
|
|
|
//
|
2001-09-29 18:38:59 +04:00
|
|
|
// Fl_File_Icon class...
|
2001-08-02 01:24:49 +04:00
|
|
|
//
|
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
class Fl_File_Icon //// Icon data
|
2001-08-02 01:24:49 +04:00
|
|
|
{
|
2001-09-29 18:38:59 +04:00
|
|
|
FL_EXPORT static Fl_File_Icon *first_; // Pointer to first icon/filetype
|
|
|
|
Fl_File_Icon *next_; // Pointer to next icon/filetype
|
2001-08-02 01:24:49 +04:00
|
|
|
const char *pattern_; // Pattern string
|
|
|
|
int type_; // Match only if directory or file?
|
|
|
|
int num_data_; // Number of data elements
|
|
|
|
int alloc_data_; // Number of allocated elements
|
|
|
|
short *data_; // Icon data
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
enum // File types
|
|
|
|
{
|
|
|
|
ANY, // Any kind of file
|
|
|
|
PLAIN, // Only plain files
|
|
|
|
FIFO, // Only named pipes
|
|
|
|
DEVICE, // Only character and block devices
|
|
|
|
LINK, // Only symbolic links
|
2001-08-02 20:17:04 +04:00
|
|
|
DIRECTORY // Only directories
|
2001-08-02 01:24:49 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
enum // Data opcodes
|
|
|
|
{
|
|
|
|
END, // End of primitive/icon
|
2001-10-29 06:44:33 +03:00
|
|
|
COLOR, // Followed by color value (2 shorts)
|
2001-08-02 01:24:49 +04:00
|
|
|
LINE, // Start of line
|
|
|
|
CLOSEDLINE, // Start of closed line
|
|
|
|
POLYGON, // Start of polygon
|
2001-10-29 06:44:33 +03:00
|
|
|
OUTLINEPOLYGON, // Followed by outline color (2 shorts)
|
2001-08-02 01:24:49 +04:00
|
|
|
VERTEX // Followed by scaled X,Y
|
|
|
|
};
|
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
FL_EXPORT Fl_File_Icon(const char *p, int t, int nd = 0, short *d = 0);
|
|
|
|
FL_EXPORT ~Fl_File_Icon();
|
2001-08-02 01:24:49 +04:00
|
|
|
|
2001-08-11 18:49:51 +04:00
|
|
|
FL_EXPORT short *add(short d);
|
2001-10-29 06:44:33 +03:00
|
|
|
short *add_color(Fl_Color c)
|
|
|
|
{ short *d = add(COLOR); add(c >> 16); add(c); return (d); }
|
2001-08-11 18:49:51 +04:00
|
|
|
short *add_vertex(int x, int y)
|
|
|
|
{ short *d = add(VERTEX); add(x); add(y); return (d); }
|
|
|
|
short *add_vertex(float x, float y)
|
|
|
|
{ short *d = add(VERTEX); add((int)(x * 10000.0));
|
|
|
|
add((int)(y * 10000.0)); return (d); }
|
|
|
|
void clear() { num_data_ = 0; }
|
|
|
|
FL_EXPORT void draw(int x, int y, int w, int h, Fl_Color ic, int active = 1);
|
|
|
|
FL_EXPORT void label(Fl_Widget *w);
|
|
|
|
FL_EXPORT static void labeltype(const Fl_Label *o, int x, int y, int w, int h, Fl_Align a);
|
|
|
|
FL_EXPORT void load(const char *f);
|
2001-11-25 19:38:11 +03:00
|
|
|
FL_EXPORT int load_fti(const char *fti);
|
|
|
|
FL_EXPORT int load_image(const char *i);
|
2001-08-11 18:49:51 +04:00
|
|
|
const char *pattern() { return (pattern_); }
|
|
|
|
int size() { return (num_data_); }
|
|
|
|
int type() { return (type_); }
|
|
|
|
short *value() { return (data_); }
|
2001-08-02 01:24:49 +04:00
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
FL_EXPORT static Fl_File_Icon *find(const char *filename, int filetype = ANY);
|
|
|
|
static Fl_File_Icon *first() { return (first_); }
|
2001-08-11 18:49:51 +04:00
|
|
|
FL_EXPORT static void load_system_icons(void);
|
2001-08-02 01:24:49 +04:00
|
|
|
};
|
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
#endif // !_Fl_Fl_File_Icon_H_
|
2001-08-02 01:24:49 +04:00
|
|
|
|
|
|
|
//
|
2001-11-25 19:38:11 +03:00
|
|
|
// End of "$Id: Fl_File_Icon.H,v 1.1.2.4 2001/11/25 16:38:10 easysw Exp $".
|
2001-08-02 01:24:49 +04:00
|
|
|
//
|