Merging NList MCC 0.119 into the main branch.
[AROS.git] / workbench / classes / zune / nlist / nbitmap_mcc / private.h
blob8dfce7bfd6044cf08155701ef4905204479d3c55
1 /***************************************************************************
3 NBitmap.mcc - New Bitmap MUI Custom Class
4 Copyright (C) 2006 by Daniel Allsopp
5 Copyright (C) 2007-2013 by NList Open Source Team
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or (at your option) any later version.
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
17 NList classes Support Site: http://www.sf.net/projects/nlist-classes
19 $Id$
21 ***************************************************************************/
23 #ifndef NBITMAP_MCC_PRIV_H
24 #define NBITMAP_MCC_PRIV_H
26 /* system includes */
27 #include <dos/exall.h>
28 #include <exec/types.h>
29 #include <intuition/classusr.h>
30 #include <libraries/mui.h>
32 /* mcc includes */
33 #include <mcc_common.h>
35 /* local includes */
36 #include "Debug.h"
37 #include "NBitmap.h"
39 /* private definitions */
40 #define MUIV_NBitmap_Normal 0
41 #define MUIV_NBitmap_Ghosted 1
42 #define MUIV_NBitmap_Selected 2
44 #ifndef uint8
45 typedef UBYTE uint8;
46 #endif
47 #ifndef int8
48 typedef BYTE int8;
49 #endif
50 #ifndef uint16
51 typedef UWORD uint16;
52 #endif
53 #ifndef int16
54 typedef WORD int16;
55 #endif
56 #ifndef uint32
57 typedef ULONG uint32;
58 #endif
59 #ifndef int32
60 typedef LONG int32;
61 #endif
63 /* private structures */
64 struct PrefsData
66 uint8 show_label;
67 uint8 overlay_type;
68 uint8 overlay_r;
69 uint8 overlay_g;
70 uint8 overlay_b;
71 uint16 overlay_shadeover;
72 uint16 overlay_shadepress;
73 uint8 spacing_horiz;
74 uint8 spacing_vert;
77 struct InstData
79 BOOL button;
80 BOOL overlay;
81 BOOL pressed;
82 STRPTR label;
84 uint32 scrdepth;
86 uint32 *data[3];
87 uint32 fmt, type;
88 uint32 width, height, depth;
89 uint32 maxwidth, maxheight;
90 uint32 border_horiz, border_vert;
91 uint32 label_horiz, label_vert;
92 uint32 arraybpp, arraybpr, arraysize;
93 APTR arraypixels[3];
94 uint32 shadeWidth;
95 uint32 shadeHeight;
96 uint32 shadeBytesPerRow;
97 APTR overShadePixels;
98 APTR pressedShadePixels;
100 uint32 *dt_colours[3];
101 Object *dt_obj[3];
102 PLANEPTR *dt_mask[3];
104 struct PrefsData prefs;
105 struct BitMap *dt_bitmap[3];
106 struct BitMapHeader *dt_header[3];
107 struct TextExtent labelte;
109 uint32 alpha;
110 const uint32 *clut;
111 APTR ditheredImage[3];
112 APTR ditheredMask[3];
113 int32 ditherPenMap[256];
114 #if !defined(__amigaos4__)
115 struct BitMap *ditheredBitmap[3];
116 #endif
118 struct MUI_EventHandlerNode ehnode;
121 /* macros */
122 #define _id(obj) (muiNotifyData(obj)->mnd_ObjectID)
123 #define _between(a,x,b) ((x)>=(a) && (x)<=(b))
124 #define _isinobject(x,y) (_between(_mleft(obj),(x),_mright(obj)) && _between(_mtop(obj),(y),_mbottom(obj)))
126 #ifndef min
127 #define min(a, b) (((a) < (b)) ? (a):(b))
128 #endif
130 #ifndef max
131 #define max(a, b) (((a) > (b)) ? (a):(b))
132 #endif
134 #ifndef MUI_EHF_GUIMODE
135 #define MUI_EHF_GUIMODE (1<<1) /* set this if you dont want your handler to be called when your object is disabled or invisible */
136 #endif
138 /* prototypes */
139 BOOL NBitmap_LoadImage(STRPTR filename, uint32 item, struct IClass *cl, Object *obj);
140 VOID NBitmap_UpdateImage(uint32 item, STRPTR filename, struct IClass *cl, Object *obj);
141 //BOOL NBitmap_ExamineData(Object *dt_obj, uint32 item, struct IClass *cl, Object *obj);
142 //VOID NBitmap_FreeImage(uint32 item, struct IClass *cl, Object *obj);
143 BOOL NBitmap_NewImage(struct IClass *cl, Object *obj);
144 VOID NBitmap_DisposeImage(struct IClass *cl, Object *obj);
145 BOOL NBitmap_SetupImage(struct IClass *cl, Object *obj);
146 VOID NBitmap_CleanupImage(struct IClass *cl, Object *obj);
147 VOID NBitmap_DrawImage(struct IClass *cl, Object *obj);
148 BOOL NBitmap_SetupShades(struct InstData *data);
149 void NBitmap_CleanupShades(struct InstData *data);
151 #if !defined(__amigaos4__) && !defined(__MORPHOS__) && !defined(__AROS__)
152 ULONG _WPA(APTR src, UWORD srcx, UWORD srcy, UWORD srcmod, struct RastPort *rp, UWORD destx, UWORD desty, UWORD width, UWORD height, ULONG fmt);
153 ULONG _WPAA(APTR src, UWORD srcx, UWORD srcy, UWORD srcmod, struct RastPort *rp, UWORD destx, UWORD desty, UWORD width, UWORD height, ULONG globalalpha);
154 #endif
156 #ifndef PDTA_AlphaChannel
157 /* Seems this V43 extension is not in the Amiga SDK */
158 #define PDTA_AlphaChannel (DTA_Dummy + 256)
159 #endif
161 #if defined(__amigaos4__)
162 #define AllocVecShared(size, flags) AllocVecTags((size), AVT_Type, MEMF_SHARED, AVT_Lock, FALSE, ((flags)&MEMF_CLEAR) ? AVT_ClearWithValue : TAG_IGNORE, 0, TAG_DONE)
163 #else
164 #define AllocVecShared(size, flags) AllocVec((size), (flags))
165 #endif
167 #if defined(__amigaos4__)
168 #define AllocVecAligned(size, flags, alignSize, alignOffset) AllocVecTags((size), AVT_Type, MEMF_SHARED, AVT_Lock, FALSE, AVT_Alignment, (alignSize), ((flags)&MEMF_CLEAR) ? AVT_ClearWithValue : TAG_IGNORE, 0, TAG_DONE)
169 #elif defined(__amigaos3__) || defined(__AROS__)
170 #define AllocVecAligned(size, flags, alignSize, alignOffset) AllocVec((size),(flags))
171 #endif
173 #endif /* NBITMAP_MCC_PRIV_H */