ULONG POPUPMENU_NEW_Gadget(piClass *cl,piObject *o,struct piSet *msg) { struct Node_Gadget *ng; piObject *obj; struct TagItem ti[]={ GAOBJ_Type,GTYPE_BOOPSI, GAOBJ_NumTags,GSIZE_NUMTAGS, GAOBJ_NumOwnTags,GSIZE_NUMOWNTAGS, GAOBJ_TagTypes,(ULONG)PopUpMenuTagsTypes, GAOBJ_OwnTagTypes,(ULONG)PopUpMenuOwnTagsTypes, GAOBJ_ID,POPUPMENU_ID, OBJ_Properties,(ULONG)PAGES_PROPERTIES_PG_PUPM_PAGES, GAOBJLIST_List,1, GAOBJLIST_Active,2, GAOBJLIST_Tags,0, TAG_DONE}; if(obj=(piObject *)piDoSuperMethod(cl,o,OM_NEW,ti)) { ng=(struct Node_Gadget *)OBJECT_DATA(obj); CopyTagItems(PopUpMenuTags,ng->ng_Tags,ng->ng_NumTags); CopyTagItems(PopUpMenuOwnTags,ng->ng_OwnTags,ng->ng_NumOwnTags); FindTagItem(PUMG_Labels,ng->ng_Tags)->ti_Data=(ULONG)MyAllocVec(sizeof(struct List),MEMF_PUBLIC); NewList(List(FindTagItem(PUMG_Labels,ng->ng_Tags)->ti_Data)); return (ULONG)obj; } return FALSE; }
ULONG TEXT_NEW_Gadget(piClass *cl,piObject *o,struct piSet *msg) { struct Node_Gadget *ng; struct GadToolsData *gtd; piObject *obj; struct TagItem ti[]={ GAOBJ_Type,GTYPE_GADTOOLS, GAOBJ_NumTags,GSIZE_NUMTAGS, GAOBJ_NumOwnTags,GSIZE_NUMOWNTAGS, GAOBJ_TagTypes,(ULONG)TextTagsTypes, GAOBJ_OwnTagTypes,(ULONG)TextOwnTagsTypes, GAOBJ_ID,TEXT_ID, OBJ_Properties,(ULONG)PAGES_PROPERTIES_PG_TEXT_PAGES, TAG_DONE}; if(obj=(piObject *)piDoSuperMethod(cl,o,OM_NEW,ti)) { ng=(struct Node_Gadget *)OBJECT_DATA(obj); gtd=(struct GadToolsData *)GadgetData(ng); CopyTagItems(TextTags,ng->ng_Tags,ng->ng_NumTags); CopyTagItems(TextOwnTags,ng->ng_OwnTags,ng->ng_NumOwnTags); gtd->g_Kind=TEXT_KIND; return (ULONG)obj; } return FALSE; }
ULONG TAPEDECK_NEW_Gadget(piClass *cl,piObject *o,struct piSet *msg) { struct Node_Gadget *ng; piObject *obj; struct TagItem ti[]={ GAOBJ_Type,GTYPE_BOOPSI, GAOBJ_NumTags,GSIZE_NUMTAGS, GAOBJ_NumOwnTags,GSIZE_NUMOWNTAGS, GAOBJ_TagTypes,(ULONG)TapeDeckTagsTypes, GAOBJ_OwnTagTypes,(ULONG)TapeDeckOwnTagsTypes, GAOBJ_ID,TAPEDECK_ID, OBJ_Properties,(ULONG)PAGES_PROPERTIES_PG_TDEK_PAGES, TAG_DONE}; if(obj=(piObject *)piDoSuperMethod(cl,o,OM_NEW,ti)) { ng=(struct Node_Gadget *)OBJECT_DATA(obj); CopyTagItems(TapeDeckTags,ng->ng_Tags,ng->ng_NumTags); CopyTagItems(TapeDeckOwnTags,ng->ng_OwnTags,ng->ng_NumOwnTags); return (ULONG)obj; } return FALSE; }
/*Create a new String *invoked by:OPC_LDC */ O createJstring(char *s) { if (java_lang_String == NULL) java_lang_String = loadClass("java/lang/String"); ClassBlock_t *cb = CLASS_CB(java_lang_String); if (!inited) initString(); O char_obj, string_obj; FieldBlock_t *fb; int length, offset; length = strlen(s); char_obj = char2Char(s); short *data = (short *) char_obj->data; unsigned char *ss = (unsigned char *) s; convertUtf8(ss, data); string_obj = allocObject(java_lang_String); string_obj->type = OBJECT_STRING; OBJECT_DATA(string_obj, value_offset - 1, O) = char_obj; OBJECT_DATA(string_obj, count_offset - 1, int) = length; //*(((Object**)string_obj->data)+offset-1) = char_obj; string_obj->cb = cb; string_obj->el_size = sizeof(int); return string_obj; }
void dumpJstring(O obj) { Assert_ASSERT(obj); Assert_ASSERT(value_offset); O c = OBJECT_DATA(obj, value_offset - 1, O); dumpChar(c); }
ULONG TAPEDECK_DELETE_Gadget(piClass *cl,piObject *o,Msg msg) { struct Node_Gadget *ng; piGetAttr(o,OBJ_Node,(ULONG *)&ng); if(ng->ng_Gadget && ng->ng_Window) RemoveGadget(((struct Node_Window *)OBJECT_DATA(ng->ng_Window))->nw_Window,ng->ng_Gadget); if(ng->ng_Gadget) DisposeObject(ng->ng_Gadget); ng->ng_Gadget=NULL; return piDoSuperMethodA(cl,o,msg); }
ULONG NEW_Frame(piClass *cl,piObject *o,struct piSet *msg) { piObject *obj; struct Node_Frame *nf; if(obj=MyAllocVec(sizeof(piObject)+cl->Size,MEMF_PUBLIC|MEMF_CLEAR)) { nf=(struct Node_Frame *)OBJECT_DATA(obj); nf->nf_Pages=PAGES_PROPERTIES_PGFR_PAGES, obj->ln_Name=NULL; nf->nf_FrameType=FTYPE_BUTTON; ClearFlag(nf->nf_Flags,MYFR_Recessed); return (ULONG) obj; } return NULL; }
ULONG NEW_Gadget(piClass *cl,piObject *o,struct piSet *msg) { piObject *obj; struct Node_Gadget *ng; struct GadToolsData *gtd; ULONG size=0; if(GetTagData(GAOBJ_Type,GTYPE_GADTOOLS,msg->Tags)==GTYPE_GADTOOLS) size=sizeof(struct GadToolsData); if(obj=MyAllocVec(sizeof(piObject)+cl->Size+size,MEMF_PUBLIC|MEMF_CLEAR)) { ng=(struct Node_Gadget *)OBJECT_DATA(obj); obj->ln_Name=ng->ng_Label; ng->ng_NumTags=GetTagData(GAOBJ_NumTags,1,msg->Tags); ng->ng_NumOwnTags=GetTagData(GAOBJ_NumOwnTags,1,msg->Tags); if(ng->ng_Tags=AllocTagItems(ng->ng_NumTags)) { if(ng->ng_OwnTags=AllocTagItems(ng->ng_NumOwnTags)) { switch(GetTagData(GAOBJLIST_Tags,2,msg->Tags)) { case 0: ng->ng_EditList.List=(struct List **)&(ng->ng_Tags[GetTagData(GAOBJLIST_List,0,msg->Tags)].ti_Data); break; case 1: ng->ng_EditList.List=(struct List **)&(ng->ng_OwnTags[GetTagData(GAOBJLIST_List,0,msg->Tags)].ti_Data); break; case 2: ng->ng_EditList.List=NULL; break; } ng->ng_EditList.Active=(ULONG *)&(ng->ng_Tags[GetTagData(GAOBJLIST_Active,0,msg->Tags)].ti_Data); ng->ng_TagTypes=(UBYTE *)GetTagData(GAOBJ_TagTypes,0,msg->Tags); ng->ng_OwnTagTypes=(UBYTE *)GetTagData(GAOBJ_OwnTagTypes,0,msg->Tags); ng->ng_PlugInID=GetTagData(GAOBJ_ID,0,msg->Tags); ng->ng_Type=GetTagData(GAOBJ_Type,GTYPE_GADTOOLS,msg->Tags); ng->ng_Pages=(struct Page *)GetTagData(OBJ_Properties,NULL,msg->Tags); ng->ng_Gadget=NULL; if(ng->ng_Type==GTYPE_GADTOOLS) { gtd=(struct GadToolsData *)GadgetData(ng); gtd->g_Kind=BUTTON_KIND; gtd->g_Flags=PLACETEXT_LEFT; } return (ULONG) obj; // FreeTagItems(ng->ng_OwnTags); } FreeTagItems(ng->ng_Tags); } MyFreeVec(obj); } return NULL; }
ULONG GET_Frame(piClass *cl,piObject *o,struct piGet *msg) { struct Node_Frame *nf=(struct Node_Frame *)OBJECT_DATA(o); switch(msg->TagID) { case GA_Left: *(msg->TagData)=nf->nf_X; return TRUE; case GA_Top: *(msg->TagData)=nf->nf_Y; return TRUE; case GA_Width: *(msg->TagData)=nf->nf_Width; return TRUE; case GA_Height: *(msg->TagData)=nf->nf_Height; return TRUE; case OBJ_Select: *(msg->TagData)=nf->nf_Selected; return TRUE; case OBJ_Node: *(msg->TagData)=(ULONG)nf; return TRUE; case OBJ_Window: *(msg->TagData)=(ULONG)nf->nf_Window; return TRUE; case OBJ_Properties: *(msg->TagData)=(ULONG)nf->nf_Pages; return TRUE; case FROBJ_Type: *(msg->TagData)=nf->nf_FrameType; return TRUE; default: return FALSE; } }
ULONG GET_Gadget(piClass *cl,piObject *o,struct piGet *msg) { struct Node_Gadget *ng=(struct Node_Gadget *)OBJECT_DATA(o); // struct Node_Window *nw; switch(msg->TagID) { case GA_Left: *(msg->TagData)=ng->ng_X; return TRUE; case GA_Top: *(msg->TagData)=ng->ng_Y; return TRUE; case GA_Width: // if(ng->ng_RelWidth) // { // piGetAttr(ng->ng_Window,OBJ_Node,(ULONG *)&nw); // *(msg->TagData)=(nw->nw_Width-nw->nw_Window->BorderLeft-nw->nw_Window->BorderRight)+ng->ng_Width-ng->ng_X; // } // else *(msg->TagData)=ng->ng_Width; return TRUE; case GA_Height: // if(ng->ng_RelHeight) // { // piGetAttr(ng->ng_Window,OBJ_Node,(ULONG *)&nw); // *(msg->TagData)=(nw->nw_Height-nw->nw_Window->BorderTop-nw->nw_Window->BorderBottom)+ng->ng_Height-ng->ng_Y; // } // else *(msg->TagData)=ng->ng_Height; return TRUE; case OBJ_Select: *(msg->TagData)=ng->ng_Selected; return TRUE; case OBJ_Node: *(msg->TagData)=(ULONG)ng; return TRUE; case OBJ_Window: *(msg->TagData)=(ULONG)ng->ng_Window; return TRUE; case OBJ_Properties: *(msg->TagData)=(ULONG)ng->ng_Pages; return TRUE; case GAOBJ_Type: *(msg->TagData)=ng->ng_Type; return TRUE; case GAOBJ_NumTags: *(msg->TagData)=ng->ng_NumTags; return TRUE; case GAOBJ_NumOwnTags: *(msg->TagData)=ng->ng_NumOwnTags; return TRUE; case GAOBJ_Tags: *(msg->TagData)=(ULONG)ng->ng_Tags; return TRUE; case GAOBJ_OwnTags: *(msg->TagData)=(ULONG)ng->ng_OwnTags; return TRUE; case GAOBJ_TagTypes: *(msg->TagData)=(ULONG)ng->ng_TagTypes; return TRUE; case GAOBJ_OwnTagTypes: *(msg->TagData)=(ULONG)ng->ng_OwnTagTypes; return TRUE; case GAOBJ_NodeData: *(msg->TagData)=(ULONG)GadgetData(ng); return TRUE; case GAOBJ_EditList: *(msg->TagData)=(ULONG)&ng->ng_EditList; return TRUE; default: return FALSE; } }
O String_getValue(O obj) { O array; array = OBJECT_DATA(obj, value_offset - 1, O); return array; }