[773] | 1 | // |
---|
| 2 | // "$Id: xpmImage.h 4419 2005-07-15 05:48:26Z spitzak $" |
---|
| 3 | // |
---|
| 4 | // Image subclass that draws the data from an xpm format file. |
---|
| 5 | // XPM is a file format designed for small icons in X, it can |
---|
| 6 | // be convienently #include'd to inline the image into a program. |
---|
| 7 | // Just pass the pointer defined by the file to the constructor. |
---|
| 8 | // |
---|
| 9 | // Copyright 1998-2003 by Bill Spitzak and others. |
---|
| 10 | // |
---|
| 11 | // This library is free software; you can redistribute it and/or |
---|
| 12 | // modify it under the terms of the GNU Library General Public |
---|
| 13 | // License as published by the Free Software Foundation; either |
---|
| 14 | // version 2 of the License, or (at your option) any later version. |
---|
| 15 | // |
---|
| 16 | // This library is distributed in the hope that it will be useful, |
---|
| 17 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 18 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
| 19 | // Library General Public License for more details. |
---|
| 20 | // |
---|
| 21 | // You should have received a copy of the GNU Library General Public |
---|
| 22 | // License along with this library; if not, write to the Free Software |
---|
| 23 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
---|
| 24 | // USA. |
---|
| 25 | // |
---|
| 26 | // Please report all bugs and problems to "fltk-bugs@fltk.org". |
---|
| 27 | // |
---|
| 28 | |
---|
| 29 | #ifndef fltk_xpmImage_h |
---|
| 30 | #define fltk_xpmImage_h |
---|
| 31 | |
---|
| 32 | #include "Image.h" |
---|
| 33 | |
---|
| 34 | namespace fltk { |
---|
| 35 | |
---|
| 36 | class FL_API xpmImage : public Image { |
---|
| 37 | Color fg, bg; // what color monochrome ones were drawn in |
---|
| 38 | public: |
---|
| 39 | const char * const * data; |
---|
| 40 | // XPM files define the data all kinds of ways, so the constructor |
---|
| 41 | // is overloaded to accept all the ones we have seen: |
---|
| 42 | xpmImage(const char * const * d, const char* name = 0) : |
---|
| 43 | Image(-1,0,name), fg(NO_COLOR), bg(NO_COLOR), data(d) {} |
---|
| 44 | xpmImage(const unsigned char* const * d, const char* name = 0) : |
---|
| 45 | Image(-1,0,name), fg(NO_COLOR), bg(NO_COLOR), data((char**)d) {} |
---|
| 46 | xpmImage(char ** d, const char* name = 0) : |
---|
| 47 | Image(-1,0,name), fg(NO_COLOR), bg(NO_COLOR), data(d) {} |
---|
| 48 | |
---|
| 49 | void _measure(int&, int&) const; |
---|
| 50 | void update(); |
---|
| 51 | |
---|
| 52 | }; |
---|
| 53 | |
---|
| 54 | } |
---|
| 55 | |
---|
| 56 | #endif |
---|
| 57 | |
---|
| 58 | // |
---|
| 59 | // End of "$Id: xpmImage.h 4419 2005-07-15 05:48:26Z spitzak $". |
---|
| 60 | // |
---|