Exemple #1
0
/*********************************************************************
* Function: CHECKBOX  *CbCreate(WORD ID, SHORT left, SHORT top, SHORT right,
*                              SHORT bottom, WORD state, XCHAR *pText,
*                              GOL_SCHEME *pScheme)
*
* Overview: Creates the check box.
*
********************************************************************/
CHECKBOX *CbCreate(WORD ID, SHORT left, SHORT top, SHORT right, SHORT bottom,
                   WORD state, XCHAR *pText, GOL_SCHEME *pScheme)
{
    CHECKBOX *pCb = NULL;

    pCb = malloc(sizeof(CHECKBOX));
    if (pCb == NULL)
        return pCb;

    pCb->hdr.ID      	= ID;
    pCb->hdr.pNxtObj 	= NULL;
    pCb->hdr.type    	= OBJ_CHECKBOX;
    pCb->hdr.left    	= left;
    pCb->hdr.top     	= top;
    pCb->hdr.right   	= right;
    pCb->hdr.bottom  	= bottom;
    pCb->pText   	= pText;
    pCb->hdr.state   	= state;

    // Set the style scheme
    if (pScheme == NULL)
        pCb->hdr.pGolScheme = _pDefaultGolScheme;
    else
        pCb->hdr.pGolScheme = (GOL_SCHEME *)pScheme;

    // Set the text height
    pCb->textHeight = 0;
    if(pText != NULL) {
        pCb->textHeight = GetTextHeight(pCb->hdr.pGolScheme->pFont);
    }

    GOLAddObject((OBJ_HEADER*) pCb);

    return pCb;
}
/*********************************************************************
* Function: CUSTOM* CcCreate(WORD ID, SHORT left, SHORT top, SHORT right, 
*                              SHORT bottom, WORD state, GOL_SCHEME *pScheme)
*
* PreCondition: none
*
* Input: ID - user defined ID for the object
*        left, top, right, bottom - location of the left,top and 
*             right, bottom corners of the object
*        state - state of the object
*        pScheme - pointer to the color scheme and font used for the object
*
* Output: returns the pointer to the object created
*
* Overview: creates the object and initialize with the passed parameters and 
*           default settings
*
* Note: none
*
********************************************************************/
CUSTOM *CcCreate(WORD ID, SHORT left, SHORT top, SHORT right, SHORT bottom, WORD state, GOL_SCHEME *pScheme)
{
    CUSTOM  *pCc = NULL;

    pCc = malloc(sizeof(CUSTOM));
    if(pCc == NULL)
        return (pCc);

    pCc->ID = ID;           // unique id assigned for referencing
    pCc->pNxtObj = NULL;    // initialize pointer to NULL
    pCc->type = OBJ_CUSTOM; // set object type
    pCc->left = left;       // left,top corner
    pCc->top = top;
    pCc->right = right;     // right buttom corner
    pCc->bottom = bottom;
    pCc->state = state;     // set state

    // Set the color scheme to be used
    if(pScheme == NULL)
        pCc->pGolScheme = _pDefaultGolScheme;
    else
        pCc->pGolScheme = (GOL_SCHEME *)pScheme;

    GOLAddObject((OBJ_HEADER *)pCc);

    return (pCc);
}
/*********************************************************************
* Function: STATICTEXT  *StCreate(WORD ID, SHORT left, SHORT top, SHORT right, SHORT bottom, 
*								  WORD state , XCHAR *pText, GOL_SCHEME *pScheme)
*
* Notes: Creates a STATICTEXT 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.
*
********************************************************************/
STATICTEXT *StCreate(WORD ID, SHORT left, SHORT top, SHORT right, SHORT bottom, 
			         WORD state, XCHAR *pText, GOL_SCHEME *pScheme)
{
	STATICTEXT *pSt = NULL;
	
	pSt = (STATICTEXT*)malloc(sizeof(STATICTEXT));
	if (pSt == NULL)
		return pSt;
	
	pSt->hdr.ID      	= ID;					// unique id assigned for referencing
	pSt->hdr.pNxtObj 	= NULL;					// initialize pointer to NULL
	pSt->hdr.type    	= OBJ_STATICTEXT;		// set object type
	pSt->hdr.left    	= left;       	    	// left,top corner
	pSt->hdr.top     	= top;
	pSt->hdr.right   	= right;     	    	// right buttom corner
	pSt->hdr.bottom  	= bottom;
	pSt->pText   	= pText;				// location of the text
	pSt->hdr.state   	= state; 	

	// Set the color scheme to be used
	if (pScheme == NULL)
		pSt->hdr.pGolScheme = _pDefaultGolScheme; 
	else 	
		pSt->hdr.pGolScheme = (GOL_SCHEME *)pScheme; 	

	pSt->textHeight 	= 0;
	if (pSt->pText != NULL) {
		// Set the text height  
		pSt->textHeight 	= GetTextHeight(pSt->hdr.pGolScheme->pFont);
	}	
	
    GOLAddObject((OBJ_HEADER*) pSt);
	return pSt;
}
Exemple #4
0
/*********************************************************************
* Function: PICTURE  *PictCreate(WORD ID, SHORT left, SHORT top, SHORT right, 
*                              SHORT bottom, WORD state, char scale, void *pBitmap, 
*                              GOL_SCHEME *pScheme)
*
* Overview: creates the picture control
*
********************************************************************/
PICTURE *PictCreate(WORD ID, SHORT left, SHORT top, SHORT right, SHORT bottom, 
			       WORD state, char scale, void *pBitmap, GOL_SCHEME *pScheme)
{
	PICTURE *pPict = NULL;
	
	pPict = malloc(sizeof(PICTURE));
	if (pPict == NULL)
		return pPict;

	pPict->ID      	= ID;
	pPict->pNxtObj 	= NULL;
	pPict->type    	= OBJ_PICTURE;
	pPict->left    	= left;
	pPict->top     	= top;
	pPict->right   	= right;
	pPict->bottom  	= bottom;
	pPict->pBitmap 	= pBitmap;
	pPict->state   	= state;
	pPict->scale   	= scale;

	// Set the style scheme to be used
	if (pScheme == NULL)
		pPict->pGolScheme = _pDefaultGolScheme; 
	else 	
		pPict->pGolScheme = (GOL_SCHEME *)pScheme; 	

    GOLAddObject((OBJ_HEADER*) pPict);
	
	return pPict;
}
/*********************************************************************
* Function: TOUCHSCROLL *TSCreate(WORD ID, SHORT left, SHORT top, SHORT right, 
*                              SHORT bottom, WORD state, 
*                              GOL_SCHEME *pScheme)
*
* Overview: creates the touchscroll control
*
********************************************************************/
TOUCHSCROLL *TSCreate(WORD ID, SHORT left, SHORT top, SHORT right, SHORT bottom, 
			       WORD state, GOL_SCHEME *pScheme)
{
	TOUCHSCROLL *pTS = NULL;
	
	pTS = (TOUCHSCROLL *)malloc(sizeof(TOUCHSCROLL));
	if (pTS == NULL)
		return pTS;

	pTS->hdr.ID      	= ID;
	pTS->hdr.pNxtObj 	= NULL;
	pTS->hdr.type    	= OBJ_TOUCHSCROLL;
	pTS->hdr.left    	= left;
	pTS->hdr.top     	= top;
	pTS->hdr.right   	= right;
	pTS->hdr.bottom  	= bottom;
	pTS->hdr.state   	= state;

	// Set the style scheme to be used
	if (pScheme == NULL)
		pTS->hdr.pGolScheme = _pDefaultGolScheme; 
	else 	
		pTS->hdr.pGolScheme = (GOL_SCHEME *)pScheme; 	

    GOLAddObject((OBJ_HEADER*) pTS);
	
	return pTS;
}
/*********************************************************************
* 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: ANALOGCLOCK  *AcCreate(WORD ID, SHORT left,SHORT top,
*                        SHORT right,SHORT bottom,SHORT hour,SHORT minute,
*                        SHORT radius,BOOL sechand,WORD state,void *pBitmap,
*                        GOL_SCHEME  *pScheme)
*
*
* Notes: Creates an ANALOGCLOCK 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.
*
********************************************************************/
ANALOGCLOCK *AcCreate
(
    WORD        ID,
    SHORT       left,
    SHORT       top,
    SHORT       right,
    SHORT       bottom,
    SHORT       hour,
    SHORT       minute,
    SHORT       radius,
    BOOL		sechand,
    WORD        state,
    void        *pBitmap,
    GOL_SCHEME  *pScheme
)
{
    ANALOGCLOCK  *pAc = NULL;
    pAc = (ANALOGCLOCK *)GFX_malloc(sizeof(ANALOGCLOCK));
    if(pAc == NULL)
        return (NULL);

    pAc->hdr.ID = ID;                   // unique id assigned for referencing
    pAc->hdr.pNxtObj = NULL;            // initialize pointer to NULL
    pAc->hdr.type = OBJ_ANALOGCLOCK;    // set object type
    pAc->hdr.left = left;               // left position
    pAc->hdr.top = top;                 // top position
    pAc->hdr.right = left;              // left position
    pAc->hdr.bottom = top;              // top position
    pAc->radius = radius;
    pAc->valueS = 0;
    pAc->prev_valueS = pAc->valueS;
    pAc->valueM = minute;
    pAc->prev_valueM = pAc->valueM-1;
    pAc->valueH = (hour*5) + (minute/12);
    pAc->prev_valueH = pAc->valueH-1;
    pAc->centerx = (left + ((right-left)>>1)); 
    pAc->centery = (top + ((bottom-top)>>1));
    pAc->pBitmap = pBitmap;             // location of bitmap
    pAc->hdr.state = state;             // state
    pAc->hdr.DrawObj = AcDraw;			// draw function
    pAc->hdr.MsgObj = NULL;             // no message function
    pAc->hdr.MsgDefaultObj = NULL;		// no default message function
    pAc->hdr.FreeObj = NULL;
 
    // Set the color scheme to be used
    if(pScheme == NULL)
        pAc->hdr.pGolScheme = _pDefaultGolScheme;
    else
        pAc->hdr.pGolScheme = (GOL_SCHEME *)pScheme;

    GOLAddObject((OBJ_HEADER *)pAc);

    return (pAc);
}
Exemple #8
0
/*********************************************************************************************************
* Function: DIGITALMETER  *DmCreate(WORD ID, SHORT left, SHORT top, SHORT right, SHORT bottom, WORD state,
*                               DWORD Value, BYTE NoOfDigits, BYTE DotPos, GOL_SCHEME *pScheme)
*
* Notes: Creates a DIGITALMETER 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.
*
**********************************************************************************************************/
DIGITALMETER *DmCreate
(
    WORD        ID,
    SHORT       left,
    SHORT       top,
    SHORT       right,
    SHORT       bottom,
    WORD        state,
    DWORD       Value,
    BYTE        NoOfDigits,
    BYTE        DotPos,
    GOL_SCHEME  *pScheme
)
{
    DIGITALMETER    *pDm = NULL;
    pDm = GFX_malloc(sizeof(DIGITALMETER));
    if(pDm == NULL)
        return (pDm);

    pDm->hdr.ID = ID;                   // unique id assigned for referencing
    pDm->hdr.pNxtObj = NULL;            // initialize pointer to NULL
    pDm->hdr.type = OBJ_DIGITALMETER;   // set object type
    pDm->hdr.left = left;               // left,top corner
    pDm->hdr.top = top;
    pDm->hdr.right = right;             // right buttom corner
    pDm->hdr.bottom = bottom;
    pDm->Cvalue = Value;                // initial value to be displayed
    pDm->hdr.state = state;
    pDm->NoOfDigits = NoOfDigits;       // number of digits to be displayed
    pDm->DotPos = DotPos;               // position of decimal point
    pDm->hdr.DrawObj = DmDraw;			// draw function
    pDm->hdr.MsgObj = DmTranslateMsg;   // message function
    pDm->hdr.MsgDefaultObj = NULL;		// default message function
    pDm->hdr.FreeObj = NULL;			// free function

    // Set the color scheme to be used
    if(pScheme == NULL)
        pDm->hdr.pGolScheme = _pDefaultGolScheme;
    else
        pDm->hdr.pGolScheme = (GOL_SCHEME *)pScheme;

    pDm->textHeight = 0;
    if(pDm->Cvalue != 0)
    {

        // Set the text height
        pDm->textHeight = GetTextHeight(pDm->hdr.pGolScheme->pFont);
    }

    GOLAddObject((OBJ_HEADER *)pDm);

    return (pDm);
}
Exemple #9
0
GRID *GridCreate( WORD ID, SHORT left, SHORT top, SHORT right, SHORT bottom, WORD state, SHORT numColumns, SHORT numRows,
                    SHORT cellWidth, SHORT cellHeight, GOL_SCHEME *pScheme )
{
    GRID *pGrid = NULL;

    if ((pGrid = malloc(sizeof(GRID))) == NULL)
    {
        return NULL;
    }

    if ((pGrid->gridObjects = malloc(sizeof(GRIDITEM)*numColumns*numRows)) == NULL)
    {
        free( pGrid );
        return NULL;
    }

    // Initialize grid items to default.
    memset( pGrid->gridObjects, 0, sizeof(GRIDITEM)*numColumns*numRows );

    // Initialize grid
    pGrid->hdr.ID           = ID;
    pGrid->hdr.pNxtObj      = NULL;
    pGrid->hdr.type         = OBJ_GRID;
    pGrid->hdr.state        = state;
    pGrid->hdr.left         = left;
    pGrid->hdr.top          = top;
    pGrid->hdr.right        = right;
    pGrid->hdr.bottom       = bottom;
    pGrid->numColumns   = numColumns;
    pGrid->numRows      = numRows;
    pGrid->cellWidth    = cellWidth;
    pGrid->cellHeight   = cellHeight;
    pGrid->focusX       = 0;
    pGrid->focusY       = 0;

    // Set the color scheme to be used
    if (pScheme == NULL)
    {
        pGrid->hdr.pGolScheme = _pDefaultGolScheme;
    }
    else
    {
        pGrid->hdr.pGolScheme = (GOL_SCHEME *)pScheme;
    }

    GOLAddObject((OBJ_HEADER*) pGrid);

    return pGrid;
}
Exemple #10
0
/*********************************************************************
* Function: PICTURE  *PictCreate(WORD ID, SHORT left, SHORT top, SHORT right, 
*                              SHORT bottom, WORD state, char scale, void *pBitmap, 
*                              GOL_SCHEME *pScheme)
*
* Overview: creates the picture control
*
********************************************************************/
PICTURE *PictCreate
(
    WORD        ID,
    SHORT       left,
    SHORT       top,
    SHORT       right,
    SHORT       bottom,
    WORD        state,
    char        scale,
    void        *pBitmap,
    GOL_SCHEME  *pScheme
)
{
    PICTURE *pPict = NULL;

    pPict = (PICTURE *)GFX_malloc(sizeof(PICTURE));
    if(pPict == NULL)
        return (pPict);

    pPict->hdr.ID = ID;
    pPict->hdr.pNxtObj = NULL;
    pPict->hdr.type = OBJ_PICTURE;
    pPict->hdr.left = left;
    pPict->hdr.top = top;
    pPict->hdr.right = right;
    pPict->hdr.bottom = bottom;
    pPict->pBitmap = pBitmap;
    pPict->hdr.state = state;
    pPict->scale = scale;
    pPict->hdr.DrawObj = PictDraw;			// draw function
    pPict->hdr.MsgObj = PictTranslateMsg;   // message function
    pPict->hdr.MsgDefaultObj = NULL;		// default message function
    pPict->hdr.FreeObj = NULL;				// free function

    // Set the style scheme to be used
    if(pScheme == NULL)
        pPict->hdr.pGolScheme = _pDefaultGolScheme;
    else
        pPict->hdr.pGolScheme = (GOL_SCHEME *)pScheme;

    GOLAddObject((OBJ_HEADER *)pPict);

    return (pPict);
}
Exemple #11
0
/*********************************************************************
* Function: BUTTON  *BtnCreate(WORD ID, SHORT left, SHORT top, SHORT right, 
*                              SHORT bottom, SHORT radius, void *pBitmap, XCHAR *pText, 
*                              GOL_SCHEME *pScheme)
*
*
* Notes: Creates a BUTTON 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.
*
********************************************************************/
BUTTON *BtnCreate(	WORD ID, SHORT left, SHORT top, SHORT right, SHORT bottom, SHORT radius,  
			        WORD state, void *pBitmap, XCHAR *pText, GOL_SCHEME *pScheme)
{
	BUTTON *pB = NULL;
	
	pB = malloc(sizeof(BUTTON));
	if (pB == NULL) 
		return NULL;
	
	pB->hdr.ID      	= ID;					// unique id assigned for referencing
	pB->hdr.pNxtObj 	= NULL;					// initialize pointer to NULL
	pB->hdr.type    	= OBJ_BUTTON;			// set object type
	pB->hdr.left       = left;       	    	// left position
	pB->hdr.top        = top;       	    	// top position
	pB->hdr.right      = right;       	    	// right position
	pB->hdr.bottom     = bottom;      	    	// bottom position
	pB->radius     = radius;				// radius
	pB->pBitmap  	= pBitmap;  			// location of bitmap 
	pB->pText   	= pText;				// location of the text
    pB->hdr.state   	= state; 	            // state

	// Set the color scheme to be used
	if (pScheme == NULL)
		pB->hdr.pGolScheme = _pDefaultGolScheme; 
	else 	
		pB->hdr.pGolScheme = (GOL_SCHEME *)pScheme; 	

	pB->textWidth  	= 0;  
	pB->textHeight 	= 0;
	if (pB->pText != NULL) {
		// Calculate the text width & height  
		pB->textWidth = GetTextWidth(pText, pB->hdr.pGolScheme->pFont);
		pB->textHeight = GetTextHeight(pB->hdr.pGolScheme->pFont);
	}	
    GOLAddObject((OBJ_HEADER*) pB);
    
#ifdef  USE_FOCUS
    if(GetState(pB,BTN_FOCUSED))
        GOLSetFocus((OBJ_HEADER*)pB);
#endif

	return pB;
}
Exemple #12
0
/*********************************************************************
* Function: WINDOW  *WndCreate(WORD ID, SHORT left, SHORT top, SHORT right, 
*                              SHORT bottom, WORD state, XCHAR *pText, void* pBitmap,
*                              GOL_SCHEME *pScheme)
*
* Overview: creates the window
*
********************************************************************/
WINDOW *WndCreate(WORD ID, SHORT left, SHORT top, SHORT right, SHORT bottom,
			      WORD state, void *pBitmap, XCHAR *pText, GOL_SCHEME *pScheme)
{
	WINDOW *pW;
	
	pW = malloc(sizeof(WINDOW));
	if (pW == NULL)
		return pW;

	pW->hdr.ID      	= ID;
	pW->hdr.pNxtObj 	= NULL;
	pW->hdr.type    	= OBJ_WINDOW;
	pW->hdr.left    	= left;
	pW->hdr.top     	= top;
	pW->hdr.right   	= right;
	pW->hdr.bottom  	= bottom;
	pW->pBitmap  		= pBitmap;
	pW->pText   		= pText;
	pW->hdr.state       = state;

	// Set the style scheme to be used
	if (pScheme == NULL)
		pW->hdr.pGolScheme = _pDefaultGolScheme; 
    else
		pW->hdr.pGolScheme = pScheme;
    

    pW->textHeight  = 0;
    if(pText != NULL){
        pW->textHeight = GetTextHeight(pW->hdr.pGolScheme->pFont);
    }

    GOLAddObject((OBJ_HEADER*) pW);
	
	return pW;
}