EDIT_Handle EDIT_CreateAsChild (int x0, int y0, int xsize, int ysize, WM_HWIN hParent, int Id, int Flags, int MaxLen) { EDIT_Handle hObj; if (MaxLen == 0) { MaxLen = 8; } /* Alloc memory for obj */ WM_LOCK(); hObj = WM_CreateWindowAsChild(x0, y0, xsize, ysize, hParent, WM_CF_SHOW | Flags, EDIT__Callback, sizeof(EDIT_Obj)-sizeof(WM_Obj)); if (hObj) { EDIT_Obj* pObj = (EDIT_Obj*)WM_HMEM2Ptr(hObj); /* init widget specific variables */ WIDGET__Init(&pObj->Widget, WIDGET_STATE_FOCUSSABLE | WIDGET_STATE_ENABLED); pObj->Widget.Id = Id; /* init member variables */ INIT_ID(pObj); pObj->pFont = _pDefaultFont; pObj->aBkColor[0] = EDIT_BKCOLOR0_DEFAULT; pObj->aBkColor[1] = EDIT_BKCOLOR1_DEFAULT; pObj->aTextColor[0] = EDIT_TEXTCOLOR0_DEFAULT; pObj->aTextColor[1] = EDIT_TEXTCOLOR1_DEFAULT; pObj->Align = _DefaultAlign; pObj->Border = _DefaultBorder; pObj->XSizeCursor = 1; pObj->MaxLen = MaxLen; if ((pObj->hpText = WM_ALLOC(MaxLen+1)) ==0) { GUI_DEBUG_ERROROUT("EDIT_Create failed to alloc buffer"); EDIT_Delete(hObj); hObj =0; } } WM_UNLOCK(); return hObj; }
/********************************************************************* * * PROGBAR_CreateEx */ PROGBAR_Handle PROGBAR_CreateEx(int x0, int y0, int xsize, int ysize, WM_HWIN hParent, int WinFlags, int ExFlags, int Id) { PROGBAR_Handle hObj; GUI_USE_PARA(ExFlags); hObj = WM_CreateWindowAsChild(x0, y0, xsize, ysize, hParent, WinFlags, _PROGBAR_Callback, sizeof(PROGBAR_Obj) - sizeof(WM_Obj)); if (hObj) { PROGBAR_Obj* pObj; WM_LOCK(); pObj = (PROGBAR_Obj*) GUI_ALLOC_h2p(hObj); /* init widget specific variables */ WIDGET__Init(&pObj->Widget, Id, 0); WIDGET_SetEffect(hObj, &WIDGET_Effect_None); /* Standard effect for progbar: None */ INIT_ID(pObj); /* init member variables */ pObj->pFont = GUI_DEFAULT_FONT; pObj->BarColor[0] = PROGBAR_DEFAULT_BARCOLOR0; pObj->BarColor[1] = PROGBAR_DEFAULT_BARCOLOR1; pObj->TextColor[0] = PROGBAR_DEFAULT_TEXTCOLOR0; pObj->TextColor[1] = PROGBAR_DEFAULT_TEXTCOLOR1; pObj->TextAlign = GUI_TA_CENTER; pObj->Max = 100; pObj->Min = 0; WM_UNLOCK(); } return hObj; }
/********************************************************************* * * LISTBOX_CreateEx */ LISTBOX_Handle LISTBOX_CreateEx(int x0, int y0, int xsize, int ysize, WM_HWIN hParent, int WinFlags, int ExFlags, int Id, const GUI_ConstString* ppText) { LISTBOX_Handle hObj; GUI_USE_PARA(ExFlags); hObj = WM_CreateWindowAsChild(x0, y0, xsize, ysize, hParent, WinFlags, _LISTBOX_Callback, sizeof(LISTBOX_Obj) - sizeof(WM_Obj)); if (hObj) { LISTBOX_Obj* pObj; WM_LOCK(); pObj = LISTBOX_H2P(hObj); /* Init sub-classes */ GUI_ARRAY_CREATE(&pObj->ItemArray); /* init widget specific variables */ WIDGET__Init(&pObj->Widget, Id, WIDGET_STATE_FOCUSSABLE); pObj->Props = LISTBOX_DefaultProps; if (ppText) { /* init member variables */ /* Set non-zero attributes */ LISTBOX_SetText(hObj, ppText); } INIT_ID(pObj); LISTBOX_UpdateScrollers(hObj); WM_UNLOCK(); } return hObj; }
LISTBOX_Handle LISTBOX_CreateIndirect(const GUI_WIDGET_CREATE_INFO* pCreateInfo, WM_HWIN hWinParent, int x0, int y0, WM_CALLBACK* cb) { LISTBOX_Handle hThis; GUI_USE_PARA(cb); hThis = LISTBOX_CreateAsChild(0, hWinParent, pCreateInfo->x0 + x0, pCreateInfo->y0 + y0, pCreateInfo->xSize, pCreateInfo->ySize, pCreateInfo->Flags); if (hThis) { LISTBOX_Obj* pObj = LISTBOX_H2P(hThis); INIT_ID(pObj); pObj->Widget.Id = pCreateInfo->Id; pObj->Widget.State = LISTBOX_STATE_INACTIVE; } return hThis; }
LISTBOX_Handle LISTBOX_CreateAsChild( const GUI_ConstString* ppText, WM_HWIN hWinParent, int x0, int y0, int xsize, int ysize, int Flags) { LISTBOX_Handle hObj = WM_CreateWindowAsChild(x0, y0, xsize, ysize, hWinParent, Flags, _LISTBOX_Callback, sizeof(LISTBOX_Obj)-sizeof(WM_Obj)); if (hObj) { LISTBOX_Obj* pObj = LISTBOX_H2P(hObj); /* init widget specific variables */ WIDGET__Init(&pObj->Widget, WIDGET_STATE_FOCUSSABLE | WIDGET_STATE_ENABLED); /* pObj->ppText = 0; */ /* Zero init not required */ pObj->pFont = _pDefaultFont; pObj->aBackColor[0] = 0xffffff; /* Non selected state */ pObj->aBackColor[1] = LISTBOX_BKCOLOR1_DEFAULT; /* selected state */ pObj->aBackColor[2] = GUI_BLUE; /* selected state with focus */ pObj->aTextColor[0] = 0x000000; /* Non selected state */ pObj->aTextColor[1] = 0xffffff; /* selected state */ pObj->aTextColor[2] = 0xffffff; /* selected state with focus */ if (hObj && ppText) { LISTBOX_Obj* pObj = LISTBOX_H2P(hObj); INIT_ID(pObj); /* init member variables */ /* Check size */ if (!xsize) { const GUI_FONT* pFontOld = GUI_SetFont(pObj->pFont); int i; for (i=0; *(ppText+i); i++) { int Size = GUI_GetStringDistX(*(ppText+i)); if (Size>xsize) xsize = Size; } GUI_SetFont(pFontOld); } /* Set non-zero attributes */ pObj->ppText = ppText; } _CalcScrollParas(hObj); } return hObj; }
PROGBAR_Handle PROGBAR_CreateEx(int x0, int y0, int xsize, int ysize, WM_HWIN hParent, int Id, int Flags) { /* Create the window */ PROGBAR_Handle hObj =WM_CreateWindowAsChild(x0, y0, xsize, ysize, hParent, Flags, _Callback, sizeof(PROGBAR_Obj) - sizeof(WM_Obj)); if (hObj) { PROGBAR_Obj* pObj = (PROGBAR_Obj*) WM_HMEM2Ptr(hObj); INIT_ID(pObj); pObj->Widget.Id = Id; /* init member variables */ pObj->pFont =GUI_DEFAULT_FONT; pObj->BarColor[0] = 0x555555; pObj->BarColor[1] = 0xaaaaaa; pObj->TextColor[0] = 0xffffff; pObj->TextColor[1] = 0x000000; pObj->TextAlign = GUI_TA_CENTER; pObj->Max =100; pObj->Min =0; } return hObj; }
/********************************************************************* * * DROPDOWN_CreateEx */ DROPDOWN_Handle DROPDOWN_CreateEx(int x0, int y0, int xsize, int ysize, WM_HWIN hParent, int WinFlags, int ExFlags, int Id) { DROPDOWN_Handle hObj; hObj = WM_CreateWindowAsChild(x0, y0, xsize, -1, hParent, WinFlags, _DROPDOWN_Callback, sizeof(DROPDOWN_Obj) - sizeof(WM_Obj)); if (hObj) { DROPDOWN_Obj* pObj; WM_LOCK(); pObj = DROPDOWN_H2P(hObj); /* Init sub-classes */ GUI_ARRAY_CREATE(&pObj->Handles); /* init widget specific variables */ WIDGET__Init(&pObj->Widget, Id, WIDGET_STATE_FOCUSSABLE); pObj->Flags = ExFlags; pObj->Props = DROPDOWN__DefaultProps; pObj->ScrollbarWidth = 0; INIT_ID(pObj); pObj->ySizeEx = ysize; DROPDOWN__AdjustHeight(hObj, pObj); WM_UNLOCK(); } return hObj; }
EXTERN void neko_global_init() { # ifdef NEKO_DIRECT_THREADED op_last = neko_get_ttable()[Last]; # endif empty_array.ptr = val_null; neko_gc_init(); neko_vm_context = alloc_local(); neko_fields_lock = alloc_lock(); neko_fields = (objtable*)alloc_root((NEKO_FIELDS_MASK+1) * sizeof(struct _objtable) / sizeof(value)); { int i; for(i=0;i<=NEKO_FIELDS_MASK;i++) otable_init(&neko_fields[i]); } neko_init_builtins(); kind_names = (kind_list**)alloc_root(1); *kind_names = NULL; id_loader = val_id("loader"); id_exports = val_id("exports"); id_cache = val_id("cache"); id_path = val_id("path"); id_loader_libs = val_id("__libs"); neko_id_module = val_id("__module"); INIT_ID(compare); INIT_ID(string); INIT_ID(add); INIT_ID(radd); INIT_ID(sub); INIT_ID(rsub); INIT_ID(mult); INIT_ID(rmult); INIT_ID(div); INIT_ID(rdiv); INIT_ID(mod); INIT_ID(rmod); INIT_ID(get); INIT_ID(set); apply_string = alloc_root(1); *apply_string = alloc_string("apply"); neko_init_jit(); }