public SelectMenu( String name, String caption, Real width, Real boxWidth, int maxItemsShown )
{
items = new List<string>();
itemElements = new List<BorderPanel>();
this.sectionIndex = -1;
this.isFitToContents = false;
this.IsCursorOver = false;
this.isExpanded = false;
this.isDragging = false;
this.maxItemsShown = maxItemsShown;
this.itemsShown = 0;
element = (BorderPanel)OverlayManager.Instance.Elements.CreateElementFromTemplate
( "SdkTrays/SelectMenu", "BorderPanel", name );
this.textArea = (TextArea)( (OverlayElementContainer)element ).Children[ name + "/MenuCaption" ];
this.smallBox = (BorderPanel)( (OverlayElementContainer)element ).Children[ name + "/MenuSmallBox" ];
this.smallBox.Width = width - 10;
this.smallTextArea = (TextArea)this.smallBox.Children[ name + "/MenuSmallBox/MenuSmallText" ];
element.Width = width;
if ( boxWidth > 0 ) // long style
{
if ( width <= 0 )
this.isFitToContents = true;
this.smallBox.Width = boxWidth;
this.smallBox.Top = 2;
this.smallBox.Left = width - boxWidth - 5;
element.Height = this.smallBox.Height + 4;
this.textArea.HorizontalAlignment = HorizontalAlignment.Left;
this.textArea.TextAlign = HorizontalAlignment.Left;
this.textArea.Left = 12;
this.textArea.Top = 10;
}
this.expandedBox = (BorderPanel)( (OverlayElementContainer)element ).Children[ name + "/MenuExpandedBox" ];
this.expandedBox.Width = this.smallBox.Width + 10;
this.expandedBox.Hide();
this.scrollTrack = (BorderPanel)this.expandedBox.Children[ this.expandedBox.Name + "/MenuScrollTrack" ];
this.scrollHandle = (Panel)this.scrollTrack.Children[ this.scrollTrack.Name + "/MenuScrollHandle" ];
this.Caption = caption;
}