1 // SeparatorGadgetClass.c
6 #include <exec/types.h>
7 #include <graphics/gfxmacros.h>
8 #include <graphics/gfxbase.h>
9 #include <graphics/text.h>
10 #include <graphics/rpattr.h>
11 #include <libraries/dos.h>
12 #include <workbench/startup.h>
13 #include <intuition/intuition.h>
14 #include <intuition/intuitionbase.h>
15 #include <intuition/gadgetclass.h>
16 #include <intuition/screens.h>
20 #include <proto/dos.h>
21 #include <proto/exec.h>
22 #include <proto/layers.h>
23 #include <proto/intuition.h>
24 #include <proto/graphics.h>
25 #include <proto/utility.h>
26 #include <proto/iconobject.h>
28 #include <proto/scalos.h>
30 #include <clib/alib_protos.h>
43 #include "scalos_structures.h"
44 #include "functions.h"
45 #include "Variables.h"
47 //----------------------------------------------------------------------------
49 // The functions in this module
51 static SAVEDS(ULONG
) INTERRUPT
dispatchSeparatorGadgetClass(Class
*cl
, Object
*o
, Msg msg
);
52 static ULONG
SeparatorGadget_Set(Class
*cl
, Object
*o
, Msg msg
);
53 static ULONG
SeparatorGadget_Get(Class
*cl
, Object
*o
, Msg msg
);
55 //----------------------------------------------------------------------------
57 /***********************************************************/
58 /** Make the class and set up the dispatcher's hook **/
59 /***********************************************************/
60 struct ScalosClass
*initSeparatorGadgetClass(const struct PluginClass
*plug
)
62 struct ScalosClass
*SeparatorGadgetClass
;
64 SeparatorGadgetClass
= SCA_MakeScalosClass(plug
->plug_classname
,
65 plug
->plug_superclassname
,
68 d1(KPrintF("%s/%s/%ld SeparatorGadgetClass=%08lx plug_classname=<%s> plug_superclassname=<%s>\n",
69 __FILE__
, __FUNC__
, __LINE__
, SeparatorGadgetClass
, plug
->plug_classname
, plug
->plug_superclassname
));
71 if (SeparatorGadgetClass
)
73 // initialize the cl_Dispatcher Hook
74 SETHOOKFUNC(SeparatorGadgetClass
->sccl_class
->cl_Dispatcher
, dispatchSeparatorGadgetClass
);
77 return SeparatorGadgetClass
;
80 //----------------------------------------------------------------------------
82 /**************************************************************************/
83 /********** The SeparatorGadgetCLASS class dispatcher *********/
84 /**************************************************************************/
85 static SAVEDS(ULONG
) INTERRUPT
dispatchSeparatorGadgetClass(Class
*cl
, Object
*o
, Msg msg
)
89 d1(KPrintF("%s/%s/%ld Class=%l08x SuperClass=%08lx Method=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, cl
, cl
->cl_Super
, msg
->MethodID
));
91 switch (msg
->MethodID
)
94 Result
= SeparatorGadget_Set(cl
, o
, msg
);
97 Result
= SeparatorGadget_Get(cl
, o
, msg
);
100 Result
= DoSuperMethodA(cl
, o
, msg
);
107 //----------------------------------------------------------------------------
109 static ULONG
SeparatorGadget_Get(Class
*cl
, Object
*o
, Msg msg
)
111 struct opGet
*opg
= (struct opGet
*) msg
;
112 struct Gadget
*gg
= (struct Gadget
*) o
;
113 ULONG Success
= TRUE
;
115 if (NULL
== opg
->opg_Storage
)
118 *(opg
->opg_Storage
) = 0;
120 switch (opg
->opg_AttrID
)
122 case GA_Left
: // required since gadgetclass attribute is [IS] - no support for [G]
123 *(opg
->opg_Storage
) = (ULONG
) gg
->LeftEdge
;
125 case GA_Top
: // required since gadgetclass attribute is [IS] - no support for [G]
126 *(opg
->opg_Storage
) = (ULONG
) gg
->TopEdge
;
128 case GA_Width
: // required since gadgetclass attribute is [IS] - no support for [G]
129 *(opg
->opg_Storage
) = (ULONG
) gg
->Width
;
131 case GA_Height
: // required since gadgetclass attribute is [IS] - no support for [G]
132 *(opg
->opg_Storage
) = (ULONG
) gg
->Height
;
135 Success
= DoSuperMethodA(cl
, o
, msg
);
142 //----------------------------------------------------------------------------
144 static ULONG
SeparatorGadget_Set(Class
*cl
, Object
*o
, Msg msg
)
146 // struct CycleGadgetInstance *inst = INST_DATA(cl, o);
147 struct opSet
*ops
= (struct opSet
*) msg
;
148 struct TagItem
*TagList
= ops
->ops_AttrList
;
150 struct Gadget
*gg
= (struct Gadget
*) o
;
151 BOOL NeedRerender
= FALSE
;
154 while ((tag
= NextTagItem(&TagList
)))
159 if ((tag
->ti_Data
&& !(gg
->Flags
& GFLG_DISABLED
)) ||
160 (!tag
->ti_Data
&& (gg
->Flags
& GFLG_DISABLED
)))
162 d1(KPrintF("%s/%s/%ld o=%l08x Flags=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, o
, gg
->Flags
));
171 Result
= DoSuperMethodA(cl
, o
, msg
);
177 rp
= ObtainGIRPort(ops
->ops_GInfo
);
178 d1(KPrintF("%s/%s/%ld: o=%08lx rp=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, o
, rp
));
193 //----------------------------------------------------------------------------