VerticalMenuControl.getNumberOfLevels

The number of menu levels that will expand vertically. After this, subsequent menu levels will be shown as dynamic dropdowns

Further documentation.

returns int