void LISTBOX_SetText(LISTBOX_Handle hObj, const GUI_ConstString* ppText) { LISTBOX_Obj* pObj; if (hObj) { WM_LOCK(); pObj = LISTBOX_H2P(hObj); ASSERT_IS_VALID_PTR(pObj); pObj->ppText = ppText; _CalcScrollParas(hObj); LISTBOX_Invalidate(hObj); WM_UNLOCK(); } }
void LISTBOX_SetFont(LISTBOX_Handle hObj, const GUI_FONT* pfont) { LISTBOX_Obj* pObj; if (hObj) { WM_LOCK(); pObj = LISTBOX_H2P(hObj); ASSERT_IS_VALID_PTR(pObj); pObj->pFont = pfont; _CalcScrollParas(hObj); LISTBOX_Invalidate(hObj); WM_UNLOCK(); } }
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; }
/********************************************************************* * * LISTBOX_UpdateScrollers */ int LISTBOX_UpdateScrollers(LISTBOX_Handle hObj) { _ManageAutoScroll(hObj); return _CalcScrollParas(hObj); }