2 Copyright 1995-2005, 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
);
77 #define IntuitionBase ((struct IntuitionBase *)(cl->cl_UserData))
80 /**************************************************************************************************/
82 #define SYSIFLG_GADTOOLS 1
83 #define SYSIFLG_NOBORDER 2
85 /**************************************************************************************************/
87 /* Some handy drawing functions */
89 void draw_thick_line(Class
*cl
, struct RastPort
*rport
,
90 LONG x1
, LONG y1
, LONG x2
, LONG y2
,
96 Move(rport
, x1
+ 1, y1
);
97 Draw(rport
, x2
+ 1, y2
);
100 /**************************************************************************************************/
102 BOOL
sysi_setnew(Class
*cl
, Object
*obj
, struct opSet
*msg
)
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((const struct TagItem
**)&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 #warning "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
= tag
->ti_Data
;
195 } /* switch(tag->ti_Tag) */
197 } /* while ((tag = NextTagItem(&taglist))) */
199 D(bug("dri: %p, unsupported: %d\n", data
->dri
, unsupported
));
201 if ((!data
->dri
) || (unsupported
))
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 SysIData
*data
;
277 D(bug("sysi_new()\n"));
278 obj
= (Object
*)DoSuperMethodA(cl
, (Object
*)rootcl
, (Msg
)msg
);
282 D(bug("sysi_new,: obj=%p\n", obj
));
284 data
= INST_DATA(cl
, obj
);
290 if (!sysi_setnew(cl
, obj
, (struct opSet
*)msg
))
292 STACKULONG method
= OM_DISPOSE
;
293 CoerceMethodA(cl
, obj
, (Msg
)&method
);
297 D(bug("sysi_setnew called successfully\n"));
304 struct TagItem tags
[] =
306 {IA_FrameType
, FRAME_BUTTON
},
307 {IA_EdgesOnly
, FALSE
},
311 tags
[2].ti_Data
= (IPTR
)msg
->ops_AttrList
;
313 data
->frame
= NewObjectA(NULL
, FRAMEICLASS
, tags
);
316 STACKULONG method
= OM_DISPOSE
;
317 CoerceMethodA(cl
, obj
, (Msg
)&method
);
323 /* Just to prevent it from reaching default: */
349 STACKULONG method
= OM_DISPOSE
;
351 CoerceMethodA(cl
, obj
, (Msg
)&method
);
359 /**************************************************************************************************/
366 * heuristics for smaller arrows used in apps
369 #define HSPACING_MIDDLE 2
370 #define VSPACING_MIDDLE 2
371 #define HSPACING_SMALL 1
372 #define VSPACING_SMALL 1
374 IPTR
SysIClass__IM_DRAW(Class
*cl
, Object
*obj
, struct impDraw
*msg
)
376 struct SysIData
*data
= INST_DATA(cl
, obj
);
377 struct RastPort
*rport
= msg
->imp_RPort
;
378 struct Window
*win
= NULL
;
379 WORD left
= IM(obj
)->LeftEdge
+ msg
->imp_Offset
.X
;
380 WORD top
= IM(obj
)->TopEdge
+ msg
->imp_Offset
.Y
;
381 UWORD width
= IM(obj
)->Width
;
382 UWORD height
= IM(obj
)->Height
;
383 WORD right
= left
+ width
- 1;
384 WORD bottom
= top
+ height
- 1;
385 struct wdpDrawSysImage wdecormsg
;
386 struct sdpDrawSysImage sdecormsg
;
387 struct mdpDrawSysImage mdecormsg
;
389 BOOL tc
= (data
->dri
->dri_Flags
& DRIF_DIRECTCOLOR
);
391 if (rport
) if (rport
->Layer
) win
= (struct Window
*) rport
->Layer
->Window
;
393 wdecormsg
.MethodID
= WDM_DRAW_SYSIMAGE
;
394 wdecormsg
.wdp_TrueColor
= tc
;
395 wdecormsg
.wdp_RPort
= rport
;
396 wdecormsg
.wdp_X
= left
;
397 wdecormsg
.wdp_Y
= top
;
398 wdecormsg
.wdp_Width
= width
;
399 wdecormsg
.wdp_Height
= height
;
400 wdecormsg
.wdp_Which
= data
->type
;
401 wdecormsg
.wdp_State
= msg
->imp_State
;
402 wdecormsg
.wdp_Flags
= 0;
403 wdecormsg
.wdp_Dri
= data
->dri
;
404 wdecormsg
.wdp_UserBuffer
= (win
== NULL
) ? NULL
: ((struct IntWindow
*)win
)->DecorUserBuffer
;
406 sdecormsg
.MethodID
= SDM_DRAW_SYSIMAGE
;
407 sdecormsg
.sdp_TrueColor
= tc
;
408 sdecormsg
.sdp_RPort
= rport
;
409 sdecormsg
.sdp_X
= left
;
410 sdecormsg
.sdp_Y
= top
;
411 sdecormsg
.sdp_Width
= width
;
412 sdecormsg
.sdp_Height
= height
;
413 sdecormsg
.sdp_Which
= data
->type
;
414 sdecormsg
.sdp_State
= msg
->imp_State
;
415 sdecormsg
.sdp_Flags
= 0;
416 sdecormsg
.sdp_Dri
= data
->dri
;
417 sdecormsg
.sdp_UserBuffer
= data
->userbuffer
;
419 mdecormsg
.MethodID
= MDM_DRAW_SYSIMAGE
;
420 mdecormsg
.mdp_TrueColor
= tc
;
421 mdecormsg
.mdp_RPort
= rport
;
422 mdecormsg
.mdp_X
= left
;
423 mdecormsg
.mdp_Y
= top
;
424 mdecormsg
.mdp_Width
= width
;
425 mdecormsg
.mdp_Height
= height
;
426 mdecormsg
.mdp_Which
= data
->type
;
427 mdecormsg
.mdp_State
= msg
->imp_State
;
428 mdecormsg
.mdp_Flags
= 0;
429 mdecormsg
.mdp_Dri
= data
->dri
;
430 mdecormsg
.mdp_UserBuffer
= data
->userbuffer
;
432 SetDrMd(rport
, JAM1
);
438 WORD h_spacing
= width
/ 4;
439 WORD v_spacing
= height
/ 4;
442 DrawImageState(rport
, data
->frame
,
443 msg
->imp_Offset
.X
, msg
->imp_Offset
.Y
,
444 IDS_NORMAL
, data
->dri
);
446 /* Draw checkmark (only if image is in selected state) */
447 if (msg
->imp_State
== IDS_SELECTED
)
451 width
-= h_spacing
* 2;
454 height
-= v_spacing
* 2;
456 SetAPen(rport
, data
->dri
->dri_Pens
[SHADOWPEN
]);
457 draw_thick_line(cl
, rport
, left
, top
+ height
/ 3 , left
, bottom
, 0);
458 draw_thick_line(cl
, rport
, left
+ 1, bottom
, right
- 1, top
, 0);
465 BOOL selected
= FALSE
;
466 WORD col1
= SHINEPEN
;
467 WORD col2
= SHADOWPEN
;
469 if ((msg
->imp_State
== IDS_SELECTED
) || (msg
->imp_State
== IDS_INACTIVESELECTED
))
476 SetAPen(rport
, data
->dri
->dri_Pens
[BACKGROUNDPEN
]);
477 RectFill(rport
, left
, top
, right
, bottom
);
482 SetAPen(rport
, data
->dri
->dri_Pens
[col1
]);
483 RectFill(rport
, left
+ 2, top
, right
- 3, top
+ 1);
484 RectFill(rport
, left
+ 1, top
+ 2, left
+ 2, top
+ 3);
485 RectFill(rport
, left
, top
+ 4, left
+ 1, bottom
- 4);
486 RectFill(rport
, left
+ 1, bottom
- 3, left
+ 2, bottom
- 2);
487 RectFill(rport
, left
+ 2, bottom
- 1, left
+ 2, bottom
);
489 SetAPen(rport
, data
->dri
->dri_Pens
[col2
]);
490 RectFill(rport
, right
- 2, top
, right
- 2, top
+ 1);
491 RectFill(rport
, right
- 2, top
+ 2, right
- 1, top
+ 3);
492 RectFill(rport
, right
- 1, top
+ 4, right
, bottom
- 4);
493 RectFill(rport
, right
- 2, bottom
- 3, right
- 1, bottom
- 2);
494 RectFill(rport
, left
+ 3, bottom
- 1, right
- 2, bottom
);
505 SetAPen(rport
, data
->dri
->dri_Pens
[FILLPEN
]);
506 if ((width
>= 3) && (height
>= 3))
508 RectFill(rport
, left
+ 1, top
, right
- 1, top
);
509 RectFill(rport
, left
, top
+ 1, right
, bottom
- 1);
510 RectFill(rport
, left
+ 1, bottom
, right
- 1, bottom
);
514 RectFill(rport
, left
, top
, right
, bottom
);
520 SetAPen(rport
, data
->dri
->dri_Pens
[col1
]);
521 RectFill(rport
, left
+ 3, top
, right
- 3, top
);
522 WritePixel(rport
, left
+ 2, top
+ 1);
523 RectFill(rport
, left
+ 1, top
+ 2, left
+ 1, top
+ 3);
524 RectFill(rport
, left
, top
+ 4, left
, bottom
- 4);
525 RectFill(rport
, left
+ 1, bottom
- 3, left
+ 1, bottom
- 2);
526 WritePixel(rport
, left
+ 2, bottom
- 1);
528 SetAPen(rport
, data
->dri
->dri_Pens
[col2
]);
529 WritePixel(rport
, right
- 2, top
+ 1);
530 RectFill(rport
, right
- 1, top
+ 2, right
- 1, top
+ 3);
531 RectFill(rport
, right
, top
+ 4, right
, bottom
- 4);
532 RectFill(rport
, right
- 1, bottom
- 3, right
- 1, bottom
- 2);
533 WritePixel(rport
, right
- 2, bottom
- 1);
534 RectFill(rport
, left
+ 3, bottom
, right
- 3, bottom
);
545 SetAPen(rport
, data
->dri
->dri_Pens
[FILLPEN
]);
546 if ((width
>= 5) && (height
>= 5))
548 RectFill(rport
, left
, top
+ 2, left
, bottom
- 2);
549 RectFill(rport
, left
+ 1, top
+ 1, left
+ 1, bottom
- 1);
550 RectFill(rport
, left
+ 2, top
, right
- 2, bottom
);
551 RectFill(rport
, right
- 1, top
+ 1, right
- 1, bottom
- 1);
552 RectFill(rport
, right
, top
+ 2, right
, bottom
- 2);
556 RectFill(rport
, left
, top
, right
, bottom
);
566 UWORD hspacing
,vspacing
;
569 if (!(data
->flags
& (SYSIFLG_NOBORDER
| SYSIFLG_GADTOOLS
)))
571 DoMethodA(((struct IntScreen
*)(((struct IntDrawInfo
*)data
->dri
)->dri_Screen
))->WinDecorObj
, (Msg
)&wdecormsg
);
580 hspacing
= HSPACING_MIDDLE
;
585 hspacing
= HSPACING_SMALL
;
590 vspacing
= VSPACING_MIDDLE
;
595 vspacing
= VSPACING_SMALL
;
598 if (!(data
->flags
& SYSIFLG_NOBORDER
))
600 renderimageframe(rport
, LEFTIMAGE
, msg
->imp_State
, data
->dri
->dri_Pens
,
601 left
, top
, width
, height
, IntuitionBase
);
609 if (data
->flags
& SYSIFLG_GADTOOLS
)
611 SetAPen(rport
, getbgpen_gt(msg
->imp_State
, data
->dri
->dri_Pens
));
612 RectFill(rport
, left
, top
, right
, bottom
);
616 if (data
->flags
& SYSIFLG_GADTOOLS
)
618 SetAPen(rport
, data
->dri
->dri_Pens
[SHADOWPEN
]);
622 Move(rport
, left
+ width
- 1 - hspacing
, top
+ vspacing
+ 1);
623 Draw(rport
, left
+ hspacing
, top
+ height
- cy
);
624 Move(rport
, left
+ width
- 1 - hspacing
, top
+ vspacing
);
625 Draw(rport
, left
+ hspacing
, top
+ height
- cy
- 1);
627 Move(rport
, left
+ width
- 1 - hspacing
, top
+ height
- 1- vspacing
- 1);
628 Draw(rport
, left
+ hspacing
, top
+ cy
- 1);
629 Move(rport
, left
+ width
- 1 - hspacing
, top
+ height
- 1 - vspacing
);
630 Draw(rport
, left
+ hspacing
, top
+ cy
);
636 SetAPen(rport
, getbgpen(msg
->imp_State
, data
->dri
->dri_Pens
));
638 RectFill(rport
, left
, top
, right
, bottom
);
642 width
-= hspacing
* 2;
643 height
-= vspacing
* 2;
645 right
= left
+ width
- 1;
646 bottom
= top
+ height
- 1;
648 cy
= (height
+ 1) / 2;
650 SetAPen(rport
, data
->dri
->dri_Pens
[SHADOWPEN
]);
652 for(i
= 0; i
< cy
; i
++)
654 RectFill(rport
, left
+ (cy
- i
- 1) * width
/ cy
,
656 right
- i
* width
/ cy
/ 2,
658 RectFill(rport
, left
+ (cy
- i
- 1) * width
/ cy
,
660 right
- i
* width
/ cy
/ 2,
670 UWORD hspacing
,vspacing
;
673 if (!(data
->flags
& (SYSIFLG_NOBORDER
| SYSIFLG_GADTOOLS
)))
675 DoMethodA(((struct IntScreen
*)(((struct IntDrawInfo
*)data
->dri
)->dri_Screen
))->WinDecorObj
, (Msg
)&wdecormsg
);
684 hspacing
= HSPACING_MIDDLE
;
689 hspacing
= HSPACING_SMALL
;
694 vspacing
= VSPACING_MIDDLE
;
699 vspacing
= VSPACING_SMALL
;
702 if (!(data
->flags
& SYSIFLG_NOBORDER
))
704 renderimageframe(rport
, UPIMAGE
, msg
->imp_State
, data
->dri
->dri_Pens
,
705 left
, top
, width
, height
, IntuitionBase
);
713 if (data
->flags
& SYSIFLG_GADTOOLS
)
715 SetAPen(rport
, getbgpen_gt(msg
->imp_State
, data
->dri
->dri_Pens
));
716 RectFill(rport
, left
, top
, right
, bottom
);
721 if (data
->flags
& SYSIFLG_GADTOOLS
)
723 SetAPen(rport
, data
->dri
->dri_Pens
[SHADOWPEN
]);
727 Move(rport
, left
+ hspacing
+ 1, top
+ height
- 1 - vspacing
);
728 Draw(rport
, left
+ width
- cx
, top
+ vspacing
);
729 Move(rport
, left
+ hspacing
, top
+ height
- 1 - vspacing
);
730 Draw(rport
, left
+ width
- cx
- 1, top
+ vspacing
);
732 Move(rport
, left
+ width
- 1 - hspacing
- 1, top
+ height
- 1 - vspacing
);
733 Draw(rport
, left
+ cx
- 1, top
+ vspacing
);
734 Move(rport
, left
+ width
- 1 - hspacing
, top
+ height
- 1 - vspacing
);
735 Draw(rport
, left
+ cx
, top
+ vspacing
);
741 SetAPen(rport
, getbgpen(msg
->imp_State
, data
->dri
->dri_Pens
));
743 RectFill(rport
, left
, top
, right
, bottom
);
747 width
-= hspacing
* 2;
748 height
-= vspacing
* 2;
750 right
= left
+ width
- 1;
751 bottom
= top
+ height
- 1;
753 cx
= (width
+ 1) / 2;
755 SetAPen(rport
, data
->dri
->dri_Pens
[SHADOWPEN
]);
757 for(i
= 0; i
< cx
; i
++)
759 RectFill(rport
, left
+ i
,
760 top
+ (cx
- i
- 1) * height
/ cx
,
762 bottom
- i
* height
/ cx
/ 2);
763 RectFill(rport
, right
- i
,
764 top
+ (cx
- i
- 1) * height
/ cx
,
766 bottom
- i
* height
/ cx
/ 2);
775 UWORD hspacing
,vspacing
;
778 if (!(data
->flags
& (SYSIFLG_NOBORDER
| SYSIFLG_GADTOOLS
)))
780 DoMethodA(((struct IntScreen
*)(((struct IntDrawInfo
*)data
->dri
)->dri_Screen
))->WinDecorObj
, (Msg
)&wdecormsg
);
789 hspacing
= HSPACING_MIDDLE
;
794 hspacing
= HSPACING_SMALL
;
799 vspacing
= VSPACING_MIDDLE
;
804 vspacing
= VSPACING_SMALL
;
807 if (!(data
->flags
& SYSIFLG_NOBORDER
))
809 renderimageframe(rport
, RIGHTIMAGE
, msg
->imp_State
, data
->dri
->dri_Pens
,
810 left
, top
, width
, height
, IntuitionBase
);
818 if (data
->flags
& SYSIFLG_GADTOOLS
)
820 SetAPen(rport
, getbgpen_gt(msg
->imp_State
, data
->dri
->dri_Pens
));
821 RectFill(rport
, left
, top
, right
, bottom
);
826 if (data
->flags
& SYSIFLG_GADTOOLS
)
828 SetAPen(rport
, data
->dri
->dri_Pens
[SHADOWPEN
]);
832 Move(rport
, left
+ hspacing
, top
+ vspacing
+ 1);
833 Draw(rport
, left
+ width
- 1 - hspacing
, top
+ height
- cy
);
834 Move(rport
, left
+ hspacing
, top
+ vspacing
);
835 Draw(rport
, left
+ width
- 1 - hspacing
, top
+ height
- cy
- 1);
837 Move(rport
, left
+ hspacing
, top
+ height
- 1- vspacing
- 1);
838 Draw(rport
, left
+ width
- 1 - hspacing
, top
+ cy
- 1);
839 Move(rport
, left
+ hspacing
, top
+ height
- 1 - vspacing
);
840 Draw(rport
, left
+ width
- 1 - hspacing
, top
+ cy
);
847 SetAPen(rport
, getbgpen(msg
->imp_State
, data
->dri
->dri_Pens
));
849 RectFill(rport
, left
, top
, right
, bottom
);
853 width
-= hspacing
* 2;
854 height
-= vspacing
* 2;
856 right
= left
+ width
- 1;
857 bottom
= top
+ height
- 1;
859 cy
= (height
+ 1) / 2;
861 SetAPen(rport
, data
->dri
->dri_Pens
[SHADOWPEN
]);
863 for(i
= 0; i
< cy
; i
++)
865 RectFill(rport
, left
+ i
* width
/ cy
/ 2,
867 right
- (cy
- i
- 1) * width
/ cy
,
869 RectFill(rport
, left
+ i
* width
/ cy
/ 2,
871 right
- (cy
- i
- 1) * width
/ cy
,
881 UWORD hspacing
,vspacing
;
884 if (!(data
->flags
& (SYSIFLG_NOBORDER
| SYSIFLG_GADTOOLS
)))
886 DoMethodA(((struct IntScreen
*)(((struct IntDrawInfo
*)data
->dri
)->dri_Screen
))->WinDecorObj
, (Msg
)&wdecormsg
);
895 hspacing
= HSPACING_MIDDLE
;
900 hspacing
= HSPACING_SMALL
;
905 vspacing
= VSPACING_MIDDLE
;
910 vspacing
= VSPACING_SMALL
;
913 if (!(data
->flags
& SYSIFLG_NOBORDER
))
915 renderimageframe(rport
, DOWNIMAGE
, msg
->imp_State
, data
->dri
->dri_Pens
,
916 left
, top
, width
, height
, IntuitionBase
);
924 if (data
->flags
& SYSIFLG_GADTOOLS
)
926 SetAPen(rport
, getbgpen_gt(msg
->imp_State
, data
->dri
->dri_Pens
));
927 RectFill(rport
, left
, top
, right
, bottom
);
931 if (data
->flags
& SYSIFLG_GADTOOLS
)
933 SetAPen(rport
, data
->dri
->dri_Pens
[SHADOWPEN
]);
937 Move(rport
, left
+ hspacing
+ 1, top
+ vspacing
);
938 Draw(rport
, left
+ width
- cx
, top
+ height
- 1 - vspacing
);
939 Move(rport
, left
+ hspacing
, top
+ vspacing
);
940 Draw(rport
, left
+ width
- cx
- 1, top
+ height
- 1 - vspacing
);
942 Move(rport
, left
+ width
- 1 - hspacing
- 1, top
+ vspacing
);
943 Draw(rport
, left
+ cx
- 1, top
+ height
- 1 - vspacing
);
944 Move(rport
, left
+ width
- 1 - hspacing
, top
+ vspacing
);
945 Draw(rport
, left
+ cx
, top
+ height
- 1 - vspacing
);
951 SetAPen(rport
, getbgpen(msg
->imp_State
, data
->dri
->dri_Pens
));
953 RectFill(rport
, left
, top
, right
, bottom
);
957 width
-= hspacing
* 2;
958 height
-= vspacing
* 2;
960 right
= left
+ width
- 1;
961 bottom
= top
+ height
- 1;
963 cx
= (width
+ 1) / 2;
965 SetAPen(rport
, data
->dri
->dri_Pens
[SHADOWPEN
]);
967 for(i
= 0; i
< cx
; i
++)
969 RectFill(rport
, left
+ i
,
970 top
+ i
* height
/ cx
/ 2,
972 bottom
- (cx
- i
- 1) * height
/ cx
);
973 RectFill(rport
, right
- i
,
974 top
+ i
* height
/ cx
/ 2,
976 bottom
- (cx
- i
- 1) * height
/ cx
);
989 DoMethodA(((struct IntScreen
*)(((struct IntDrawInfo
*)data
->dri
)->dri_Screen
))->WinDecorObj
, (Msg
)&wdecormsg
);
995 DoMethodA(((struct IntScreen
*)(((struct IntDrawInfo
*)data
->dri
)->dri_Screen
))->ScrDecorObj
, (Msg
)&sdecormsg
);
1001 DoMethodA(((struct IntScreen
*)(((struct IntDrawInfo
*)data
->dri
)->dri_Screen
))->MenuDecorObj
, (Msg
)&mdecormsg
);
1007 DoMethodA(((struct IntScreen
*)(((struct IntDrawInfo
*)data
->dri
)->dri_Screen
))->MenuDecorObj
, (Msg
)&mdecormsg
);
1013 DoMethodA(((struct IntScreen
*)(((struct IntDrawInfo
*)data
->dri
)->dri_Screen
))->MenuDecorObj
, (Msg
)&mdecormsg
);
1017 /* MUI and other non-std images */
1024 DoMethodA(((struct IntScreen
*)(((struct IntDrawInfo
*)data
->dri
)->dri_Screen
))->WinDecorObj
, (Msg
)&wdecormsg
);
1030 } /* switch (image type) */
1035 IPTR
SysIClass__OM_DISPOSE(Class
*cl
, Object
*obj
, Msg msg
)
1037 struct SysIData
*data
= INST_DATA(cl
, obj
);
1039 DisposeObject(data
->frame
);
1040 return DoSuperMethodA(cl
, obj
, msg
);
1043 IPTR
SysIClass__OM_SET(Class
*cl
, Object
*obj
, Msg msg
)
1045 struct SysIData
*data
= INST_DATA(cl
, obj
);
1048 DoMethodA((Object
*)data
->frame
, msg
);
1049 return DoSuperMethodA(cl
, obj
, msg
);
1052 /**************************************************************************************************/
1054 #undef IntuitionBase
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 WORD right
= left
+ width
- 1;
1105 WORD bottom
= top
+ height
- 1;
1106 BOOL leftedgegodown
= FALSE
;
1107 BOOL topedgegoright
= FALSE
;
1112 /* draw separator line at the right side */
1113 SetAPen(rp
, pens
[SHINEPEN
]);
1114 RectFill(rp
, right
, top
, right
, bottom
- 1);
1115 SetAPen(rp
, pens
[SHADOWPEN
]);
1116 WritePixel(rp
, right
, bottom
);
1124 /* draw separator line at the left side */
1125 SetAPen(rp
, pens
[SHINEPEN
]);
1126 WritePixel(rp
, left
, top
);
1127 SetAPen(rp
, pens
[SHADOWPEN
]);
1128 RectFill(rp
, left
, top
+ 1, left
, bottom
);
1135 leftedgegodown
= TRUE
;
1140 topedgegoright
= TRUE
;
1144 if (left
== 0) leftedgegodown
= TRUE
;
1145 if (top
== 0) topedgegoright
= TRUE
;
1147 SetAPen(rp
, pens
[((state
== IDS_SELECTED
) || (state
== IDS_INACTIVESELECTED
)) ? SHADOWPEN
: SHINEPEN
]);
1153 bottom
- (leftedgegodown
? 0 : 1));
1156 RectFill(rp
, left
+ 1,
1158 right
- (topedgegoright
? 0 : 1),
1161 SetAPen(rp
, pens
[((state
== IDS_SELECTED
) || (state
== IDS_INACTIVESELECTED
)) ? SHINEPEN
: SHADOWPEN
]);
1165 top
+ (topedgegoright
? 1 : 0),
1170 RectFill(rp
, left
+ (leftedgegodown
? 1 : 0),
1176 /**************************************************************************************************/