Beispiel #1
0
/** Add the "Back" or "Quit" button at the bottom of the menu screen.
    @ingroup	gui
    @param	scr	Screen or Menu handle
    @param	text	Text of the button
    @param	tip	Text to display when the button is focused
    @param	userdata	Parameter of the Push function
    @param	onpush		Callback when the button is pushed
    @return	Button Id
 */
int
GfuiMenuBackQuitButtonCreate(void *scr, char *text, char *tip, void *userdata, tfuiCallback onpush)
{
    tMnuCallbackInfo	*cbinfo;
    int			xpos, ypos;
    int			bId;
    
    xpos = 320;
    ypos = 40;

    cbinfo = (tMnuCallbackInfo*)calloc(1, sizeof(tMnuCallbackInfo));
    cbinfo->screen = scr;
    cbinfo->labelId = GfuiTipCreate(scr, tip, strlen(tip));

    GfuiVisibilitySet(scr, cbinfo->labelId, 0);
    
    bId = GfuiButtonCreate(scr,
			text,
			GFUI_FONT_LARGE,
			xpos, ypos, GFUI_BTNSZ, GFUI_ALIGN_HC_VB, 0,
			userdata, onpush,
			(void*)cbinfo, dispInfo,
			remInfo);

    GfuiAddKey(scr, (unsigned char)27, tip, userdata, onpush, NULL);

    return bId;
}
Beispiel #2
0
static int 
createImageButton(void* hscr, void* hparm, const char* pszPath,
				  void* userDataOnPush, tfuiCallback onPush,
				  void* userDataOnFocus, tfuiCallback onFocus, tfuiCallback onFocusLost,
				  bool bFromTemplate = false,
				  const char* tip = GFUI_TPL_TIP,
				  int x = GFUI_TPL_X, int y = GFUI_TPL_Y,
				  int width = GFUI_TPL_WIDTH, int height = GFUI_TPL_HEIGHT)
{
	if (strcmp(GfParmGetStr(hparm, pszPath, GFMNU_ATTR_TYPE, ""), GFMNU_TYPE_IMAGE_BUTTON))
	{
		GfLogError("Failed to create image button control '%s' : section not found or not an '%s'\n",
				   pszPath, GFMNU_TYPE_IMAGE_BUTTON);
		return -1;
	}
        
	const char* pszTip =
		bFromTemplate && tip != GFUI_TPL_TIP
		? tip : GfParmGetStr(hparm, pszPath, GFMNU_ATTR_TIP, "");
	const int nX = 
		bFromTemplate && x != GFUI_TPL_X
		? x : (int)GfParmGetNum(hparm, pszPath, GFMNU_ATTR_X, NULL, 0);
	const int nY = 
		bFromTemplate && y != GFUI_TPL_Y
		? y : (int)GfParmGetNum(hparm, pszPath, GFMNU_ATTR_Y, NULL, 0);
	int nWidth = 
		bFromTemplate && width != GFUI_TPL_WIDTH
		? width : (int)GfParmGetNum(hparm, pszPath, GFMNU_ATTR_WIDTH, NULL, 0);
	int nHeight = 
		bFromTemplate && height != GFUI_TPL_HEIGHT
		? height : (int)GfParmGetNum(hparm, pszPath, GFMNU_ATTR_HEIGHT, NULL, 0);

	if (strlen(pszTip) > 0)
	{
		tMenuCallbackInfo * cbinfo = (tMenuCallbackInfo*)calloc(1, sizeof(tMenuCallbackInfo));
		cbinfo->screen = hscr;
		cbinfo->labelId = GfuiTipCreate(hscr, pszTip, strlen(pszTip));
		GfuiVisibilitySet(hscr, cbinfo->labelId, GFUI_INVISIBLE);

		// TODO: In this case, we crudely overwrite onFocus/onFocusLost !
		userDataOnFocus = (void*)cbinfo;
		onFocus = onFocusShowTip;
		onFocusLost = onFocusLostHideTip;
	}

	const char* pszDisabledImage = GfParmGetStr(hparm, pszPath, GFMNU_ATTR_IMAGE_DISABLED, "");
	const char* pszEnabledImage = GfParmGetStr(hparm, pszPath, GFMNU_ATTR_IMAGE_ENABLED, "");
	const char* pszFocusedImage = GfParmGetStr(hparm, pszPath, GFMNU_ATTR_IMAGE_FOCUSED, "");
	const char* pszPushedImage = GfParmGetStr(hparm, pszPath, GFMNU_ATTR_IMAGE_PUSHED, "");

	int butId =
		GfuiGrButtonCreate(hscr,
						   pszDisabledImage, pszEnabledImage, pszFocusedImage, pszPushedImage,
						   nX, nY, nWidth, nHeight, GFUI_MIRROR_NONE, true, GFUI_MOUSE_UP,
						   userDataOnPush, onPush,
						   userDataOnFocus, onFocus, onFocusLost);

	return butId;
}
Beispiel #3
0
int 
GfuiMenuCreateProgressbarControl(void* hscr, void* hparm, const char* pszName)
{
	std::string strControlPath(GFMNU_SECT_DYNAMIC_CONTROLS"/");
	strControlPath += pszName;
	
	const std::string strType = GfParmGetStr(hparm, strControlPath.c_str(), GFMNU_ATTR_TYPE, "");
	if (strType != GFMNU_TYPE_PROGRESS_BAR)
	{
		GfLogError("Failed to create control '%s' : section not found or not an '%s' \n",
				   pszName, GFMNU_TYPE_PROGRESS_BAR);
		return -1;
	}
	
	const char* pszImage =
		GfParmGetStr(hparm, strControlPath.c_str(), GFMNU_ATTR_IMAGE, "data/img/progressbar.png");
	const char* pszBgImage =
		GfParmGetStr(hparm, strControlPath.c_str(), GFMNU_ATTR_BG_IMAGE, "data/img/progressbar-bg.png");
	
	const float* aOutlineColor = 0;
	const GfuiColor color = getControlColor(hparm, strControlPath.c_str(), GFMNU_ATTR_COLOR);
	if (color.alpha)
		aOutlineColor = color.toFloatRGBA();

	const int x = (int)GfParmGetNum(hparm, strControlPath.c_str(), GFMNU_ATTR_X, NULL, 0.0);
	const int y = (int)GfParmGetNum(hparm, strControlPath.c_str(), GFMNU_ATTR_Y, NULL, 0.0);
	const int w = (int)GfParmGetNum(hparm, strControlPath.c_str(), GFMNU_ATTR_WIDTH, NULL, 100.0);
	const int h = (int)GfParmGetNum(hparm, strControlPath.c_str(), GFMNU_ATTR_HEIGHT, NULL, 20.0);
	
	const float min = GfParmGetNum(hparm, strControlPath.c_str(), GFMNU_ATTR_MIN, NULL, 0.0);
	const float max = GfParmGetNum(hparm, strControlPath.c_str(), GFMNU_ATTR_MAX, NULL, 100.0);
	const float value = GfParmGetNum(hparm, strControlPath.c_str(), GFMNU_ATTR_VALUE, NULL, 50.0);
	
	const char* pszTip = GfParmGetStr(hparm, strControlPath.c_str(), GFMNU_ATTR_TIP, "");
	
	void* userDataOnFocus = 0;
	tfuiCallback onFocus = 0;
	tfuiCallback onFocusLost = 0;
	if (strlen(pszTip) > 0)
	{
		tMenuCallbackInfo * cbinfo = (tMenuCallbackInfo*)calloc(1, sizeof(tMenuCallbackInfo));
		cbinfo->screen = hscr;
		cbinfo->labelId = GfuiTipCreate(hscr, pszTip, strlen(pszTip));
		GfuiVisibilitySet(hscr, cbinfo->labelId, GFUI_INVISIBLE);
		
		userDataOnFocus = (void*)cbinfo;
		onFocus = onFocusShowTip;
		onFocusLost = onFocusLostHideTip;
	}

	int id = GfuiProgressbarCreate(hscr, x, y, w, h, pszBgImage, pszImage, aOutlineColor,
								   min, max, value, userDataOnFocus, onFocus, onFocusLost);
	
	return id;
}
Beispiel #4
0
/** Add a button to a menu screen.
    @ingroup	gui
    @param	scr		Screen (menu) handle
    @param	text		Text of the button
    @param	tip		Text of the tip displayed when the button is focused
    @param	userdata	Parameter of the Push function
    @param	onpush		Callback when the button is pushed
    @return	Button Id
 */
int
GfuiMenuButtonCreate(void *scr, char *text, char *tip, void *userdata, tfuiCallback onpush)
{
    tMnuCallbackInfo	*cbinfo;
    int			xpos, ypos;
    int			nbItems = ((tGfuiScreen*)scr)->nbItems++;
    int			bId;

    if (nbItems < 11) {
	xpos = 320;
	ypos = 380 - 30 * nbItems;
    } else {
	if (nbItems > 22) {
	    GfTrace("Too many items in that menu !!!\n");
	    return -1;
	}
	xpos = 380;
	ypos = 380 - 30 * (nbItems - 11);
    }

    cbinfo = (tMnuCallbackInfo*)calloc(1, sizeof(tMnuCallbackInfo));
    cbinfo->screen = scr;
    cbinfo->labelId = GfuiTipCreate(scr, tip, strlen(tip));

    GfuiVisibilitySet(scr, cbinfo->labelId, 0);
    
    bId = GfuiButtonCreate(scr,
			   text,
			   GFUI_FONT_LARGE,
			   xpos, ypos, GFUI_BTNSZ, GFUI_ALIGN_HC_VB, 0,
			   userdata, onpush,
			   (void*)cbinfo, dispInfo,
			   remInfo);

    return bId;
}
Beispiel #5
0
int 
GfuiMenuCreateCheckboxControl(void* hscr, void* hparm, const char* pszName,void* userData,tfuiCheckboxCallback onChange)
{
	std::string strControlPath(GFMNU_SECT_DYNAMIC_CONTROLS"/");
	strControlPath += pszName;

	const std::string strType = GfParmGetStr(hparm, strControlPath.c_str(), GFMNU_ATTR_TYPE, "");
	if (strType != GFMNU_TYPE_CHECK_BOX)
	{
		GfLogError("Failed to create control '%s' : section not found or not an '%s' \n",
				   pszName, GFMNU_TYPE_CHECK_BOX);
		return -1;
	}

	int id = -1;
	
	const int x = (int)GfParmGetNum(hparm, strControlPath.c_str(), GFMNU_ATTR_X, NULL, 0.0);
	const int y = (int)GfParmGetNum(hparm, strControlPath.c_str(), GFMNU_ATTR_Y, NULL, 0.0);

	std::string strFontName = GfParmGetStr(hparm, strControlPath.c_str(), GFMNU_ATTR_FONT, "");
	const int font = gfuiMenuGetFontId(strFontName.c_str());

    const char* pszText = GfParmGetStr(hparm, strControlPath.c_str(), GFMNU_ATTR_TEXT, "");

	int imagewidth =
		(int)GfParmGetNum(hparm, strControlPath.c_str(), GFMNU_ATTR_IMAGE_WIDTH, NULL, 0.0);
	if (imagewidth <= 0)
	    imagewidth = 30; // TODO: Get default from screen.xml

	int imageheight =
		(int)GfParmGetNum(hparm, strControlPath.c_str(), GFMNU_ATTR_IMAGE_HEIGHT, NULL, 0.0);
	if (imageheight <= 0)
	    imageheight = 30; // TODO: Get default from screen.xml

    const bool bChecked =
		getControlBoolean(hparm, strControlPath.c_str(), GFMNU_ATTR_CHECKED, false);

	const char* pszTip = GfParmGetStr(hparm, strControlPath.c_str(), GFMNU_ATTR_TIP, "");
	
	void* userDataOnFocus = 0;
	tfuiCallback onFocus = 0;
	tfuiCallback onFocusLost = 0;
	if (strlen(pszTip) > 0)
	{
		tMenuCallbackInfo * cbinfo = (tMenuCallbackInfo*)calloc(1, sizeof(tMenuCallbackInfo));
		cbinfo->screen = hscr;
		cbinfo->labelId = GfuiTipCreate(hscr, pszTip, strlen(pszTip));
		GfuiVisibilitySet(hscr, cbinfo->labelId, GFUI_INVISIBLE);
		
		userDataOnFocus = (void*)cbinfo;
		onFocus = onFocusShowTip;
		onFocusLost = onFocusLostHideTip;
	}


	id = GfuiCheckboxCreate(hscr, font, x, y, imagewidth, imageheight,
							pszText, bChecked, userData, onChange,
							userDataOnFocus, onFocus, onFocusLost);

	GfuiColor c = getControlColor(hparm, pszName, GFMNU_ATTR_COLOR);
	if (c.alpha)
		GfuiCheckboxSetTextColor(hscr, id, c);

	return id;
}
Beispiel #6
0
int 
GfuiMenuCreateComboboxControl(void* hscr, void* hparm, const char* pszName,
							  void* userData, tfuiComboboxCallback onChange)
{
	std::string strControlPath(GFMNU_SECT_DYNAMIC_CONTROLS"/");
	strControlPath += pszName;

	const std::string strType = GfParmGetStr(hparm, strControlPath.c_str(), GFMNU_ATTR_TYPE, "");
	if (strType != GFMNU_TYPE_COMBO_BOX)
	{
		GfLogError("Failed to create control '%s' : section not found or not an '%s' \n",
				   pszName, GFMNU_TYPE_COMBO_BOX);
		return -1;
	}

	int id = -1;
	
	const int x = (int)GfParmGetNum(hparm,strControlPath.c_str(), GFMNU_ATTR_X, NULL, 0.0);
	const int y = (int)GfParmGetNum(hparm,strControlPath.c_str(), GFMNU_ATTR_Y, NULL, 0.0);

	std::string strFontName = GfParmGetStr(hparm, strControlPath.c_str(), GFMNU_ATTR_FONT, "");
	const int font = gfuiMenuGetFontId(strFontName.c_str());

	int width = (int)GfParmGetNum(hparm,strControlPath.c_str(), GFMNU_ATTR_WIDTH, NULL, 0.0);
	if (width == 0)
	    width = 200;

	const int nArrowsWidth = (int)GfParmGetNum(hparm, strControlPath.c_str(), GFMNU_ATTR_ARROWS_WIDTH, NULL, 0);
	const int nArrowsHeight = (int)GfParmGetNum(hparm, strControlPath.c_str(), GFMNU_ATTR_ARROWS_HEIGHT, NULL, 0);

    const char* pszText = GfParmGetStr(hparm, strControlPath.c_str(), GFMNU_ATTR_TEXT, "");

	const int maxlen = (int)GfParmGetNum(hparm, strControlPath.c_str(), GFMNU_ATTR_MAX_LEN, 0, 0);

	const char* pszTip = GfParmGetStr(hparm, strControlPath.c_str(), GFMNU_ATTR_TIP, 0);
	
	void* userDataOnFocus = 0;
	tfuiCallback onFocus = 0;
	tfuiCallback onFocusLost = 0;
	if (pszTip && strlen(pszTip) > 0)
	{
		tMenuCallbackInfo * cbinfo = (tMenuCallbackInfo*)calloc(1, sizeof(tMenuCallbackInfo));
		cbinfo->screen = hscr;
		cbinfo->labelId = GfuiTipCreate(hscr, pszTip, strlen(pszTip));
		GfuiVisibilitySet(hscr, cbinfo->labelId, GFUI_INVISIBLE);
		
		userDataOnFocus = (void*)cbinfo;
		onFocus = onFocusShowTip;
		onFocusLost = onFocusLostHideTip;
	}

	const float* aColor = 0;
	const GfuiColor color = getControlColor(hparm, strControlPath.c_str(), GFMNU_ATTR_COLOR);
	if (color.alpha)
		aColor = color.toFloatRGBA();
	
	const float* aFocusColor = 0;
	const GfuiColor focusColor =
		getControlColor(hparm, strControlPath.c_str(), GFMNU_ATTR_COLOR_FOCUSED);
	if (focusColor.alpha)
		aFocusColor = focusColor.toFloatRGBA();
	
	id = GfuiComboboxCreate(hscr, font, x, y, width, nArrowsWidth, nArrowsHeight,
							pszText, maxlen, aColor, aFocusColor,
							userData, onChange, userDataOnFocus, onFocus, onFocusLost);

	return id;
}
Beispiel #7
0
static int 
createTextButton(void* hscr, void* hparm, const char* pszPath,
				 void* userDataOnPush, tfuiCallback onPush,
				 void* userDataOnFocus, tfuiCallback onFocus, tfuiCallback onFocusLost,
				 bool bFromTemplate = false,
				 const char* text = GFUI_TPL_TEXT,
				 const char* tip = GFUI_TPL_TIP,
				 int x = GFUI_TPL_X, int y = GFUI_TPL_Y,
				 int width = GFUI_TPL_WIDTH,
				 int font = GFUI_TPL_FONTID, int textHAlign = GFUI_TPL_ALIGN,
				 const float* aFgColor = GFUI_TPL_COLOR,
				 const float* aFgFocusColor = GFUI_TPL_FOCUSCOLOR,
				 const float* aFgPushedColor = GFUI_TPL_PUSHEDCOLOR)
{
	if (strcmp(GfParmGetStr(hparm, pszPath, GFMNU_ATTR_TYPE, ""), GFMNU_TYPE_TEXT_BUTTON))
	{
		GfLogError("Failed to create text button control '%s' : section not found or not a '%s'\n",
				   pszPath, GFMNU_TYPE_TEXT_BUTTON);
		return -1;
	}
        
	const char* pszText =
		bFromTemplate && text != GFUI_TPL_TEXT
		? text : GfParmGetStr(hparm, pszPath, GFMNU_ATTR_TEXT, "");
	const char* pszTip =
		bFromTemplate && tip != GFUI_TPL_TIP
		? tip : GfParmGetStr(hparm, pszPath, GFMNU_ATTR_TIP, "");
	const int nX = 
		bFromTemplate && x != GFUI_TPL_X
		? x : (int)GfParmGetNum(hparm, pszPath, GFMNU_ATTR_X, NULL, 0);
	const int nY = 
		bFromTemplate && y != GFUI_TPL_Y
		? y : (int)GfParmGetNum(hparm, pszPath, GFMNU_ATTR_Y, NULL, 0);
	int nWidth = 
		bFromTemplate && width != GFUI_TPL_WIDTH
		? width : (int)GfParmGetNum(hparm, pszPath, GFMNU_ATTR_WIDTH, NULL, 0);
	if (nWidth <= 0)
		nWidth = GFUI_BTNSZ; // TODO: Get default from screen.xml
	const int nFontId = 
		bFromTemplate && font != GFUI_TPL_FONTID
		? font : gfuiMenuGetFontId(GfParmGetStr(hparm, pszPath, GFMNU_ATTR_FONT, ""));
	const char* pszAlignH = GfParmGetStr(hparm, pszPath, GFMNU_ATTR_H_ALIGN, "");
	//const char* pszAlignV = GfParmGetStr(hparm, pszPath, GFMNU_ATTR_V_ALIGN, "");
	const int nAlign = 
		bFromTemplate && textHAlign != GFUI_TPL_ALIGN
		? textHAlign : gfuiMenuGetAlignment(pszAlignH); //, pszAlignV);
	
	GfuiColor color;
	const float* aColor = 0;
	if (bFromTemplate && aFgColor != GFUI_TPL_COLOR)
		aColor = aFgColor;
	else
	{
		color = getControlColor(hparm, pszPath, GFMNU_ATTR_COLOR);
		if (color.alpha)
			aColor = color.toFloatRGBA();
	}

	GfuiColor focusColor;
	const float* aFocusColor = 0;
	if (bFromTemplate && aFgFocusColor != GFUI_TPL_FOCUSCOLOR)
		aFocusColor = aFgFocusColor;
	else
	{
		focusColor = getControlColor(hparm, pszPath, GFMNU_ATTR_COLOR_FOCUSED);
		if (focusColor.alpha)
			aFocusColor = focusColor.toFloatRGBA();
	}

	GfuiColor pushedColor;
	const float* aPushedColor = 0;
	if (bFromTemplate && aFgPushedColor != GFUI_TPL_PUSHEDCOLOR)
		aPushedColor = aFgPushedColor;
	else
	{
		pushedColor = getControlColor(hparm, pszPath, GFMNU_ATTR_COLOR_PUSHED);
		if (pushedColor.alpha)
			aPushedColor = pushedColor.toFloatRGBA();
	}

	if (pszTip && strlen(pszTip) > 0)
	{
		tMenuCallbackInfo * cbinfo = (tMenuCallbackInfo*)calloc(1, sizeof(tMenuCallbackInfo));
		cbinfo->screen = hscr;
		cbinfo->labelId = GfuiTipCreate(hscr, pszTip, strlen(pszTip));
		GfuiVisibilitySet(hscr, cbinfo->labelId, GFUI_INVISIBLE);

		// TODO: In this case, we crudely overwrite onFocus/onFocusLost !
		userDataOnFocus = (void*)cbinfo;
		onFocus = onFocusShowTip;
		onFocusLost = onFocusLostHideTip;
	}

	const bool bShowbox = getControlBoolean(hparm, pszPath, GFMNU_ATTR_BOX_SHOW, true);

	const char* pszDisabledImage = GfParmGetStr(hparm, pszPath, GFMNU_ATTR_IMAGE_DISABLED, 0);
	const char* pszEnabledImage = GfParmGetStr(hparm, pszPath, GFMNU_ATTR_IMAGE_ENABLED, 0);
	const char* pszFocusedImage = GfParmGetStr(hparm, pszPath, GFMNU_ATTR_IMAGE_FOCUSED, 0);
	const char* pszPushedImage = GfParmGetStr(hparm, pszPath, GFMNU_ATTR_IMAGE_PUSHED, 0);

	const int imgX = (int)GfParmGetNum(hparm, pszPath, GFMNU_ATTR_IMAGE_X, NULL, 0.0);
	const int imgY = (int)GfParmGetNum(hparm, pszPath, GFMNU_ATTR_IMAGE_Y, NULL, 0.0);
	const int imgWidth = (int)GfParmGetNum(hparm, pszPath, GFMNU_ATTR_IMAGE_WIDTH, NULL, 20.0);
	const int imgHeight = (int)GfParmGetNum(hparm, pszPath, GFMNU_ATTR_IMAGE_HEIGHT, NULL, 20.0);

	int butId = GfuiButtonCreate(hscr, pszText, nFontId,
								 nX, nY, nWidth, nAlign, GFUI_MOUSE_UP,
								 userDataOnPush, onPush,
								 userDataOnFocus, onFocus, onFocusLost);

	GfuiButtonShowBox(hscr, butId, bShowbox);

	if (pszDisabledImage || pszEnabledImage || pszFocusedImage || pszPushedImage)
		GfuiButtonSetImage(hscr, butId, imgX, imgY, imgWidth, imgHeight,
						   pszDisabledImage, pszEnabledImage,
						   pszFocusedImage, pszPushedImage);

	GfuiButtonSetColors(hscr, butId,
						GfuiColor::build(aColor), GfuiColor::build(aFocusColor),
						GfuiColor::build(aPushedColor));
        
	return butId;
}
Beispiel #8
0
static int 
createLabel(void* hscr, void* hparm, const char* pszPath,
			bool bFromTemplate = false,
			const char* text = GFUI_TPL_TEXT, int x = GFUI_TPL_X, int y = GFUI_TPL_Y,
			int font = GFUI_TPL_FONTID, int width = GFUI_TPL_WIDTH, int hAlign = GFUI_TPL_ALIGN,
			int maxlen = GFUI_TPL_MAXLEN, 
			const float* aFgColor = GFUI_TPL_COLOR,
			const float* aFgFocusColor = GFUI_TPL_FOCUSCOLOR)
{
	if (strcmp(GfParmGetStr(hparm, pszPath, GFMNU_ATTR_TYPE, ""), GFMNU_TYPE_LABEL))
	{
		GfLogError("Failed to create label control '%s' : section not found or not a '%s'\n",
				   pszPath, GFMNU_TYPE_LABEL);
		return -1;
	}
        
	const char* pszText =
		bFromTemplate && text != GFUI_TPL_TEXT
		? text : GfParmGetStr(hparm, pszPath, GFMNU_ATTR_TEXT, "");
	const int nX = 
		bFromTemplate && x != GFUI_TPL_X
		? x : (int)GfParmGetNum(hparm, pszPath, GFMNU_ATTR_X, NULL, 0);
	const int nY = 
		bFromTemplate && y != GFUI_TPL_Y
		? y : (int)GfParmGetNum(hparm, pszPath, GFMNU_ATTR_Y, NULL, 0);
	const int nWidth =
		bFromTemplate && width != GFUI_TPL_WIDTH
		? width : (int)GfParmGetNum(hparm, pszPath, GFMNU_ATTR_WIDTH, NULL, 0);
	const int nFontId = 
		bFromTemplate && font != GFUI_TPL_FONTID
		? font : gfuiMenuGetFontId(GfParmGetStr(hparm, pszPath, GFMNU_ATTR_FONT, ""));
	const char* pszAlignH = GfParmGetStr(hparm, pszPath, GFMNU_ATTR_H_ALIGN, "");
	//const char* pszAlignV = GfParmGetStr(hparm, pszPath, GFMNU_ATTR_V_ALIGN, "");
	const int nAlign = 
		bFromTemplate && hAlign != GFUI_TPL_ALIGN
		? hAlign : gfuiMenuGetAlignment(pszAlignH); //, pszAlignV);
	int nMaxLen = 
		bFromTemplate && maxlen != GFUI_TPL_MAXLEN
		? maxlen : (int)GfParmGetNum(hparm, pszPath, GFMNU_ATTR_MAX_LEN, NULL, 0);
	
	GfuiColor color;
	const float* aColor = 0;
	if (bFromTemplate && aFgColor != GFUI_TPL_COLOR)
		aColor = aFgColor;
	else
	{
		color = getControlColor(hparm, pszPath, GFMNU_ATTR_COLOR);
		if (color.alpha)
			aColor = color.toFloatRGBA();
	}

	GfuiColor focusColor;
	const float* aFocusColor = 0;
	if (bFromTemplate && aFgFocusColor != GFUI_TPL_FOCUSCOLOR)
		aFocusColor = aFgFocusColor;
	else
	{
		focusColor = getControlColor(hparm, pszPath, GFMNU_ATTR_COLOR_FOCUSED);
		if (focusColor.alpha)
			aFocusColor = focusColor.toFloatRGBA();
	}

	void* userDataOnFocus = 0;
	tfuiCallback onFocus = 0;
	tfuiCallback onFocusLost = 0;
	const char* pszTip = GfParmGetStr(hparm, pszPath, GFMNU_ATTR_TIP, 0);
	if (pszTip && strlen(pszTip) > 0)
	{
		tMenuCallbackInfo * cbinfo = (tMenuCallbackInfo*)calloc(1, sizeof(tMenuCallbackInfo));
		cbinfo->screen = hscr;
		cbinfo->labelId = GfuiTipCreate(hscr, pszTip, strlen(pszTip));
		GfuiVisibilitySet(hscr, cbinfo->labelId, GFUI_INVISIBLE);

		userDataOnFocus = (void*)cbinfo;
		onFocus = onFocusShowTip;
		onFocusLost = onFocusLostHideTip;
	}

	int labelId = GfuiLabelCreate(hscr, pszText, nFontId, nX, nY, nWidth, nAlign, nMaxLen,
								  aColor, aFocusColor, userDataOnFocus, onFocus, onFocusLost);

    return labelId;
}