/********************************************************************* * * WIDGET_OrState */ void WIDGET_OrState(WM_HWIN hObj, int State) { WIDGET* pWidget = WIDGET_H2P(hObj); if (State != (pWidget->State & State)) { pWidget->State |= State; WM_Invalidate(hObj); } }
/********************************************************************* * * EDIT_SetHexMode */ void EDIT_SetHexMode(EDIT_Handle hEdit, U32 Value, U32 Min, U32 Max) { EDIT_Obj* pObj; WM_LOCK(); if (hEdit) { int MaxLen; pObj = EDIT_H2P(hEdit); pObj->pfAddKeyEx = _AddKeyHex; pObj->pfUpdateBuffer= _UpdateBuffer; pObj->CurrentValue = Value; pObj->CursorPos = 0; MaxLen = pObj->MaxLen; if (MaxLen <= 0 ) { MaxLen = _GetNumDigits(Max); } if (MaxLen > 8) { MaxLen = 8; } if (MaxLen != pObj->MaxLen) { EDIT_SetMaxLen(hEdit, MaxLen); } pObj->Min = Min; pObj->Max = Max; pObj->EditMode = GUI_EDIT_MODE_OVERWRITE; _UpdateBuffer(hEdit); WM_Invalidate(hEdit); } WM_UNLOCK(); }
/********************************************************************* * * WIDGET_SetState */ void WIDGET_SetState(WM_HWIN hObj, int State) { WIDGET* pWidget = WIDGET_H2P(hObj); if (State != pWidget->State) { pWidget->State = State; WM_Invalidate(hObj); } }
/********************************************************************* * * _SetOffY */ static void _SetOffY(GRAPH_DATA_OBJ * pDataObj, int Value) { if (pDataObj) { if (pDataObj->OffY != Value) { pDataObj->OffY = Value; WM_Invalidate(pDataObj->PaintObj.hGraph); } } }
/********************************************************************* * * WIDGET_AndState Purpose: Clear flags in the State element of the widget. The bits to be cleared are set. Example: ...(..., 3); // Clears bit 0, 1 int the state member */ void WIDGET_AndState(WM_HWIN hObj, int Mask) { U16 StateNew; WIDGET* pWidget = WIDGET_H2P(hObj); StateNew = pWidget->State & (~Mask); if (pWidget->State != StateNew) { pWidget->State = StateNew; WM_Invalidate(hObj); } }
/********************************************************************* * * TEXT_SetTextAlign */ void TEXT_SetTextAlign(TEXT_Handle hObj, int Align) { if (hObj) { TEXT_Obj* pObj; WM_LOCK(); pObj = TEXT_H2P(hObj); pObj->Align = Align; WM_Invalidate(hObj); WM_UNLOCK(); } }
/********************************************************************* * * TEXT_SetTextColor */ void TEXT_SetTextColor(TEXT_Handle hObj, GUI_COLOR Color) { if (hObj) { TEXT_Obj* pObj; WM_LOCK(); pObj = TEXT_H2P(hObj); pObj->TextColor = Color; WM_Invalidate(hObj); WM_UNLOCK(); } }
/********************************************************************* * * CHECKBOX_SetText */ void CHECKBOX_SetText(CHECKBOX_Handle hObj, const char * s) { CHECKBOX_Obj * pObj; if (hObj && s) { WM_LOCK(); pObj = CHECKBOX_H2P(hObj); if (GUI__SetText(&pObj->hpText, s)) { WM_Invalidate(hObj); } WM_UNLOCK(); } }
/********************************************************************* * * CHECKBOX_SetTextAlign */ void CHECKBOX_SetTextAlign(CHECKBOX_Handle hObj, int Align) { CHECKBOX_Obj * pObj; if (hObj) { WM_LOCK(); pObj = CHECKBOX_H2P(hObj); if (pObj->Props.Align != Align) { pObj->Props.Align = Align; WM_Invalidate(hObj); } WM_UNLOCK(); } }
/********************************************************************* * * WIDGET_Enable */ void WIDGET_Enable(WM_HWIN hObj) { WIDGET* pWidget; if (hObj) { WM_LOCK(); pWidget = WIDGET_H2P(hObj); if ((pWidget->State & WIDGET_STATE_ENABLED) == 0) { pWidget->State |= WIDGET_STATE_ENABLED; WM_Invalidate(hObj); } WM_UNLOCK(); } }
/********************************************************************* * * CHECKBOX_SetTextColor */ void CHECKBOX_SetTextColor(CHECKBOX_Handle hObj, GUI_COLOR Color) { if (hObj) { CHECKBOX_Obj * pObj; WM_LOCK(); pObj = CHECKBOX_H2P(hObj); if (pObj->Props.TextColor != Color) { pObj->Props.TextColor = Color; WM_Invalidate(hObj); } WM_UNLOCK(); } }
/********************************************************************* * * LISTBOX_SetTextAlign */ int LISTBOX_GetTextAlign(LISTBOX_Handle hObj) { int Align = 0; if (hObj) { LISTBOX_Obj* pObj; WM_LOCK(); pObj = LISTBOX_H2P(hObj); Align = pObj->Props.Align; WM_Invalidate(hObj); WM_UNLOCK(); } return Align; }
/********************************************************************* * * TEXT_SetBkColor */ void TEXT_SetBkColor(TEXT_Handle hObj, GUI_COLOR Color) { if (hObj) { TEXT_Obj* pObj; WM_LOCK(); pObj = TEXT_H2P(hObj); if (pObj->Props.BkColor != Color) { pObj->Props.BkColor = Color; #if TEXT_SUPPORT_TRANSPARENCY if (Color <= 0xFFFFFF) { WM_ClrHasTrans(hObj); } else { WM_SetHasTrans(hObj); } #endif WM_Invalidate(hObj); } WM_UNLOCK(); } }
/******************************************************************* * * _MoveWindow */ static void _MoveWindow(const char* pText) { WM_HWIN hWnd; int i; /* Create foreground window */ hWnd = WM_CreateWindow(10, 50, 150, 100, WM_CF_SHOW, _cbWindow, 0); GUI_Delay(500); /* Move foreground window */ for (i = 0; i < 40; i++) { WM_MoveWindow(hWnd, 2, 2); GUI_Delay(10); } /* Show text before deleting window if we have one */ if (pText) { GUI_DispStringAt(pText, 5, 50); GUI_Delay(2500); } /* Delete foreground window */ WM_DeleteWindow(hWnd); WM_Invalidate(WM_HBKWIN); GUI_Exec(); }
/********************************************************************* * * EDIT_SetDecMode */ void EDIT_SetDecMode(EDIT_Handle hEdit, I32 Value, I32 Min, I32 Max, int Shift, U8 Flags) { EDIT_Obj* pObj; WM_LOCK(); if (hEdit) { pObj = EDIT_H2P(hEdit); pObj->pfAddKeyEx = _AddKeyDec; pObj->pfUpdateBuffer= _UpdateBuffer; pObj->CurrentValue = Value; pObj->CursorPos = 0; pObj->Min = Min; pObj->Max = Max; pObj->NumDecs = Shift; pObj->Flags = Flags; pObj->EditMode = GUI_EDIT_MODE_OVERWRITE; _UpdateBuffer(hEdit); if (EDIT__GetCurrentChar(pObj) == '.') { EDIT__SetCursorPos(pObj, pObj->CursorPos + 1); } WM_Invalidate(hEdit); } WM_UNLOCK(); }