Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXIcon.h

00001 /********************************************************************************
00002 *                                                                               *
00003 *                               I c o n - O b j e c t                           *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 1997,2002 by Jeroen van der Zijp.   All Rights Reserved.        *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or                 *
00009 * modify it under the terms of the GNU Lesser General Public                    *
00010 * License as published by the Free Software Foundation; either                  *
00011 * version 2.1 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 * Lesser General Public License for more details.                               *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser 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  USA.    *
00021 *********************************************************************************
00022 * $Id: FXIcon.h,v 1.17 2002/02/20 07:02:12 fox Exp $                         *
00023 ********************************************************************************/
00024 #ifndef FXICON_H
00025 #define FXICON_H
00026 
00027 #ifndef FXIMAGE_H
00028 #include "FXImage.h"
00029 #endif
00030 
00031 
00032 
00033 class FXDC;
00034 class FXDCWindow;
00035 class FXDrawable;
00036 class FXTopWindow;
00037 
00038 
00039 /// Icon class
00040 class FXAPI FXIcon : public FXImage {
00041   FXDECLARE(FXIcon)
00042   friend class FXDC;
00043   friend class FXDCWindow;
00044   friend class FXDrawable;
00045   friend class FXTopWindow;
00046 protected:
00047   FXID     shape;             // Shape pixmap
00048   FXID     etch;              // Etch pixmap
00049   FXColor  transp;            // Transparency color
00050 protected:
00051   FXIcon(){}
00052   FXColor guesstransp();
00053 private:
00054   FXIcon(const FXIcon&);
00055   FXIcon &operator=(const FXIcon&);
00056 public:
00057 
00058   /**
00059   * Create an icon with an initial pixel buffer pix, a transparent color clr,
00060   * and options as in FXImage.
00061   */
00062   FXIcon(FXApp* a,const void *pix=NULL,FXColor clr=0,FXuint opts=0,FXint w=1,FXint h=1);
00063 
00064   /// Create the icon resource
00065   virtual void create();
00066 
00067   /// Detach the icon resource
00068   virtual void detach();
00069 
00070   /// Destroy the icon resource
00071   virtual void destroy();
00072 
00073   /// Render the image from client-side pixel buffer
00074   virtual void render();
00075 
00076   /// Resize pixmap to the specified width and height
00077   virtual void resize(FXint w,FXint h);
00078 
00079   /// Obtain transparency color
00080   FXColor getTransparentColor() const { return transp; }
00081   
00082   /// Change transparency color
00083   void setTransparentColor(FXColor color){ transp=color; }
00084   
00085   /// Destructor
00086   virtual ~FXIcon();
00087   };
00088 
00089 
00090 #endif