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