Example #1
0
/*********************************************************************
*
*       _CalcScrollParas
*/
static int _CalcScrollParas(LISTBOX_Handle hObj) {
  GUI_RECT Rect;
  LISTBOX_Obj* pObj = LISTBOX_H2P(hObj);
  /* Calc vertical scroll parameters */
  pObj->ScrollStateV.NumItems = LISTBOX__GetNumItems(pObj);
  pObj->ScrollStateV.PageSize = _GetNumVisItems(pObj, hObj);
  /* Calc horizontal scroll parameters */
  WM_GetInsideRectExScrollbar(hObj, &Rect);
  pObj->ScrollStateH.NumItems = _GetContentsSizeX(hObj);
  pObj->ScrollStateH.PageSize = Rect.x1 - Rect.x0 + 1;
  return _UpdateScrollPos(hObj, pObj);
}
Example #2
0
static int _OnMouseOver(LISTBOX_Handle hObj, LISTBOX_Obj* pObj, WM_MESSAGE* pMsg) {
  const GUI_PID_STATE* pState = (const GUI_PID_STATE*)pMsg->Data.p;
  if (pObj->hOwner) {
    if (pState) {  /* Something happened in our area (pressed or released) */
      int Sel;
      Sel = _GetItemFromPos(hObj, pObj, pState->x, pState->y);
      if (Sel >= 0) {
        if (Sel < (int)(pObj->ScrollStateV.v + _GetNumVisItems(pObj, hObj))) {
          LISTBOX_SetSel(hObj, Sel);
        }
      }
    }
  }
  return 0;                        /* Message handled */
}
Example #3
0
/*********************************************************************
*
*       _ManageAutoScroll
*/
static void _ManageAutoScroll(LISTBOX_Handle hObj) {
  char IsRequired;
  LISTBOX_Obj* pObj = LISTBOX_H2P(hObj);
  if (pObj->Flags & LISTBOX_SF_AUTOSCROLLBAR_V) {
    IsRequired = (_GetNumVisItems(pObj, hObj) < LISTBOX__GetNumItems(pObj));
    WM_SetScrollbarV(hObj, IsRequired);
  }
  if (pObj->Flags & LISTBOX_SF_AUTOSCROLLBAR_H) {
    GUI_RECT Rect;
    int xSize, xSizeContents;
    xSizeContents = _GetContentsSizeX(hObj);
    WM_GetInsideRectExScrollbar(hObj, &Rect);
    xSize = Rect.x1 - Rect.x0 + 1;
    IsRequired = (xSizeContents > xSize);
    WM_SetScrollbarH(hObj, IsRequired);
  }
  if (pObj->ScrollbarWidth) {
    LISTBOX__SetScrollbarWidth(hObj, pObj);
  }
}
static void _CalcScrollParas(WM_HWIN hWin) {
  LISTBOX_Obj* pObj    = LISTBOX_H2P(hWin);
  pObj->ScrollState.NumItems = _GetNumItems(pObj);
  pObj->ScrollState.PageSize = _GetNumVisItems(pObj);
}