/********************************************************************* * Function: SLIDER *SldCreate(WORD ID, SHORT left, SHORT top, SHORT right, * SHORT bottom, WORD state, SHORT range, * SHORT page, SHORT pos, GOL_SCHEME *pScheme) * * Notes: Creates a SLIDER object and adds it to the current active list. * If the creation is successful, the pointer to the created Object * is returned. If not successful, NULL is returned. * ********************************************************************/ SLIDER *SldCreate ( WORD ID, SHORT left, SHORT top, SHORT right, SHORT bottom, WORD state, WORD range, WORD page, WORD pos, GOL_SCHEME *pScheme ) { SLIDER *pSld = NULL; pSld = (SLIDER *)GFX_malloc(sizeof(SLIDER)); if(pSld == NULL) return (pSld); pSld->hdr.ID = ID; // unique id assigned for referencing pSld->hdr.pNxtObj = NULL; pSld->hdr.type = OBJ_SLIDER; // set object type pSld->hdr.left = left; // left and right should be equal when oriented vertically pSld->hdr.top = top; // top and bottom should be equal when oriented horizontally pSld->hdr.right = right; pSld->hdr.bottom = bottom; pSld->hdr.state = state; pSld->hdr.DrawObj = SldDraw; // draw function pSld->hdr.MsgObj = SldTranslateMsg; // message function pSld->hdr.MsgDefaultObj = SldMsgDefault; // default message function pSld->hdr.FreeObj = NULL; // default free function // Parameters in the user defined range system (pos, page and range) pSld->range = range; // range of the slider movement (always measured from 0 to range) // 0 refers to pSld->minPos and // range refers to pSld->maxpos where: minPos and maxPos are // the coordinate equivalent of 0 and range value pSld->page = page; // set the resolution pSld->pos = pos; // set the initial position // calculate the thumb width and height pSld->thWidth = SldGetWidth(pSld); pSld->thHeight = SldGetHeight(pSld); // Set the color scheme to be used if(pScheme == NULL) pSld->hdr.pGolScheme = _pDefaultGolScheme; // use default scheme else pSld->hdr.pGolScheme = (GOL_SCHEME *)pScheme; // user defined scheme GOLAddObject((OBJ_HEADER *)pSld); // add the new object to the current list return (pSld); }
/********************************************************************* * Function: GFX_GOL_SCROLLBAR *GFX_GOL_Slider_Create(uint16_t ID, uint16_t left, uint16_t top, uint16_t right, * uint16_t bottom, uint16_t state, uint16_t range, * uint16_t page, uint16_t pos, GFX_GOL_OBJ_SCHEME *pScheme) * * Notes: Creates a SLIDER object and adds it to the current active list. * If the creation is successful, the pointer to the created Object * is returned. If not successful, NULL is returned. * ********************************************************************/ GFX_GOL_SCROLLBAR *GFX_GOL_ScrollBarCreate ( uint16_t ID, uint16_t left, uint16_t top, uint16_t right, uint16_t bottom, uint16_t state, uint16_t range, uint16_t page, uint16_t pos, GFX_GOL_OBJ_SCHEME *pScheme ) { GFX_GOL_SCROLLBAR *pSld = NULL; pSld = (GFX_GOL_SCROLLBAR *) GFX_malloc(sizeof (GFX_GOL_SCROLLBAR)); if (pSld == NULL) return (pSld); //pSld->hdr.instance = instance; //Device Instance set pSld->hdr.ID = ID; // unique id assigned for referencing pSld->hdr.pNxtObj = NULL; pSld->hdr.type = GFX_GOL_SCROLLBAR_TYPE; // set object type pSld->hdr.left = left; // left and right should be equal when oriented vertically pSld->hdr.top = top; // top and bottom should be equal when oriented horizontally pSld->hdr.right = right; pSld->hdr.bottom = bottom; pSld->hdr.state = state; pSld->hdr.DrawObj = GFX_GOL_ScrollBarDraw; // draw function pSld->hdr.actionGet = GFX_GOL_ScrollBarActionGet; // message function pSld->hdr.actionSet = GFX_GOL_ScrollBarActionSet; // default message function pSld->hdr.FreeObj = NULL; // default free function // Parameters in the user defined range system (pos, page and range) pSld->range = range; // range of the slider movement (always measured from 0 to range) // 0 refers to pSld->minPos and // range refers to pSld->maxpos where: minPos and maxPos are // the coordinate equivalent of 0 and range value pSld->page = page; // set the resolution pSld->pos = pos; // set the initial position // calculate the thumb width and height pSld->thWidth = SldGetWidth(pSld); pSld->thHeight = SldGetHeight(pSld); // Set the color scheme to be used pSld->hdr.pGolScheme = (GFX_GOL_OBJ_SCHEME *) pScheme; // user defined scheme GFX_GOL_ObjectAdd((GFX_GOL_OBJ_HEADER *) pSld); // add the new object to the current list return (pSld); }