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

本文档详细介绍了UEFI环境下Setup设置界面的表单集、表单、变量存储、跳转、显示文本以及用户交互元素如复选框、选项列表、数值输入和密码输入等的定义和用法,涉及各个元素的属性、帮助文本和用户界面交互逻辑。
摘要由CSDN通过智能技术生成

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;

UiListThirdPartyDrivers是edk2中的一个用户界面控件,用于显示第三方驱动程序列表。要使用它,你需要遵循以下步骤: 1. 在你的edk2工程中创建一个新的表单文件(.fdf)或在现有的表单文件中添加一个新的表单页。 2. 在表单页中添加UiListThirdPartyDrivers控件。你可以使用以下代码片段添加该控件: ``` <Form> <Guid>YOUR_FORM_GUID_HERE</Guid> <Title>Your Form Title</Title> <SuppressIfDisabled>false</SuppressIfDisabled> <FormData> <Guid>YOUR_FORM_DATA_GUID_HERE</Guid> <Data> ... </Data> </FormData> <SubTitle>Your Form Subtitle</SubTitle> <Ui> <List> <QuestionType>ONE_OF</QuestionType> <QuestionId>YOUR_QUESTION_ID_HERE</QuestionId> <LabelText>Your List Label</LabelText> <HelpText>Your List Help Text</HelpText> <Options> <Option> <Text>Your Option Text</Text> <Value>0</Value> <SuppressIf>FALSE</SuppressIf> </Option> ... </Options> <Default>0</Default> <MaxContainers>0</MaxContainers> <NoSubmitIf>FALSE</NoSubmitIf> <Attributes> <Attribute> <Id>UEFI_LIST_THIRD_PARTY_DRIVERS</Id> <Value>TRUE</Value> </Attribute> </Attributes> </List> </Ui> </Form> ``` 3. 在你的edk2应用程序中处理表单提交事件,并从提交表单数据中获取用户选择的第三方驱动程序列表。你可以使用以下代码片段来处理表单提交事件: ``` EFI_STATUS EFIAPI YourFormSubmitHandler ( IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN CONST EFI_STRING Configuration, OUT EFI_STRING *Progress ) { ... EFI_STRING Value; // Get user selection from the submitted form data Value = HiiGetConfigString ( &This->ConfigAccess, Configuration, L"YOUR_QUESTION_ID_HERE" ); ... } ``` 希望这可以帮助你开始使用UiListThirdPartyDrivers控件。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值