2 Copyright 2002-2003, The AROS Development Team. All rights reserved.
6 #define MUIMASTER_YES_INLINE_STDARG
10 #include <graphics/gfx.h>
11 #include <graphics/view.h>
12 #include <clib/alib_protos.h>
13 #include <proto/exec.h>
14 #include <proto/graphics.h>
15 #include <proto/utility.h>
16 #include <proto/intuition.h>
17 #include <proto/muimaster.h>
21 /* #define MYDEBUG 1 */
24 #include "muimaster_intern.h"
26 #include "support_classes.h"
28 #include "framedisplay_private.h"
30 extern struct Library
*MUIMasterBase
;
33 IPTR
Framedisplay__OM_NEW(struct IClass
*cl
, Object
*obj
,
36 struct Framedisplay_DATA
*data
;
40 D(bug("Framedisplay_New starts\n"));
42 obj
= (Object
*) DoSuperMethodA(cl
, obj
, (Msg
) msg
);
46 data
= INST_DATA(cl
, obj
);
48 /* parse initial taglist */
50 for (tags
= msg
->ops_AttrList
; (tag
= NextTagItem(&tags
));)
54 case MUIA_Framedisplay_Spec
:
55 zune_frame_spec_to_intern((CONST_STRPTR
) tag
->ti_Data
,
61 D(bug("Framedisplay_New(%lx) spec=%lx\n", obj
, data
->fs_intern
));
65 IPTR
Framedisplay__OM_SET(struct IClass
*cl
, Object
*obj
,
68 struct Framedisplay_DATA
*data
= INST_DATA(cl
, obj
);
72 for (tags
= msg
->ops_AttrList
; (tag
= NextTagItem(&tags
));)
76 case MUIA_Framedisplay_Spec
:
77 zune_frame_spec_to_intern((CONST_STRPTR
) tag
->ti_Data
,
79 MUI_Redraw(obj
, MADF_DRAWOBJECT
);
84 return (IPTR
) DoSuperMethodA(cl
, obj
, (Msg
) msg
);
87 IPTR
Framedisplay__OM_GET(struct IClass
*cl
, Object
*obj
,
90 struct Framedisplay_DATA
*data
= INST_DATA(cl
, obj
);
91 switch (msg
->opg_AttrID
)
93 case MUIA_Framedisplay_Spec
:
94 zune_frame_intern_to_spec(&data
->fs_intern
, (STRPTR
) data
->spec
);
95 *msg
->opg_Storage
= (IPTR
) data
->spec
;
99 return (IPTR
) DoSuperMethodA(cl
, obj
, (Msg
) msg
);
102 IPTR
Framedisplay__MUIM_AskMinMax(struct IClass
*cl
, Object
*obj
,
103 struct MUIP_AskMinMax
*msg
)
105 DoSuperMethodA(cl
, obj
, (Msg
) msg
);
107 msg
->MinMaxInfo
->MinWidth
+= 8;
108 msg
->MinMaxInfo
->MinHeight
+= 8;
110 msg
->MinMaxInfo
->DefWidth
+= 16;
111 msg
->MinMaxInfo
->DefHeight
+= 16;
113 msg
->MinMaxInfo
->MaxWidth
= MUI_MAXMAX
;
114 msg
->MinMaxInfo
->MaxHeight
= MUI_MAXMAX
;
119 IPTR
Framedisplay__MUIM_Draw(struct IClass
*cl
, Object
*obj
,
120 struct MUIP_Draw
*msg
)
122 struct Framedisplay_DATA
*data
= INST_DATA(cl
, obj
);
123 const struct ZuneFrameGfx
*zframe
;
125 WORD ileft
, itop
, iright
, ibottom
;
128 DoSuperMethodA(cl
, obj
, (Msg
) msg
);
130 if (!(msg
->flags
& MADF_DRAWOBJECT
))
133 zframe
= zune_zframe_get(obj
, &data
->fs_intern
);
136 zframe
->draw(zframe
->customframe
, muiRenderInfo(obj
), _mleft(obj
),
137 _mtop(obj
), _mwidth(obj
), _mheight(obj
), _mleft(obj
), _mtop(obj
),
138 _mwidth(obj
), _mheight(obj
));
140 ileft
= _mleft(obj
) + zframe
->ileft
+ data
->fs_intern
.innerLeft
;
141 itop
= _mtop(obj
) + zframe
->itop
+ data
->fs_intern
.innerTop
;
142 iright
= _mright(obj
) - zframe
->iright
- data
->fs_intern
.innerRight
;
143 ibottom
= _mbottom(obj
) - zframe
->ibottom
- data
->fs_intern
.innerBottom
;
145 SetAPen(_rp(obj
), _pens(obj
)[MPEN_SHADOW
]);
147 region
= MUI_AddClipping(muiRenderInfo(obj
), ileft
, itop
,
148 iright
- ileft
+ 1, ibottom
- itop
+ 1);
150 for (i
= itop
; i
< ibottom
+ iright
- ileft
; i
++)
154 Move(_rp(obj
), ileft
, i
);
155 Draw(_rp(obj
), ileft
+ i
- itop
, itop
);
159 MUI_RemoveClipping(muiRenderInfo(obj
), region
);
164 IPTR
Framedisplay__MUIM_DragQuery(struct IClass
*cl
, Object
*obj
,
165 struct MUIP_DragQuery
*msg
)
167 struct MUI_FrameSpec
*dummy
= NULL
;
170 return MUIV_DragQuery_Refuse
;
171 if (!get(msg
->obj
, MUIA_Framedisplay_Spec
, &dummy
))
172 return MUIV_DragQuery_Refuse
;
173 return MUIV_DragQuery_Accept
;
176 IPTR
Framedisplay__MUIM_DragDrop(struct IClass
*cl
, Object
*obj
,
177 struct MUIP_DragDrop
*msg
)
179 struct MUI_FrameSpec
*spec
= NULL
;
181 get(msg
->obj
, MUIA_Framedisplay_Spec
, &spec
);
182 set(obj
, MUIA_Framedisplay_Spec
, (IPTR
) spec
);
187 #if ZUNE_BUILTIN_FRAMEDISPLAY
188 BOOPSI_DISPATCHER(IPTR
, Framedisplay_Dispatcher
, cl
, obj
, msg
)
190 switch (msg
->MethodID
)
193 return Framedisplay__OM_NEW(cl
, obj
, (struct opSet
*)msg
);
195 return Framedisplay__OM_SET(cl
, obj
, (APTR
) msg
);
197 return Framedisplay__OM_GET(cl
, obj
, (APTR
) msg
);
199 return Framedisplay__MUIM_AskMinMax(cl
, obj
, (APTR
) msg
);
201 return Framedisplay__MUIM_Draw(cl
, obj
, (APTR
) msg
);
203 return Framedisplay__MUIM_DragQuery(cl
, obj
, (APTR
) msg
);
205 return Framedisplay__MUIM_DragDrop(cl
, obj
, (APTR
) msg
);
207 return DoSuperMethodA(cl
, obj
, msg
);
210 BOOPSI_DISPATCHER_END
212 const struct __MUIBuiltinClass _MUI_Framedisplay_desc
=
216 sizeof(struct Framedisplay_DATA
),
217 (void *) Framedisplay_Dispatcher
219 #endif /* ZUNE_BUILTIN_FRAMEDISPLAY */