Bootstrap

UEFI原理与编程实践--GUI之Setup界面分析一

formset &endformset

表单集,Setup设置界面的一个页面,该页面内的内容都需要放在表单集内

Example:
	formset guid  = MAIN_FORM_SET_GUID,
    	title     = STRING_TOKEN(STR_MAIN),
    	help      = STRING_TOKEN(STR_MAIN_HELP),
    	class     = MAIN_FORM_SET_CLASS,
    	subclass  = 0,
		….
	endformset;

Definitions:
guid: GUID for this formset.
title: Title strings for this formset.
help: help strings for this formset.
class and subclass: can be used for DXE driver.

form & endform

表单,包含在表单集内:

form formid = AUTO_ID(MAIN_MAIN),
        title = STRING_TOKEN(STR_MAIN);
	…..	
	endform.

varstore

用于定义设置选项将引用的变量,varstore语法需要放在formsetform之间

varstore VARIABLE_STRUCTURE,
        key/varid   = VARIABLE_ID,
        name  = VARIABLE_NAME,
        guid  = VARIABLE_GUID;

VARIABLE_STRUCTURE:保存setup variable的一个结构体

VARIABLE_ID:EFI_VARSTORE_ID  VarStoreId使用

VARIABLE_NAME:相当于结构体的定义:VARIABLE_STRUCTURE  VARIABLE_NAME

VARIABLE_NAME.OnboardVGA=1;

goto

用于转到另一个表单页面,就像超链接一样,转到表单和尾页之间。

Example:
	goto FORM_ID, 
	prompt = STRING_TOKEN(STR_FORM),
	help = STRING_TOKEN(STR_FORM_HELP);
	Definitions:
		FORM_ID: define which form will display.
		prompt: Strings for the goto syntax’s Name.
		help: help strings.

subtitle

用于在页面中显示字符串,需要放在表单和尾端表单之间。

Example:
	subtitle text = STRING_TOKEN(STR_SUB_TITLE);
	Definitions:
		text: text strings which will display.

text 

用于在页面中显示文本字符串,需要放在表单和尾端表单之间

Example:
     text 
        help   = STRING_TOKEN(STR_MEMORY_SIZE_HELP),
        text   = STRING_TOKEN(STR_MEMORY_SIZE_NAME),
        text   = STRING_TOKEN(STR_MEMORY_SIZE_VALUE),
        flags  = 0,
        key    = 0;
	Definitions:
		help: help strings.
		text: Text string in left side.
		text: Text string value in right side, usually will be updated in each boot.
		flags: used for special control, like dynamic text.
		key: used for special control.

subtitle->text,相当于分支,这种就是单纯的显示字符串,不可更改

subtitle text = STRING_TOKEN(STR_SUB_TITLE);
   
    text 
        help   = STRING_TOKEN(STR_MEMORY_SIZE_HELP),
        text   = STRING_TOKEN(STR_MEMORY_SIZE_NAME),
        text   = STRING_TOKEN(STR_MEMORY_SIZE_VALUE),
        flags  = 0,
        key    = 0;

checkbox & endcheckbox

用于创建一个复选框,让用户选择是或否,需要将其置于表单和结束表单之间。

 checkbox varid  = SETUP_DATA.OnboardVGA,
        prompt = STRING_TOKEN(STR_ONBOARD_VGA_PROMPT),
        help = STRING_TOKEN(STR_ONBOARD_VGA_PROMPT_HELP),
        flags = 1, 
    endcheckbox;


Definitions:
		varid: reference variable for this checkbox question.
		prompt: name for the checkbox.
		help: help strings.
		flags: default value for this question, 1=On 0=Off.

oneof & endoneof

用于创建具有更多选择的选项

oneof varid   = SETUP_DATA.Value,
        prompt    = STRING_TOKEN(STR_PROMPT),
        help      = STRING_TOKEN(STR_HELP),
        option
            text  = STRING_TOKEN(STR_OPTION1),
            value = 0,
            flags = DEFAULT;
        option
            text  = STRING_TOKEN(STR_OPTION2),
            value = 1,
            flags = 0;
    endoneof;
	Definitions:
		varid: variable which referenced by this question.
		prompt: question name string.
		help: help strings for this question.
		option: option start syntax.
		text: text strings for this option.
		value: variable value, which will be write into NVRAM.
		flags: used to define the state for this option, 0 means nothing, set to 				DEFAULT will let this option become a default setting.

 grayoutif & suppressif

用于item的变灰不可选以及是否隐藏

ideqval:如果变量的值等于某个值,则表示变灰或者隐藏。

以endif结束

suppressif ideqval SETUP_DATA.UsbLockHide == 1;
            oneof   varid   = SETUP_DATA.Usb,
              prompt = STRING_TOKEN(STR_ALL_USBPORTS_PROMPT),
              help= STRING_TOKEN(STR_ALL_USBPORTS_HELP),
              option 
				text = STRING_TOKEN(STR_DISABLE), 
			  	value=1,
              	flags=0 | RESET_REQUIRED;
              option 
				text = STRING_TOKEN(STR_ENABLE), 
				value=0,
 				flags=DEFAULT | MANUFACTURING | RESET_REQUIRED;
            endoneof;
        endif;

numeric & endnumeric

用于创建允许用户输入数字的字段,也就是说可以设置数字,不过最多不大于65535

numeric varid = TIMEOUT.Value,
            prompt    = STRING_TOKEN(STR_BOOT_TIMEOUT),
            help      = STRING_TOKEN(STR_BOOT_TIMEOUT_HELP),
            minimum   = 0x1,
            maximum   = 0xffff,
            step      = 1,
            default   = DEFAULT_BOOT_TIMEOUT,
        endnumeric;
	Definitions:
		prompt: Name string for this question.
		help: help string for this question.
		minimum: minimum number of this question.
		maximum: maximum number of this question.
		step: step for this question.
		default: default value.

password & endpassword

用于为输入密码创建字段

 password varid  = AMITSESETUP.AdminPassword,
           prompt      = STRING_TOKEN(STR_ADMIN_PASSWORD),
           help       = STRING_TOKEN(STR_ADMIN_PASSWORD_HELP),
           flags       = 0,
           minsize     = 0,
           maxsize     = PASSWORD_MAX_SIZE,
           encoding    = 1,
       endpassword;
	Definitions:
		minsize: minimum length for the password.
		maxsize: maximum length for the password.
		encoding: encoding or not, 1 = enable encoding.

LABEL

用于指向VFR文件中的地址,然后DXE驱动程序可以在VFR文件中的指定位置动态添加或修改item。

label LABEL_NETWORK_DEVICE_LIST_ID;
label LABEL_END;

;