Example #1
0
void BUTTON_SetTextColor(BUTTON_Handle hObj, int Index, GUI_COLOR color) {
  if (hObj) {
    BUTTON_Obj* pObj = BUTTON_H2P(hObj);
    BUTTON_ASSERT_IS_VALID_PTR(pObj);
    pObj->aTextColor[Index] = color;
    BUTTON_Invalidate(hObj);
  } else {
    GUI_DEBUG_WARN("BUTTON_SetTextColor: Invalid handle");
  }
}
Example #2
0
void BUTTON_SetFont(BUTTON_Handle hObj, const GUI_FONT* pfont) {
  if (hObj) {
    BUTTON_Obj* pObj = BUTTON_H2P(hObj);
    BUTTON_ASSERT_IS_VALID_PTR(pObj);
    pObj->pFont = pfont;
    BUTTON_Invalidate(hObj);
  } else {
    GUI_DEBUG_WARN("BUTTON_SetFont: Invalid handle");
  }
}
Example #3
0
void TERMINAL_Add(TERMINAL_Handle hObj, const char* sAdd) {
  if (!sAdd) {
    GUI_DEBUG_WARN("TERMINAL_Add: NULL pointer passed");
    return;
  }
  if (hObj) {
    TERMINAL_Obj* pObj = TERMINAL_H2P(hObj);
    char* sBuffer = (char*) WM_HMEM2Ptr(pObj->hpText);
    int AddLen = strlen(sAdd);
    int NewLen = AddLen+strlen(sBuffer);
    if (AddLen > pObj->MaxLen) {
      GUI_DEBUG_WARN("TERMINAL_Add: String longer than buffer !");
      return;
    }
    /* Make space in buffer if necessary */
    if (NewLen > pObj->MaxLen) {
      *sBuffer =0;
    }
    sBuffer+= strlen(sBuffer); 
    memcpy(sBuffer, sAdd, AddLen);
    *(sBuffer+AddLen) = 0;
    Invalidate(hObj);
  }
}
Example #4
0
/*********************************************************************
*
*       GUI_MEASDEV_Create
*/
GUI_MEASDEV_Handle GUI_MEASDEV_Create(void) {
  int MemSize;
  GUI_MEASDEV_Handle hMemDev;
  MemSize = sizeof(GUI_MEASDEV);
  hMemDev = GUI_ALLOC_AllocZero(MemSize);
  if (hMemDev) {
    GUI_MEASDEV* pDevData;
    GUI_LOCK();
    pDevData = (GUI_MEASDEV*)GUI_ALLOC_h2p(hMemDev);
    pDevData->pfColor2Index = GUI_Context.pDeviceAPI->pfColor2Index;    
    pDevData->pfIndex2Color = GUI_Context.pDeviceAPI->pfIndex2Color;
    GUI_MEASDEV_ClearRect(hMemDev);
    GUI_UNLOCK();
  } else {
    GUI_DEBUG_WARN("GUI_MEASDEV_Create: Alloc failed");
  }
  return hMemDev;
}
Example #5
0
void BUTTON_SetText(BUTTON_Handle hObj, const char* s) {
  WM_LOCK();
  if (hObj) {
    BUTTON_Obj* pObj = BUTTON_H2P(hObj);
    BUTTON_ASSERT_IS_VALID_PTR(pObj);
    WM_FREEPTR(&pObj->hpText);
    {
      WM_HMEM hMem = WM_ALLOC(strlen(s)+1);
      if (hMem) {
        strcpy((char *) WM_HMEM2Ptr(hMem), s);
      }
      pObj->hpText = hMem;
    }
    BUTTON_Invalidate(hObj);
  } else {
    GUI_DEBUG_WARN("BUTTON_SetText: Invalid handle");
  }
  WM_UNLOCK();
}
Example #6
0
void WM_DeleteWindow (WM_HWIN Win) {
  WM_Obj* pWin;
  if (!Win)
    return;
  WM_LOCK();
  if (WM__IsWindow(Win)) {
    pWin = WM_H2P(Win);
    ResetNextDrawWin();              /* Make sure the window will no longer receive drawing messages */
  /* Make sure that focus is set to an existing window */
    if (WM__hWinFocus == Win) {
      WM__hWinFocus = 0;
    }
    if (Win == WM__hCapture) {
      WM__hCapture = 0;
    }
  /* Delete all children */
    _DeleteAllChildren(pWin->hFirstChild);
    _DeleteInSiblingList(Win);
  /* Send WM_DELETE message to window in order to inform window itself */
    WM__SendMsgNoData(Win, WM_DELETE);     /* tell window about it */
    /* Inform other modules if necessary */
    if (WM__pfDeleteWindowHook) {
      (*WM__pfDeleteWindowHook)(Win);
    }
  /* Remove window from window stack */
    if (pWin->Status & WM_SF_INVALID) {
      WM__NumInvalidWindows--;
    }
    WM__RemoveFromLinList(Win);
  /* Clear area used by this window */
    WM_InvalidateArea(&pWin->Rect);
  /* Free window memory */
    WM__NumWindows--;
    WM_FREE(Win);
  /* Select a valid window */
    WM_SelectWindow(WM__FirstWin);
  } else {
    GUI_DEBUG_WARN("WM_DeleteWindow: Invalid handle");
  }
  WM_UNLOCK();
}