6 #include <exec/types.h>
7 #include <graphics/rastport.h>
8 #include <intuition/classes.h>
9 #include <intuition/classusr.h>
10 #include <utility/hooks.h>
11 #include <intuition/gadgetclass.h>
12 #include <intuition/newmouse.h>
13 #include <workbench/workbench.h>
14 #include <workbench/startup.h>
18 #include <proto/dos.h>
19 #include <proto/exec.h>
20 #include <proto/layers.h>
21 #include <proto/intuition.h>
22 #include <proto/graphics.h>
23 #include <proto/utility.h>
24 #include <proto/locale.h>
26 #include <proto/scalos.h>
28 #include <clib/alib_protos.h>
31 #include <scalos/scalos.h>
37 #include "scalos_structures.h"
38 #include "functions.h"
39 #include "Variables.h"
41 //----------------------------------------------------------------------------
44 // 20010902 jl initial history
45 //----------------------------------------------------------------------------
47 // local data definitions
49 struct IconifyClassInst
54 //----------------------------------------------------------------------------
58 static SAVEDS(IPTR
) INTERRUPT
IconifyClassDispatcher(Class
*cl
, Object
*o
, Msg msg
);
59 static IPTR
Iconify_New(Class
*cl
, Object
*o
, Msg msg
);
60 static ULONG
Iconify_Draw(Class
*cl
, Object
*o
, Msg msg
);
62 static LONG
RenderYPos(const struct Image
*img
, LONG MinY
, LONG y
);
63 static void DrawSquare(struct RastPort
*rp
, LONG x1
, LONG y1
, LONG x2
, LONG y2
);
65 //----------------------------------------------------------------------------
67 // public data items :
69 //----------------------------------------------------------------------------
71 Class
* initIconifyClass(void)
75 IconifyClass
= MakeClass( NULL
,
76 (STRPTR
) "imageclass",
78 sizeof(struct IconifyClassInst
),
83 // initialize the cl_Dispatcher Hook
84 SETHOOKFUNC(IconifyClass
->cl_Dispatcher
, IconifyClassDispatcher
);
91 static SAVEDS(IPTR
) INTERRUPT
IconifyClassDispatcher(Class
*cl
, Object
*o
, Msg msg
)
95 switch (msg
->MethodID
)
98 Result
= Iconify_New(cl
, o
, msg
);
102 Result
= Iconify_Draw(cl
, o
, msg
);
106 Result
= DoSuperMethodA(cl
, o
, msg
);
114 static IPTR
Iconify_New(Class
*cl
, Object
*o
, Msg msg
)
116 o
= (Object
*) DoSuperMethodA(cl
, o
, msg
);
120 struct Image
*img
= (struct Image
*) o
;
130 static ULONG
Iconify_Draw(Class
*cl
, Object
*o
, Msg msg
)
132 struct impDraw
*imp
= (struct impDraw
*) msg
;
133 struct Image
*img
= (struct Image
*) o
;
134 LONG MinX
, MaxX
, MinY
, MaxY
;
138 MinX
= MaxX
= imp
->imp_Offset
.X
+ img
->LeftEdge
;
139 MinY
= MaxY
= imp
->imp_Offset
.Y
+ img
->TopEdge
;
140 MaxX
+= img
->Width
- 1;
141 MaxY
+= img
->Height
- 1;
143 SetAPen(imp
->imp_RPort
, iInfos
.xii_iinfos
.ii_DrawInfo
->dri_Pens
[SHADOWPEN
]);
144 Move(imp
->imp_RPort
, MinX
- 1, MinY
+ 1);
145 Draw(imp
->imp_RPort
, MinX
- 1, MaxY
);
147 if (IDS_SELECTED
== imp
->imp_State
)
152 SetAPen(imp
->imp_RPort
, iInfos
.xii_iinfos
.ii_DrawInfo
->dri_Pens
[Pen
]);
154 Move(imp
->imp_RPort
, MinX
+ 1, MaxY
);
155 Draw(imp
->imp_RPort
, MaxX
, MaxY
);
156 Draw(imp
->imp_RPort
, MaxX
, MinY
);
158 if (IDS_SELECTED
== imp
->imp_State
)
163 SetAPen(imp
->imp_RPort
, iInfos
.xii_iinfos
.ii_DrawInfo
->dri_Pens
[Pen
]);
165 Draw(imp
->imp_RPort
, MinX
+ 1, MinY
);
166 Draw(imp
->imp_RPort
, MinX
+ 1, MaxY
);
168 switch (imp
->imp_State
)
179 SetAPen(imp
->imp_RPort
, iInfos
.xii_iinfos
.ii_DrawInfo
->dri_Pens
[Pen
]);
180 RectFill(imp
->imp_RPort
, MinX
+ 2, MinY
+ 1,
183 SetAPen(imp
->imp_RPort
, iInfos
.xii_iinfos
.ii_DrawInfo
->dri_Pens
[SHADOWPEN
]);
185 if (IDS_SELECTED
== imp
->imp_State
)
190 DrawSquare(imp
->imp_RPort
, x
, RenderYPos(img
, MinY
, 25), MinX
+ 6, RenderYPos(img
, MinY
, 75));
192 if (IDS_INACTIVENORMAL
== imp
->imp_State
)
197 SetAPen(imp
->imp_RPort
, iInfos
.xii_iinfos
.ii_DrawInfo
->dri_Pens
[Pen
]);
199 RectFill(imp
->imp_RPort
, MinX
+ 8, RenderYPos(img
, MinY
, 45), MinX
+ 11, RenderYPos(img
, MinY
, 60));
201 SetAPen(imp
->imp_RPort
, iInfos
.xii_iinfos
.ii_DrawInfo
->dri_Pens
[SHADOWPEN
]);
203 DrawSquare(imp
->imp_RPort
, MinX
+ 8, RenderYPos(img
, MinY
, 45), MinX
+ 11, RenderYPos(img
, MinY
, 60));
209 static LONG
RenderYPos(const struct Image
*img
, LONG MinY
, LONG y
)
211 return MinY
+ (y
* img
->Height
) / 100;
215 static void DrawSquare(struct RastPort
*rp
, LONG x1
, LONG y1
, LONG x2
, LONG y2
)