1 /***************************************************************************
3 NList.mcc - New List MUI Custom Class
4 Registered MUI class, Serial Number: 1d51 0x9d510030 to 0x9d5100A0
5 0x9d5100C0 to 0x9d5100FF
7 Copyright (C) 1996-2001 by Gilles Masson
8 Copyright (C) 2001-2014 NList Open Source Team
10 This library is free software; you can redistribute it and/or
11 modify it under the terms of the GNU Lesser General Public
12 License as published by the Free Software Foundation; either
13 version 2.1 of the License, or (at your option) any later version.
15 This library is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
20 NList classes Support Site: http://www.sf.net/projects/nlist-classes
24 ***************************************************************************/
30 #include <exec/types.h>
31 #include <exec/memory.h>
32 #include <exec/ports.h>
34 #include <libraries/dos.h>
35 #include <libraries/dosextens.h>
36 #include <libraries/gadtools.h>
37 #include <libraries/asl.h>
38 #include <libraries/mui.h>
39 #include <workbench/workbench.h>
40 #include <intuition/intuition.h>
41 #include <intuition/classusr.h>
42 #include <graphics/gfxmacros.h>
45 #if !defined(__amigaos4__)
46 #include <clib/alib_protos.h>
49 #include <proto/exec.h>
50 #include <proto/dos.h>
51 #include <proto/gadtools.h>
52 #include <proto/graphics.h>
53 #include <proto/utility.h>
54 #include <proto/asl.h>
55 #include <proto/intuition.h>
57 extern struct Library
*MUIMasterBase
;
59 #include <mui/NListview_mcc.h>
60 #include <mui/NFloattext_mcc.h>
62 #include "NList-Demo3.h"
64 #include <proto/muimaster.h>
68 /* *********************************************** */
71 struct MUI_CustomClass
*NLI_Class
= NULL
;
74 /* *********************************************** */
85 /* *********************************************** */
88 IPTR
mNLI_Draw(struct IClass
*cl
,Object
*obj
,struct MUIP_Draw
*msg
)
90 struct NLIData
*data
= INST_DATA(cl
,obj
);
91 DoSuperMethodA(cl
,obj
,(Msg
) msg
);
92 if ((msg
->flags
& MADF_DRAWOBJECT
) || (msg
->flags
& MADF_DRAWUPDATE
))
93 { WORD x1
,x2
,x3
,x4
,x5
,y1
,y2
,y3
,y4
,y5
;
98 if ((data
->special
== 0) || (data
->special
== 1))
102 SetAPen(_rp(obj
),_pens(obj
)[MPEN_MARK
]);
103 SetBPen(_rp(obj
),_pens(obj
)[MPEN_SHADOW
]);
104 SetDrMd(_rp(obj
),JAM2
);
105 SetDrPt(_rp(obj
),(UWORD
) ~0);
106 if (data
->special
== 0)
107 { Move(_rp(obj
), x3
-2, y1
+1);
108 Draw(_rp(obj
), x3
-2, y2
-1);
109 Move(_rp(obj
), x3
, y1
+1);
110 Draw(_rp(obj
), x3
, y2
-1);
111 Move(_rp(obj
), x3
+2, y1
+1);
112 Draw(_rp(obj
), x3
+2, y2
-1);
114 else if (data
->special
== 1)
115 { Move(_rp(obj
), x1
, y3
-2);
116 Draw(_rp(obj
), x2
, y3
-2);
117 Move(_rp(obj
), x1
, y3
);
118 Draw(_rp(obj
), x2
, y3
);
119 Move(_rp(obj
), x1
, y3
+2);
120 Draw(_rp(obj
), x2
, y3
+2);
122 SetAPen(_rp(obj
),_pens(obj
)[MPEN_SHADOW
]);
123 Move(_rp(obj
), x1
, y2
-1);
124 Draw(_rp(obj
), x1
, y1
+1);
125 Draw(_rp(obj
), x2
, y1
+1);
126 SetAPen(_rp(obj
),_pens(obj
)[MPEN_SHINE
]);
127 Draw(_rp(obj
), x2
, y2
-1);
128 Draw(_rp(obj
), x1
, y2
-1);
129 SetDrMd(_rp(obj
),JAM1
);
131 else if (((x2
- x1
) >= 10) && ((y2
- y1
) >= 8)) /* and special==2 to 9 */
136 SetAPen(_rp(obj
),_pens(obj
)[MPEN_SHADOW
]);
137 SetDrMd(_rp(obj
),JAM1
);
143 if ((data
->EntryHeight
& 1) && (data
->EntryCurrent
& 1))
145 if ((y4
& 1) != (y3
& 1))
147 if (data
->special
> 5)
149 if (data
->special
& 1)
152 { WritePixel(_rp(obj
), x3
, y4
);
155 if (data
->special
<= 7)
158 { WritePixel(_rp(obj
), x4
, y3
);
162 if (data
->special
<= 5)
164 Move(_rp(obj
), x2
-6, y3
);
165 Draw(_rp(obj
), x2
-6, y3
-3);
166 Draw(_rp(obj
), x2
, y3
-3);
167 Draw(_rp(obj
), x2
, y3
+3);
168 Draw(_rp(obj
), x2
-6, y3
+3);
169 Draw(_rp(obj
), x2
-6, y3
);
170 Move(_rp(obj
), x2
-4, y3
);
171 Draw(_rp(obj
), x2
-2, y3
);
172 if ((data
->special
== 2) || (data
->special
== 3))
173 { Move(_rp(obj
), x2
-3, y3
-1);
174 Draw(_rp(obj
), x2
-3, y3
+1);
184 IPTR
mNLI_New(struct IClass
*cl
,Object
*obj
,struct opSet
*msg
)
186 struct NLIData
*data
;
187 if (!(obj
= (Object
*)DoSuperMethodA(cl
,obj
,(Msg
) msg
)))
189 data
= INST_DATA(cl
,obj
);
195 IPTR
mNLI_AskMinMax(struct IClass
*cl
,Object
*obj
,struct MUIP_AskMinMax
*msg
)
197 DoSuperMethodA(cl
,obj
,(Msg
) msg
);
198 msg
->MinMaxInfo
->MinWidth
+= 8;
199 msg
->MinMaxInfo
->DefWidth
+= 18; /* the only width def value really used by NList object */
200 msg
->MinMaxInfo
->MaxWidth
+= MUI_MAXMAX
;
201 msg
->MinMaxInfo
->MinHeight
+= 7; /* the only height def value really used by NList object */
202 msg
->MinMaxInfo
->DefHeight
+= 12;
203 msg
->MinMaxInfo
->MaxHeight
+= MUI_MAXMAX
;
208 IPTR
mNLI_Set(struct IClass
*cl
,Object
*obj
,Msg msg
)
210 struct NLIData
*data
= INST_DATA(cl
,obj
);
211 struct TagItem
*tags
,*tag
;
213 for(tags
=((struct opSet
*)msg
)->ops_AttrList
; (tag
=(struct TagItem
*)NextTagItem((APTR
)&tags
)); )
217 case MUIA_NLIMG_EntryCurrent
:
218 data
->EntryCurrent
= tag
->ti_Data
;
220 case MUIA_NLIMG_EntryHeight
:
221 data
->EntryHeight
= tag
->ti_Data
;
223 case MUIA_NLIMG_Spec
:
224 data
->special
= tag
->ti_Data
;
231 DISPATCHER(NLI_Dispatcher
)
233 switch (msg
->MethodID
)
235 case OM_NEW
: return ( mNLI_New(cl
,obj
,(APTR
)msg
));
236 case OM_SET
: return ( mNLI_Set(cl
,obj
,(APTR
)msg
));
237 case MUIM_AskMinMax
: return (mNLI_AskMinMax(cl
,obj
,(APTR
)msg
));
238 case MUIM_Draw
: return ( mNLI_Draw(cl
,obj
,(APTR
)msg
));
241 return(DoSuperMethodA(cl
,obj
,msg
));
247 struct MUI_CustomClass
*NLI_Create(void)
249 NLI_Class
= MUI_CreateCustomClass(NULL
, (STRPTR
)MUIC_Area
, NULL
, sizeof(struct NLIData
), ENTRY(NLI_Dispatcher
));
255 void NLI_Delete(void)
258 MUI_DeleteCustomClass(NLI_Class
);