⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wap_gle.c

📁 是一个手机功能的模拟程序
💻 C
📖 第 1 页 / 共 4 页
字号:
 $Arguments:	label			- the label of the key (used to calculate size)
 				eventType		- identifies the type
 				maxWidth		- maximum width possible (or -1 for no maximum)
 				width			- the width in pixels
 				height			- the height in pixels
 				ascent			- the ascent in pixels.  Should be the number of
 									pixels of the key above the baseline
 									(<=height)
 				
*******************************************************************************/

VOID GLEa_keySize(const GLE_STRING label, const GLE_STRING eventType, INT16 maxWidth, INT16 *width, INT16 *height, UINT16 *ascent)
{
#ifdef TRACE_WAP_GLE
	TRACE_EVENT("GLEa_keySize");
	TRACE_EVENT_P1("Maxwidth: %d", maxWidth);
#endif	

	*width = (INT16) GLEa_textFontWidth (label, (UINT16) GLEa_strlen(label), 0, TRUE);
	*height = (INT16) GLEa_textFontLineHeight (0, TRUE);
	*ascent = (INT16) GLEa_textFontAscent (0, TRUE);
	/* currently no border provided for */
	/* if (*width>maxWidth && maxWidth!=-1)
		*width = maxWidth;*/

#ifdef TRACE_WAP_GLE
	TRACE_EVENT_P3("Width %d, Height %d, MaxWidth %d",*width, *height, maxWidth);
#endif
	
	return;
}


/*******************************************************************************

 $Function:    	GLEa_keyDraw

 $Description:	Draws a key with a label
 
 $Returns:		None.

 $Arguments:	viewId			- the id of the view	
 				label			- the label of the key
 				eventType		- identifies the type
 				invert			- if TRUE, the key should be drawn marked, otherwise
 									not
 				keyBounds		- the position of the upper left hand corner and the
 									allowed width and height
 				
*******************************************************************************/

VOID GLEa_keyDraw(UINT8 viewId, const GLE_STRING label, const GLE_STRING eventType, BOOL invert, GleRectangleType *keyBounds)
{
	T_WAP_MMI_SEND_TEXT_IND 	parameter;

#ifdef TRACE_WAP_GLE
	TRACE_EVENT("GLEa_keyDraw");
	TRACE_EVENT_P4("x, y, width, height: %d, %d, %d, %d", keyBounds->topLeft.x, keyBounds->topLeft.y,
		keyBounds->extent.x, keyBounds->extent.y);
	WAP_trace_ushort_string((USHORT *) label, (USHORT)GLEa_strlen(label));
#endif

	/* If our key is off the edge of the screen, don't send the event */
	
	if (keyBounds->topLeft.x > view_width || keyBounds->topLeft.y > (view_height-font_height)
		|| (keyBounds->topLeft.x+keyBounds->extent.x)<0 || keyBounds->topLeft.y<0)
		return;
	
	parameter.object_id		= viewId;
	parameter.type			= WAP_TEXT_KEY;	

	parameter.text_length	= (UINT16) GLEa_strlen((GLE_STRING)label);
	parameter.Text			= (USHORT*)label;

	parameter.invert		= invert;
	parameter.pX			= keyBounds->topLeft.x;
	parameter.pY			= keyBounds->topLeft.y;
	parameter.pWidth		= keyBounds->extent.x;
	parameter.pHeight		= keyBounds->extent.y;
	parameter.format		= 0;		
	parameter.selected		= 0;
	parameter.is_link		= TRUE;
	
	parameter.formatstring_length = 0;
	parameter.Formatstring 	= NULL;
	
	W_WAP_MMI_SEND_TEXT_IND(&parameter);
	return;
}


#endif

#ifdef SHOW_OPTIONS_IN_CONTENT


/*******************************************************************************

 $Function:    	GLEa_optionSize

 $Description:	Sets the dimensions of an option
 
 $Returns:		None.

 $Arguments:	label			- the label of the option (used to calculate size)
 				multiselect		- if TRUE, the option is in a multiple-choice menu,
 									otherwise it is in a single-choice menu
 				maxWidth		- maximum width possible (or -1 for no maximum)
 				width			- the width in pixels
 				height			- the height in pixels
 				ascent			- the ascent in pixels.  Should be the number of
 									pixels of the option above the baseline
 									(<=height)
 				
*******************************************************************************/

VOID GLEa_optionSize(const GLE_STRING label, BOOL multiSelect, INT16 maxWidth, INT16 *width, INT16 *height, UINT16 *ascent)
{
#ifdef TRACE_WAP_GLE
	TRACE_EVENT("GLEa_optionSize");
	TRACE_EVENT_P1("Maxwidth: %d", maxWidth);
#endif

	/* Add width of checkbox & padding space */

	*width = (INT16) GLEa_textFontWidth (label, (UINT16) GLEa_strlen((GLE_STRING)label), 0, FALSE) \
		+ WAP_CHECKBOX_WIDTH+WAP_CHECKBOX_RIGHT;
		
	*height = (INT16) GLEa_textFontLineHeight (0, FALSE);
	*ascent = (INT16) GLEa_textFontAscent (0, FALSE);
	/* currently no border provided for */
	/*if (*width>maxWidth)
		*width = maxWidth;*/
	return;
}


/*******************************************************************************

 $Function:    	GLEa_optionDraw

 $Description:	Draws an option with a label
 
 $Returns:		None.

 $Arguments:	viewId			- the id of the view
 				label			- the label of the option (used to calculate size)
 				multiselect		- if TRUE, the option is in a multiple-choice menu,
 									otherwise it is in a single-choice menu
 				invert			- if TRUE, the option should be drawn marked,
 									otherwise not
 				selected		- if TRUE, the option should be drawn selected,
 									otherwise not
 				optionBounds	- the position of the upper left hand corner and the
 									allowed width and height
 				
*******************************************************************************/

VOID GLEa_optionDraw(UINT8 viewId, const GLE_STRING label, BOOL multiSelect, BOOL invert, BOOL selected, GleRectangleType *optionBounds)
{
	T_WAP_MMI_SEND_TEXT_IND 	parameter;

#ifdef TRACE_WAP_GLE
	TRACE_EVENT("GLEa_optionDraw");
#endif	

	/* If our option is off the edge of the screen, don't send the event */
	
	if (optionBounds->topLeft.x > view_width || optionBounds->topLeft.y > (view_height-font_height)
		|| (optionBounds->topLeft.x+optionBounds->extent.x)<0 || optionBounds->topLeft.y<0)
		return;
	
	parameter.object_id		= viewId;
	parameter.type			= WAP_TEXT_OPTION;

	parameter.text_length	= (UINT16) GLEa_strlen((GLE_STRING)label);
	parameter.Text			= (USHORT*)label;

	parameter.invert		= invert;
	parameter.pX			= (UINT16) optionBounds->topLeft.x;
	parameter.pY			= (UINT16) optionBounds->topLeft.y;
	parameter.pWidth		= (UINT16) optionBounds->extent.x;
	parameter.pHeight		= (UINT16) optionBounds->extent.y;
	parameter.format		= 0;
	parameter.selected		= selected;
	parameter.is_link		= FALSE;

	parameter.formatstring_length = 0;
	parameter.Formatstring 	= NULL;
	W_WAP_MMI_SEND_TEXT_IND(&parameter);
	
	return;
}


/*******************************************************************************

 $Function:    	GLEa_optionGroupSize

 $Description:	Sets the dimensions of an option group
 
 $Returns:		None.

 $Arguments:	label			- the label of the option (used to calculate size)
 				maxWidth		- maximum width possible (or -1 for no maximum)
 				width			- the width in pixels
 				height			- the height in pixels
 				ascent			- the ascent in pixels.  Should be the number of
 									pixels of the option group above the baseline
 									(<=height)
 				
*******************************************************************************/

VOID GLEa_optionGroupSize(const GLE_STRING label, INT16 maxWidth, INT16 *width, INT16 *height, UINT16 *ascent)
{
#ifdef TRACE_WAP_GLE
	TRACE_EVENT("GLEa_optionGroupSize");
#endif

	*width = (INT16) GLEa_textFontWidth (label, (UINT16) GLEa_strlen((GLE_STRING)label), 0, FALSE);
	*height = (INT16) GLEa_textFontLineHeight (0, FALSE);
	*ascent = (INT16) GLEa_textFontAscent (0, FALSE);
	/* currently no border provided for */
	/* if (*width>maxWidth)
		*width = maxWidth; */
	return;
}


/*******************************************************************************

 $Function:    	GLEa_optionGroupDraw

 $Description:	Draws an option group with a label
 
 $Returns:		None.

 $Arguments:	viewId			- the id of the view
 				label			- the label of the option group (used to calculate size)
 				optionGroupBounds- the position of the upper left hand corner and the
 									allowed width and height
 				
*******************************************************************************/

VOID GLEa_optionGroupDraw(UINT8 viewId, const GLE_STRING label, GleRectangleType *optionGroupBounds)
{
	T_WAP_MMI_SEND_TEXT_IND 	parameter;
	/* unsigned short * UshortText; */

#ifdef TRACE_WAP_GLE
	TRACE_EVENT("GLEa_optionGroupDraw");
#endif

	/* If our option is off the edge of the screen, don't send the event */
	
	if (optionGroupBounds->topLeft.x > view_width || optionGroupBounds->topLeft.y > (view_height-font_height)
		|| (optionGroupBounds->topLeft.x+optionGroupBounds->extent.x)<0 || optionGroupBounds->topLeft.y<0)
		return;
	
	parameter.object_id		= viewId;
	parameter.type			= WAP_TEXT_OPTIONGROUP;
	
	parameter.text_length	= (UINT16) GLEa_strlen((GLE_STRING)label);
	parameter.Text			= (USHORT*)label;
	
	parameter.invert		= FALSE;
	parameter.pX			= (UINT16) optionGroupBounds->topLeft.x;
	parameter.pY			= (UINT16) optionGroupBounds->topLeft.y;
	parameter.pWidth		= (UINT16) optionGroupBounds->extent.x;
	parameter.pHeight		= (UINT16) optionGroupBounds->extent.y;
	parameter.format		= 0;
	parameter.selected		= FALSE;
	parameter.is_link		= FALSE;

	parameter.formatstring_length = 0;
	parameter.Formatstring 	= NULL;
	
	W_WAP_MMI_SEND_TEXT_IND(&parameter);

	return;
}

#else


/*******************************************************************************

 $Function:    	GLEa_selectSize

 $Description:	Sets the dimensions of a select
 
 $Returns:		None

 $Arguments:	label			- the label of the select (used to calculate size)
 				multiselect		- if TRUE, the select is in a multiple-choice menu,
 									otherwise it is in a single-choice menu
 				maxWidth		- maximum width possible (or -1 for no maximum)
 				width			- the width in pixels
 				height			- the height in pixels
 				ascent			- the ascent in pixels.  Should be the number of
 									pixels of the select above the baseline
 									(<=height)
 				
*******************************************************************************/

VOID GLEa_selectSize(const GLE_STRING label, BOOL multiSelect, INT16 maxWidth, INT16 *width, INT16 *height, UINT16 *ascent)
{
#ifdef TRACE_WAP_GLE
	TRACE_EVENT("GLEa_selectSize");
#endif

	*width = (INT16) GLEa_textFontWidth (label, (UINT16) GLEa_strlen((GLE_STRING)label), 0, FALSE);
	*height = (INT16) GLEa_textFontLineHeight (0, FALSE);
	*ascent = (INT16) GLEa_textFontAscent (0, FALSE);
	/* currently no border provided for */
	/* if (*width>maxWidth)
		*width = maxWidth;*/
	return;
}



/*******************************************************************************

 $Function:    	GLEa_selectDraw

 $Description:	Draws a select with a label
 
 $Returns:		None.
 
 $Arguments:	viewId			- the id of the view
 				label			- the label of the select (used to calculate size)
 				multiselect		- if TRUE, the select is in a multiple-choice menu,
 									otherwise it is in a single-choice menu
 				invert			- if TRUE, the select should be drawn marked,
 									otherwise not
 				selectBounds	- the position of the upper left hand corner and the
 									allowed width and height
 				
*******************************************************************************/

VOID GLEa_selectDraw(UINT8 viewId, const GLE_STRING label, BOOL multiSelect, BOOL invert, GleRectangleType *selectBounds)
{
	T_WAP_MMI_SEND_TEXT_IND 	parameter;
	/* unsigned short * UshortText; */

#ifdef TRACE_WAP_GLE
	TRACE_EVENT("GLEa_selectDraw");
#endif

	/* If our option is off the edge of the screen, don't send the event */
	
	if (selectBounds->topLeft.x > view_width || selectBounds->topLeft.y > (view_height-font_height)
		|| (selectBounds->topLeft.x+selectBounds->extent.x)<0 || selectBounds->topLeft.y<0)
		return;
	
	parameter.object_id		= viewId;
	parameter.type			= WAP_TEXT_SELECT;
	
	parameter.text_length	= (UINT16) GLEa_strlen((GLE_STRING)label);
	parameter.Text			= (USHORT*)label;
	
	parameter.invert		= invert;
	parameter.pX			= (USHORT) selectBounds->topLeft.x;
	parameter.pY			= (USHORT) selectBounds->topLeft.y;
	parameter.pWidth		= (USHORT) selectBounds->extent.x;
	parameter.pHeight		= (USHORT) selectBounds->extent.y;
	parameter.format		= NULL;	
	parameter.selected		= 0;
	parameter.is_link		= FALSE;
	parameter.formatstring_length = 0;
	parameter.Formatstring 	= NULL;
	
	W_WAP_MMI_SEND_TEXT_IND(&parameter);

	return;
}


/*******************************************************************************

 $Function:    	GLEa_selectGetLabel

 $Description:	Asks the WAP application for the label to display in the content for the
 				WMLSelect
 
 $Returns:		None.

 $Arguments:	self->multiselect	- if TRUE, the select is in a multiple-choice menu,
 									otherwise it is in a single-choice menu
 				self->next			- next option in the list
 				self->singleSelectedOption -  if list is single-select, this points to the
 									selected option
 				
*******************************************************************************/

VOID GLEa_selectGetLabel(GleSelect* self)
{
#ifdef TRACE_WAP_GLE
	TRACE_EVENT("GLEa_selectGetLabel");
#endif
	
	return;
}

/*******************************************************************************

 $Function:    	GLEa_selectDialog

 $Description:	Opens a dialog box for a WMLSelect
 
 $Returns:		None.

 $Arguments:	viewId		- the id of the view
 				self		- see above
 				
*******************************************************************************/

VOID GLEa_selectDialog(const GleSelect* self)
{
#ifdef TRACE_WAP_GLE
	TRACE_EVENT("GLEa_selectDialog");
#endif

	return;
}

#endif


/*******************************************************************************

 $Function:    	GLEa_tableDraw

 $Description:	Draws the title and cells of a table
 
 $Returns:		None.

 $Arguments:	viewId		- the id of the view
 				pos			- the position of the upper left hand corner
 				title		- the title of the table
 				noOfCells	- the number of cells
 				noOfColumns	- the number of columns
 				noOfRows	- the number of rows
 				colWidth	- array with the widths of columns
 				rowHeight	- array with the height of rows
 				
*******************************************************************************/

VOID GLEa_tableDraw(UINT8 viewId, GlePointType pos, GLE_STRING title, INT8 noOfCells, INT8 noOfColumns, INT8 noOfRows, const INT16 *colWidth, const INT16 *rowHeight)
{
	T_WAP_MMI_SEND_TABLE_IND	parameter;
	SHORT						width;
	SHORT						height;
	USHORT						index;
	
#ifdef TRACE_WAP_GLE
	TRACE_EVENT("GLEa_tableDraw");
#endif

	width = (noOfColumns-1)*gle_cell_hBetween + gle_cell_hBefore + gle_cell_hAfter;
	for (index = 0; index<noOfColumns; index++)
		width += colWidth[index];

	height = (noOfRows-1)*gle_cell_vBetween + gle_cell_vBefore + gle_cell_vAfter;
	for (index = 0; index<noOfRows; index++)
		height += rowHeight[index];
	
	if (pos.x > view_width
		|| pos.y > (view_height-font_height)
		|| (pos.x+width)<0
		|| (pos.y+height)<0)
		return;
	
	parameter.object_id		= viewId;
	parameter.title_length	= (UINT16) GLEa_strlen((GLE_STRING)title);
	parameter.Title			= (USHORT*)title;
	parameter.pX			= pos.x;
	parameter.pY			= pos.y;
	parameter.pWidth		= width;
	parameter.pHeight		= height;
	parameter.cols_length	= (U32)noOfColumns;
	parameter.ColWidth		= (SHORT *)colWidth;
	parameter.rows_length	= (U32)noOfRows;
	parameter.RowHeight		= (SHORT *)rowHeight;
	parameter.noOfCells		= noOfCells;
	W_WAP_MMI_SEND_TABLE_IND(&parameter);

	return;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -