FLTK 1.3.0
Fl_Pixmap.H
00001 //
00002 // "$Id: Fl_Pixmap.H 7903 2010-11-28 21:06:39Z matt $"
00003 //
00004 // Pixmap header file for the Fast Light Tool Kit (FLTK).
00005 //
00006 // Copyright 1998-2010 by Bill Spitzak and others.
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_Pixmap widget . */
00030 
00031 #ifndef Fl_Pixmap_H
00032 #define Fl_Pixmap_H
00033 #  include "Fl_Image.H"
00034 
00035 class Fl_Widget;
00036 struct Fl_Menu_Item;
00037 
00038 // Older C++ compilers don't support the explicit keyword... :(
00039 #  if defined(__sgi) && !defined(_COMPILER_VERSION)
00040 #    define explicit
00041 #  endif // __sgi && !_COMPILER_VERSION
00042 
00047 class FL_EXPORT Fl_Pixmap : public Fl_Image {
00048   friend class Fl_Quartz_Graphics_Driver;
00049   friend class Fl_GDI_Graphics_Driver;
00050   friend class Fl_Xlib_Graphics_Driver;
00051   void copy_data();
00052   void delete_data();
00053   void set_data(const char * const *p);
00054 
00055   protected:
00056 
00057   void measure();
00058 
00059   public:
00060 
00061   int alloc_data; // Non-zero if data was allocated
00062   
00063   private:
00064 
00065 #if defined(__APPLE__) || defined(WIN32)
00066   void *id_; // for internal use
00067   void *mask_; // for internal use (mask bitmap)
00068 #else
00069   unsigned id_; // for internal use
00070   unsigned mask_; // for internal use (mask bitmap)
00071 #endif // __APPLE__ || WIN32
00072   
00073   public:
00074 
00076   explicit Fl_Pixmap(char * const * D) : Fl_Image(-1,0,1), alloc_data(0), id_(0), mask_(0) {set_data((const char*const*)D); measure();}
00078   explicit Fl_Pixmap(uchar* const * D) : Fl_Image(-1,0,1), alloc_data(0), id_(0), mask_(0) {set_data((const char*const*)D); measure();}
00080   explicit Fl_Pixmap(const char * const * D) : Fl_Image(-1,0,1), alloc_data(0), id_(0), mask_(0) {set_data((const char*const*)D); measure();}
00082   explicit Fl_Pixmap(const uchar* const * D) : Fl_Image(-1,0,1), alloc_data(0), id_(0), mask_(0) {set_data((const char*const*)D); measure();}
00083   virtual ~Fl_Pixmap();
00084   virtual Fl_Image *copy(int W, int H);
00085   Fl_Image *copy() { return copy(w(), h()); }
00086   virtual void color_average(Fl_Color c, float i);
00087   virtual void desaturate();
00088   virtual void draw(int X, int Y, int W, int H, int cx=0, int cy=0);
00089   void draw(int X, int Y) {draw(X, Y, w(), h(), 0, 0);}
00090   virtual void label(Fl_Widget*w);
00091   virtual void label(Fl_Menu_Item*m);
00092   virtual void uncache();
00093 };
00094 
00095 #endif
00096 
00097 //
00098 // End of "$Id: Fl_Pixmap.H 7903 2010-11-28 21:06:39Z matt $".
00099 //