def menus(doc, id, label="Options", xstyle=nil)
@view_buffer << "<m:menu id=\"#{id}\" height=\"0\""
if xstyle
@view_buffer << " #{xstyle}>"
else
@view_buffer << " width=\"40%\" style=\"popup-menu\">"
end
@view_buffer << "<m:hstack height=\"1ex\" style=\"title\"><m:icon>jar://img/option.png</m:icon>"
@view_buffer << "<m:output style=\"option\">#{label}</m:output></m:hstack>"
@accesskey=0
@view_buffer << "<m:itemlist height=\"0\" style=\"menu\"> "
yield doc
@view_buffer << "</m:itemlist>"
@view_buffer << "<m:softkey position=\"3\"/>
<m:softkey position=\"1\"><m:hide-popup ev:event=\"DOMActivate\" refid=\"#{id}\" />
<m:label>Close</m:label></m:softkey></m:menu>"
end