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)"
165 case SYSIA_ReferenceFont
:
166 if (tag
->ti_Data
) reffont
= (struct TextFont
*)tag
->ti_Data
;
175 case SYSIA_WithBorder
:
176 if (tag
->ti_Data
== FALSE
)
178 data
->flags
|= SYSIFLG_NOBORDER
;
183 if (tag
->ti_Data
== SYSISTYLE_GADTOOLS
)
185 data
->flags
|= SYSIFLG_GADTOOLS
;
189 } /* switch(tag->ti_Tag) */
191 } /* while ((tag = NextTagItem(&taglist))) */
193 D(bug("dri: %p, unsupported: %d\n", data
->dri
, unsupported
));
195 if ((!data
->dri
) || (unsupported
))
199 struct wdpGetDefSizeSysImage msg
;
200 ULONG width
= DEFSIZE_WIDTH
, height
= DEFSIZE_HEIGHT
;
202 msg
.MethodID
= (data
->type
== SDEPTHIMAGE
) ? SDM_GETDEFSIZE_SYSIMAGE
:
203 WDM_GETDEFSIZE_SYSIMAGE
;
204 msg
.wdp_Which
= data
->type
;
205 msg
.wdp_SysiSize
= size
;
206 msg
.wdp_ReferenceFont
= reffont
;
207 msg
.wdp_Width
= &width
;
208 msg
.wdp_Height
= &height
;
211 if (data
->type
== SDEPTHIMAGE
)
213 LOCKSHARED_SCRDECOR(data
->dri
);
214 DoMethodA(INTDRI(data
->dri
)->dri_ScrDecorObj
, (Msg
)&msg
);
215 UNLOCK_SCRDECOR(data
->dri
);
219 LOCKSHARED_WINDECOR(data
->dri
);
220 DoMethodA(INTDRI(data
->dri
)->dri_WinDecorObj
, (Msg
)&msg
);
221 UNLOCK_WINDECOR(data
->dri
);
224 if (!set_width
) IM(obj
)->Width
= width
;
225 if (!set_height
) IM(obj
)->Height
= height
;
231 /**************************************************************************************************/
233 Object
*SysIClass__OM_NEW(Class
*cl
, Class
*rootcl
, struct opSet
*msg
)
235 struct SysIData
*data
;
238 D(bug("sysi_new()\n"));
239 obj
= (Object
*)DoSuperMethodA(cl
, (Object
*)rootcl
, (Msg
)msg
);
243 D(bug("sysi_new,: obj=%p\n", obj
));
245 data
= INST_DATA(cl
, obj
);
251 if (!sysi_setnew(cl
, obj
, (struct opSet
*)msg
))
253 STACKULONG method
= OM_DISPOSE
;
254 CoerceMethodA(cl
, obj
, (Msg
)&method
);
258 D(bug("sysi_setnew called successfully\n"));
264 struct TagItem tags
[] =
266 {IA_FrameType
, FRAME_BUTTON
},
267 {IA_EdgesOnly
, FALSE
},
271 tags
[2].ti_Data
= (IPTR
)msg
->ops_AttrList
;
273 data
->frame
= NewObjectA(NULL
, FRAMEICLASS
, tags
);
276 STACKULONG method
= OM_DISPOSE
;
277 CoerceMethodA(cl
, obj
, (Msg
)&method
);
283 /* Just to prevent it from reaching default: */
309 STACKULONG method
= OM_DISPOSE
;
311 CoerceMethodA(cl
, obj
, (Msg
)&method
);
319 /**************************************************************************************************/
326 * heuristics for smaller arrows used in apps
329 #define HSPACING_MIDDLE 2
330 #define VSPACING_MIDDLE 2
331 #define HSPACING_SMALL 1
332 #define VSPACING_SMALL 1
334 IPTR
SysIClass__IM_DRAW(Class
*cl
, Object
*obj
, struct impDraw
*msg
)
336 struct SysIData
*data
= INST_DATA(cl
, obj
);
337 struct RastPort
*rport
= msg
->imp_RPort
;
338 WORD left
= IM(obj
)->LeftEdge
+ msg
->imp_Offset
.X
;
339 WORD top
= IM(obj
)->TopEdge
+ msg
->imp_Offset
.Y
;
340 UWORD width
= IM(obj
)->Width
;
341 UWORD height
= IM(obj
)->Height
;
342 WORD right
= left
+ width
- 1;
343 WORD bottom
= top
+ height
- 1;
344 struct wdpDrawSysImage decormsg
;
346 decormsg
.MethodID
= WDM_DRAW_SYSIMAGE
;
347 decormsg
.wdp_RPort
= rport
;
348 decormsg
.wdp_X
= left
;
349 decormsg
.wdp_Y
= top
;
350 decormsg
.wdp_Width
= width
;
351 decormsg
.wdp_Height
= height
;
352 decormsg
.wdp_Which
= data
->type
;
353 decormsg
.wdp_State
= msg
->imp_State
;
354 decormsg
.wdp_Flags
= 0;
356 SetDrMd(rport
, JAM1
);
362 WORD h_spacing
= width
/ 4;
363 WORD v_spacing
= height
/ 4;
366 DrawImageState(rport
, data
->frame
,
367 msg
->imp_Offset
.X
, msg
->imp_Offset
.Y
,
368 IDS_NORMAL
, data
->dri
);
370 /* Draw checkmark (only if image is in selected state) */
371 if (msg
->imp_State
== IDS_SELECTED
)
375 width
-= h_spacing
* 2;
378 height
-= v_spacing
* 2;
380 SetAPen(rport
, data
->dri
->dri_Pens
[SHADOWPEN
]);
381 draw_thick_line(cl
, rport
, left
, top
+ height
/ 3 , left
, bottom
, 0);
382 draw_thick_line(cl
, rport
, left
+ 1, bottom
, right
- 1, top
, 0);
389 BOOL selected
= FALSE
;
390 WORD col1
= SHINEPEN
;
391 WORD col2
= SHADOWPEN
;
393 if ((msg
->imp_State
== IDS_SELECTED
) || (msg
->imp_State
== IDS_INACTIVESELECTED
))
400 SetAPen(rport
, data
->dri
->dri_Pens
[BACKGROUNDPEN
]);
401 RectFill(rport
, left
, top
, right
, bottom
);
406 SetAPen(rport
, data
->dri
->dri_Pens
[col1
]);
407 RectFill(rport
, left
+ 2, top
, right
- 3, top
+ 1);
408 RectFill(rport
, left
+ 1, top
+ 2, left
+ 2, top
+ 3);
409 RectFill(rport
, left
, top
+ 4, left
+ 1, bottom
- 4);
410 RectFill(rport
, left
+ 1, bottom
- 3, left
+ 2, bottom
- 2);
411 RectFill(rport
, left
+ 2, bottom
- 1, left
+ 2, bottom
);
413 SetAPen(rport
, data
->dri
->dri_Pens
[col2
]);
414 RectFill(rport
, right
- 2, top
, right
- 2, top
+ 1);
415 RectFill(rport
, right
- 2, top
+ 2, right
- 1, top
+ 3);
416 RectFill(rport
, right
- 1, top
+ 4, right
, bottom
- 4);
417 RectFill(rport
, right
- 2, bottom
- 3, right
- 1, bottom
- 2);
418 RectFill(rport
, left
+ 3, bottom
- 1, right
- 2, bottom
);
429 SetAPen(rport
, data
->dri
->dri_Pens
[FILLPEN
]);
430 if ((width
>= 3) && (height
>= 3))
432 RectFill(rport
, left
+ 1, top
, right
- 1, top
);
433 RectFill(rport
, left
, top
+ 1, right
, bottom
- 1);
434 RectFill(rport
, left
+ 1, bottom
, right
- 1, bottom
);
438 RectFill(rport
, left
, top
, right
, bottom
);
444 SetAPen(rport
, data
->dri
->dri_Pens
[col1
]);
445 RectFill(rport
, left
+ 3, top
, right
- 3, top
);
446 WritePixel(rport
, left
+ 2, top
+ 1);
447 RectFill(rport
, left
+ 1, top
+ 2, left
+ 1, top
+ 3);
448 RectFill(rport
, left
, top
+ 4, left
, bottom
- 4);
449 RectFill(rport
, left
+ 1, bottom
- 3, left
+ 1, bottom
- 2);
450 WritePixel(rport
, left
+ 2, bottom
- 1);
452 SetAPen(rport
, data
->dri
->dri_Pens
[col2
]);
453 WritePixel(rport
, right
- 2, top
+ 1);
454 RectFill(rport
, right
- 1, top
+ 2, right
- 1, top
+ 3);
455 RectFill(rport
, right
, top
+ 4, right
, bottom
- 4);
456 RectFill(rport
, right
- 1, bottom
- 3, right
- 1, bottom
- 2);
457 WritePixel(rport
, right
- 2, bottom
- 1);
458 RectFill(rport
, left
+ 3, bottom
, right
- 3, bottom
);
469 SetAPen(rport
, data
->dri
->dri_Pens
[FILLPEN
]);
470 if ((width
>= 5) && (height
>= 5))
472 RectFill(rport
, left
, top
+ 2, left
, bottom
- 2);
473 RectFill(rport
, left
+ 1, top
+ 1, left
+ 1, bottom
- 1);
474 RectFill(rport
, left
+ 2, top
, right
- 2, bottom
);
475 RectFill(rport
, right
- 1, top
+ 1, right
- 1, bottom
- 1);
476 RectFill(rport
, right
, top
+ 2, right
, bottom
- 2);
480 RectFill(rport
, left
, top
, right
, bottom
);
490 UWORD hspacing
,vspacing
;
493 if (!(data
->flags
& (SYSIFLG_NOBORDER
| SYSIFLG_GADTOOLS
)))
495 LOCKSHARED_WINDECOR(data
->dri
)
496 DoMethodA(INTDRI(data
->dri
)->dri_WinDecorObj
, (Msg
)&decormsg
);
497 UNLOCK_WINDECOR(data
->dri
)
506 hspacing
= HSPACING_MIDDLE
;
511 hspacing
= HSPACING_SMALL
;
516 vspacing
= VSPACING_MIDDLE
;
521 vspacing
= VSPACING_SMALL
;
524 if (!(data
->flags
& SYSIFLG_NOBORDER
))
526 renderimageframe(rport
, LEFTIMAGE
, msg
->imp_State
, data
->dri
->dri_Pens
,
527 left
, top
, width
, height
, IntuitionBase
);
535 if (data
->flags
& SYSIFLG_GADTOOLS
)
537 SetAPen(rport
, getbgpen_gt(msg
->imp_State
, data
->dri
->dri_Pens
));
538 RectFill(rport
, left
, top
, right
, bottom
);
542 if (data
->flags
& SYSIFLG_GADTOOLS
)
544 SetAPen(rport
, data
->dri
->dri_Pens
[SHADOWPEN
]);
548 Move(rport
, left
+ width
- 1 - hspacing
, top
+ vspacing
+ 1);
549 Draw(rport
, left
+ hspacing
, top
+ height
- cy
);
550 Move(rport
, left
+ width
- 1 - hspacing
, top
+ vspacing
);
551 Draw(rport
, left
+ hspacing
, top
+ height
- cy
- 1);
553 Move(rport
, left
+ width
- 1 - hspacing
, top
+ height
- 1- vspacing
- 1);
554 Draw(rport
, left
+ hspacing
, top
+ cy
- 1);
555 Move(rport
, left
+ width
- 1 - hspacing
, top
+ height
- 1 - vspacing
);
556 Draw(rport
, left
+ hspacing
, top
+ cy
);
562 SetAPen(rport
, getbgpen(msg
->imp_State
, data
->dri
->dri_Pens
));
564 RectFill(rport
, left
, top
, right
, bottom
);
568 width
-= hspacing
* 2;
569 height
-= vspacing
* 2;
571 right
= left
+ width
- 1;
572 bottom
= top
+ height
- 1;
574 cy
= (height
+ 1) / 2;
576 SetAPen(rport
, data
->dri
->dri_Pens
[SHADOWPEN
]);
578 for(i
= 0; i
< cy
; i
++)
580 RectFill(rport
, left
+ (cy
- i
- 1) * width
/ cy
,
582 right
- i
* width
/ cy
/ 2,
584 RectFill(rport
, left
+ (cy
- i
- 1) * width
/ cy
,
586 right
- i
* width
/ cy
/ 2,
596 UWORD hspacing
,vspacing
;
599 if (!(data
->flags
& (SYSIFLG_NOBORDER
| SYSIFLG_GADTOOLS
)))
601 LOCKSHARED_WINDECOR(data
->dri
)
602 DoMethodA(INTDRI(data
->dri
)->dri_WinDecorObj
, (Msg
)&decormsg
);
603 UNLOCK_WINDECOR(data
->dri
)
612 hspacing
= HSPACING_MIDDLE
;
617 hspacing
= HSPACING_SMALL
;
622 vspacing
= VSPACING_MIDDLE
;
627 vspacing
= VSPACING_SMALL
;
630 if (!(data
->flags
& SYSIFLG_NOBORDER
))
632 renderimageframe(rport
, UPIMAGE
, msg
->imp_State
, data
->dri
->dri_Pens
,
633 left
, top
, width
, height
, IntuitionBase
);
641 if (data
->flags
& SYSIFLG_GADTOOLS
)
643 SetAPen(rport
, getbgpen_gt(msg
->imp_State
, data
->dri
->dri_Pens
));
644 RectFill(rport
, left
, top
, right
, bottom
);
649 if (data
->flags
& SYSIFLG_GADTOOLS
)
651 SetAPen(rport
, data
->dri
->dri_Pens
[SHADOWPEN
]);
655 Move(rport
, left
+ hspacing
+ 1, top
+ height
- 1 - vspacing
);
656 Draw(rport
, left
+ width
- cx
, top
+ vspacing
);
657 Move(rport
, left
+ hspacing
, top
+ height
- 1 - vspacing
);
658 Draw(rport
, left
+ width
- cx
- 1, top
+ vspacing
);
660 Move(rport
, left
+ width
- 1 - hspacing
- 1, top
+ height
- 1 - vspacing
);
661 Draw(rport
, left
+ cx
- 1, top
+ vspacing
);
662 Move(rport
, left
+ width
- 1 - hspacing
, top
+ height
- 1 - vspacing
);
663 Draw(rport
, left
+ cx
, top
+ vspacing
);
669 SetAPen(rport
, getbgpen(msg
->imp_State
, data
->dri
->dri_Pens
));
671 RectFill(rport
, left
, top
, right
, bottom
);
675 width
-= hspacing
* 2;
676 height
-= vspacing
* 2;
678 right
= left
+ width
- 1;
679 bottom
= top
+ height
- 1;
681 cx
= (width
+ 1) / 2;
683 SetAPen(rport
, data
->dri
->dri_Pens
[SHADOWPEN
]);
685 for(i
= 0; i
< cx
; i
++)
687 RectFill(rport
, left
+ i
,
688 top
+ (cx
- i
- 1) * height
/ cx
,
690 bottom
- i
* height
/ cx
/ 2);
691 RectFill(rport
, right
- i
,
692 top
+ (cx
- i
- 1) * height
/ cx
,
694 bottom
- i
* height
/ cx
/ 2);
703 UWORD hspacing
,vspacing
;
706 if (!(data
->flags
& (SYSIFLG_NOBORDER
| SYSIFLG_GADTOOLS
)))
708 LOCKSHARED_WINDECOR(data
->dri
)
709 DoMethodA(INTDRI(data
->dri
)->dri_WinDecorObj
, (Msg
)&decormsg
);
710 UNLOCK_WINDECOR(data
->dri
)
719 hspacing
= HSPACING_MIDDLE
;
724 hspacing
= HSPACING_SMALL
;
729 vspacing
= VSPACING_MIDDLE
;
734 vspacing
= VSPACING_SMALL
;
737 if (!(data
->flags
& SYSIFLG_NOBORDER
))
739 renderimageframe(rport
, RIGHTIMAGE
, msg
->imp_State
, data
->dri
->dri_Pens
,
740 left
, top
, width
, height
, IntuitionBase
);
748 if (data
->flags
& SYSIFLG_GADTOOLS
)
750 SetAPen(rport
, getbgpen_gt(msg
->imp_State
, data
->dri
->dri_Pens
));
751 RectFill(rport
, left
, top
, right
, bottom
);
756 if (data
->flags
& SYSIFLG_GADTOOLS
)
758 SetAPen(rport
, data
->dri
->dri_Pens
[SHADOWPEN
]);
762 Move(rport
, left
+ hspacing
, top
+ vspacing
+ 1);
763 Draw(rport
, left
+ width
- 1 - hspacing
, top
+ height
- cy
);
764 Move(rport
, left
+ hspacing
, top
+ vspacing
);
765 Draw(rport
, left
+ width
- 1 - hspacing
, top
+ height
- cy
- 1);
767 Move(rport
, left
+ hspacing
, top
+ height
- 1- vspacing
- 1);
768 Draw(rport
, left
+ width
- 1 - hspacing
, top
+ cy
- 1);
769 Move(rport
, left
+ hspacing
, top
+ height
- 1 - vspacing
);
770 Draw(rport
, left
+ width
- 1 - hspacing
, top
+ cy
);
777 SetAPen(rport
, getbgpen(msg
->imp_State
, data
->dri
->dri_Pens
));
779 RectFill(rport
, left
, top
, right
, bottom
);
783 width
-= hspacing
* 2;
784 height
-= vspacing
* 2;
786 right
= left
+ width
- 1;
787 bottom
= top
+ height
- 1;
789 cy
= (height
+ 1) / 2;
791 SetAPen(rport
, data
->dri
->dri_Pens
[SHADOWPEN
]);
793 for(i
= 0; i
< cy
; i
++)
795 RectFill(rport
, left
+ i
* width
/ cy
/ 2,
797 right
- (cy
- i
- 1) * width
/ cy
,
799 RectFill(rport
, left
+ i
* width
/ cy
/ 2,
801 right
- (cy
- i
- 1) * width
/ cy
,
811 UWORD hspacing
,vspacing
;
814 if (!(data
->flags
& (SYSIFLG_NOBORDER
| SYSIFLG_GADTOOLS
)))
816 LOCKSHARED_WINDECOR(data
->dri
)
817 DoMethodA(INTDRI(data
->dri
)->dri_WinDecorObj
, (Msg
)&decormsg
);
818 UNLOCK_WINDECOR(data
->dri
)
827 hspacing
= HSPACING_MIDDLE
;
832 hspacing
= HSPACING_SMALL
;
837 vspacing
= VSPACING_MIDDLE
;
842 vspacing
= VSPACING_SMALL
;
845 if (!(data
->flags
& SYSIFLG_NOBORDER
))
847 renderimageframe(rport
, DOWNIMAGE
, msg
->imp_State
, data
->dri
->dri_Pens
,
848 left
, top
, width
, height
, IntuitionBase
);
856 if (data
->flags
& SYSIFLG_GADTOOLS
)
858 SetAPen(rport
, getbgpen_gt(msg
->imp_State
, data
->dri
->dri_Pens
));
859 RectFill(rport
, left
, top
, right
, bottom
);
863 if (data
->flags
& SYSIFLG_GADTOOLS
)
865 SetAPen(rport
, data
->dri
->dri_Pens
[SHADOWPEN
]);
869 Move(rport
, left
+ hspacing
+ 1, top
+ vspacing
);
870 Draw(rport
, left
+ width
- cx
, top
+ height
- 1 - vspacing
);
871 Move(rport
, left
+ hspacing
, top
+ vspacing
);
872 Draw(rport
, left
+ width
- cx
- 1, top
+ height
- 1 - vspacing
);
874 Move(rport
, left
+ width
- 1 - hspacing
- 1, top
+ vspacing
);
875 Draw(rport
, left
+ cx
- 1, top
+ height
- 1 - vspacing
);
876 Move(rport
, left
+ width
- 1 - hspacing
, top
+ vspacing
);
877 Draw(rport
, left
+ cx
, top
+ height
- 1 - vspacing
);
883 SetAPen(rport
, getbgpen(msg
->imp_State
, data
->dri
->dri_Pens
));
885 RectFill(rport
, left
, top
, right
, bottom
);
889 width
-= hspacing
* 2;
890 height
-= vspacing
* 2;
892 right
= left
+ width
- 1;
893 bottom
= top
+ height
- 1;
895 cx
= (width
+ 1) / 2;
897 SetAPen(rport
, data
->dri
->dri_Pens
[SHADOWPEN
]);
899 for(i
= 0; i
< cx
; i
++)
901 RectFill(rport
, left
+ i
,
902 top
+ i
* height
/ cx
/ 2,
904 bottom
- (cx
- i
- 1) * height
/ cx
);
905 RectFill(rport
, right
- i
,
906 top
+ i
* height
/ cx
/ 2,
908 bottom
- (cx
- i
- 1) * height
/ cx
);
921 LOCKSHARED_WINDECOR(data
->dri
)
922 DoMethodA(INTDRI(data
->dri
)->dri_WinDecorObj
, (Msg
)&decormsg
);
923 UNLOCK_WINDECOR(data
->dri
)
929 decormsg
.MethodID
= SDM_DRAW_SYSIMAGE
;
931 LOCKSHARED_SCRDECOR(data
->dri
)
932 DoMethodA(INTDRI(data
->dri
)->dri_ScrDecorObj
, (Msg
)&decormsg
);
933 UNLOCK_SCRDECOR(data
->dri
)
939 UWORD
*pens
= data
->dri
->dri_Pens
;
943 SetAPen(rport
, pens
[BARBLOCKPEN
]);
947 SetAPen(rport
, pens
[(msg
->imp_State
== IDS_SELECTED
) ? FILLPEN
: BACKGROUNDPEN
]);
950 RectFill(rport
, left
, top
, right
, bottom
);
952 SetAPen(rport
, pens
[BARDETAILPEN
]);
953 draw_thick_line(cl
, rport
, left
+ 1, top
+ height
/ 3 , left
+ 1, bottom
, 0);
954 draw_thick_line(cl
, rport
, left
+ 2, bottom
, right
- 2, top
, 0);
961 UWORD
*pens
= data
->dri
->dri_Pens
;
962 struct TextFont
*oldfont
;
967 SetAPen(rport
, pens
[BARDETAILPEN
]);
971 SetAPen(rport
, pens
[SHINEPEN
]);
974 RectFill(rport
, left
, top
, right
, bottom
);
978 SetAPen(rport
, pens
[BARBLOCKPEN
]);
980 oldfont
= rport
->Font
;
981 oldstyle
= rport
->AlgoStyle
;
983 SetFont(rport
, GfxBase
->DefaultFont
);
984 SetSoftStyle(rport
, FSF_ITALIC
, AskSoftStyle(rport
));
986 Move(rport
, left
+ (width
- rport
->TxWidth
) / 2,
987 top
+ (height
- rport
->TxHeight
) / 2 + rport
->TxBaseline
);
990 SetSoftStyle(rport
, oldstyle
, AskSoftStyle(rport
));
991 SetFont(rport
, oldfont
);
993 SetAPen(rport
, pens
[BARBLOCKPEN
]);
997 SetAPen(rport
, pens
[SHADOWPEN
]);
999 RectFill(rport
, left
+ 1, top
, right
- 1, top
);
1000 RectFill(rport
, right
, top
+ 1, right
, bottom
- 1);
1001 RectFill(rport
, left
+ 1, bottom
, right
- 1, bottom
);
1002 RectFill(rport
, left
, top
+ 1, left
, bottom
- 1);
1004 SetAPen(rport
, pens
[BACKGROUNDPEN
]);
1005 RectFill(rport
, left
+ 1, bottom
- 1, right
- 1, bottom
- 1);
1006 RectFill(rport
, right
- 1, top
+ 1, right
- 1, bottom
- 2);
1008 RectFill(rport
, left
+ 2, top
+ 2, left
+ 4, top
+ 2);
1009 RectFill(rport
, left
+ 2, top
+ 3, left
+ 2, top
+ 4);
1011 SetAPen(rport
, pens
[SHADOWPEN
]);
1012 RectFill(rport
, left
+ 2, bottom
- 2, right
- 2, bottom
- 2);
1013 RectFill(rport
, right
- 2, top
+ 2, right
- 2, bottom
- 4);
1016 WORD a_size
= height
- 7;
1017 WORD a_left
= left
+ 5;
1018 WORD a_top
= top
+ 2;
1019 WORD a_right
= a_left
+ a_size
;
1020 WORD a_bottom
= a_top
+ a_size
;
1022 Move(rport
, a_left
, a_bottom
);
1023 Draw(rport
, a_right
, a_top
);
1024 Draw(rport
, a_right
, a_bottom
);
1025 Move(rport
, a_right
- 1, a_top
+ 1);
1026 Draw(rport
, a_right
- 1, a_bottom
);
1029 SetAPen(rport
, pens
[(msg
->imp_State
== IDS_SELECTED
) ? FILLPEN
: BACKGROUNDPEN
]);
1032 WritePixel(rport
, left
, top
);
1033 WritePixel(rport
, right
, top
);
1034 WritePixel(rport
, right
, bottom
);
1035 WritePixel(rport
, left
, bottom
);
1040 /* MUI and other non-std images */
1044 UWORD
*pens
= data
->dri
->dri_Pens
;
1047 if (!(data
->flags
& SYSIFLG_NOBORDER
))
1049 renderimageframe(rport
, SIZEIMAGE
, msg
->imp_State
, pens
,
1050 left
, top
, width
, height
, IntuitionBase
);
1059 bg
= getbgpen(msg
->imp_State
, pens
);
1061 /* Clear background into correct color */
1063 RectFill(rport
, left
, top
, right
, bottom
);
1067 DrawIB(rport
,(BYTE
*)ibPrefs
,left
+(width
/2),top
+(height
/2),IntuitionBase
);
1077 UWORD
*pens
= data
->dri
->dri_Pens
;
1080 if (!(data
->flags
& SYSIFLG_NOBORDER
))
1082 renderimageframe(rport
, SIZEIMAGE
, msg
->imp_State
, pens
,
1083 left
, top
, width
, height
, IntuitionBase
);
1092 bg
= getbgpen(msg
->imp_State
, pens
);
1094 /* Clear background into correct color */
1096 RectFill(rport
, left
, top
, right
, bottom
);
1100 if (data
->type
== SNAPSHOTIMAGE
)
1102 if (msg
->imp_State
== IDS_SELECTED
)
1104 DrawIB(rport
,(BYTE
*)ibSnapshotSel
,left
+(width
/2),top
+(height
/2),IntuitionBase
);
1108 DrawIB(rport
,(BYTE
*)ibSnapshot
,left
+(width
/2),top
+(height
/2),IntuitionBase
);
1112 if (data
->type
== POPUPIMAGE
)
1114 if (msg
->imp_State
== IDS_SELECTED
)
1116 DrawIB(rport
,(BYTE
*)ibPopupSel
,left
+(width
/2),top
+(height
/2),IntuitionBase
);
1120 DrawIB(rport
,(BYTE
*)ibPopup
,left
+(width
/2),top
+(height
/2),IntuitionBase
);
1124 if (data
->type
== ICONIFYIMAGE
)
1126 if (msg
->imp_State
== IDS_SELECTED
)
1128 DrawIB(rport
,(BYTE
*)ibIconifySel
,left
+(width
/2),top
+(height
/2),IntuitionBase
);
1132 DrawIB(rport
,(BYTE
*)ibIconify
,left
+(width
/2),top
+(height
/2),IntuitionBase
);
1136 if (data
->type
== LOCKIMAGE
)
1138 if ((msg
->imp_State
== IDS_SELECTED
) || (msg
->imp_State
== IDS_INACTIVESELECTED
))
1140 DrawIB(rport
,(BYTE
*)ibLockSel
,left
+(width
/2),top
+(height
/2),IntuitionBase
);
1144 DrawIB(rport
,(BYTE
*)ibLock
,left
+(width
/2),top
+(height
/2),IntuitionBase
);
1153 UWORD
*pens
= data
->dri
->dri_Pens
;
1156 if (!(data
->flags
& SYSIFLG_NOBORDER
))
1158 renderimageframe(rport
, SIZEIMAGE
, msg
->imp_State
, pens
,
1159 left
, top
, width
, height
, IntuitionBase
);
1168 bg
= getbgpen(msg
->imp_State
, pens
);
1170 /* Clear background into correct color */
1172 RectFill(rport
, left
, top
, right
, bottom
);
1176 DrawJUMP(rport
,msg
->imp_State
,left
+(width
/2),top
+(height
/2),IntuitionBase
);
1181 } /* switch (image type) */
1186 IPTR
SysIClass__OM_DISPOSE(Class
*cl
, Object
*obj
, Msg msg
)
1188 struct SysIData
*data
= INST_DATA(cl
, obj
);
1190 DisposeObject(data
->frame
);
1191 return DoSuperMethodA(cl
, obj
, msg
);
1194 IPTR
SysIClass__OM_SET(Class
*cl
, Object
*obj
, Msg msg
)
1196 struct SysIData
*data
= INST_DATA(cl
, obj
);
1199 DoMethodA((Object
*)data
->frame
, msg
);
1200 return DoSuperMethodA(cl
, obj
, msg
);
1203 /**************************************************************************************************/
1205 #undef IntuitionBase
1207 /**************************************************************************************************/
1209 static UWORD
getbgpen(ULONG state
, UWORD
*pens
)
1221 bg
= pens
[BACKGROUNDPEN
];
1228 /**************************************************************************************************/
1230 static UWORD
getbgpen_gt(ULONG state
, UWORD
*pens
)
1237 case IDS_INACTIVESELECTED
:
1242 bg
= pens
[BACKGROUNDPEN
];
1249 /**************************************************************************************************/
1251 static void renderimageframe(struct RastPort
*rp
, ULONG which
, ULONG state
, UWORD
*pens
,
1252 WORD left
, WORD top
, WORD width
, WORD height
,
1253 struct IntuitionBase
*IntuitionBase
)
1255 WORD right
= left
+ width
- 1;
1256 WORD bottom
= top
+ height
- 1;
1257 BOOL leftedgegodown
= FALSE
;
1258 BOOL topedgegoright
= FALSE
;
1263 /* draw separator line at the right side */
1264 SetAPen(rp
, pens
[SHINEPEN
]);
1265 RectFill(rp
, right
, top
, right
, bottom
- 1);
1266 SetAPen(rp
, pens
[SHADOWPEN
]);
1267 WritePixel(rp
, right
, bottom
);
1275 /* draw separator line at the left side */
1276 SetAPen(rp
, pens
[SHINEPEN
]);
1277 WritePixel(rp
, left
, top
);
1278 SetAPen(rp
, pens
[SHADOWPEN
]);
1279 RectFill(rp
, left
, top
+ 1, left
, bottom
);
1286 leftedgegodown
= TRUE
;
1291 topedgegoright
= TRUE
;
1295 if (left
== 0) leftedgegodown
= TRUE
;
1296 if (top
== 0) topedgegoright
= TRUE
;
1298 SetAPen(rp
, pens
[((state
== IDS_SELECTED
) || (state
== IDS_INACTIVESELECTED
)) ? SHADOWPEN
: SHINEPEN
]);
1304 bottom
- (leftedgegodown
? 0 : 1));
1307 RectFill(rp
, left
+ 1,
1309 right
- (topedgegoright
? 0 : 1),
1312 SetAPen(rp
, pens
[((state
== IDS_SELECTED
) || (state
== IDS_INACTIVESELECTED
)) ? SHINEPEN
: SHADOWPEN
]);
1316 top
+ (topedgegoright
? 1 : 0),
1321 RectFill(rp
, left
+ (leftedgegodown
? 1 : 0),
1327 /**************************************************************************************************/