Fixed binary search: no more infinite loops when vendor is unknown.
[tangerine.git] / workbench / libs / muimaster / classes / floattext.c
blobc6b63c320e72dacefd309403ff8d691895cc3d4e
1 /*
2 Copyright © 2002-2007, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #define MUIMASTER_YES_INLINE_STDARG
8 #define DEBUG 1
9 #include <aros/debug.h>
11 #include <exec/memory.h>
12 #include <clib/alib_protos.h>
13 #include <proto/exec.h>
14 #include <proto/dos.h>
15 #include <proto/intuition.h>
16 #include <proto/utility.h>
17 #include <proto/muimaster.h>
19 #include <string.h>
21 #include "mui.h"
22 #include "muimaster_intern.h"
23 #include "support.h"
24 #include "support_classes.h"
25 #include "floattext_private.h"
27 extern struct Library *MUIMasterBase;
29 IPTR Floattext__OM_NEW(struct IClass *cl, Object *obj, struct opSet *msg)
31 obj = (Object *)DoSuperMethodA(cl, obj, (Msg)msg);
33 if (obj)
35 struct Floattext_DATA *data = INST_DATA(cl, obj);
36 struct TagItem *tag;
38 if ((tag = FindTagItem(MUIA_Floattext_Text, msg->ops_AttrList)))
39 data->text = (char *)tag->ti_Data;
40 else
41 data->text = NULL;
43 if (data->text)
44 DoMethod(obj, MUIM_List_InsertSingle, data->text, MUIV_List_Insert_Top);
47 return (IPTR)obj;
50 IPTR Floattext__OM_DISPOSE(struct IClass *cl, Object *obj, struct opSet *msg)
52 return DoSuperMethodA(cl, obj, (Msg)msg);
55 IPTR Floattext__OM_GET(struct IClass *cl, Object *obj, struct opSet *msg)
57 return DoSuperMethodA(cl, obj, (Msg)msg);
60 IPTR Floattext__OM_SET(struct IClass *cl, Object *obj, struct opSet *msg)
62 struct Floattext_DATA *data = INST_DATA(cl, obj);
64 const struct TagItem *tags;
65 const struct TagItem *tag;
67 for (tags = msg->ops_AttrList; (tag = NextTagItem(&tags)); )
69 switch (tag->ti_Tag)
71 case MUIA_Floattext_Text:
72 DoMethod(obj, MUIM_List_Clear, NULL);
73 //if (data->text) free
74 data->text = (char *)tag->ti_Data;
75 if (data->text)
76 DoMethod(obj, MUIM_List_InsertSingle, data->text, MUIV_List_Insert_Top);
77 break;
81 return DoSuperMethodA(cl, obj, (Msg)msg);
84 #if ZUNE_BUILTIN_FLOATTEXT
85 BOOPSI_DISPATCHER(IPTR, Floattext_Dispatcher, cl, obj, msg)
87 struct opSet* omsg = (struct opSet *)msg;
89 switch (msg->MethodID)
91 case OM_NEW: return Floattext__OM_NEW(cl, obj, omsg);
92 case OM_DISPOSE: return Floattext__OM_DISPOSE(cl, obj, omsg);
93 case OM_GET: return Floattext__OM_GET(cl, obj, omsg);
94 case OM_SET: return Floattext__OM_SET(cl, obj, omsg);
96 default: return DoSuperMethodA(cl, obj, msg);
99 BOOPSI_DISPATCHER_END
101 const struct __MUIBuiltinClass _MUI_Floattext_desc =
103 MUIC_Floattext,
104 MUIC_List,
105 sizeof(struct Floattext_DATA),
106 (void*)Floattext_Dispatcher
108 #endif /* ZUNE_BUILTIN_FLOATTEXT */