/********************************************************************* * * LISTBOX_InvalidateItem */ void LISTBOX_InvalidateItem(LISTBOX_Handle hObj, int Index) { if (hObj) { LISTBOX_Obj* pObj; int NumItems; WM_LOCK(); pObj = LISTBOX_H2P(hObj); NumItems = LISTBOX__GetNumItems(pObj); if (Index < NumItems) { if (Index < 0) { int i; for (i = 0; i < NumItems; i++) { LISTBOX__InvalidateItemSize(pObj, i); } LISTBOX_UpdateScrollers(hObj); LISTBOX__InvalidateInsideArea(hObj); } else { LISTBOX__InvalidateItemSize(pObj, Index); LISTBOX_UpdateScrollers(hObj); LISTBOX__InvalidateItemAndBelow(hObj, pObj, Index); } } WM_UNLOCK(); } }
/********************************************************************* * * LISTBOX_AddString */ void LISTBOX_AddString(LISTBOX_Handle hObj, const char* s) { if (hObj && s) { LISTBOX_Obj* pObj; LISTBOX_ITEM Item = {0, 0}; WM_LOCK(); pObj = LISTBOX_H2P(hObj); if (GUI_ARRAY_AddItem(&pObj->ItemArray, &Item, sizeof(LISTBOX_ITEM) + strlen(s)) == 0) { unsigned ItemIndex = GUI_ARRAY_GetNumItems(&pObj->ItemArray) - 1; LISTBOX_ITEM* pItem= (LISTBOX_ITEM*)GUI_ARRAY_GetpItem(&pObj->ItemArray, ItemIndex); strcpy(pItem->acText, s); LISTBOX__InvalidateItemSize(pObj, ItemIndex); LISTBOX_UpdateScrollers(hObj); LISTBOX__InvalidateItem(hObj, pObj, ItemIndex); } WM_UNLOCK(); } }
/********************************************************************* * * LISTBOX_SetString */ void LISTBOX_SetString(LISTBOX_Handle hObj, const char* s, unsigned int Index) { if (hObj) { LISTBOX_Obj* pObj; WM_LOCK(); pObj = LISTBOX_H2P(hObj); if (Index < (unsigned int)LISTBOX__GetNumItems(pObj)) { LISTBOX_ITEM* pItem; pItem = (LISTBOX_ITEM*)GUI_ARRAY_ResizeItem(&pObj->ItemArray, Index, sizeof(LISTBOX_ITEM) + strlen(s)); if (pItem) { strcpy(pItem->acText, s); LISTBOX__InvalidateItemSize(pObj, Index); LISTBOX_UpdateScrollers(hObj); LISTBOX__InvalidateItem(hObj, pObj, Index); } } WM_UNLOCK(); } }