1 /********************************************************************************
2 *                                                                               *
3 *                          I C O   I m a g e   O b j e c t                      *
4 *                                                                               *
5 *********************************************************************************
6 * Copyright (C) 2001,2005 by Janusz Ganczarski.   All Rights Reserved.          *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or                 *
9 * modify it under the terms of the GNU Lesser General Public                    *
10 * License as published by the Free Software Foundation; either                  *
11 * version 2.1 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 * Lesser General Public License for more details.                               *
17 *                                                                               *
18 * You should have received a copy of the GNU Lesser 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  USA.    *
21 *********************************************************************************
22 * $Id: FXICOImage.h,v 1.17 2005/01/16 16:06:06 fox Exp $                        *
23 ********************************************************************************/
24 #ifndef FXICOIMAGE_H
25 #define FXICOIMAGE_H
26 
27 #ifndef FXIMAGE_H
28 #include "FXImage.h"
29 #endif
30 
31 namespace FX {
32 
33 /// ICO (Microsoft icon format) graphics file
34 class FXAPI FXICOImage : public FXImage {
FXDECLARE(FXICOImage)35   FXDECLARE(FXICOImage)
36 protected:
37   FXICOImage(){}
38 private:
39   FXICOImage(const FXICOImage&);
40   FXICOImage &operator=(const FXICOImage&);
41 public:
42   static const FXchar fileExt[];
43 public:
44 
45   /// Construct image from memory stream formatted in Microsoft icon format
46   FXICOImage(FXApp* a,const void *pix=NULL,FXuint opts=0,FXint w=1,FXint h=1);
47 
48   /// Save pixels into stream in Microsoft icon format
49   virtual FXbool savePixels(FXStream& store) const;
50 
51   /// Load pixels from stream in Microsoft icon format
52   virtual FXbool loadPixels(FXStream& store);
53 
54   /// Destroy image
55   virtual ~FXICOImage();
56   };
57 
58 
59 #ifndef FXLOADICO
60 #define FXLOADICO
61 
62 /**
63 * Check if stream contains a ICO, return TRUE if so.
64 */
65 extern FXAPI FXbool fxcheckICO(FXStream& store);
66 
67 
68 /**
69 * Load an ICO (Microsoft icon format) file from a stream.
70 * Upon successful return, the pixel array and size are returned.
71 * If an error occurred, the pixel array is set to NULL.
72 */
73 extern FXAPI FXbool fxloadICO(FXStream& store,FXColor*& data,FXint& width,FXint& height,FXint& xspot,FXint& yspot);
74 
75 
76 /**
77 * Save an ICO (Microsoft icon format) file to a stream.
78 * If no hot-spot given, save as an ICO instead of a CUR resource.
79 */
80 extern FXAPI FXbool fxsaveICO(FXStream& store,const FXColor *data,FXint width,FXint height,FXint xspot=-1,FXint yspot=-1);
81 
82 #endif
83 
84 }
85 
86 #endif
87