Initial import of Scalos. To decrease size I have
[AROS-Contrib.git] / scalos / datatypes / GlowIconObject / GlowIconObject.h
blob091e49178626fc513ef612eafc5537ec69ef0c4b
1 // GlowIconObject.h
2 // $Date$
3 // $Revision$
6 #ifndef GLOWICONOBJECT_H_INCLUDED
7 #define GLOWICONOBJECT_H_INCLUDED
9 #include <exec/types.h>
10 #include <graphics/gfx.h>
11 #include <graphics/text.h>
12 #include <intuition/intuition.h>
13 #include <intuition/classes.h>
14 #include <scalos/scalosgfx.h>
16 #include <defs.h>
18 //-----------------------------------------------------------------------------
20 #define MEMPOOL_MEMFLAGS MEMF_PUBLIC
21 #define MEMPOOL_PUDDLESIZE 16384
22 #define MEMPOOL_THRESHSIZE 16384
24 //-----------------------------------------------------------------------------
26 #define LIB_VERSION 40
27 #define LIB_REVISION 14
29 extern char ALIGNED libName[];
30 extern char ALIGNED libIdString[];
32 //-----------------------------------------------------------------------------
34 #define BYTESPERROW(width) ((((width) + 15) & 0xfff0) >> 3)
36 // Width for TempRp.BitMap for ReadPixelLine8() and WritePixelLine8()
37 #define TEMPRP_WIDTH(width) (8 * ((((width) + 15) >> 4) << 1))
39 //-----------------------------------------------------------------------------
41 #ifndef __AROS__
42 #define BNULL ((BPTR) NULL)
43 #endif
45 //-----------------------------------------------------------------------------
47 #define ID_ICON MAKE_ID('I','C','O','N')
48 #define ID_FACE MAKE_ID('F','A','C','E')
49 #define ID_IMAG MAKE_ID('I','M','A','G')
50 #define ID_ARGB MAKE_ID('A','R','G','B')
52 //-----------------------------------------------------------------------------
54 struct GlowIconObjectDtLibBase
56 struct ClassLibrary nib_ClassLibrary;
58 struct SegList *nib_SegList;
60 UBYTE nib_Initialized;
63 //----------------------------------------------------------------------------
65 LIBFUNC_PROTO(ObtainInfoEngine, libbase, ULONG);
67 ULONG InitDatatype(struct GlowIconObjectDtLibBase *dtLib);
68 ULONG OpenDatatype(struct GlowIconObjectDtLibBase *dtLib);
69 void CloseDatatype(struct GlowIconObjectDtLibBase *dtLib);
71 /* ------------------------------------------------- */
73 #if defined(__GNUC__) && !defined(mc68000)
74 #pragma pack(2)
75 #endif /* __GNUC__ */
77 struct FaceChunk /* 6 Bytes */
79 UBYTE fc_Width; // Width - 1
80 UBYTE fc_Height; // Height - 1
81 UBYTE fc_Flags;
82 UBYTE fc_AspectRatio;
83 UWORD fc_MaxPaletteBytes;
86 // Values in fc_Flags
87 #define FCB_Borderless 0
88 #define FCF_Borderless (1 << FCB_Borderless)
90 /* ------------------------------------------------- */
92 struct ImageChunk /* 10 Bytes */
94 UBYTE ic_TransparentColor; // index of transparent color
95 UBYTE ic_PaletteSize; // number of palette entries - 1
96 UBYTE ic_Flags; // see below
97 UBYTE ic_ImageCompressionType; // compression type - imagedata ?
98 UBYTE ic_PaletteCompressionType; // compression type - palette ?
99 UBYTE ic_BitsPerPixel; // number of significant bits/pixel
100 UWORD ic_NumImageBytes; // number of compressed image bytes - 1
101 UWORD ic_NumPaletteBytes; // number of compressed palette bytes - 1
104 #define ICB_IsTransparent 0
105 #define ICF_IsTransparent (1 << ICB_IsTransparent)
106 #define ICB_HasPalette 1
107 #define ICF_HasPalette (1 << ICB_HasPalette)
109 #if defined(__GNUC__) && !defined(mc68000)
110 #pragma pack(2)
111 #endif /* __GNUC__ */
113 /* ------------------------------------------------- */
115 struct NewImage
117 WORD nim_Width;
118 WORD nim_Height;
120 struct ImageChunk nim_ImageChunk;
122 UWORD nim_PaletteSize; // number of palette entries
124 UBYTE *nim_ImageData; // (allocated) chunky image data, 1 byte per pixel
126 struct ColorRegister *nim_Palette; // (allocated) palette data, NULL for 32bit GlowIcons
128 struct ARGBHeader nim_ARGBheader;
131 //-----------------------------------------------------------------------------
133 struct NewImagePenList
135 ULONG nip_PaletteSize;
136 UBYTE *nip_PenArray; // Array of allocated pens for Normal image, 1 byte per pen
139 //-----------------------------------------------------------------------------
141 struct InstanceData
143 struct DiskObject *aio_DiskObject;
144 struct DrawerData *aio_myDrawerData;
145 struct Screen *aio_Screen;
147 UWORD aio_ImageLeft;
148 UWORD aio_ImageTop;
150 UBYTE aio_Borderless; //Flag: Don't draw border around icon!
152 struct Image aio_DoImage1; //diskObj.do_Gadget.GadgetRender
153 struct Image aio_DoImage2;
155 struct FaceChunk aio_FaceChunk;
157 STRPTR aio_DefaultTool;
158 STRPTR aio_ToolWindow;
159 STRPTR *aio_ToolTypes;
160 ULONG aio_ToolTypesLength; // Allocated length for aio_ToolTypes
162 struct NewImage *aio_Image1; // Normal image
163 struct NewImage *aio_Image2; // Selected image
165 struct NewImagePenList aio_PenList1; // pen list for Normal image
166 struct NewImagePenList aio_PenList2; // pen list for selected image
168 ULONG aio_BackfillPenNorm; // pen to use for unselected background fill or IDTA_BACKFILL_NONE
169 ULONG aio_BackfillPenSel; // pen to use for selected background fill or IDTA_BACKFILL_NONE
172 //---------------------------------------------------------------
174 // private and temporary Data during dtWrite
176 struct WriteData
178 STRPTR aiowd_DefaultTool;
179 STRPTR *aiowd_ToolTypes;
180 ULONG aiowd_StackSize;
181 struct IBox *aiowd_WindowRect;
182 ULONG aiowd_CurrentX;
183 ULONG aiowd_CurrentY;
184 ULONG aiowd_Flags;
185 ULONG aiowd_ViewModes;
186 ULONG aiowd_Type;
189 /* ------------------------------------------------- */
191 #define UGetByte() (*source++)
192 #define UPutByte(c) (*dest++ = (c))
194 /* ------------------------------------------------- */
196 #define Sizeof(x) (sizeof(x) / sizeof(x[0]))
198 //-----------------------------------------------------------------------------
200 // defined in mempools.lib
202 extern int _STI_240_InitMemFunctions(void);
203 extern void _STD_240_TerminateMemFunctions(void);
205 /* ------------------------------------------------- */
207 // from debug.lib
208 #ifdef __AROS__
209 #include <clib/arossupport_protos.h>
210 #define KPrintF kprintf
211 #else
212 extern int kprintf(const char *fmt, ...);
213 extern int KPrintF(const char *fmt, ...);
214 #endif
217 #define d1(x) ;
218 #define d2(x) { Forbid(); x; Permit(); }
220 //#define TIMESTAMPS
221 #define TIMESTAMP_d1() ;
222 #define TIMESTAMP_d2() \
224 struct EClockVal ev; \
225 ULONG ticks; \
226 ticks = ReadEClock(&ev); \
227 KPrintF("%s/%s/%ld: ticks=%lu hi=%8lu lo=%8lu\n", __FILE__, __FUNC__, __LINE__, ticks, ev.ev_hi, ev.ev_lo); \
230 /* ------------------------------------------------- */
232 #if !defined(__amigaos4__) && !defined(__AROS__)
233 VOID UpdateWorkbench(CONST_STRPTR name, BPTR parentlock, LONG action);
235 #if defined(__MORPHOS__)
237 #ifndef __PPCINLINE_MACROS_H
238 #include <ppcinline/macros.h>
239 #endif /* !__PPCINLINE_MACROS_H */
241 #define UpdateWorkbench(__p0, __p1, __p2) \
242 LP3NR(30, UpdateWorkbench, \
243 CONST_STRPTR , __p0, a0, \
244 BPTR, __p1, a1, \
245 LONG, __p2, d0, \
246 , WB_BASE_NAME, 0, 0, 0, 0, 0, 0)
248 #else
250 #ifdef __SASC
252 #ifdef __CLIB_PRAGMA_LIBCALL
253 #pragma libcall WorkbenchBase UpdateWorkbench 01e 09803
254 #endif /* __CLIB_PRAGMA_LIBCALL */
256 #else
258 #define WBInfo(lock, name, screen) \
259 LP3NR(30, UpdateWorkbench, CONST_STRPTR, name, a0, BPTR, parentlock, a1, LONG, action, d0, \
260 , WB_BASE_NAME)
262 #endif /* __SASC */
264 #endif /* __MORPHOS__ */
266 #endif /* !__amigaos4__ */
268 /* ------------------------------------------------- */
270 #endif // GLOWICONOBJECT_H_INCLUDED