2 Copyright 1995-2005, The AROS Development Team. All rights reserved.
3 Copyright 2001-2003, The MorphOS Development Team. All Rights Reserved.
9 #include <dos/dosextens.h>
11 #include <intuition/intuition.h>
12 #include <intuition/intuitionbase.h>
13 #include <intuition/classes.h>
14 #include <intuition/classusr.h>
15 #include <intuition/windecorclass.h>
16 #include <intuition/cghooks.h>
17 #include <intuition/icclass.h>
18 #include <intuition/extensions.h>
20 #include <graphics/gfxbase.h>
21 #include <graphics/gfxmacros.h>
23 #include <utility/tagitem.h>
24 #include <utility/hooks.h>
26 #include <clib/macros.h>
30 #include <proto/exec.h>
31 #include <proto/intuition.h>
32 #include <proto/graphics.h>
33 #include <proto/utility.h>
35 #include <proto/alib.h>
37 #include "intuition_intern.h"
40 /**************************************************************************************************/
43 #define USE_AROS_DEFSIZE 1
45 #define USE_AROS_DEFSIZE 0
48 #define DEFSIZE_WIDTH 14
49 #define DEFSIZE_HEIGHT 14
54 * heuristics for smaller arrows used in apps
57 #define HSPACING_MIDDLE 2
58 #define VSPACING_MIDDLE 2
59 #define HSPACING_SMALL 1
60 #define VSPACING_SMALL 1
62 #define DRI(dri) ((struct DrawInfo *)(dri))
64 /**************************************************************************************************/
66 static void renderimageframe(struct RastPort
*rp
, ULONG which
, ULONG state
, UWORD
*pens
,
67 WORD left
, WORD top
, WORD width
, WORD height
,
68 struct IntuitionBase
*IntuitionBase
)
70 WORD right
= left
+ width
- 1;
71 WORD bottom
= top
+ height
- 1;
72 BOOL leftedgegodown
= FALSE
;
73 BOOL topedgegoright
= FALSE
;
79 /* draw separator line at the right side */
80 SetAPen(rp
, pens
[SHINEPEN
]);
81 RectFill(rp
, right
, top
, right
, bottom
- 1);
82 SetAPen(rp
, pens
[SHADOWPEN
]);
83 WritePixel(rp
, right
, bottom
);
91 /* draw separator line at the left side */
92 SetAPen(rp
, pens
[SHINEPEN
]);
93 WritePixel(rp
, left
, top
);
94 SetAPen(rp
, pens
[SHADOWPEN
]);
95 RectFill(rp
, left
, top
+ 1, left
, bottom
);
103 leftedgegodown
= TRUE
;
108 topedgegoright
= TRUE
;
112 if (left
== 0) leftedgegodown
= TRUE
;
113 if (top
== 0) topedgegoright
= TRUE
;
115 SetAPen(rp
, pens
[((state
== IDS_SELECTED
) || (state
== IDS_INACTIVESELECTED
)) ? SHADOWPEN
: SHINEPEN
]);
121 bottom
- (leftedgegodown
? 0 : 1));
124 RectFill(rp
, left
+ 1,
126 right
- (topedgegoright
? 0 : 1),
129 SetAPen(rp
, pens
[((state
== IDS_SELECTED
) || (state
== IDS_INACTIVESELECTED
)) ? SHINEPEN
: SHADOWPEN
]);
133 top
+ (topedgegoright
? 1 : 0),
138 RectFill(rp
, left
+ (leftedgegodown
? 1 : 0),
144 /**************************************************************************************************/
146 static UWORD
getbgpen(ULONG state
, UWORD
*pens
)
157 bg
= pens
[BACKGROUNDPEN
];
165 /**************************************************************************************************/
168 #define IntuitionBase ((struct IntuitionBase *)(cl->cl_UserData))
170 /**************************************************************************************************/
172 IPTR
WinDecorClass__OM_NEW(Class
*cl
, Object
*obj
, struct opSet
*msg
)
174 struct windecor_data
*data
;
176 obj
= (Object
*)DoSuperMethodA(cl
, obj
, (Msg
)msg
);
179 data
= INST_DATA(cl
, obj
);
180 data
->userbuffersize
= (ULONG
) GetTagData(WDA_UserBuffer
, 0, msg
->ops_AttrList
);
186 /**************************************************************************************************/
188 IPTR
WinDecorClass__OM_GET(Class
*cl
, Object
*obj
, struct opGet
*msg
)
190 struct windecor_data
*data
= INST_DATA(cl
, obj
);
192 switch(msg
->opg_AttrID
)
195 *msg
->opg_Storage
= (IPTR
) data
->userbuffersize
;
197 case WDA_TrueColorOnly
:
198 *msg
->opg_Storage
= FALSE
;
202 return DoSuperMethodA(cl
, obj
, (Msg
)msg
);
209 /**************************************************************************************************/
211 IPTR
WinDecorClass__WDM_GETDEFSIZE_SYSIMAGE(Class
*cl
, Object
*obj
, struct wdpGetDefSizeSysImage
*msg
)
213 ULONG def_low_width
= DEFSIZE_WIDTH
, def_low_height
= DEFSIZE_HEIGHT
;
214 ULONG def_med_width
= DEFSIZE_WIDTH
, def_med_height
= DEFSIZE_HEIGHT
;
215 ULONG def_high_width
= DEFSIZE_WIDTH
, def_high_height
= DEFSIZE_HEIGHT
;
217 #define REFHEIGHT (msg->wdp_ReferenceFont->tf_YSize)
218 #define REFWIDTH REFHEIGHT
220 switch(msg
->wdp_Which
)
225 def_low_width
= def_med_width
= def_high_width
= DEFSIZE_WIDTH
;
226 def_low_height
= def_med_height
= def_high_height
= DEFSIZE_HEIGHT
;
233 def_high_height
= 22;
240 def_low_width
= def_med_width
= def_high_width
= DEFSIZE_WIDTH
;
241 def_low_height
= def_med_height
= def_high_height
= DEFSIZE_HEIGHT
;
248 def_high_height
= 22;
261 def_low_width
= def_med_width
= def_high_width
= DEFSIZE_WIDTH
;
262 def_low_height
= def_med_height
= def_high_height
= DEFSIZE_HEIGHT
;
272 def_low_width
= def_med_width
= def_high_width
= DEFSIZE_WIDTH
;
273 def_low_height
= def_med_height
= def_high_height
= DEFSIZE_HEIGHT
;
283 def_low_width
= def_med_width
= def_high_width
= DEFSIZE_WIDTH
;
284 def_low_height
= def_med_height
= def_high_height
= DEFSIZE_HEIGHT
;
294 def_low_width
= def_med_width
= def_high_width
= DEFSIZE_WIDTH
;
295 def_low_height
= def_med_height
= def_high_height
= DEFSIZE_HEIGHT
;
302 def_high_height
= 10;
309 def_high_width
= REFWIDTH
/ 2 + 4; // reffont->tf_XSize * 3 / 2;
312 def_high_height
= REFHEIGHT
;
318 def_high_width
= (REFWIDTH
+ 1) * 2; // reffont->tf_XSize * 3 - 1;
321 def_high_height
= REFHEIGHT
+ 1;
325 def_low_width
= (REFWIDTH
+ 3) * 2;//reffont->tf_XSize * 2;
326 def_low_height
= REFHEIGHT
+ 3;
333 switch(msg
->wdp_SysiSize
)
335 case SYSISIZE_LOWRES
:
336 *msg
->wdp_Width
= def_low_width
;
337 *msg
->wdp_Height
= def_low_height
;
340 case SYSISIZE_MEDRES
:
341 *msg
->wdp_Width
= def_med_width
;
342 *msg
->wdp_Height
= def_med_height
;
347 *msg
->wdp_Width
= def_high_width
;
348 *msg
->wdp_Height
= def_high_height
;
355 /**************************************************************************************************/
357 IPTR
WinDecorClass__WDM_DRAW_SYSIMAGE(Class
*cl
, Object
*obj
, struct wdpDrawSysImage
*msg
)
359 struct windecor_data
*data
= INST_DATA(cl
, obj
);
360 struct RastPort
*rp
= msg
->wdp_RPort
;
361 UWORD
*pens
= DRI(msg
->wdp_Dri
)->dri_Pens
;
362 LONG state
= msg
->wdp_State
;
363 LONG left
= msg
->wdp_X
;
364 LONG top
= msg
->wdp_Y
;
365 LONG width
= msg
->wdp_Width
;
366 LONG height
= msg
->wdp_Height
;
367 LONG right
= left
+ width
- 1;
368 LONG bottom
= top
+ height
- 1;
369 LONG h_spacing
, v_spacing
;
373 switch(msg
->wdp_Which
)
378 renderimageframe(rp
, CLOSEIMAGE
, state
, pens
, left
, top
, width
, height
, IntuitionBase
);
384 renderimageframe(rp
, CLOSEIMAGE
, state
, pens
, left
, top
, width
, height
, IntuitionBase
);
385 /* code should be added later */
390 renderimageframe(rp
, CLOSEIMAGE
, state
, pens
, left
, top
, width
, height
, IntuitionBase
);
396 right
= left
+ width
- 1;
397 bottom
= top
+ height
- 1;
398 h_spacing
= width
* 4 / 10;
399 v_spacing
= height
* 3 / 10;
401 SetAPen(rp
, getbgpen(state
, pens
));
402 RectFill(rp
, left
, top
, right
, bottom
);
409 SetAPen(rp
, pens
[SHADOWPEN
]);
410 RectFill(rp
, left
, top
, right
, bottom
);
417 SetAPen(rp
, pens
[(state
== IDS_NORMAL
) ? SHINEPEN
: BACKGROUNDPEN
]);
418 RectFill(rp
, left
, top
, right
, bottom
);
429 renderimageframe(rp
, ZOOMIMAGE
, state
, pens
,
430 left
, top
, width
, height
, IntuitionBase
);
436 right
= left
+ width
- 1;
437 bottom
= top
+ height
- 1 ;
438 h_spacing
= width
/ 6;
439 v_spacing
= height
/ 6;
441 bg
= getbgpen(state
, pens
);
443 /* Clear background into correct color */
445 RectFill(rp
, left
, top
, right
, bottom
);
452 SetAPen(rp
, pens
[SHADOWPEN
]);
453 RectFill(rp
, left
, top
, right
, bottom
);
455 SetAPen(rp
, pens
[(state
== IDS_SELECTED
) ? SHINEPEN
:
456 (state
== IDS_NORMAL
) ? FILLPEN
: BACKGROUNDPEN
]);
457 RectFill(rp
, left
+ 1, top
+ 1, right
- 1, bottom
- 1);
459 right
= left
+ (right
- left
+ 1) / 2;
460 bottom
= top
+ (bottom
- top
+ 1) / 2;
462 if (right
- left
< 4) right
= left
+ 4;
464 SetAPen(rp
, pens
[SHADOWPEN
]);
465 RectFill(rp
, left
, top
, right
, bottom
);
472 SetAPen(rp
, pens
[(state
== IDS_SELECTED
) ? FILLPEN
:
473 (state
== IDS_NORMAL
) ? SHINEPEN
: BACKGROUNDPEN
]);
474 RectFill(rp
,left
, top
, right
, bottom
);
484 renderimageframe(rp
, DEPTHIMAGE
, state
, pens
,
485 left
, top
, width
, height
, IntuitionBase
);
493 h_spacing
= width
/ 6;
494 v_spacing
= height
/ 6;
496 bg
= getbgpen(state
, pens
);
498 /* Clear background into correct color */
500 RectFill(rp
, left
, top
, right
, bottom
);
502 /* Draw a image of two partly overlapped tiny windows,
508 width
-= h_spacing
* 2;
509 height
-= v_spacing
* 2;
511 right
= left
+ width
- 1;
512 bottom
= top
+ height
- 1;
514 /* Render top left window */
516 SetAPen(rp
, pens
[SHADOWPEN
]);
520 , right
- (width
/ 3 )
521 , bottom
- (height
/ 3)
525 /* Fill top left window (inside of the frame above) */
527 if ((state
!= IDS_INACTIVENORMAL
))
529 SetAPen(rp
, pens
[BACKGROUNDPEN
]);
530 RectFill(rp
, left
+ 1, top
+ 1,
531 right
- (width
/ 3) - 1, bottom
- (height
/ 3) - 1);
535 /* Render bottom right window */
536 SetAPen(rp
, pens
[SHADOWPEN
]);
537 drawrect(rp
, left
+ (width
/ 3), top
+ (height
/ 3),
538 right
, bottom
, IntuitionBase
);
540 /* Fill bottom right window (inside of the frame above) */
541 SetAPen(rp
, pens
[(state
== IDS_INACTIVENORMAL
) ? BACKGROUNDPEN
: SHINEPEN
]);
542 RectFill(rp
, left
+ (width
/ 3) + 1, top
+ (height
/ 3) + 1,
543 right
- 1, bottom
- 1);
545 if (state
== IDS_SELECTED
)
547 /* Re-Render top left window */
549 SetAPen(rp
, pens
[SHADOWPEN
]);
550 drawrect(rp
, left
, top
,
551 right
- (width
/ 3 ), bottom
- (height
/ 3), IntuitionBase
);
563 renderimageframe(rp
, SIZEIMAGE
, state
, pens
,
564 left
, top
, width
, height
, IntuitionBase
);
572 h_spacing
= width
/ 5;
573 v_spacing
= height
/ 5;
575 bg
= getbgpen(state
, pens
);
577 /* Clear background into correct color */
579 RectFill(rp
, left
, top
, right
, bottom
);
581 /* A triangle image */
586 right
= left
+ width
- 1 - (h_spacing
* 2);
587 bottom
= top
+ height
- 1 - (v_spacing
* 2);
589 width
= right
- left
+ 1;
590 height
= bottom
- top
+ 1;
592 if (state
!= IDS_INACTIVENORMAL
)
594 SetAPen(rp
, pens
[SHINEPEN
]);
596 for(y
= top
; y
<= bottom
; y
++)
598 x
= left
+ (bottom
- y
) * width
/ height
;
599 RectFill(rp
, x
, y
, right
, y
);
603 SetAPen(rp
, pens
[SHADOWPEN
]);
604 /* Draw triangle border */
605 Move(rp
, left
, bottom
);
606 Draw(rp
, right
, top
);
607 Draw(rp
, right
, bottom
);
608 Draw(rp
, left
, bottom
);
615 UWORD hspacing
,vspacing
;
623 hspacing
= HSPACING_MIDDLE
;
628 hspacing
= HSPACING_SMALL
;
633 vspacing
= VSPACING_MIDDLE
;
638 vspacing
= VSPACING_SMALL
;
641 renderimageframe(rp
, LEFTIMAGE
, state
, pens
,
642 left
, top
, width
, height
, IntuitionBase
);
650 SetAPen(rp
, getbgpen(state
, pens
));
651 RectFill(rp
, left
, top
, right
, bottom
);
655 width
-= hspacing
* 2;
656 height
-= vspacing
* 2;
658 right
= left
+ width
- 1;
659 bottom
= top
+ height
- 1;
661 cy
= (height
+ 1) / 2;
663 SetAPen(rp
, pens
[SHADOWPEN
]);
665 for(i
= 0; i
< cy
; i
++)
667 RectFill(rp
, left
+ (cy
- i
- 1) * width
/ cy
,
669 right
- i
* width
/ cy
/ 2,
671 RectFill(rp
, left
+ (cy
- i
- 1) * width
/ cy
,
673 right
- i
* width
/ cy
/ 2,
681 UWORD hspacing
,vspacing
;
689 hspacing
= HSPACING_MIDDLE
;
694 hspacing
= HSPACING_SMALL
;
699 vspacing
= VSPACING_MIDDLE
;
704 vspacing
= VSPACING_SMALL
;
707 renderimageframe(rp
, UPIMAGE
, state
, pens
,
708 left
, top
, width
, height
, IntuitionBase
);
716 SetAPen(rp
, getbgpen(state
, pens
));
717 RectFill(rp
, left
, top
, right
, bottom
);
721 width
-= hspacing
* 2;
722 height
-= vspacing
* 2;
724 right
= left
+ width
- 1;
725 bottom
= top
+ height
- 1;
727 cx
= (width
+ 1) / 2;
729 SetAPen(rp
, pens
[SHADOWPEN
]);
731 for(i
= 0; i
< cx
; i
++)
733 RectFill(rp
, left
+ i
,
734 top
+ (cx
- i
- 1) * height
/ cx
,
736 bottom
- i
* height
/ cx
/ 2);
737 RectFill(rp
, right
- i
,
738 top
+ (cx
- i
- 1) * height
/ cx
,
740 bottom
- i
* height
/ cx
/ 2);
748 UWORD hspacing
,vspacing
;
756 hspacing
= HSPACING_MIDDLE
;
761 hspacing
= HSPACING_SMALL
;
766 vspacing
= VSPACING_MIDDLE
;
771 vspacing
= VSPACING_SMALL
;
774 renderimageframe(rp
, RIGHTIMAGE
, state
, pens
,
775 left
, top
, width
, height
, IntuitionBase
);
784 SetAPen(rp
, getbgpen(state
, pens
));
785 RectFill(rp
, left
, top
, right
, bottom
);
789 width
-= hspacing
* 2;
790 height
-= vspacing
* 2;
792 right
= left
+ width
- 1;
793 bottom
= top
+ height
- 1;
795 cy
= (height
+ 1) / 2;
797 SetAPen(rp
, pens
[SHADOWPEN
]);
799 for(i
= 0; i
< cy
; i
++)
801 RectFill(rp
, left
+ i
* width
/ cy
/ 2,
803 right
- (cy
- i
- 1) * width
/ cy
,
805 RectFill(rp
, left
+ i
* width
/ cy
/ 2,
807 right
- (cy
- i
- 1) * width
/ cy
,
815 UWORD hspacing
,vspacing
;
823 hspacing
= HSPACING_MIDDLE
;
828 hspacing
= HSPACING_SMALL
;
833 vspacing
= VSPACING_MIDDLE
;
838 vspacing
= VSPACING_SMALL
;
841 renderimageframe(rp
, DOWNIMAGE
, state
, pens
,
842 left
, top
, width
, height
, IntuitionBase
);
850 SetAPen(rp
, getbgpen(state
, pens
));
851 RectFill(rp
, left
, top
, right
, bottom
);
855 width
-= hspacing
* 2;
856 height
-= vspacing
* 2;
858 right
= left
+ width
- 1;
859 bottom
= top
+ height
- 1;
861 cx
= (width
+ 1) / 2;
863 SetAPen(rp
, pens
[SHADOWPEN
]);
865 for(i
= 0; i
< cx
; i
++)
867 RectFill(rp
, left
+ i
,
868 top
+ i
* height
/ cx
/ 2,
870 bottom
- (cx
- i
- 1) * height
/ cx
);
871 RectFill(rp
, right
- i
,
872 top
+ i
* height
/ cx
/ 2,
874 bottom
- (cx
- i
- 1) * height
/ cx
);
888 /**************************************************************************************************/
890 static void findtitlearea(struct Window
*win
, LONG
*left
, LONG
*right
)
895 *right
= win
->Width
- 1;
897 for (g
= win
->FirstGadget
; g
; g
= g
->NextGadget
)
899 if (g
->Activation
& GACT_TOPBORDER
&& g
!= (struct Gadget
*)IW(win
)->sysgads
[DRAGBAR
])
901 if (!(g
->Flags
& GFLG_RELRIGHT
))
903 if (g
->LeftEdge
+ g
->Width
> *left
)
904 *left
= g
->LeftEdge
+ g
->Width
;
908 if (g
->LeftEdge
+ win
->Width
- 1 - 1 < *right
)
909 *right
= g
->LeftEdge
+ win
->Width
- 1 - 1;
916 /**************************************************************************************************/
918 IPTR
INTERNAL_WDM_DRAW_WINTITLE(Class
*cl
, Object
*obj
, struct wdpDrawWinBorder
*msg
)
920 struct windecor_data
*data
= INST_DATA(cl
, obj
);
921 struct RastPort
*rp
= msg
->wdp_RPort
;
922 struct Window
*window
= msg
->wdp_Window
;
923 UWORD
*pens
= DRI(msg
->wdp_Dri
)->dri_Pens
;
926 findtitlearea(window
, &left
, &right
);
929 SetAPen(rp
, pens
[(window
->Flags
& WFLG_WINDOWACTIVE
) ? FILLPEN
: BACKGROUNDPEN
]);
930 CheckRectFill(rp
, left
+ 1, 1, right
- 1, window
->BorderTop
- 2, IntuitionBase
);
932 if (right
- left
> 6)
934 ULONG textlen
, titlelen
, textpixellen
;
935 struct TextExtent te
;
937 SetFont(rp
, DRI(msg
->wdp_Dri
)->dri_Font
);
939 titlelen
= strlen(window
->Title
);
947 , window
->BorderTop
- 2);
950 textpixellen
= te
.te_Extent
.MaxX
- te
.te_Extent
.MinX
+ 1;
954 SetAPen(rp
, pens
[(window
->Flags
& WFLG_WINDOWACTIVE
) ? FILLTEXTPEN
: TEXTPEN
]);
956 Move(rp
, left
, DRI(msg
->wdp_Dri
)->dri_Font
->tf_Baseline
+ 2);
957 Text(rp
, window
->Title
, textlen
);
964 /**************************************************************************************************/
966 IPTR
WinDecorClass__WDM_DRAW_WINBORDER(Class
*cl
, Object
*obj
, struct wdpDrawWinBorder
*msg
)
968 struct windecor_data
*data
= INST_DATA(cl
, obj
);
969 struct RastPort
*rp
= msg
->wdp_RPort
;
970 struct Window
*window
= msg
->wdp_Window
;
971 UWORD
*pens
= DRI(msg
->wdp_Dri
)->dri_Pens
;
975 SetAPen(rp
, pens
[SHINEPEN
]);
977 if (window
->BorderTop
> 0)
979 /* Outer shine edge on top side */
981 CheckRectFill(rp
, 0, 0, window
->Width
- 1, 0, IntuitionBase
);
984 if (!(msg
->wdp_Flags
& WDF_DWB_TOP_ONLY
))
986 if (window
->BorderLeft
> 0)
988 /* Outer shine edge on left side */
990 CheckRectFill(rp
, 0, 0, 0, window
->Height
- 1, IntuitionBase
);
993 if (window
->BorderRight
> 1)
995 /* Inner shine edge on right side */
998 window
->Width
- window
->BorderRight
, window
->BorderTop
,
999 window
->Width
- window
->BorderRight
, window
->Height
- window
->BorderBottom
,
1003 if (window
->BorderBottom
> 1)
1005 /* Inner shine edge on bottom side */
1008 window
->BorderLeft
, window
->Height
- window
->BorderBottom
,
1009 window
->Width
- window
->BorderRight
, window
->Height
- window
->BorderBottom
,
1014 SetAPen(rp
, pens
[SHADOWPEN
]);
1016 if (!(msg
->wdp_Flags
& WDF_DWB_TOP_ONLY
))
1018 if (window
->BorderRight
> 0)
1020 /* Outer shadow edge on right side */
1022 CheckRectFill(rp
, window
->Width
- 1, 1,
1023 window
->Width
- 1, window
->Height
- 1, IntuitionBase
);
1026 if (window
->BorderBottom
> 0)
1028 /* Outer shadow edge on bottom side */
1030 CheckRectFill(rp
, 1, window
->Height
- 1,
1031 window
->Width
- 1, window
->Height
- 1, IntuitionBase
);
1034 if (window
->BorderLeft
> 1)
1036 /* Inner shadow edge on left side */
1038 CheckRectFill(rp
, window
->BorderLeft
- 1, window
->BorderTop
- 1,
1039 window
->BorderLeft
- 1, window
->Height
- window
->BorderBottom
,
1045 if (window
->BorderTop
> 1)
1047 /* Inner shadow edge on top side */
1049 CheckRectFill(rp
, window
->BorderLeft
- 1, window
->BorderTop
- 1,
1050 window
->Width
- window
->BorderRight
, window
->BorderTop
- 1,
1054 SetAPen(rp
, pens
[(window
->Flags
& WFLG_WINDOWACTIVE
) ? FILLPEN
: BACKGROUNDPEN
]);
1056 if (window
->BorderTop
> 2)
1058 /* Fill on top side */
1060 CheckRectFill(rp
, 1, 1, window
->Width
- 2, window
->BorderTop
- 2, IntuitionBase
);
1063 if (!(msg
->wdp_Flags
& WDF_DWB_TOP_ONLY
))
1065 if (window
->BorderLeft
> 2)
1067 /* Fill on left side */
1069 CheckRectFill(rp
, 1, 1, window
->BorderLeft
- 2, window
->Height
- 2, IntuitionBase
);
1073 if (window
->BorderRight
> 2)
1075 /* Fill on right side */
1077 CheckRectFill(rp
, window
->Width
- window
->BorderRight
+ 1, 1,
1078 window
->Width
- 2, window
->Height
- 2, IntuitionBase
);
1081 if (window
->BorderBottom
> 2)
1083 /* Fill on bottom side */
1085 CheckRectFill(rp
, 1, window
->Height
- window
->BorderBottom
+ 1,
1086 window
->Width
- 2, window
->Height
- 2, IntuitionBase
);
1090 findtitlearea(window
, &left
, &right
);
1094 /* Left edge of title area */
1096 SetAPen(rp
, pens
[SHINEPEN
]);
1098 Draw(rp
, left
, window
->BorderTop
- 2);
1101 if (right
!= window
->Width
- 1)
1103 /* Right edges of title area */
1105 SetAPen(rp
, pens
[SHADOWPEN
]);
1107 Draw(rp
, right
, window
->BorderTop
- 2);
1110 if (window
->Title
) INTERNAL_WDM_DRAW_WINTITLE(cl
, obj
, msg
);
1115 /**************************************************************************************************/
1117 IPTR
WinDecorClass__WDM_LAYOUT_BORDERGADGETS(Class
*cl
, Object
*obj
, struct wdpLayoutBorderGadgets
*msg
)
1119 //struct windecor_data *data = INST_DATA(cl, obj);
1120 //struct Window *window = msg->wdp_Window;
1121 struct Gadget
*gadget
= msg
->wdp_Gadgets
;
1123 if (!(msg
->wdp_Flags
& WDF_LBG_SYSTEMGADGET
)) return TRUE
;
1127 switch(gadget
->GadgetType
& GTYP_SYSTYPEMASK
)
1130 gadget
->LeftEdge
= 0;
1131 gadget
->Width
= gadget
->Height
;
1132 gadget
->Flags
&= ~(GFLG_RELRIGHT
| GFLG_RELWIDTH
);
1136 gadget
->LeftEdge
= -gadget
->Height
+ 1;
1137 gadget
->Width
= gadget
->Height
;
1138 gadget
->Flags
&= ~GFLG_RELWIDTH
;
1139 gadget
->Flags
|= GFLG_RELRIGHT
;
1143 gadget
->LeftEdge
= -gadget
->Height
* 2 + 1;
1144 gadget
->Width
= gadget
->Height
;
1145 gadget
->Flags
&= ~GFLG_RELWIDTH
;
1146 gadget
->Flags
|= GFLG_RELRIGHT
;
1149 case GTYP_WDRAGGING
:
1150 gadget
->LeftEdge
= 0;
1152 gadget
->Flags
&= ~GFLG_RELRIGHT
;
1153 gadget
->Flags
|= GFLG_RELWIDTH
;
1157 if (msg
->wdp_Flags
& WDF_LBG_MULTIPLE
)
1159 gadget
= gadget
->NextGadget
;
1170 /**************************************************************************************************/
1172 IPTR
WinDecorClass__WDM_DRAW_BORDERPROPBACK(Class
*cl
, Object
*obj
, struct wdpDrawBorderPropBack
*msg
)
1174 struct windecor_data
*data
= INST_DATA(cl
, obj
);
1175 struct Window
*window
= msg
->wdp_Window
;
1176 struct RastPort
*rp
= msg
->wdp_RPort
;
1177 struct Gadget
*gadget
= msg
->wdp_Gadget
;
1178 struct Rectangle
*r
= msg
->wdp_RenderRect
;
1179 struct PropInfo
*pi
= ((struct PropInfo
*)gadget
->SpecialInfo
);
1180 UWORD
*pens
= DRI(msg
->wdp_Dri
)->dri_Pens
;
1184 if (pi
->Flags
& PROPNEWLOOK
)
1186 static UWORD pattern
[] = {0x5555,0xAAAA};
1188 SetAfPt(rp
, pattern
, 1);
1189 SetAPen(rp
, pens
[SHADOWPEN
]);
1190 SetBPen(rp
, pens
[(window
->Flags
& WFLG_WINDOWACTIVE
) ? FILLPEN
: BACKGROUNDPEN
]);
1191 RectFill(rp
, r
->MinX
, r
->MinY
, r
->MaxX
, r
->MaxY
);
1192 SetAfPt(rp
, NULL
, 0);
1196 SetAPen(rp
, pens
[BACKGROUNDPEN
]);
1197 RectFill(rp
, r
->MinX
, r
->MinY
, r
->MaxX
, r
->MaxY
);
1203 /**************************************************************************************************/
1205 IPTR
WinDecorClass__WDM_DRAW_BORDERPROPKNOB(Class
*cl
, Object
*obj
, struct wdpDrawBorderPropKnob
*msg
)
1207 struct windecor_data
*data
= INST_DATA(cl
, obj
);
1208 struct Window
*window
= msg
->wdp_Window
;
1209 struct RastPort
*rp
= msg
->wdp_RPort
;
1210 struct Gadget
*gadget
= msg
->wdp_Gadget
;
1211 struct Rectangle
*r
= msg
->wdp_RenderRect
;
1212 struct PropInfo
*pi
= ((struct PropInfo
*)gadget
->SpecialInfo
);
1213 UWORD
*pens
= DRI(msg
->wdp_Dri
)->dri_Pens
;
1217 if (pi
->Flags
& PROPBORDERLESS
)
1219 SetAPen(rp
, pens
[SHINEPEN
]);
1222 RectFill(rp
, r
->MinX
, r
->MinY
, r
->MaxX
- 1, r
->MinY
);
1225 RectFill(rp
, r
->MinX
, r
->MinY
+ 1, r
->MinX
, r
->MaxY
- 1);
1227 SetAPen(rp
, pens
[SHADOWPEN
]);
1230 RectFill(rp
, r
->MaxX
, r
->MinY
, r
->MaxX
, r
->MaxY
);
1233 RectFill(rp
, r
->MinX
, r
->MaxY
, r
->MaxX
- 1, r
->MaxY
);
1240 } /* PROPBORDERLESS */
1243 SetAPen(rp
, pens
[SHADOWPEN
]);
1245 if (pi
->Flags
& FREEHORIZ
)
1247 /* black line at the left and at the right */
1249 RectFill(rp
, r
->MinX
, r
->MinY
, r
->MinX
, r
->MaxY
);
1250 RectFill(rp
, r
->MaxX
, r
->MinY
, r
->MaxX
, r
->MaxY
);
1257 if (pi
->Flags
& FREEVERT
)
1259 /* black line at the top and at the bottom */
1261 RectFill(rp
, r
->MinX
, r
->MinY
, r
->MaxX
, r
->MinY
);
1262 RectFill(rp
, r
->MinX
, r
->MaxY
, r
->MaxX
, r
->MaxY
);
1269 } /* not PROPBORDERLESS */
1272 SetAPen(rp
, pens
[(window
->Flags
& WFLG_WINDOWACTIVE
) ? FILLPEN
: BACKGROUNDPEN
]);
1275 RectFill(rp
, r
->MinX
, r
->MinY
, r
->MaxX
, r
->MaxY
);
1281 /**************************************************************************************************/
1283 IPTR
WinDecorClass__WDM_INITWINDOW(Class
*cl
, Object
*obj
, struct wdpInitWindow
*msg
)
1288 /**************************************************************************************************/
1290 IPTR
WinDecorClass__WDM_EXITWINDOW(Class
*cl
, Object
*obj
, struct wdpExitWindow
*msg
)
1295 /**************************************************************************************************/
1297 IPTR
WinDecorClass__WDM_WINDOWSHAPE(Class
*cl
, Object
*obj
, struct wdpWindowShape
*msg
)