1 /****************************************************************************/
2 /* ArrowString class */
3 /* By Michal Rybinski */
4 /****************************************************************************/
7 #include "../common/mui_misc.h"
8 #include "../common/mui_help.h"
9 #include "../common/help.h"
10 #include "../macros/vapor.h"
11 #include <emul/emulregs.h>
14 #include <proto/alib.h>
15 #include <proto/muimaster.h>
16 #include <proto/utility.h>
19 #include <private/vapor/vapor.h>
20 #include "arrowstring_class.h"
34 ULONG
ArrowString_New(struct IClass
*cl
, Object
*obj
, struct opSet
*msg
)
38 memset(&tmp
, sizeof(tmp
), 0);
40 obj
= (Object
*) DoSuperNew(cl
, obj
, MUIA_Group_Horiz
, TRUE
, MUIA_Group_HorizSpacing
, 0,
41 Child
, tmp
.ST_Number
= StringObject
, StringFrame
,
42 MUIA_CycleChain
, TRUE
,
43 MUIA_String_Accept
, "0123456789",
44 MUIA_String_MaxLen
, 5,
45 MUIA_FixWidthTxt
, "123456",
46 MUIA_String_Format
, MUIV_String_Format_Right
,
47 MUIA_String_Contents
, (IPTR
) "1",
49 Child
, tmp
.BT_Increase
= ImageObject
, ImageButtonFrame
,
50 MUIA_InputMode
, MUIV_InputMode_RelVerify
,
51 MUIA_Image_Spec
, MUII_ArrowUp
,
52 MUIA_Image_FreeVert
, TRUE
,
53 MUIA_Background
, MUII_ButtonBack
,
54 MUIA_ShowSelState
, FALSE
,
56 Child
, tmp
.BT_Decrease
= ImageObject
, ImageButtonFrame
,
57 MUIA_InputMode
, MUIV_InputMode_RelVerify
,
58 MUIA_Image_Spec
, MUII_ArrowDown
,
59 MUIA_Image_FreeVert
, TRUE
,
60 MUIA_Background
, MUII_ButtonBack
,
61 MUIA_ShowSelState
, FALSE
,
64 TAG_MORE
, msg
->ops_AttrList
);
68 struct Data
*data
= INST_DATA(cl
, obj
);
71 memcpy(data
, &tmp
, sizeof(tmp
));
76 if ((ti
= FindTagItem(MA_ArrowString_Step
, msg
->ops_AttrList
)))
78 data
->Step
= ti
->ti_Data
;
82 if ((ti
= FindTagItem(MA_ArrowString_Min
, msg
->ops_AttrList
)))
84 data
->Min
= ti
->ti_Data
;
87 DoMethod(data
->BT_Increase
, MUIM_Notify
, MUIA_Timer
, MUIV_EveryTime
,
88 obj
, 1, MM_ArrowString_Increase
);
90 DoMethod(data
->BT_Decrease
, MUIM_Notify
, MUIA_Timer
, MUIV_EveryTime
,
91 obj
, 1, MM_ArrowString_Decrease
);
93 DoMethod(data
->ST_Number
, MUIM_Notify
, MUIA_String_Acknowledge
, MUIV_EveryTime
,
94 obj
, 3, MUIM_Set
, MA_ArrowString_Changed
, TRUE
);
102 ULONG
ArrowString_Get(struct IClass
*cl
, Object
*obj
, struct opGet
*msg
)
104 switch (msg
->opg_AttrID
)
106 case MA_ArrowString_Changed
:
112 return(DoSuperMethodA(cl
, obj
, (APTR
)msg
));
115 ULONG
ArrowString_Increase(struct IClass
*cl
, Object
*obj
)
117 struct Data
*data
= INST_DATA(cl
, obj
);
118 ULONG no
= xget(data
->ST_Number
, MUIA_String_Integer
);
120 set(data
->ST_Number
, MUIA_String_Integer
, no
+ data
->Step
);
121 set(obj
, MA_ArrowString_Changed
, TRUE
);
126 ULONG
ArrowString_Decrease(struct IClass
*cl
, Object
*obj
)
128 struct Data
*data
= INST_DATA(cl
, obj
);
129 ULONG no
= xget(data
->ST_Number
, MUIA_String_Integer
);
133 set(data
->ST_Number
, MUIA_String_Integer
, no
- data
->Step
);
134 set(obj
, MA_ArrowString_Changed
, TRUE
);
140 ULONG
ArrowString_Dispose(struct IClass
*cl
, Object
*obj
, Msg msg
)
142 return(DoSuperMethodA(cl
, obj
, (Msg
)msg
));
146 case OM_NEW
: return(ArrowString_New (cl
, obj
, (APTR
)msg
));
147 case OM_DISPOSE
: return(ArrowString_Dispose (cl
, obj
, (APTR
)msg
));
148 case OM_GET
: return(ArrowString_Get (cl
, obj
, (APTR
)msg
));
149 case MM_ArrowString_Increase
: return(ArrowString_Increase (cl
, obj
));
150 case MM_ArrowString_Decrease
: return(ArrowString_Decrease (cl
, obj
));
153 DECSUBCLASS_NC(MUIC_Group
, ArrowStringClass
)