2 Copyright 2002-2006, The AROS Development Team. All rights reserved.
6 #include <exec/memory.h>
7 #include <intuition/icclass.h>
8 #include <intuition/gadgetclass.h>
9 #include <clib/alib_protos.h>
10 #include <proto/exec.h>
11 #include <proto/intuition.h>
12 #include <proto/utility.h>
13 #include <proto/muimaster.h>
15 #include "../datatypescache.h"
16 #include "../imspec_intern.h"
19 #include "muimaster_intern.h"
26 extern struct Library
*MUIMasterBase
;
37 IPTR
Scrollbar__OM_NEW(struct IClass
*cl
, Object
*obj
, struct opSet
*msg
)
39 struct Scrollbar_DATA
*data
;
40 //struct TagItem *tags,*tag;
41 int horiz
= GetTagData(MUIA_Group_Horiz
, 0, msg
->ops_AttrList
);
43 GetTagData(MUIA_Prop_UseWinBorder
, 0, msg
->ops_AttrList
);
44 int sb_pos
= GetTagData(MUIA_Scrollbar_Type
, 0, msg
->ops_AttrList
);
47 MUI_NewObject(MUIC_Prop
, PropFrame
, MUIA_Prop_Horiz
, horiz
,
48 TAG_MORE
, msg
->ops_AttrList
);
50 obj
= (Object
*) DoSuperNewTags(cl
, obj
, NULL
,
51 MUIA_Group_Spacing
, 0,
52 MUIA_Background
, MUII_GroupBack
,
53 TAG_MORE
, (IPTR
) msg
->ops_AttrList
);
57 data
= INST_DATA(cl
, obj
);
59 data
->sb_pos
= sb_pos
;
63 data
->up_arrow
= ImageObject
,
64 MUIA_Background
, MUII_ButtonBack
,
67 MUIA_InputMode
, MUIV_InputMode_RelVerify
,
68 MUIA_Image_Spec
, horiz
? MUII_ArrowLeft
: MUII_ArrowUp
,
69 MUIA_Image_Prop
, prop
, End
;
72 DoMethod(data
->up_arrow
, MUIM_Notify
, MUIA_Timer
,
73 MUIV_EveryTime
, (IPTR
) prop
, 2, MUIM_Prop_Decrease
, 1);
76 data
->down_arrow
= ImageObject
,
77 MUIA_Background
, MUII_ButtonBack
,
80 MUIA_InputMode
, MUIV_InputMode_RelVerify
,
81 MUIA_Image_Spec
, horiz
? MUII_ArrowRight
: MUII_ArrowDown
,
82 MUIA_Image_Prop
, prop
, End
;
85 DoMethod(data
->down_arrow
, MUIM_Notify
, MUIA_Timer
,
86 MUIV_EveryTime
, (IPTR
) prop
, 2, MUIM_Prop_Increase
, 1);
91 case MUIV_Scrollbar_Type_Default
:
92 case MUIV_Scrollbar_Type_Top
:
93 DoMethod(obj
, OM_ADDMEMBER
, (IPTR
) data
->prop
);
94 DoMethod(obj
, OM_ADDMEMBER
, (IPTR
) data
->up_arrow
);
95 DoMethod(obj
, OM_ADDMEMBER
, (IPTR
) data
->down_arrow
);
97 case MUIV_Scrollbar_Type_Bottom
:
98 DoMethod(obj
, OM_ADDMEMBER
, (IPTR
) data
->up_arrow
);
99 DoMethod(obj
, OM_ADDMEMBER
, (IPTR
) data
->down_arrow
);
100 DoMethod(obj
, OM_ADDMEMBER
, (IPTR
) data
->prop
);
102 case MUIV_Scrollbar_Type_Sym
:
103 DoMethod(obj
, OM_ADDMEMBER
, (IPTR
) data
->up_arrow
);
104 DoMethod(obj
, OM_ADDMEMBER
, (IPTR
) data
->prop
);
105 DoMethod(obj
, OM_ADDMEMBER
, (IPTR
) data
->down_arrow
);
111 _flags(obj
) |= MADF_BORDERGADGET
;
112 DoMethod(obj
, OM_ADDMEMBER
, (IPTR
) data
->prop
);
119 IPTR
Scrollbar__MUIM_Setup(struct IClass
*cl
, Object
*obj
, Msg msg
)
121 struct Scrollbar_DATA
*data
= INST_DATA(cl
, obj
);
123 if (!DoSuperMethodA(cl
, obj
, msg
))
126 if (!(_flags(obj
) & MADF_BORDERGADGET
) && !data
->sb_pos
)
128 switch (muiGlobalInfo(obj
)->mgi_Prefs
->scrollbar_arrangement
)
130 case SCROLLBAR_ARRANGEMENT_TOP
:
131 DoMethod(obj
, MUIM_Group_Sort
, (IPTR
) data
->prop
,
132 (IPTR
) data
->up_arrow
, (IPTR
) data
->down_arrow
,
135 case SCROLLBAR_ARRANGEMENT_MIDDLE
:
136 DoMethod(obj
, MUIM_Group_Sort
, (IPTR
) data
->up_arrow
,
137 (IPTR
) data
->prop
, (IPTR
) data
->down_arrow
, (IPTR
) NULL
);
139 case SCROLLBAR_ARRANGEMENT_BOTTOM
:
140 DoMethod(obj
, MUIM_Group_Sort
, (IPTR
) data
->up_arrow
,
141 (IPTR
) data
->down_arrow
, (IPTR
) data
->prop
, (IPTR
) NULL
);
145 switch (muiGlobalInfo(obj
)->mgi_Prefs
->scrollbar_type
)
147 case SCROLLBAR_TYPE_STANDARD
:
149 case SCROLLBAR_TYPE_NEWLOOK
:
151 case SCROLLBAR_TYPE_CUSTOM
:
160 BOOPSI_DISPATCHER(IPTR
, Scrollbar_Dispatcher
, cl
, obj
, msg
)
162 switch (msg
->MethodID
)
165 return Scrollbar__OM_NEW(cl
, obj
, (struct opSet
*)msg
);
167 return Scrollbar__MUIM_Setup(cl
, obj
, msg
);
169 return DoSuperMethodA(cl
, obj
, msg
);
172 BOOPSI_DISPATCHER_END
174 const struct __MUIBuiltinClass _MUI_Scrollbar_desc
=
178 sizeof(struct Scrollbar_DATA
),
179 (void *)Scrollbar_Dispatcher