2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
5 Desc: Support functions for AROSCycleClass.
9 /***********************************************************************************/
12 #include <exec/types.h>
13 #include <proto/intuition.h>
14 #include <intuition/screens.h>
15 #include <proto/graphics.h>
16 #include <graphics/rastport.h>
17 #include <graphics/text.h>
18 #include <libraries/gadtools.h>
20 #include "aroscycle_intern.h"
22 /***********************************************************************************/
24 #define CYCLEIMAGEWIDTH 19
26 /***********************************************************************************/
28 UWORD disabledpattern
[2] = {0x4444, 0x1111};
30 /* draws a disabled pattern */
31 void drawdisabledpattern(struct RastPort
*rport
, UWORD pen
,
32 WORD left
, WORD top
, UWORD width
, UWORD height
35 SetABPenDrMd(rport
, pen
, 0, JAM1
);
36 rport
->AreaPtrn
= disabledpattern
;
38 RectFill(rport
, left
, top
, left
+width
-1, top
+height
-1);
42 /***********************************************************************************/
44 void renderlabel(struct Gadget
*gad
,
46 struct RastPort
*rport
,
47 struct GadgetInfo
*ginfo
50 UWORD
*pens
= ginfo
->gi_DrInfo
->dri_Pens
;
52 int len
= strlen(string
);
54 SetABPenDrMd(rport
, pens
[TEXTPEN
], pens
[BACKGROUNDPEN
], JAM1
);
56 gad
->LeftEdge
+ (gad
->Width
- CYCLEIMAGEWIDTH
- TextLength(rport
, string
, len
)) / 2,
57 gad
->TopEdge
+ (gad
->Height
- rport
->Font
->tf_YSize
) / 2 + rport
->Font
->tf_Baseline
);
58 Text(rport
, string
, len
);
60 x
= gad
->LeftEdge
+ gad
->Width
- CYCLEIMAGEWIDTH
;
64 SetAPen(rport
, pens
[SHINEPEN
]);
65 RectFill(rport
, x
+ 1, gad
->TopEdge
+ 2, x
+ 1, gad
->TopEdge
+ gad
->Height
- 1 - 2);
66 SetAPen(rport
, pens
[SHADOWPEN
]);
67 RectFill(rport
, x
, gad
->TopEdge
+ 2, x
, gad
->TopEdge
+ gad
->Height
- 1 - 2);
75 for(y
= 0; y
< 4; y
++)
78 gad
->TopEdge
+ gad
->Height
- 1 - h
- y
- 1,
80 gad
->TopEdge
+ gad
->Height
- 1 - h
- y
- 1);
83 gad
->TopEdge
+ h
+ y
+ 1,
85 gad
->TopEdge
+ h
+ y
+ 1);
89 /***********************************************************************************/
91 BOOL
pointingadget(struct Gadget
*gad
, struct GadgetInfo
*gi
, WORD x
, WORD y
)
96 if (gad
->Flags
& GFLG_RELWIDTH
) gadw
+= gi
->gi_Domain
.Width
;
99 if (gad
->Flags
& GFLG_RELHEIGHT
) gadh
+= gi
->gi_Domain
.Height
;
101 return ((x
>= 0) && (y
>= 0) && (x
< gadw
) && (y
< gadh
)) ? TRUE
: FALSE
;
104 /***********************************************************************************/