2.3.1.35 GETN_FONT


Name

GETN_FONT

Declaration

#define GETN_FONT(_NODE_NAME, _NODE_LABEL, _DEFAULT_VAL) _tmpSubNode = _tmpNode.AddNumericNode(_DEFAULT_VAL, #_NODE_NAME, ONODETYPE_DROPLIST_FONTS);TREE_ADD_LABEL(_NODE_LABEL);

Remark

This macro creates a font combo list in the dialogbox.

Parameters

_NODE_NAME
[input] the name of the new node to be added to the tree
_NODE_LABEL
[input] the string value to show as the node label in the dialogbox
_DEFAULT_VAL
[input] default showing font.

Return

Examples

EX1

void FONT_Example()
{
	//font name list 
	out_str("Font List:");
	vector<string> vsNames;	
	int nSize = GetFontNames(&vsNames);
	for(int ii = 0; ii < min(10, nSize); ii++)//show no more than 10 names
		out_str( vsNames[ii] );
	
	//name of font
	int nIndex = 4;
	out_str( "\nInput Font = " + GetFontNameByIndex(nIndex) );
	
	//convert between font index and font DWORD
    GETN_TREE(testTree)
    GETN_FONT(Face, "face", FontFaceIndex_to_DWORD(nIndex))        
    if(GetNBox(testTree))
    {
    	int nSel = FontFaceDWORD_to_Index(testTree.Face.nVal);
    	out_str( "User's Font = " + GetFontNameByIndex(nSel) );
    }
}

See Also

GetFontNames
GetFontNameByIndex
FontFaceIndex_to_DWORD
FontFaceDWORD_to_Index

Header to Included

GetNBox.h

Reference