2 Copyright 1995-2011, The AROS Development Team. All rights reserved.
3 Copyright 2001-2003, The MorphOS Development Team. All Rights Reserved.
7 /**************************************************************************************************/
9 #include <exec/types.h>
11 #include <proto/intuition.h>
12 #include <proto/layers.h>
13 #include <intuition/classes.h>
14 #include <intuition/classusr.h>
15 #include <intuition/imageclass.h>
16 #include <intuition/windecorclass.h>
17 #include <intuition/scrdecorclass.h>
18 #include <intuition/intuition.h>
19 #include <intuition/intuitionbase.h>
20 #include <intuition/extensions.h>
21 #include <intuition/screens.h>
23 #include <proto/graphics.h>
24 #include <graphics/rastport.h>
26 #include <proto/utility.h>
27 #include <utility/tagitem.h>
29 #include <proto/alib.h>
31 #include <aros/asmcall.h>
32 #include "intuition_intern.h"
34 #include "intuition_extend.h"
37 #include "gadgets.h" /* Some handy rendering funtions */
39 #define INTDRI(dri) ((struct IntDrawInfo *)(dri))
43 extern BYTE
*ibSnapshot
;
44 extern BYTE
*ibSnapshotSel
;
45 extern BYTE
*ibPopupSel
;
47 extern BYTE
*ibIconify
;
48 extern BYTE
*ibIconifySel
;
50 extern BYTE
*ibLockSel
;
51 extern VOID
DrawIB(struct RastPort
*rp
,BYTE
*ib
,LONG cx
,LONG cy
,struct IntuitionBase
*IntuitionBase
);
52 extern void DrawJUMP(struct RastPort
*rp
,ULONG state
,LONG cx
,LONG cy
,struct IntuitionBase
*IntuitionBase
);
57 #include <aros/debug.h>
59 /**************************************************************************************************/
61 #define DEFSIZE_WIDTH 14
62 #define DEFSIZE_HEIGHT 14
64 /**************************************************************************************************/
66 /* Some handy transparent base class object casting defines.
68 #define IM(o) ((struct Image *)o)
70 static UWORD
getbgpen(ULONG state
, UWORD
*pens
);
71 static UWORD
getbgpen_gt(ULONG state
, UWORD
*pens
);
72 static void renderimageframe(struct RastPort
*rp
, ULONG which
, ULONG state
, UWORD
*pens
,
73 WORD left
, WORD top
, WORD width
, WORD height
,
74 struct IntuitionBase
*IntuitionBase
);
76 /**************************************************************************************************/
78 #define SYSIFLG_GADTOOLS 1
79 #define SYSIFLG_NOBORDER 2
81 /**************************************************************************************************/
83 /* Some handy drawing functions */
85 void draw_thick_line(Class
*cl
, struct RastPort
*rport
,
86 LONG x1
, LONG y1
, LONG x2
, LONG y2
,
89 struct IntuitionBase
*IntuitionBase
= (struct IntuitionBase
*)cl
->cl_UserData
;
90 struct GfxBase
*GfxBase
= GetPrivIBase(IntuitionBase
)->GfxBase
;
94 Move(rport
, x1
+ 1, y1
);
95 Draw(rport
, x2
+ 1, y2
);
98 /**************************************************************************************************/
100 BOOL
sysi_setnew(Class
*cl
, Object
*obj
, struct opSet
*msg
)
102 struct IntuitionBase
*IntuitionBase
= (struct IntuitionBase
*)cl
->cl_UserData
;
103 struct Library
*UtilityBase
= GetPrivIBase(IntuitionBase
)->UtilityBase
;
104 struct SysIData
*data
= INST_DATA(cl
, obj
);
105 struct TagItem
*taglist
, *tag
;
106 struct TextFont
*reffont
= NULL
;
107 int size
= SYSISIZE_MEDRES
;
108 BOOL unsupported
= FALSE
;
109 BOOL set_width
= FALSE
, set_height
= FALSE
;
111 taglist
= msg
->ops_AttrList
;
112 while ((tag
= NextTagItem(&taglist
)))
125 data
->dri
= (struct DrawInfo
*)tag
->ti_Data
;
126 reffont
= data
->dri
->dri_Font
;
130 data
->type
= tag
->ti_Data
;
132 D(bug("SYSIA_Which type: %d\n", data
->type
));
134 switch (tag
->ti_Data
)
136 // FIXME: if IA_Width, IA_Height was not specified sysiclass should choose size depending on drawinfo (screen resolution)"
166 case SYSIA_ReferenceFont
:
167 if (tag
->ti_Data
) reffont
= (struct TextFont
*)tag
->ti_Data
;
176 case SYSIA_WithBorder
:
179 data
->flags
|= SYSIFLG_NOBORDER
;
184 if (tag
->ti_Data
== SYSISTYLE_GADTOOLS
)
186 data
->flags
|= SYSIFLG_GADTOOLS
;
190 case SYSIA_UserBuffer
:
191 data
->userbuffer
= (APTR
)tag
->ti_Data
;
195 } /* switch(tag->ti_Tag) */
197 } /* while ((tag = NextTagItem(&taglist))) */
199 D(bug("dri: %p, unsupported: %d version: %d\n", data
->dri
, unsupported
, data
->dri
->dri_Version
));
201 if ((!data
->dri
) || (unsupported
) || (data
->dri
->dri_Version
!= DRI_VERSION_AROS
))
205 ULONG width
= DEFSIZE_WIDTH
, height
= DEFSIZE_HEIGHT
;
207 BOOL tc
= (data
->dri
->dri_Flags
& DRIF_DIRECTCOLOR
);
209 if (data
->type
== SDEPTHIMAGE
)
211 struct sdpGetDefSizeSysImage smsg
;
213 smsg
.MethodID
= SDM_GETDEFSIZE_SYSIMAGE
;
214 smsg
.sdp_TrueColor
= tc
;
215 smsg
.sdp_Which
= data
->type
;
216 smsg
.sdp_SysiSize
= size
;
217 smsg
.sdp_ReferenceFont
= reffont
;
218 smsg
.sdp_Width
= &width
;
219 smsg
.sdp_Height
= &height
;
221 smsg
.sdp_Dri
= data
->dri
;
222 smsg
.sdp_UserBuffer
= 0;
224 DoMethodA(((struct IntScreen
*)(((struct IntDrawInfo
*)data
->dri
)->dri_Screen
))->ScrDecorObj
, (Msg
)&smsg
);
227 else if ((data
->type
== AMIGAKEY
) || (data
->type
== MENUCHECK
) || (data
->type
== SUBMENUIMAGE
))
229 struct mdpGetDefSizeSysImage mmsg
;
231 mmsg
.MethodID
= MDM_GETDEFSIZE_SYSIMAGE
;
232 mmsg
.mdp_TrueColor
= tc
;
233 mmsg
.mdp_Which
= data
->type
;
234 mmsg
.mdp_SysiSize
= size
;
235 mmsg
.mdp_ReferenceFont
= reffont
;
236 mmsg
.mdp_Width
= &width
;
237 mmsg
.mdp_Height
= &height
;
239 mmsg
.mdp_Dri
= data
->dri
;
240 DoMethodA(((struct IntScreen
*)(((struct IntDrawInfo
*)data
->dri
)->dri_Screen
))->MenuDecorObj
, (Msg
)&mmsg
);
245 struct wdpGetDefSizeSysImage wmsg
;
247 wmsg
.MethodID
= WDM_GETDEFSIZE_SYSIMAGE
;
248 wmsg
.wdp_TrueColor
= tc
;
249 wmsg
.wdp_Which
= data
->type
;
250 wmsg
.wdp_SysiSize
= size
;
251 wmsg
.wdp_ReferenceFont
= reffont
;
252 wmsg
.wdp_Width
= &width
;
253 wmsg
.wdp_Height
= &height
;
255 wmsg
.wdp_Dri
= data
->dri
;
256 wmsg
.wdp_UserBuffer
= 0;
258 DoMethodA(((struct IntScreen
*)(((struct IntDrawInfo
*)data
->dri
)->dri_Screen
))->WinDecorObj
, (Msg
)&wmsg
);
263 if (!set_width
) IM(obj
)->Width
= width
;
264 if (!set_height
) IM(obj
)->Height
= height
;
270 /**************************************************************************************************/
272 Object
*SysIClass__OM_NEW(Class
*cl
, Class
*rootcl
, struct opSet
*msg
)
274 struct IntuitionBase
*IntuitionBase
= (struct IntuitionBase
*)cl
->cl_UserData
;
275 struct SysIData
*data
;
278 D(bug("sysi_new()\n"));
279 obj
= (Object
*)DoSuperMethodA(cl
, (Object
*)rootcl
, (Msg
)msg
);
283 D(bug("sysi_new,: obj=%p\n", obj
));
285 data
= INST_DATA(cl
, obj
);
291 if (!sysi_setnew(cl
, obj
, (struct opSet
*)msg
))
293 STACKULONG method
= OM_DISPOSE
;
294 CoerceMethodA(cl
, obj
, (Msg
)&method
);
298 D(bug("sysi_setnew called successfully\n"));
305 struct TagItem tags
[] =
307 {IA_FrameType
, FRAME_BUTTON
},
308 {IA_EdgesOnly
, FALSE
},
312 tags
[2].ti_Data
= (IPTR
)msg
->ops_AttrList
;
314 data
->frame
= NewObjectA(NULL
, FRAMEICLASS
, tags
);
317 STACKULONG method
= OM_DISPOSE
;
318 CoerceMethodA(cl
, obj
, (Msg
)&method
);
324 /* Just to prevent it from reaching default: */
350 STACKULONG method
= OM_DISPOSE
;
352 CoerceMethodA(cl
, obj
, (Msg
)&method
);
360 /**************************************************************************************************/
367 * heuristics for smaller arrows used in apps
370 #define HSPACING_MIDDLE 2
371 #define VSPACING_MIDDLE 2
372 #define HSPACING_SMALL 1
373 #define VSPACING_SMALL 1
375 IPTR
SysIClass__IM_DRAW(Class
*cl
, Object
*obj
, struct impDraw
*msg
)
377 struct IntuitionBase
*IntuitionBase
= (struct IntuitionBase
*)cl
->cl_UserData
;
378 struct GfxBase
*GfxBase
= GetPrivIBase(IntuitionBase
)->GfxBase
;
379 struct SysIData
*data
= INST_DATA(cl
, obj
);
380 struct RastPort
*rport
= msg
->imp_RPort
;
381 struct Window
*win
= NULL
;
382 WORD left
= IM(obj
)->LeftEdge
+ msg
->imp_Offset
.X
;
383 WORD top
= IM(obj
)->TopEdge
+ msg
->imp_Offset
.Y
;
384 UWORD width
= IM(obj
)->Width
;
385 UWORD height
= IM(obj
)->Height
;
386 WORD right
= left
+ width
- 1;
387 WORD bottom
= top
+ height
- 1;
388 struct wdpDrawSysImage wdecormsg
;
389 struct sdpDrawSysImage sdecormsg
;
390 struct mdpDrawSysImage mdecormsg
;
392 BOOL tc
= (data
->dri
->dri_Flags
& DRIF_DIRECTCOLOR
);
394 if (rport
) if (rport
->Layer
) win
= (struct Window
*) rport
->Layer
->Window
;
396 wdecormsg
.MethodID
= WDM_DRAW_SYSIMAGE
;
397 wdecormsg
.wdp_TrueColor
= tc
;
398 wdecormsg
.wdp_RPort
= rport
;
399 wdecormsg
.wdp_X
= left
;
400 wdecormsg
.wdp_Y
= top
;
401 wdecormsg
.wdp_Width
= width
;
402 wdecormsg
.wdp_Height
= height
;
403 wdecormsg
.wdp_Which
= data
->type
;
404 wdecormsg
.wdp_State
= msg
->imp_State
;
405 wdecormsg
.wdp_Flags
= 0;
406 wdecormsg
.wdp_Dri
= data
->dri
;
407 wdecormsg
.wdp_UserBuffer
= (win
== NULL
) ? 0 : ((struct IntWindow
*)win
)->DecorUserBuffer
;
409 sdecormsg
.MethodID
= SDM_DRAW_SYSIMAGE
;
410 sdecormsg
.sdp_TrueColor
= tc
;
411 sdecormsg
.sdp_RPort
= rport
;
412 sdecormsg
.sdp_X
= left
;
413 sdecormsg
.sdp_Y
= top
;
414 sdecormsg
.sdp_Width
= width
;
415 sdecormsg
.sdp_Height
= height
;
416 sdecormsg
.sdp_Which
= data
->type
;
417 sdecormsg
.sdp_State
= msg
->imp_State
;
418 sdecormsg
.sdp_Flags
= 0;
419 sdecormsg
.sdp_Dri
= data
->dri
;
420 sdecormsg
.sdp_UserBuffer
= (IPTR
)data
->userbuffer
;
422 mdecormsg
.MethodID
= MDM_DRAW_SYSIMAGE
;
423 mdecormsg
.mdp_TrueColor
= tc
;
424 mdecormsg
.mdp_RPort
= rport
;
425 mdecormsg
.mdp_X
= left
;
426 mdecormsg
.mdp_Y
= top
;
427 mdecormsg
.mdp_Width
= width
;
428 mdecormsg
.mdp_Height
= height
;
429 mdecormsg
.mdp_Which
= data
->type
;
430 mdecormsg
.mdp_State
= msg
->imp_State
;
431 mdecormsg
.mdp_Flags
= 0;
432 mdecormsg
.mdp_Dri
= data
->dri
;
433 mdecormsg
.mdp_UserBuffer
= (IPTR
)data
->userbuffer
;
435 SetDrMd(rport
, JAM1
);
441 WORD h_spacing
= width
/ 4;
442 WORD v_spacing
= height
/ 4;
445 DrawImageState(rport
, data
->frame
,
446 msg
->imp_Offset
.X
, msg
->imp_Offset
.Y
,
447 IDS_NORMAL
, data
->dri
);
449 /* Draw checkmark (only if image is in selected state) */
450 if (msg
->imp_State
== IDS_SELECTED
)
454 width
-= h_spacing
* 2;
457 height
-= v_spacing
* 2;
459 SetAPen(rport
, data
->dri
->dri_Pens
[SHADOWPEN
]);
460 draw_thick_line(cl
, rport
, left
, top
+ height
/ 3 , left
, bottom
, 0);
461 draw_thick_line(cl
, rport
, left
+ 1, bottom
, right
- 1, top
, 0);
468 BOOL selected
= FALSE
;
469 WORD col1
= SHINEPEN
;
470 WORD col2
= SHADOWPEN
;
472 if ((msg
->imp_State
== IDS_SELECTED
) || (msg
->imp_State
== IDS_INACTIVESELECTED
))
479 SetAPen(rport
, data
->dri
->dri_Pens
[BACKGROUNDPEN
]);
480 RectFill(rport
, left
, top
, right
, bottom
);
485 SetAPen(rport
, data
->dri
->dri_Pens
[col1
]);
486 RectFill(rport
, left
+ 2, top
, right
- 3, top
+ 1);
487 RectFill(rport
, left
+ 1, top
+ 2, left
+ 2, top
+ 3);
488 RectFill(rport
, left
, top
+ 4, left
+ 1, bottom
- 4);
489 RectFill(rport
, left
+ 1, bottom
- 3, left
+ 2, bottom
- 2);
490 RectFill(rport
, left
+ 2, bottom
- 1, left
+ 2, bottom
);
492 SetAPen(rport
, data
->dri
->dri_Pens
[col2
]);
493 RectFill(rport
, right
- 2, top
, right
- 2, top
+ 1);
494 RectFill(rport
, right
- 2, top
+ 2, right
- 1, top
+ 3);
495 RectFill(rport
, right
- 1, top
+ 4, right
, bottom
- 4);
496 RectFill(rport
, right
- 2, bottom
- 3, right
- 1, bottom
- 2);
497 RectFill(rport
, left
+ 3, bottom
- 1, right
- 2, bottom
);
508 SetAPen(rport
, data
->dri
->dri_Pens
[FILLPEN
]);
509 if ((width
>= 3) && (height
>= 3))
511 RectFill(rport
, left
+ 1, top
, right
- 1, top
);
512 RectFill(rport
, left
, top
+ 1, right
, bottom
- 1);
513 RectFill(rport
, left
+ 1, bottom
, right
- 1, bottom
);
517 RectFill(rport
, left
, top
, right
, bottom
);
523 SetAPen(rport
, data
->dri
->dri_Pens
[col1
]);
524 RectFill(rport
, left
+ 3, top
, right
- 3, top
);
525 WritePixel(rport
, left
+ 2, top
+ 1);
526 RectFill(rport
, left
+ 1, top
+ 2, left
+ 1, top
+ 3);
527 RectFill(rport
, left
, top
+ 4, left
, bottom
- 4);
528 RectFill(rport
, left
+ 1, bottom
- 3, left
+ 1, bottom
- 2);
529 WritePixel(rport
, left
+ 2, bottom
- 1);
531 SetAPen(rport
, data
->dri
->dri_Pens
[col2
]);
532 WritePixel(rport
, right
- 2, top
+ 1);
533 RectFill(rport
, right
- 1, top
+ 2, right
- 1, top
+ 3);
534 RectFill(rport
, right
, top
+ 4, right
, bottom
- 4);
535 RectFill(rport
, right
- 1, bottom
- 3, right
- 1, bottom
- 2);
536 WritePixel(rport
, right
- 2, bottom
- 1);
537 RectFill(rport
, left
+ 3, bottom
, right
- 3, bottom
);
548 SetAPen(rport
, data
->dri
->dri_Pens
[FILLPEN
]);
549 if ((width
>= 5) && (height
>= 5))
551 RectFill(rport
, left
, top
+ 2, left
, bottom
- 2);
552 RectFill(rport
, left
+ 1, top
+ 1, left
+ 1, bottom
- 1);
553 RectFill(rport
, left
+ 2, top
, right
- 2, bottom
);
554 RectFill(rport
, right
- 1, top
+ 1, right
- 1, bottom
- 1);
555 RectFill(rport
, right
, top
+ 2, right
, bottom
- 2);
559 RectFill(rport
, left
, top
, right
, bottom
);
569 UWORD hspacing
,vspacing
;
572 if (!(data
->flags
& (SYSIFLG_NOBORDER
| SYSIFLG_GADTOOLS
)))
574 DoMethodA(((struct IntScreen
*)(((struct IntDrawInfo
*)data
->dri
)->dri_Screen
))->WinDecorObj
, (Msg
)&wdecormsg
);
583 hspacing
= HSPACING_MIDDLE
;
588 hspacing
= HSPACING_SMALL
;
593 vspacing
= VSPACING_MIDDLE
;
598 vspacing
= VSPACING_SMALL
;
601 if (!(data
->flags
& SYSIFLG_NOBORDER
))
603 renderimageframe(rport
, LEFTIMAGE
, msg
->imp_State
, data
->dri
->dri_Pens
,
604 left
, top
, width
, height
, IntuitionBase
);
612 if (data
->flags
& SYSIFLG_GADTOOLS
)
614 SetAPen(rport
, getbgpen_gt(msg
->imp_State
, data
->dri
->dri_Pens
));
615 RectFill(rport
, left
, top
, right
, bottom
);
619 if (data
->flags
& SYSIFLG_GADTOOLS
)
621 SetAPen(rport
, data
->dri
->dri_Pens
[SHADOWPEN
]);
625 Move(rport
, left
+ width
- 1 - hspacing
, top
+ vspacing
+ 1);
626 Draw(rport
, left
+ hspacing
, top
+ height
- cy
);
627 Move(rport
, left
+ width
- 1 - hspacing
, top
+ vspacing
);
628 Draw(rport
, left
+ hspacing
, top
+ height
- cy
- 1);
630 Move(rport
, left
+ width
- 1 - hspacing
, top
+ height
- 1- vspacing
- 1);
631 Draw(rport
, left
+ hspacing
, top
+ cy
- 1);
632 Move(rport
, left
+ width
- 1 - hspacing
, top
+ height
- 1 - vspacing
);
633 Draw(rport
, left
+ hspacing
, top
+ cy
);
639 SetAPen(rport
, getbgpen(msg
->imp_State
, data
->dri
->dri_Pens
));
641 RectFill(rport
, left
, top
, right
, bottom
);
645 width
-= hspacing
* 2;
646 height
-= vspacing
* 2;
648 right
= left
+ width
- 1;
649 bottom
= top
+ height
- 1;
651 cy
= (height
+ 1) / 2;
653 SetAPen(rport
, data
->dri
->dri_Pens
[SHADOWPEN
]);
655 for(i
= 0; i
< cy
; i
++)
657 RectFill(rport
, left
+ (cy
- i
- 1) * width
/ cy
,
659 right
- i
* width
/ cy
/ 2,
661 RectFill(rport
, left
+ (cy
- i
- 1) * width
/ cy
,
663 right
- i
* width
/ cy
/ 2,
673 UWORD hspacing
,vspacing
;
676 if (!(data
->flags
& (SYSIFLG_NOBORDER
| SYSIFLG_GADTOOLS
)))
678 DoMethodA(((struct IntScreen
*)(((struct IntDrawInfo
*)data
->dri
)->dri_Screen
))->WinDecorObj
, (Msg
)&wdecormsg
);
687 hspacing
= HSPACING_MIDDLE
;
692 hspacing
= HSPACING_SMALL
;
697 vspacing
= VSPACING_MIDDLE
;
702 vspacing
= VSPACING_SMALL
;
705 if (!(data
->flags
& SYSIFLG_NOBORDER
))
707 renderimageframe(rport
, UPIMAGE
, msg
->imp_State
, data
->dri
->dri_Pens
,
708 left
, top
, width
, height
, IntuitionBase
);
716 if (data
->flags
& SYSIFLG_GADTOOLS
)
718 SetAPen(rport
, getbgpen_gt(msg
->imp_State
, data
->dri
->dri_Pens
));
719 RectFill(rport
, left
, top
, right
, bottom
);
724 if (data
->flags
& SYSIFLG_GADTOOLS
)
726 SetAPen(rport
, data
->dri
->dri_Pens
[SHADOWPEN
]);
730 Move(rport
, left
+ hspacing
+ 1, top
+ height
- 1 - vspacing
);
731 Draw(rport
, left
+ width
- cx
, top
+ vspacing
);
732 Move(rport
, left
+ hspacing
, top
+ height
- 1 - vspacing
);
733 Draw(rport
, left
+ width
- cx
- 1, top
+ vspacing
);
735 Move(rport
, left
+ width
- 1 - hspacing
- 1, top
+ height
- 1 - vspacing
);
736 Draw(rport
, left
+ cx
- 1, top
+ vspacing
);
737 Move(rport
, left
+ width
- 1 - hspacing
, top
+ height
- 1 - vspacing
);
738 Draw(rport
, left
+ cx
, top
+ vspacing
);
744 SetAPen(rport
, getbgpen(msg
->imp_State
, data
->dri
->dri_Pens
));
746 RectFill(rport
, left
, top
, right
, bottom
);
750 width
-= hspacing
* 2;
751 height
-= vspacing
* 2;
753 right
= left
+ width
- 1;
754 bottom
= top
+ height
- 1;
756 cx
= (width
+ 1) / 2;
758 SetAPen(rport
, data
->dri
->dri_Pens
[SHADOWPEN
]);
760 for(i
= 0; i
< cx
; i
++)
762 RectFill(rport
, left
+ i
,
763 top
+ (cx
- i
- 1) * height
/ cx
,
765 bottom
- i
* height
/ cx
/ 2);
766 RectFill(rport
, right
- i
,
767 top
+ (cx
- i
- 1) * height
/ cx
,
769 bottom
- i
* height
/ cx
/ 2);
778 UWORD hspacing
,vspacing
;
781 if (!(data
->flags
& (SYSIFLG_NOBORDER
| SYSIFLG_GADTOOLS
)))
783 DoMethodA(((struct IntScreen
*)(((struct IntDrawInfo
*)data
->dri
)->dri_Screen
))->WinDecorObj
, (Msg
)&wdecormsg
);
792 hspacing
= HSPACING_MIDDLE
;
797 hspacing
= HSPACING_SMALL
;
802 vspacing
= VSPACING_MIDDLE
;
807 vspacing
= VSPACING_SMALL
;
810 if (!(data
->flags
& SYSIFLG_NOBORDER
))
812 renderimageframe(rport
, RIGHTIMAGE
, msg
->imp_State
, data
->dri
->dri_Pens
,
813 left
, top
, width
, height
, IntuitionBase
);
821 if (data
->flags
& SYSIFLG_GADTOOLS
)
823 SetAPen(rport
, getbgpen_gt(msg
->imp_State
, data
->dri
->dri_Pens
));
824 RectFill(rport
, left
, top
, right
, bottom
);
829 if (data
->flags
& SYSIFLG_GADTOOLS
)
831 SetAPen(rport
, data
->dri
->dri_Pens
[SHADOWPEN
]);
835 Move(rport
, left
+ hspacing
, top
+ vspacing
+ 1);
836 Draw(rport
, left
+ width
- 1 - hspacing
, top
+ height
- cy
);
837 Move(rport
, left
+ hspacing
, top
+ vspacing
);
838 Draw(rport
, left
+ width
- 1 - hspacing
, top
+ height
- cy
- 1);
840 Move(rport
, left
+ hspacing
, top
+ height
- 1- vspacing
- 1);
841 Draw(rport
, left
+ width
- 1 - hspacing
, top
+ cy
- 1);
842 Move(rport
, left
+ hspacing
, top
+ height
- 1 - vspacing
);
843 Draw(rport
, left
+ width
- 1 - hspacing
, top
+ cy
);
850 SetAPen(rport
, getbgpen(msg
->imp_State
, data
->dri
->dri_Pens
));
852 RectFill(rport
, left
, top
, right
, bottom
);
856 width
-= hspacing
* 2;
857 height
-= vspacing
* 2;
859 right
= left
+ width
- 1;
860 bottom
= top
+ height
- 1;
862 cy
= (height
+ 1) / 2;
864 SetAPen(rport
, data
->dri
->dri_Pens
[SHADOWPEN
]);
866 for(i
= 0; i
< cy
; i
++)
868 RectFill(rport
, left
+ i
* width
/ cy
/ 2,
870 right
- (cy
- i
- 1) * width
/ cy
,
872 RectFill(rport
, left
+ i
* width
/ cy
/ 2,
874 right
- (cy
- i
- 1) * width
/ cy
,
884 UWORD hspacing
,vspacing
;
887 if (!(data
->flags
& (SYSIFLG_NOBORDER
| SYSIFLG_GADTOOLS
)))
889 DoMethodA(((struct IntScreen
*)(((struct IntDrawInfo
*)data
->dri
)->dri_Screen
))->WinDecorObj
, (Msg
)&wdecormsg
);
898 hspacing
= HSPACING_MIDDLE
;
903 hspacing
= HSPACING_SMALL
;
908 vspacing
= VSPACING_MIDDLE
;
913 vspacing
= VSPACING_SMALL
;
916 if (!(data
->flags
& SYSIFLG_NOBORDER
))
918 renderimageframe(rport
, DOWNIMAGE
, msg
->imp_State
, data
->dri
->dri_Pens
,
919 left
, top
, width
, height
, IntuitionBase
);
927 if (data
->flags
& SYSIFLG_GADTOOLS
)
929 SetAPen(rport
, getbgpen_gt(msg
->imp_State
, data
->dri
->dri_Pens
));
930 RectFill(rport
, left
, top
, right
, bottom
);
934 if (data
->flags
& SYSIFLG_GADTOOLS
)
936 SetAPen(rport
, data
->dri
->dri_Pens
[SHADOWPEN
]);
940 Move(rport
, left
+ hspacing
+ 1, top
+ vspacing
);
941 Draw(rport
, left
+ width
- cx
, top
+ height
- 1 - vspacing
);
942 Move(rport
, left
+ hspacing
, top
+ vspacing
);
943 Draw(rport
, left
+ width
- cx
- 1, top
+ height
- 1 - vspacing
);
945 Move(rport
, left
+ width
- 1 - hspacing
- 1, top
+ vspacing
);
946 Draw(rport
, left
+ cx
- 1, top
+ height
- 1 - vspacing
);
947 Move(rport
, left
+ width
- 1 - hspacing
, top
+ vspacing
);
948 Draw(rport
, left
+ cx
, top
+ height
- 1 - vspacing
);
954 SetAPen(rport
, getbgpen(msg
->imp_State
, data
->dri
->dri_Pens
));
956 RectFill(rport
, left
, top
, right
, bottom
);
960 width
-= hspacing
* 2;
961 height
-= vspacing
* 2;
963 right
= left
+ width
- 1;
964 bottom
= top
+ height
- 1;
966 cx
= (width
+ 1) / 2;
968 SetAPen(rport
, data
->dri
->dri_Pens
[SHADOWPEN
]);
970 for(i
= 0; i
< cx
; i
++)
972 RectFill(rport
, left
+ i
,
973 top
+ i
* height
/ cx
/ 2,
975 bottom
- (cx
- i
- 1) * height
/ cx
);
976 RectFill(rport
, right
- i
,
977 top
+ i
* height
/ cx
/ 2,
979 bottom
- (cx
- i
- 1) * height
/ cx
);
992 DoMethodA(((struct IntScreen
*)(((struct IntDrawInfo
*)data
->dri
)->dri_Screen
))->WinDecorObj
, (Msg
)&wdecormsg
);
998 DoMethodA(((struct IntScreen
*)(((struct IntDrawInfo
*)data
->dri
)->dri_Screen
))->ScrDecorObj
, (Msg
)&sdecormsg
);
1004 DoMethodA(((struct IntScreen
*)(((struct IntDrawInfo
*)data
->dri
)->dri_Screen
))->MenuDecorObj
, (Msg
)&mdecormsg
);
1010 DoMethodA(((struct IntScreen
*)(((struct IntDrawInfo
*)data
->dri
)->dri_Screen
))->MenuDecorObj
, (Msg
)&mdecormsg
);
1016 DoMethodA(((struct IntScreen
*)(((struct IntDrawInfo
*)data
->dri
)->dri_Screen
))->MenuDecorObj
, (Msg
)&mdecormsg
);
1020 /* MUI and other non-std images */
1027 DoMethodA(((struct IntScreen
*)(((struct IntDrawInfo
*)data
->dri
)->dri_Screen
))->WinDecorObj
, (Msg
)&wdecormsg
);
1033 } /* switch (image type) */
1038 IPTR
SysIClass__OM_DISPOSE(Class
*cl
, Object
*obj
, Msg msg
)
1040 struct IntuitionBase
*IntuitionBase
= (struct IntuitionBase
*)cl
->cl_UserData
;
1041 struct SysIData
*data
= INST_DATA(cl
, obj
);
1043 DisposeObject(data
->frame
);
1044 return DoSuperMethodA(cl
, obj
, msg
);
1047 IPTR
SysIClass__OM_SET(Class
*cl
, Object
*obj
, Msg msg
)
1049 struct SysIData
*data
= INST_DATA(cl
, obj
);
1052 DoMethodA((Object
*)data
->frame
, msg
);
1053 return DoSuperMethodA(cl
, obj
, msg
);
1056 /**************************************************************************************************/
1058 static UWORD
getbgpen(ULONG state
, UWORD
*pens
)
1070 bg
= pens
[BACKGROUNDPEN
];
1077 /**************************************************************************************************/
1079 static UWORD
getbgpen_gt(ULONG state
, UWORD
*pens
)
1086 case IDS_INACTIVESELECTED
:
1091 bg
= pens
[BACKGROUNDPEN
];
1098 /**************************************************************************************************/
1100 static void renderimageframe(struct RastPort
*rp
, ULONG which
, ULONG state
, UWORD
*pens
,
1101 WORD left
, WORD top
, WORD width
, WORD height
,
1102 struct IntuitionBase
*IntuitionBase
)
1104 struct GfxBase
*GfxBase
= GetPrivIBase(IntuitionBase
)->GfxBase
;
1105 WORD right
= left
+ width
- 1;
1106 WORD bottom
= top
+ height
- 1;
1107 BOOL leftedgegodown
= FALSE
;
1108 BOOL topedgegoright
= FALSE
;
1113 /* draw separator line at the right side */
1114 SetAPen(rp
, pens
[SHINEPEN
]);
1115 RectFill(rp
, right
, top
, right
, bottom
- 1);
1116 SetAPen(rp
, pens
[SHADOWPEN
]);
1117 WritePixel(rp
, right
, bottom
);
1125 /* draw separator line at the left side */
1126 SetAPen(rp
, pens
[SHINEPEN
]);
1127 WritePixel(rp
, left
, top
);
1128 SetAPen(rp
, pens
[SHADOWPEN
]);
1129 RectFill(rp
, left
, top
+ 1, left
, bottom
);
1136 leftedgegodown
= TRUE
;
1141 topedgegoright
= TRUE
;
1145 if (left
== 0) leftedgegodown
= TRUE
;
1146 if (top
== 0) topedgegoright
= TRUE
;
1148 SetAPen(rp
, pens
[((state
== IDS_SELECTED
) || (state
== IDS_INACTIVESELECTED
)) ? SHADOWPEN
: SHINEPEN
]);
1154 bottom
- (leftedgegodown
? 0 : 1));
1157 RectFill(rp
, left
+ 1,
1159 right
- (topedgegoright
? 0 : 1),
1162 SetAPen(rp
, pens
[((state
== IDS_SELECTED
) || (state
== IDS_INACTIVESELECTED
)) ? SHINEPEN
: SHADOWPEN
]);
1166 top
+ (topedgegoright
? 1 : 0),
1171 RectFill(rp
, left
+ (leftedgegodown
? 1 : 0),
1177 /**************************************************************************************************/