00001 /** 00002 * \file micon.h <mi32/micon.h> 00003 * \brief Definitions for portable "icon" functions 00004 * 00005 * \if NODOC 00006 * $Id: micon.h_v 1.20 2003/09/25 21:29:07 dwilliss Exp $ 00007 * 00008 * $Log: micon.h_v $ 00009 * Revision 1.20 2003/09/25 21:29:07 dwilliss 00010 * Don't capitalize enum any more. Genitor needed it, doxygen doesn't like it. 00011 * 00012 * Revision 1.19 2003/09/15 13:49:56 fileserver!dwilliss 00013 * Doxygen 00014 * 00015 * Revision 1.18 2001/12/20 15:51:18 mju 00016 * Another Surveyor test. 00017 * 00018 * Revision 1.17 2001/12/19 16:04:51 mju 00019 * Another Surveyor test. 00020 * 00021 * Revision 1.11 2001/12/14 18:52:51 mju 00022 * Add MiconRead which uses ICONID. 00023 * 00024 * Revision 1.9 2001/12/04 14:48:33 mju 00025 * Use enum for MICONFLAGS. 00026 * 00027 * Revision 1.8 2000/06/20 20:17:45 sparsons 00028 * Genitor documentation. 00029 * 00030 * Revision 1.1 1999/01/07 23:10:27 mju 00031 * Initial revision 00032 * \endif 00033 **/ 00034 00035 #ifndef INC_MI32_MICON_H 00036 #define INC_MI32_MICON_H 00037 00038 #ifndef INC_MI32_STDDEFNS_H 00039 #include <mi32/stddefns.h> 00040 #endif 00041 00042 #ifndef INC_MI32_ICONID_H 00043 #include <mi32/iconid.h> 00044 #endif 00045 00046 //---------------------------------------------------------------------------- 00047 // Types and constants 00048 //---------------------------------------------------------------------------- 00049 00050 //! Enumeration for flags used in various Micon functions. 00051 enum MICONFLAGS { 00052 MICONFLAG_None = 0x0000, //!< No flags specified 00053 MICONFLAG_Stippled = 0x0001, //!< Create a "dimmed" pixmap as well as a normal pixmap 00054 MICONFLAG_DefaultBackground = 0x0002, //!< Use MxTopLevel()'s XmNbackground resource 00055 MICONFLAG_StippledSelected = 0x0008, //!< Create "dimmed" pixmap for armed/selected state 00056 MICONFLAG_SizeMask = 0x0FF0, //!< Bit mask for sizes from 1 to 255 00057 MICONFLAG_Size16 = 0x0100, //!< Resize icon to 16 by 16 if smaller 00058 MICONFLAG_Size32 = 0x0200, //!< Resize icon to 32 by 32 if smaller 00059 MICONFLAG_NoDarkenSelected = 0x1000, //!< Don't darken background for "selected" state 00060 MICONFLAG_DisplayError = 0x2000, //!< Display icon reading error even in non-programmer mode 00061 }; 00062 DEFINE_ENUM_OPERATORS(MICONFLAGS); 00063 00064 00065 struct MICONSTRUCT { 00066 UNICODE group[16]; 00067 UNICODE name[16]; 00068 UINT8 height; 00069 UINT8 width; 00070 UINT8 resized; 00071 UINT8 spare; //!< For alignment 00072 UINT32 refcount; 00073 MPIXEL bgpixel; //!< Background pixel 00074 void *privptr; 00075 }; 00076 typedef MICONSTRUCT *MICON; 00077 00078 00079 //---------------------------------------------------------------------------- 00080 // Function prototypes 00081 //---------------------------------------------------------------------------- 00082 00083 // Note, these functions use C++ linkage. 00084 00085 //!:Associate with "Micon Functions" 00086 //!\addtogroup Micon Micon functions 00087 //!@{ 00088 00089 //! Create new icon. 00090 //! 00091 //! Flags: 00092 //! MICONFLAG_DefaultBackground Use MxTopLevel()'s XmNbackground resource 00093 //! MICONFLAG_SizeMask Bit mask for sizes from 1 to 255 00094 //! MICONFLAG_Size16 16 by 16 00095 //! MICONFLAG_Size32 32 by 32 00096 //! MICONFLAG_Stippled Create a "dimmed" pixmap as well as a normal pixmap 00097 int MiconCreate ( 00098 MICON *icon, //!< Icon returned 00099 int ihandle, //!< Icon group handle (0 for standard file) 00100 const UNICODE *group, //!< Icon group name 00101 const UNICODE *name, //!< Icon name 00102 MPIXEL bgpixel, //!< Background pixel 00103 UINT8 width, //!< Icon width (0 to use value from file) 00104 UINT8 height, //!< Icon height (0 to use value from file) 00105 UINT32 flags //!< Flags 00106 ); 00107 00108 //! Create new icon. 00109 //! 00110 //! Flags: 00111 //! MICONFLAG_DefaultBackground Use MxTopLevel()'s XmNbackground resource 00112 //! MICONFLAG_SizeMask Bit mask for sizes from 1 to 255 00113 //! MICONFLAG_Size16 16 by 16 00114 //! MICONFLAG_Size32 32 by 32 00115 //! MICONFLAG_Stippled Create a "dimmed" pixmap as well as a normal pixmap 00116 int MiconCreate ( 00117 MICON *icon, //!< Icon returned 00118 const char *group, //!< Icon group, NULL for "standard" 00119 const char *name, //!< Icon name 00120 MPIXEL bgpixel, //!< Background pixel 00121 UINT8 width, //!< Icon width (0 to use value from file) 00122 UINT8 height, //!< Icon height (0 to use value from file) 00123 UINT32 flags //!< Flags 00124 ); 00125 00126 //! Destroy icon. 00127 void MiconDestroy ( 00128 MICON icon //!< Icon to destroy 00129 ); 00130 00131 //! Get icon height in pixels. 00132 inline UINT8 MiconGetHeight ( 00133 const MICON icon //!< Icon to use 00134 ) { return (icon->height); } 00135 00136 //! Get icon width in pixels. 00137 inline UINT8 MiconGetWidth ( 00138 const MICON icon //!< Icon to use 00139 ) { return (icon->width); } 00140 00141 //! Close icon group. 00142 void MiconGroupClose ( 00143 int ihandle //!< Icon group handle 00144 ); 00145 00146 //! Open icon group. 00147 //! @return Icon handle or error < 0. 00148 int MiconGroupOpen ( 00149 const UNICODE *filename, //!< Icon file name, NULL for "icons.ref" 00150 const UNICODE *group //!< Icon group name 00151 ); 00152 00153 //! Read icon as bitmap pattern. 00154 int MiconReadPattern ( 00155 int ihandle, //!< Icon group handle 00156 INT32 pattnum, //!< Pattern number if known 00157 const UNICODE *name, //!< Icon name 00158 int width, //!< Width, 0 for value from file 00159 int height, //!< Height, 0 for value from file 00160 void **pattdata //!< Pattern buffer allocated and returned 00161 ); 00162 00163 //! Read icon(s) in standard format for use with widget. 00164 //! 00165 //! Flags: 00166 //! MICONFLAG_DefaultBackground Use MxTopLevel()'s XmNbackground resource 00167 //! MICONFLAG_NoDarkenSelected Don't darken background for "armed/selected" state 00168 //! MICONFLAG_SizeMask Bit mask for sizes from 1 to 255 00169 //! MICONFLAG_Size16 16 by 16 00170 //! MICONFLAG_Size32 32 by 32 00171 //! MICONFLAG_Stippled Create a "dimmed" pixmap as well as a normal pixmap 00172 int MiconReadStandard ( 00173 int ihandle, //!< Icon group handle, 0 for standard file 00174 const char *group, //!< Icon group, NULL for "standard" 00175 const char *name, //!< Icon name 00176 MICON *normalicon, //!< Icon with "normal" colors returned, NULL if don't need 00177 MICON *armselicon, //!< Icon with "armed/selected" colors returned, NULL if don't need 00178 MPIXEL normalbg, //!< Normal background pixel if default not used 00179 MPIXEL armselbg, //!< Armed/selected background pixel if default not used 00180 UINT32 flags //!< Flags 00181 ); 00182 00183 //! Read icon(s) in standard format for use with widget. 00184 //! 00185 //! Flags: 00186 //! MICONFLAG_DefaultBackground Use MxTopLevel()'s XmNbackground resource 00187 //! MICONFLAG_NoDarkenSelected Don't darken background for "armed/selected" state 00188 //! MICONFLAG_SizeMask Bit mask for sizes from 1 to 255 00189 //! MICONFLAG_Size16 16 by 16 00190 //! MICONFLAG_Size32 32 by 32 00191 //! MICONFLAG_Stippled Create a "dimmed" pixmap as well as a normal pixmap 00192 int MiconReadStandard ( 00193 int ihandle, //!< Icon group handle, 0 for standard file 00194 const char *group, //!< Icon group, NULL for "standard" 00195 const char *name, //!< Icon name 00196 MICON *normalicon, //!< Icon with "normal" colors returned, NULL if don't need 00197 MICON *armeselicon, //!< Icon with "armed/selected" colors returned, NULL if don't need 00198 UINT32 flags //!< Flags 00199 ); 00200 00201 //! Read icon for use with widget. 00202 ERRVALUE MiconRead ( 00203 ICONID iconid, //!< Icon ID 00204 MICON *normalicon, //!< Icon with "normal" colors returned, NULL if don't need 00205 MICON *armselicon, //!< Icon with "armed/selected" colors returned, NULL if don't need 00206 MICONFLAGS flags //!< Flags 00207 ); 00208 00209 //! Read icon for use with widget with background pixel override. 00210 ERRVALUE MiconRead ( 00211 ICONID iconid, //!< Icon ID 00212 MICON *normalicon, //!< Icon with "normal" colors returned, NULL if don't need 00213 MICON *armselicon, //!< Icon with "armed/selected" colors returned, NULL if don't need 00214 MPIXEL normalbg, //!< Normal background pixel if default not used 00215 MPIXEL armselbg, //!< Armed/selected background pixel if default not used 00216 MICONFLAGS flags //!< Flags 00217 ); 00218 00219 //!@} 00220 00221 #endif //!< INC_MI32_MICON_H
1.3.8-20040913