Copyright 2010-2017 Obihai Technology, Inc.
129
MainMenu
This parameter servces to customize the
main menu of the phone. The value must
be a valid
<MainMenu>
<item id="phone-book"/>
<item id="calls"/>
<item id="call-history"/>
<item id="sd"
number="14089991234" name="Ben Thomson"
/>
<item id="sd"
number="14089991234" name="Ben Thomson"
/>
</MainMenu>
MainMenuItem
Styles
<MainMenuItemStyles>
<style id="default" bgimg="" hlimg=""
bgcolor="" hlcolor="">
<icon width="20" height="20"
xpos="" ypos=""/>
<icon2 width="20" height="20"
xpos="" ypos=""/>
</style>
</MainMenuItemStyles>
In addition to the above, a <ScreenItem> XML can also be used to customize a MenuItem in an OBiPhone XML App: The
<ScreenItem> in that case would be defined dynamically in a CDATA block of the corresponding XML App page.
Using $Macros and @Macros inside XML
Using macros in the XML extends the reusability of the XML for different situations. There are two flavors of macros:
variables
with macro names that start with $ and
constants
with macro names that start with @. A $Macro may
represent the value of a configuration parameter, an internal state, or other user assigned value. A @Macro may
represent a system level constant (that could be different per device model, per GUI Skin, etc.). If the $macro name
contains characters that are not (asci or dot (.))
$eval(
expression
)
$Eval is a special macro that evaluates the given expression at run time to produce a result. It must be followed by the
expression to evaluate inside parentheses. For example:
-
$eval({$pic}==)
evaluates to "1" if $pic expands into an empty string, or "0" otherwise.
-
$eval($nitems<2)
evalutes to "1" if $nitems expands into a string that is numerically less than 2 numerically,
or "0" otherwise
This expression is evaluated left to right recursively, starting from the innermost paretheses, to produce a final result
that is a simple string without any more operators. The final result can be an empty string. An expression is made up of
one, two, or three operands according to the operator. An operand can be the result of a sub-expression which must be
enclosed inside a pair of paretheses. Here are some examples:
-
$eval(($name==)?Anonymous:$call.name)
-
$eval(({$name}==)?{Out Of Area},({$name}==anonymous)?Restricted:{$name})
If an operand contains one or more macros, the macros are fully expanded before the expression is evaluated. The
operand after any necessary macro expansion, may contain any characters including white spaces if it is enclosed in
braces {}. Otherwise, it can only contain alphanumeric, UTF-8 charaters,
'@'
,
'.'
,
'/'
, and
'_'
. Extra white
spaces are allowed in the expression. If the value of a macro cannot be determined, it is a good practice to always
enclose operands containing macros with { }.
For instance one could use
$eval()
in a
display
attribute to show just one of several overlapping elements where the
expressions would evaluate to "1" for one and only one of the elements. For example: only one of the following
elements, <span display="
$eval({$pic}==)"
> and <span display="
$eval({$pic!}=)"
>, will be shown. Similarly for <span
display="
$eval($nitems<2)"
>
and <span display="
eval($nitems>1)"
>.
The following table lists the operators that are currently available.