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
);
42 int usewinborder
= GetTagData(MUIA_Prop_UseWinBorder
, 0, msg
->ops_AttrList
);
43 int sb_pos
= GetTagData(MUIA_Scrollbar_Type
, 0, msg
->ops_AttrList
);
45 Object
*prop
= MUI_NewObject(MUIC_Prop
, PropFrame
, MUIA_Prop_Horiz
, horiz
,
46 TAG_MORE
, msg
->ops_AttrList
);
48 obj
= (Object
*)DoSuperNewTags(cl
, obj
, NULL
,
49 MUIA_Group_Spacing
, 0,
50 MUIA_Background
, MUII_GroupBack
,
52 TAG_MORE
, (IPTR
) msg
->ops_AttrList
);
56 data
= INST_DATA(cl
, obj
);
58 data
->sb_pos
= sb_pos
;
62 data
->up_arrow
= ImageObject
,
63 MUIA_Background
, MUII_ButtonBack
,
66 MUIA_InputMode
, MUIV_InputMode_RelVerify
,
67 MUIA_Image_Spec
, horiz
? MUII_ArrowLeft
: MUII_ArrowUp
,
68 MUIA_Image_Prop
, prop
,
72 DoMethod(data
->up_arrow
, MUIM_Notify
, MUIA_Timer
, MUIV_EveryTime
,
73 (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
,
86 DoMethod(data
->down_arrow
, MUIM_Notify
, MUIA_Timer
, MUIV_EveryTime
,
87 (IPTR
)prop
, 2, MUIM_Prop_Increase
, 1);
92 case MUIV_Scrollbar_Type_Default
:
93 case MUIV_Scrollbar_Type_Top
:
94 DoMethod(obj
, OM_ADDMEMBER
, (IPTR
)data
->prop
);
95 DoMethod(obj
, OM_ADDMEMBER
, (IPTR
)data
->up_arrow
);
96 DoMethod(obj
, OM_ADDMEMBER
, (IPTR
)data
->down_arrow
);
98 case MUIV_Scrollbar_Type_Bottom
:
99 DoMethod(obj
, OM_ADDMEMBER
, (IPTR
)data
->up_arrow
);
100 DoMethod(obj
, OM_ADDMEMBER
, (IPTR
)data
->down_arrow
);
101 DoMethod(obj
, OM_ADDMEMBER
, (IPTR
)data
->prop
);
103 case MUIV_Scrollbar_Type_Sym
:
104 DoMethod(obj
, OM_ADDMEMBER
, (IPTR
)data
->up_arrow
);
105 DoMethod(obj
, OM_ADDMEMBER
, (IPTR
)data
->prop
);
106 DoMethod(obj
, OM_ADDMEMBER
, (IPTR
)data
->down_arrow
);
112 _flags(obj
) |= MADF_BORDERGADGET
;
113 DoMethod(obj
, OM_ADDMEMBER
, (IPTR
)data
->prop
);
120 IPTR
Scrollbar__MUIM_Setup(struct IClass
*cl
, Object
*obj
, Msg msg
)
122 struct Scrollbar_DATA
*data
= INST_DATA(cl
, obj
);
124 if (!DoSuperMethodA(cl
, obj
, msg
))
127 if (!(_flags(obj
) & MADF_BORDERGADGET
) && !data
->sb_pos
)
129 switch (muiGlobalInfo(obj
)->mgi_Prefs
->scrollbar_arrangement
)
131 case SCROLLBAR_ARRANGEMENT_TOP
:
132 DoMethod(obj
, MUIM_Group_Sort
, (IPTR
)data
->prop
,
133 (IPTR
)data
->up_arrow
, (IPTR
)data
->down_arrow
, (IPTR
)NULL
);
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
)
164 case OM_NEW
: return Scrollbar__OM_NEW(cl
, obj
, (struct opSet
*) msg
);
165 case MUIM_Setup
: return Scrollbar__MUIM_Setup(cl
, obj
, msg
);
166 default: return DoSuperMethodA(cl
, obj
, msg
);
169 BOOPSI_DISPATCHER_END
171 const struct __MUIBuiltinClass _MUI_Scrollbar_desc
=
175 sizeof(struct Scrollbar_DATA
),
176 (void*)Scrollbar_Dispatcher