/********************************************************************* * * 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; }
SLIDER_Handle SLIDER_Create (int x0, int y0, int xsize, int ysize, WM_HWIN hParent, int Id, int WinFlags, int SpecialFlags) { SLIDER_Handle hObj; /* Create the window */ WM_LOCK(); hObj = WM_CreateWindowAsChild(x0, y0, xsize, ysize, hParent, WinFlags, _SLIDER_Callback, sizeof(SLIDER_Obj)-sizeof(WM_Obj)); if (hObj) { SLIDER_Obj* pObj = SLIDER_H2P(hObj); U16 InitState; /* Handle SpecialFlags */ InitState = WIDGET_STATE_ENABLED; if (SpecialFlags & SLIDER_CF_VERTICAL) { InitState |= WIDGET_CF_VERTICAL; } /* init widget specific variables */ WIDGET__Init(&pObj->Widget, InitState); /* init member variables */ SLIDER_INIT_ID(pObj); pObj->Widget.Id = Id; pObj->aBkColor[0] = SLIDER_BKCOLOR0_DEFAULT; pObj->aBkColor[1] = SLIDER_BKCOLOR1_DEFAULT; pObj->aColor[0] = SLIDER_COLOR0_DEFAULT; pObj->aColor[1] = SLIDER_COLOR1_DEFAULT; pObj->Width = 8; pObj->Max =100; pObj->Min =0; pObj->NumSections = 10; } else { GUI_DEBUG_ERROROUT_IF(hObj==0, "SLIDER_Create failed") } WM_UNLOCK(); return hObj; }
FRAMEWIN_Handle FRAMEWIN_CreateAsChild( int x0, int y0, int xsize, int ysize, WM_HWIN hParent, const char* pText, WM_CALLBACK* cb, int Flags) { FRAMEWIN_Handle hObj; /* Create the window */ GUI_LOCK(); hObj = WM_CreateWindowAsChild(x0, y0, xsize/*+2*HBorder*/, ysize/*+TBorder+BBorder*/, hParent, Flags, _FRAMEWIN_Callback, sizeof(FRAMEWIN_Obj) - sizeof(WM_Obj)); if (hObj) { FRAMEWIN_Obj* pObj = FRAMEWIN_H2P(hObj); /* init widget specific variables */ WIDGET__Init(&pObj->Widget, WIDGET_STATE_FOCUSSABLE | WIDGET_STATE_ENABLED); /* init member variables */ pObj->pFont = _pDefaultFont; memcpy(pObj->BarColor, _aBarColor, sizeof(pObj->BarColor)); pObj->TextColor = 0xffffff; pObj->TextAlign = GUI_TA_LEFT; pObj->ClientColor = _DefaultClientColor; pObj->pText = pText; pObj->XOff = 1; pObj->YOff = 1; pObj->cb = cb; CalcPositions(hObj); pObj->hClient = WM_CreateWindowAsChild(0, 0, 0, 0, hObj, WM_CF_SHOW, FRAMEWIN__cbClient, 0); } GUI_UNLOCK(); return hObj; }
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; }
/********************************************************************* * * TEXT_CreateEx */ TEXT_Handle TEXT_CreateEx(int x0, int y0, int xsize, int ysize, WM_HWIN hParent, int WinFlags, int ExFlags, int Id, const char* pText) { TEXT_Handle hObj; /* Create the window */ #if TEXT_SUPPORT_TRANSPARENCY WinFlags |= WM_CF_HASTRANS; #endif WM_LOCK(); hObj = WM_CreateWindowAsChild(x0, y0, xsize, ysize, hParent, WinFlags, TEXT_Callback, sizeof(TEXT_Obj) - sizeof(WM_Obj)); if (hObj) { TEXT_Obj* pObj; WM_HMEM hMem = 0; pObj = (TEXT_Obj *)GUI_ALLOC_h2p(hObj); /* Don't use use WIDGET_H2P because WIDGET_INIT_ID() has not be called at this point */ /* init widget specific variables */ WIDGET__Init(&pObj->Widget, Id, 0); /* init member variables */ TEXT_INIT_ID(pObj); if (pText) { hMem = GUI_ALLOC_AllocZero(strlen(pText) + 1); if (hMem) { strcpy((char*) GUI_ALLOC_h2p(hMem), pText); } } pObj->hpText = hMem; pObj->Align = ExFlags; pObj->Props = TEXT__DefaultProps; } else { GUI_DEBUG_ERROROUT_IF(hObj==0, "TEXT_Create failed") } 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; }
/********************************************************************* * * SLIDER_CreateEx */ SLIDER_Handle SLIDER_CreateEx(int x0, int y0, int xsize, int ysize, WM_HWIN hParent, int WinFlags, int ExFlags, int Id) { SLIDER_Handle hObj; /* Create the window */ WM_LOCK(); #if SLIDER_SUPPORT_TRANSPARENCY WinFlags |= WM_CF_HASTRANS; #endif hObj = WM_CreateWindowAsChild(x0, y0, xsize, ysize, hParent, WinFlags, SLIDER_Callback, sizeof(SLIDER_Obj) - sizeof(WM_Obj)); if (hObj) { SLIDER_Obj * pObj; U16 InitState; pObj = (SLIDER_Obj *)GUI_ALLOC_h2p(hObj); /* Don't use use WIDGET_H2P because WIDGET_INIT_ID() has not be called at this point */ /* Handle SpecialFlags */ InitState = WIDGET_STATE_FOCUSSABLE; if (ExFlags & SLIDER_CF_VERTICAL) { InitState |= WIDGET_CF_VERTICAL; } /* init widget specific variables */ WIDGET__Init(&pObj->Widget, Id, InitState); /* init member variables */ SLIDER_INIT_ID(pObj); pObj->Props = SLIDER__DefaultProps; pObj->Width = 8; pObj->Max = 100; pObj->Min = 0; pObj->NumTicks = -1; } else { GUI_DEBUG_ERROROUT_IF(hObj==0, "SLIDER_Create failed") } WM_UNLOCK(); return hObj; }
/********************************************************** * HSD_SLIDER_CreateEx * */ SLIDER_Handle HSD_SLIDER_CreateEx(int x0, int y0, int xSize, int ySize, WM_HWIN hParent, int WinFlags, int ExFlags, int Id) { SLIDER_Handle hObj; WM_LOCK(); hObj = WM_CreateWindowAsChild(x0, y0, xSize, ySize, hParent, WinFlags, HSD_SLIDER_Callback, sizeof(SLIDER_Obj)-sizeof(WM_Obj)); if(hObj) { SLIDER_Obj* pObj = SLIDER_H2P(hObj); U16 InitState; InitState = WIDGET_STATE_FOCUSSABLE; if(ExFlags & SLIDER_CF_VERTICAL) { InitState |= WIDGET_CF_VERTICAL; } WIDGET__Init(&pObj->Widget, Id, InitState); pObj->aBkColor[0] = GUI_GRAY; pObj->aBkColor[1] = GUI_DARKCYAN; pObj->aColor[0] = GUI_BLACK; pObj->aColor[1] = GUI_ORANGE; pObj->Width = 16; pObj->Max = 6; pObj->Min = 0; pObj->NumTicks = -1; } else { //INFO("Slider create failed!"); } WM_UNLOCK(); return hObj; }
/********************************************************************* * * EDIT_CreateEx */ EDIT_Handle EDIT_CreateEx(int x0, int y0, int xsize, int ysize, WM_HWIN hParent, int WinFlags, int ExFlags, int Id, int MaxLen) { EDIT_Handle hObj; GUI_USE_PARA(ExFlags); WM_LOCK(); /* Alloc memory for obj */ WinFlags |= WM_CF_LATE_CLIP; /* Always use late clipping since widget is optimized for it. */ hObj = WM_CreateWindowAsChild(x0, y0, xsize, ysize, hParent, WM_CF_SHOW | WinFlags, EDIT_Callback, sizeof(EDIT_Obj) - sizeof(WM_Obj)); if (hObj) { EDIT_Obj* pObj; pObj = (EDIT_Obj *)GUI_ALLOC_h2p(hObj); /* Don't use use WIDGET_H2P because WIDGET_INIT_ID() has not be called at this point */ /* init widget specific variables */ WIDGET__Init(&pObj->Widget, Id, WIDGET_STATE_FOCUSSABLE); /* init member variables */ EDIT_INIT_ID(pObj); pObj->Props = EDIT__DefaultProps; pObj->XSizeCursor = 1; pObj->MaxLen = (MaxLen == 0) ? 8 : MaxLen; pObj->BufferSize = 0; pObj->hpText = 0; if (_IncrementBuffer(pObj, pObj->MaxLen + 1) == 0) { GUI_DEBUG_ERROROUT("EDIT_Create failed to alloc buffer"); EDIT_Delete(hObj); hObj = 0; } } WM_UNLOCK(); return hObj; }
/********************************************************************* * * SCROLLBAR_CreateEx */ SCROLLBAR_Handle SCROLLBAR_CreateEx(int x0, int y0, int xsize, int ysize, WM_HWIN hParent, int WinFlags, int ExFlags, int Id) { SCROLLBAR_Handle hObj; WM_LOCK(); /* Set defaults if necessary */ if ((xsize == 0) && (ysize == 0)) { GUI_RECT Rect; WM_GetInsideRectEx(hParent, &Rect); if (ExFlags & SCROLLBAR_CF_VERTICAL) { xsize = SCROLLBAR__DefaultWidth; x0 = Rect.x1 + 1 - xsize; y0 = Rect.y0; ysize = Rect.y1 - Rect.y0 + 1; } else { ysize = SCROLLBAR__DefaultWidth; y0 = Rect.y1 + 1 - ysize; x0 = Rect.x0; xsize = Rect.x1 - Rect.x0 + 1; } } /* Create the window */ hObj = WM_CreateWindowAsChild(x0, y0, xsize, ysize, hParent, WinFlags, _SCROLLBAR_Callback, sizeof(SCROLLBAR_Obj) - sizeof(WM_Obj)); if (hObj) { SCROLLBAR_Obj* pObj = SCROLLBAR_H2P(hObj); U16 InitState; /* Handle SpecialFlags */ InitState = 0; if (ExFlags & SCROLLBAR_CF_VERTICAL) { InitState |= WIDGET_CF_VERTICAL; } if (ExFlags & SCROLLBAR_CF_FOCUSSABLE) { InitState |= WIDGET_STATE_FOCUSSABLE; } if ((Id != GUI_ID_HSCROLL) && (Id != GUI_ID_VSCROLL)) { InitState |= WIDGET_STATE_FOCUSSABLE; } /* init widget specific variables */ WIDGET__Init(&pObj->Widget, Id, InitState); /* init member variables */ SCROLLBAR_INIT_ID(pObj); pObj->aBkColor[0] = SCROLLBAR__aDefaultBkColor[0]; pObj->aBkColor[1] = SCROLLBAR__aDefaultBkColor[1]; pObj->aColor[0] = SCROLLBAR__aDefaultColor[0]; pObj->aColor[1] = SCROLLBAR__aDefaultColor[1]; pObj->NumItems = 100; pObj->PageSize = 10; pObj->v = 0; SCROLLBAR__InvalidatePartner(hObj); } else { GUI_DEBUG_ERROROUT_IF(hObj==0, "SCROLLBAR_Create failed") } WM_UNLOCK(); return hObj; }
/********************************************************************* * * RADIO_CreateEx */ RADIO_Handle RADIO_CreateEx(int x0, int y0, int xSize, int ySize, WM_HWIN hParent, int WinFlags, int ExFlags, int Id, int NumItems, int Spacing) { RADIO_Handle hObj; int Height, i; /* Calculate helper variables */ Height = RADIO__apDefaultImage[0]->YSize + RADIO_BORDER * 2; Spacing = (Spacing <= 0) ? 20 : Spacing; NumItems = (NumItems <= 0) ? 2 : NumItems; if (ySize == 0) { ySize = Height + ((NumItems - 1) * Spacing); } if (xSize == 0) { xSize = RADIO__apDefaultImage[0]->XSize + RADIO_BORDER * 2; } #if WM_SUPPORT_TRANSPARENCY WinFlags |= WM_CF_HASTRANS; #endif /* Create the window */ hObj = WM_CreateWindowAsChild(x0, y0, xSize, ySize, hParent, WinFlags, _RADIO_Callback, sizeof(RADIO_Obj) - sizeof(WM_Obj)); if (hObj) { RADIO_Obj* pObj; WM_LOCK(); pObj = RADIO_H2P(hObj); /* Init sub-classes */ GUI_ARRAY_CREATE(&pObj->TextArray); for (i = 0; i < NumItems; i++) { GUI_ARRAY_AddItem(&pObj->TextArray, NULL, 0); } /* Init widget specific variables */ ExFlags &= RADIO_TEXTPOS_LEFT; WIDGET__Init(&pObj->Widget, Id, WIDGET_STATE_FOCUSSABLE | ExFlags); /* Init member variables */ RADIO_INIT_ID(pObj); pObj->apBmRadio[0] = RADIO__apDefaultImage[0]; pObj->apBmRadio[1] = RADIO__apDefaultImage[1]; pObj->pBmCheck = RADIO__pDefaultImageCheck; pObj->pFont = RADIO__pDefaultFont; pObj->TextColor = RADIO__DefaultTextColor; pObj->BkColor = WM_GetBkColor(hParent); pObj->NumItems = NumItems; pObj->Spacing = Spacing; pObj->Height = Height; WM_UNLOCK(); } else { GUI_DEBUG_ERROROUT_IF(hObj==0, "RADIO_Create failed") } return hObj; }
/********************************************************************* * * WINDOW_CreateIndirect */ WM_HWIN WINDOW_CreateIndirect(const GUI_WIDGET_CREATE_INFO* pCreateInfo, WM_HWIN hWinParent, int x0, int y0, WM_CALLBACK* cb) { WM_HWIN hObj; WM_LOCK(); hObj = WM_CreateWindowAsChild( pCreateInfo->x0 + x0, pCreateInfo->y0 + y0, pCreateInfo->xSize, pCreateInfo->ySize, hWinParent, pCreateInfo->Flags, WINDOW_Callback, sizeof(WINDOW_OBJ) - sizeof(WM_Obj)); if (hObj) { WINDOW_OBJ* pObj; pObj = WINDOW_H2P(hObj); WIDGET__Init(&pObj->Widget, pCreateInfo->Id, WIDGET_STATE_FOCUSSABLE); pObj->cb = cb; pObj->hFocussedChild = 0; } WM_UNLOCK(); return hObj; }
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; }
/********************************************************************* * * BUTTON_CreateEx */ BUTTON_Handle BUTTON_CreateEx(int x0, int y0, int xsize, int ysize, WM_HWIN hParent, int WinFlags, int ExFlags, int Id) { BUTTON_Handle hObj; GUI_USE_PARA(ExFlags); /* Create the window */ WM_LOCK(); hObj = WM_CreateWindowAsChild(x0, y0, xsize, ysize, hParent, WinFlags, BUTTON_Callback, sizeof(BUTTON_Obj) - sizeof(WM_Obj)); if (hObj) { BUTTON_Obj * pObj = (BUTTON_Obj *)GUI_ALLOC_h2p(hObj); /* Don't use use WIDGET_H2P because WIDGET_INIT_ID() has not be called at this point */ /* init widget specific variables */ WIDGET__Init(&pObj->Widget, Id, WIDGET_STATE_FOCUSSABLE); /* init member variables */ BUTTON_INIT_ID(pObj); pObj->Props = BUTTON__DefaultProps; } else { GUI_DEBUG_ERROROUT_IF(hObj==0, "BUTTON_Create failed") } WM_UNLOCK(); return hObj; }
/********************************************************************* * * LISTVIEW_CreateEx */ LISTVIEW_Handle LISTVIEW_CreateEx(int x0, int y0, int xsize, int ysize, WM_HWIN hParent, int WinFlags, int ExFlags, int Id) { LISTVIEW_Handle hObj; GUI_USE_PARA(ExFlags); /* Create the window */ if ((xsize == 0) && (ysize == 0) && (x0 == 0) && (y0 == 0)) { GUI_RECT Rect; WM_GetClientRectEx(hParent, &Rect); xsize = Rect.x1 - Rect.x0 + 1; ysize = Rect.y1 - Rect.y0 + 1; } hObj = WM_CreateWindowAsChild(x0, y0, xsize, ysize, hParent, WinFlags, &_LISTVIEW_Callback, sizeof(LISTVIEW_Obj) - sizeof(WM_Obj)); if (hObj) { LISTVIEW_Obj* pObj; WM_LOCK(); pObj = LISTVIEW_H2P(hObj); /* Init sub-classes */ GUI_ARRAY_CREATE(&pObj->RowArray); GUI_ARRAY_CREATE(&pObj->AlignArray); /* Init widget specific variables */ WIDGET__Init(&pObj->Widget, Id, WIDGET_STATE_FOCUSSABLE); /* Init member variables */ LISTVIEW_INIT_ID(pObj); pObj->Props = LISTVIEW_DefaultProps; pObj->ShowGrid = 0; pObj->RowDistY = 0; pObj->Sel = -1; pObj->LBorder = 1; pObj->RBorder = 1; pObj->hHeader = HEADER_CreateEx(0, 0, 0, 0, hObj, WM_CF_SHOW, 0, 0); LISTVIEW__UpdateScrollParas(hObj, pObj); WM_UNLOCK(); } else { GUI_DEBUG_ERROROUT_IF(hObj==0, "LISTVIEW_Create failed") } return hObj; }
/********************************************************************* * * CHECKBOX_CreateEx */ CHECKBOX_Handle CHECKBOX_CreateEx(int x0, int y0, int xsize, int ysize, WM_HWIN hParent, int WinFlags, int ExFlags, int Id) { CHECKBOX_Handle hObj; GUI_USE_PARA(ExFlags); WM_LOCK(); /* Calculate size if needed */ if ((xsize == 0) || (ysize == 0)) { int EffectSize; EffectSize = WIDGET_GetDefaultEffect()->EffectSize; if (xsize == 0) { xsize = CHECKBOX__DefaultProps.apBm[CHECKBOX_BI_ACTIV]->XSize + 2 * EffectSize; } if (ysize == 0) { ysize = CHECKBOX__DefaultProps.apBm[CHECKBOX_BI_ACTIV]->YSize + 2 * EffectSize; } } #if WM_SUPPORT_TRANSPARENCY if (CHECKBOX__DefaultProps.BkColor == GUI_INVALID_COLOR) { WinFlags |= WM_CF_HASTRANS; } #endif /* Create the window */ hObj = WM_CreateWindowAsChild(x0, y0, xsize, ysize, hParent, WinFlags, CHECKBOX_Callback, sizeof(CHECKBOX_Obj) - sizeof(WM_Obj)); if (hObj) { CHECKBOX_Obj* pObj = (CHECKBOX_Obj *)GUI_ALLOC_h2p(hObj); /* Don't use use WIDGET_H2P because WIDGET_INIT_ID() has not be called at this point */ /* init widget specific variables */ WIDGET__Init(&pObj->Widget, Id, WIDGET_STATE_FOCUSSABLE); CHECKBOX_INIT_ID(pObj); /* init member variables */ pObj->Props = CHECKBOX__DefaultProps; pObj->NumStates = 2; /* Default behaviour is 2 states: checked and unchecked */ } else { GUI_DEBUG_ERROROUT_IF(hObj==0, "CHECKBOX_Create failed") } WM_UNLOCK(); return hObj; }
/********************************************************************* * * TEXT_CreateEx */ TEXT_Handle TEXT_CreateEx(int x0, int y0, int xsize, int ysize, WM_HWIN hParent, int WinFlags, int ExFlags, int Id, const char* pText) { TEXT_Handle hObj; /* Create the window */ #if TEXT_SUPPORT_TRANSPARENCY WinFlags |= WM_CF_HASTRANS; #endif hObj = WM_CreateWindowAsChild(x0, y0, xsize, ysize, hParent, WinFlags, _TEXT_Callback, sizeof(TEXT_Obj) - sizeof(WM_Obj)); if (hObj) { TEXT_Obj* pObj; WM_HMEM hMem = 0; WM_LOCK(); pObj = TEXT_H2P(hObj); /* init widget specific variables */ WIDGET__Init(&pObj->Widget, Id, 0); /* init member variables */ TEXT_INIT_ID(pObj); if (pText) { hMem = GUI_ALLOC_AllocZero(strlen(pText) + 1); if (hMem) { strcpy((char*) GUI_ALLOC_h2p(hMem), pText); } } pObj->hpText = hMem; pObj->Align = ExFlags; pObj->pFont = _pDefaultFont; pObj->BkColor = GUI_INVALID_COLOR; pObj->TextColor = _DefaultTextColor; WM_UNLOCK(); } else { GUI_DEBUG_ERROROUT_IF(hObj==0, "TEXT_Create failed") } 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; }