/********************************************************************* * Function: WORD SldGetHeight(SLIDER *pSld) * * Notes: An INTERNAL function that computes for the height * of the thumb. This function is created to save * code size. This function is called only to dynamically * compute for the thumb size. * ********************************************************************/ WORD SldGetHeight(SLIDER *pSld) { WORD temp; /* Calculating the height is dependent on the mode type. If type Scrollbar, width is dependent on the ratio of the page/range = width/max-min (see SetThumbSize()) if type is Slider, width is dependent on width*3/8 When vertical height is dynamic, width is contant. */ if(GetState(pSld, SLD_VERTICAL)) { if(GetState(pSld, SLD_SCROLLBAR)) { temp = SldSetThumbSize(pSld, pSld->hdr.bottom, pSld->hdr.top); } else { temp = (((pSld->hdr.right - pSld->hdr.left) - (GOL_EMBOSS_SIZE << 1) - 2) * 3) >> 3; } } else {
/********************************************************************* * Function: uint16_t SldGetHeight(GFX_GOL_SCROLLBAR *pSld) * * Notes: An INTERNAL function that computes for the height * of the thumb. This function is created to save * code size. This function is called only to dynamically * compute for the thumb size. * ********************************************************************/ uint16_t SldGetHeight(GFX_GOL_SCROLLBAR *pSld) { uint16_t temp; /* Calculating the height is dependent on the mode type. If type Scrollbar, width is dependent on the ratio of the page/range = width/max-min (see SetThumbSize()) if type is Slider, width is dependent on width*3/8 When vertical height is dynamic, width is contant. */ if (GFX_GOL_ObjectStateGet(pSld, GFX_GOL_SCROLLBAR_VERTICAL_STATE)) { if (GFX_GOL_ObjectStateGet(pSld, GFX_GOL_SCROLLBAR_SLIDER_MODE_STATE)) { temp = SldSetThumbSize(pSld, pSld->hdr.bottom, pSld->hdr.top); } else { temp = (((pSld->hdr.right - pSld->hdr.left) - (GFX_GOL_EMBOSS_SIZE << 1) - 2) * 3) >> 3; } } else {
/********************************************************************* * Function: WORD SldGetWidth(SLIDER *pSld) * * Notes: An INTERNAL function that computes for the width * of the thumb. This function is created to save * code size. This function is called only to dynamically * compute for the thumb size. * ********************************************************************/ WORD SldGetWidth(SLIDER *pSld) { WORD temp; /* Calculating the width is dependent on the mode type. If type Scrollbar, width is dependent on the ratio of the page/range = width/max-min (see SetThumbSize()) if type is Slider, width is dependent on height*3/8 When horizontal width is dynamic, height is contant. */ if(GetState(pSld, SLD_VERTICAL)) { temp = pSld->hdr.right - pSld->hdr.left; if(GetState(pSld, SLD_SCROLLBAR)) { temp = temp - (GOL_EMBOSS_SIZE << 1); } else { temp = temp - (GOL_EMBOSS_SIZE << 1) - 2; } } else { if(GetState(pSld, SLD_SCROLLBAR)) { temp = SldSetThumbSize(pSld, pSld->hdr.right, pSld->hdr.left); } else { temp = (((pSld->hdr.bottom - pSld->hdr.top) - (GOL_EMBOSS_SIZE << 1) - 2) * 3) >> 3; } } // to avoid calculations of dividing by two, we store half the width value return (temp >> 1); }