Menus can have sub-menus.
Very often specifications of Styles for a Menu having sub levels will be different from one level of the Menu to another.
dFrameAPI allow to set different values for different levels. They have to be set in an array:
menuStyle.setBordersWidth(1)
will set this parameter for all levels.
menuStyle.setBordersWidth([1, 2, 3])
will set the value 1 for the first level, the value 2 for the second level and the value 3 for the third one and all followings.
If a menu has more levels than the number of parameters the last parameter will be used.
In the same way definitions of properties for Styles of items of a Menu can refer to sublevels:
var menuStyle = new MenuStyle ()
…
//itemsStyle !
var x = new ButtonStyle(buttonStyle)
x.setWidth([150,10])
…
x.setImageNormal([basePathForIcons+'big-Off.gif', basePathForIcons+'small-Off.gif'])
…
menuStyle.setItemsStyle(x)
This features are not valid for two methods and only one value is accepted for all levels:
§ MenuStyle.setArrowImage
§ ButtonStyle.setCloseImage (for items of Menus)
Syntax for images.
The general syntax of methods defining images (setBgImage, setItemsBgImage, setItemsImageXXX and setImageArrowXX) is:
menuStyle.setImageXXX(filePathAndName)
or
menuStyle.setImageXXX(filePathAndName, 'A')
If this syntax is used with an array for different images for different sublevels and uses the 'A' option this option cannot be included in the array and must be outside of it:
style.setImageXXX([filePath1, filePath2, …], 'A')
Demo
file: styleBlue.js, buttonStyle.setImageNormal et buttonStyle.setImageRoll