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
21 ***************************************************************************/
23 #ifndef NBITMAP_MCC_PRIV_H
24 #define NBITMAP_MCC_PRIV_H
27 #include <dos/exall.h>
28 #include <exec/types.h>
29 #include <intuition/classusr.h>
30 #include <libraries/mui.h>
33 #include <mcc_common.h>
39 /* private definitions */
40 #define MUIV_NBitmap_Normal 0
41 #define MUIV_NBitmap_Ghosted 1
42 #define MUIV_NBitmap_Selected 2
63 /* private structures */
71 uint16 overlay_shadeover
;
72 uint16 overlay_shadepress
;
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
;
96 uint32 shadeBytesPerRow
;
98 APTR pressedShadePixels
;
100 uint32
*dt_colours
[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
;
111 APTR ditheredImage
[3];
112 APTR ditheredMask
[3];
113 int32 ditherPenMap
[256];
114 #if !defined(__amigaos4__)
115 struct BitMap
*ditheredBitmap
[3];
118 struct MUI_EventHandlerNode ehnode
;
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)))
127 #define min(a, b) (((a) < (b)) ? (a):(b))
131 #define max(a, b) (((a) > (b)) ? (a):(b))
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 */
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
);
156 #ifndef PDTA_AlphaChannel
157 /* Seems this V43 extension is not in the Amiga SDK */
158 #define PDTA_AlphaChannel (DTA_Dummy + 256)
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)
164 #define AllocVecShared(size, flags) AllocVec((size), (flags))
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))
173 #endif /* NBITMAP_MCC_PRIV_H */