public override void FinalizeConstruction()
 {
   base.FinalizeConstruction();
   _spinControl = new GUISpinControl(_controlId, 0, _spinControlPositionX, _spinControlPositionY, _spinControlWidth,
                                     _spinControlHeight, _upTextureName, _downTextureName, _upTextureNameFocus,
                                     _downTextureNameFocus, _fontName, _colorSpinColor,
                                     GUISpinControl.SpinType.SPIN_CONTROL_TYPE_INT, Alignment.ALIGN_RIGHT);
   _spinControl.WindowId = WindowId;
   _spinControl.AutoCheck = false;
   _spinControl.ParentControl = this;
 }
 /// <summary>
 /// The constructor of the GUISliderControl.
 /// </summary>
 /// <param name="dwParentID">The parent of this control.</param>
 /// <param name="dwControlId">The ID of this control.</param>
 /// <param name="dwPosX">The X position of this control.</param>
 /// <param name="dwPosY">The Y position of this control.</param>
 /// <param name="dwWidth">The width of this control.</param>
 /// <param name="dwHeight">The height of this control.</param>
 /// <param name="strBackGroundTexture">The background texture of the </param>
 /// <param name="strMidTexture">The unfocused texture.</param>
 /// <param name="strMidTextureFocus">The focused texture</param>
 /// <param name="iType">The type of control.</param>
 public GUISliderControl(int dwParentID, int dwControlId, int dwPosX, int dwPosY, int dwWidth, int dwHeight,
                         string strBackGroundTexture, string strMidTexture, string strMidTextureFocus,
                         GUISpinControl.SpinType iType)
   : base(dwParentID, dwControlId, dwPosX, dwPosY, dwWidth, dwHeight)
 {
   _backgroundTextureName = strBackGroundTexture;
   _sliderTextureName = strMidTexture;
   _sliderFocusTextureName = strMidTextureFocus;
   _spinType = iType;
   FinalizeConstruction();
 }
    /*public GUIFilmstripControl(int dwParentID, int dwControlId, int dwPosX, int dwPosY, int dwWidth, int dwHeight, 
      string strFontName, 
      string strImageIcon, 
      string strImageIconFocus, 
      int dwitemWidth, int dwitemHeight, 
      int dwSpinWidth, int dwSpinHeight, 
      string strUp, string strDown, 
      string strUpFocus, string strDownFocus, 
      long dwSpinColor, int dwSpinX, int dwSpinY, 
      string strFont, long dwTextColor, long dwSelectedColor, 
      string strScrollbarBackground, string strScrollbarTop, string strScrollbarBottom)
      : base(dwParentID, dwControlId, dwPosX, dwPosY, dwWidth, dwHeight)
    {
    }*/

    /// <summary> 
    /// This function is called after all of the XmlSkinnable fields have been filled
    /// with appropriate data.
    /// Use this to do any construction work other than simple data member assignments,
    /// for example, initializing new reference types, extra calculations, etc..
    /// </summary>
    public override void FinalizeConstruction()
    {
      base.FinalizeConstruction();
      if (_positionY > _positionY && _spinControlPositionY < _positionY + _height)
      {
        _spinControlPositionY = _positionY + _height;
      }
      for (int i = 0; i < 30; ++i)
      {
        GUIAnimation anim = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _itemWidth,
                                                 _itemHeight, _imageFolderName);
        anim.ParentControl = this;
        anim.DimColor = DimColor;
        anim.FlipX = _flipX;
        anim.FlipY = _flipY;
        anim.DiffuseFileName = _diffuseFileName;
        anim.MaskFileName = _imageFolderMask;
        //anim.SetAnimations(ThumbAnimations);
        _imageFolder.Add(anim);

        anim = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _itemWidth, _itemHeight,
                                    _imageFolderNameFocus);
        anim.ParentControl = this;
        anim.DimColor = DimColor;
        anim.FlipX = _flipX;
        anim.FlipY = _flipY;
        anim.DiffuseFileName = _diffuseFileName;
        anim.MaskFileName = _imageFolderFocusMask;
        //anim.SetAnimations(ThumbAnimations);
        _imageFolderFocus.Add(anim);

        anim = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _itemWidth, _itemHeight,
                                    _frameName);
        anim.ParentControl = this;
        anim.DimColor = DimColor;
        //anim.FlipX = _flipX;
        //anim.FlipY = _flipY;
        anim.DiffuseFileName = _diffuseFileName;
        anim.MaskFileName = _frameMask;
        //anim.SetAnimations(ThumbAnimations);
        _frameControl.Add(anim);

        anim = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _itemWidth, _itemHeight,
                                    _frameFocusName);
        anim.ParentControl = this;
        anim.DimColor = DimColor;
        //anim.FlipX = _flipX;
        //anim.FlipY = _flipY;
        anim.DiffuseFileName = _diffuseFileName;
        anim.MaskFileName = _frameFocusMask;
        //anim.SetAnimations(ThumbAnimations);
        _frameFocusControl.Add(anim);

        // for label
        GUIFadeLabel fadelabel = new GUIFadeLabel(_parentControlId, _controlId, _positionX, _positionY, _textureWidth,
                                                  _textureHeight, _fontName, _textColor, Alignment.ALIGN_LEFT,
                                                  VAlignment.ALIGN_TOP, 0, 0, 0, " | ");
        fadelabel.ParentControl = this;
        fadelabel.AllowScrolling = false;
        fadelabel.DimColor = DimColor;
        //fadelabel.AllowFadeIn = false;
        _listLabels.Add(fadelabel);
      }

      _upDownControl = new GUISpinControl(_controlId, 0, _spinControlPositionX, _spinControlPositionY, _spinControlWidth,
                                          _spinControlHeight, _upTextureName, _downTextureName, _upTextureNameFocus,
                                          _downTextureNameFocus, _fontName, _spinControlColor,
                                          GUISpinControl.SpinType.SPIN_CONTROL_TYPE_INT, _spinControlAlignment);
      _upDownControl.ParentControl = this;
      _upDownControl.DimColor = DimColor;

      _font = GUIFontManager.GetFont(_fontName);



      // Create the horizontal scrollbar.
      int scrollbarWidth = _scrollbarWidth;
      int scrollbarHeight = _scrollbarHeight;
      GUIGraphicsContext.ScaleHorizontal(ref scrollbarWidth);
      GUIGraphicsContext.ScaleVertical(ref scrollbarHeight);
      int scrollbarPosX = _positionX + (_width / 2) - (scrollbarWidth / 2);

      _horizontalScrollbar = new GUIHorizontalScrollbar(_controlId, 0,
                                                        scrollbarPosX, _positionY + _scrollbarOffsetY,
                                                        scrollbarWidth, scrollbarHeight,
                                                        _scrollbarBackgroundName, _scrollbarLeftName,
                                                        _scrollbarRightName);
      _horizontalScrollbar.ParentControl = this;
      _horizontalScrollbar.DimColor = DimColor;


      _upDownControl.Orientation = eOrientation.Horizontal;
      _upDownControl.SetReverse(true);

      _imageBackground = LoadAnimationControl(0, 0, _backGroundPositionX, _backGroundPositionY, _backGroundWidth,
                                              _backGroundHeight, _backgroundTextureName);
      _imageBackground.ParentControl = this;
      _imageBackground.DimColor = DimColor;

      _imageInfo = new GUIImage(0, 0, _infoImagePositionX, _infoImagePositionY, _infoImageWidth, _infoImageHeight,
                                _infoImageName, 0);
      _imageInfo.ParentControl = this;
      _imageInfo.Filtering = true;
      _imageInfo.KeepAspectRatio = true;
      _imageInfo.ImageAlignment = Alignment.ALIGN_CENTER;
      _imageInfo.ImageVAlignment = VAlignment.ALIGN_MIDDLE;
      _imageInfo.HorizontalAlignment = MediaPortal.Drawing.HorizontalAlignment.Center;
      _imageInfo.VerticalAlignment = MediaPortal.Drawing.VerticalAlignment.Center;
      _imageInfo.DimColor = DimColor;
      _imageInfo.FlipX = _flipInfoImageX;
      _imageInfo.FlipY = _flipInfoImageY;
      _imageInfo.DiffuseFileName = _diffuseInfoImageFileName;
      _imageInfo.MaskFileName = _infoImageMask;

      SetThumbDimensionsLow(_thumbNailPositionX, _thumbNailPositionY, _thumbNailWidth, _thumbNailHeight);
      SetTextureDimensions(_textureWidth, _textureHeight);
    }
    public override void FinalizeConstruction()
    {
      base.FinalizeConstruction();
      _lowItemHeight = _itemHeight;
      _lowItemWidth = _itemWidth;
      _lowTextureWidth = _textureWidth;
      _lowTextureHeight = _textureHeight;

      _controlUpDown = new GUISpinControl(GetID, 0, _spinControlPositionX, _spinControlPositionY,
                                          _spinControlWidth, _spinControlHeight,
                                          _upTextureName, _downTextureName, _upTextureNameFocus, _downTextureNameFocus,
                                          _fontName, _spinControlColor,
                                          GUISpinControl.SpinType.SPIN_CONTROL_TYPE_INT,
                                          _spinControlAlignment);
      _controlUpDown.ParentControl = this;
      _controlUpDown.DimColor = DimColor;

      int xpos = 5 + _positionX + _width;
      if (xpos + 15 > GUIGraphicsContext.Width)
      {
        xpos = GUIGraphicsContext.Width - 15;
      }
      _verticalScrollBar = new GUIVerticalScrollbar(_controlId, 0,
                                                    5 + _positionX + _width + _scrollbarXOff, _positionY,
                                                    _scrollbarWidth, _height,
                                                    _scrollbarBackGroundTextureName, _scrollbarTopTextureName,
                                                    _scrollbarBottomTextureName);
      _verticalScrollBar.ParentControl = this;
      _verticalScrollBar.SendNotifies = false;
      _verticalScrollBar.DimColor = DimColor;
      _font = GUIFontManager.GetFont(_fontName);
      SetTextureDimensions(_textureWidth, _textureHeight);
      SetThumbDimensionsLow(_xPositionThumbNail, _yPositionThumbNail, _thumbNailWidth, _thumbNailHeight);

      _frameNoFocusControl = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _itemWidth,
                                                  _itemHeight,
                                                  _frameNoFocusName);
      _frameNoFocusControl.ParentControl = this;
      _frameNoFocusControl.DimColor = DimColor;
      _frameNoFocusControl.MaskFileName = _frameNoFocusMask;
      _frameNoFocusControl.SetAnimations(_allThumbAnimations);


      _frameFocusControl = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _itemWidth,
                                                _itemHeight,
                                                _frameFocusName);
      _frameFocusControl.ParentControl = this;
      _frameFocusControl.DimColor = DimColor;
      _frameFocusControl.MaskFileName = _frameFocusMask;
      _frameFocusControl.SetAnimations(_allThumbAnimations);

      using (Settings xmlreader = new MPSettings())
      {
        _loopDelay = xmlreader.GetValueAsInt("gui", "listLoopDelay", 100);
      }
    }
    public override sealed void FinalizeConstruction()
    {
      base.FinalizeConstruction();

      _font = GUIFontManager.GetFont(_fontName);
      if (_fontName2Name == string.Empty)
      {
        _fontName2Name = _fontName;
      }
      if (_fontName3Name == string.Empty)
      {
        _fontName3Name = _fontName2Name;
      }
      Font2 = _fontName2Name;
      Font3 = _fontName3Name;

      _upDownControl = new GUISpinControl(_controlId, 0, _spinControlPositionX, _spinControlPositionY, _spinControlWidth,
                                          _spinControlHeight, _upTextureName, _downTextureName, _upTextureNameFocus,
                                          _downTextureNameFocus, _fontName, _spinControlColor,
                                          GUISpinControl.SpinType.SPIN_CONTROL_TYPE_INT, _spinControlAlignment)
                         {
                           ParentControl = this,
                           DimColor = DimColor
                         };

      _verticalScrollbar = new GUIVerticalScrollbar(_controlId, 0, 5 + _positionX + _width + _scrollbarXOff, _positionY,
                                                    _scrollbarWidth, _height,
                                                    _scrollbarBackgroundName, _scrollbarTopName, _scrollbarBottomName)
                             {
                               ParentControl = this,
                               SendNotifies = false,
                               DimColor =DimColor
                             };
      _upDownControl.WindowId = WindowId;

      using (Settings xmlreader = new MPSettings())
      {
        _loopDelay = xmlreader.GetValueAsInt("gui", "listLoopDelay", 100);
      }
    }
    /// <summary>
    /// This method gets called when the control is created and all properties has been set
    /// It allows the control todo any initialization
    /// </summary>
    public override void FinalizeConstruction()
    {
      base.FinalizeConstruction();
      _imageFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height,
                                           _focusedTextureName);
      _imageFocused.ParentControl = this;
      _imageFocused.Filtering = false;
      _imageFocused.DimColor = DimColor;
      _imageFocused.SetBorder(_strBorderTF, _borderPositionTF, _borderTextureRepeatTF, _borderTextureRotateTF,
                              _borderTextureFileNameTF, _borderColorKeyTF, _borderHasCornersTF,
                              _borderCornerTextureRotateTF);

      _imageNonFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height,
                                              _nonFocusedTextureName);
      _imageNonFocused.ParentControl = this;
      _imageNonFocused.Filtering = false;
      _imageNonFocused.DimColor = DimColor;
      _imageNonFocused.SetBorder(_strBorderTNF, _borderPositionTNF, _borderTextureRepeatTNF, _borderTextureRotateTNF,
                                 _borderTextureFileNameTNF, _borderColorKeyTNF, _borderHasCornersTNF,
                                 _borderCornerTextureRotateTNF);
      GUILocalizeStrings.LocalizeLabel(ref _label);


      if (_scrollStartDelay < 0)
      {
        _labelControl = new GUILabelControl(_parentControlId, 0, _positionX, _positionY, _width, _height, _fontName,
                                            _label, _textColor, Alignment.ALIGN_LEFT, VAlignment.ALIGN_TOP, false,
                                            _shadowAngle, _shadowDistance, _shadowColor);
        ((GUILabelControl)_labelControl).ParentControl = this;
        ((GUILabelControl)_labelControl).DimColor = DimColor;
        ((GUILabelControl)_labelControl).TextAlignment = _textAlignment;
        ((GUILabelControl)_labelControl).TextVAlignment = _textVAlignment;
      }
      else
      {
        _labelControl = new GUIFadeLabel(_parentControlId, 0, _positionX, _positionY, _width, _height, _fontName,
                                         _textColor, Alignment.ALIGN_LEFT, VAlignment.ALIGN_TOP,
                                         _shadowAngle, _shadowDistance, _shadowColor,
                                         _userWrapString);
        ((GUIFadeLabel)_labelControl).TextAlignment = _textAlignment;
        ((GUIFadeLabel)_labelControl).TextVAlignment = _textVAlignment;
        ((GUIFadeLabel)_labelControl).AllowScrolling = false;
        ((GUIFadeLabel)_labelControl).AllowFadeIn = false;
      }

      string spinFontName = _fontName;
      if (_spinTextInButton)
      {
        // When the spin control font name is null the spin control will not render the text.
        // _spinTextInButton will render the spin control text in the button label.
        spinFontName = null;
      }

      _spinControl = new GUISpinControl(GetID, 0, _positionX + _width - _spinWidth, _positionY, _spinWidth,
                                        _spinHeight, _upTextureName, _downTextureName,
                                        _upTextureNameFocus, _downTextureNameFocus,
                                        spinFontName, _textColor, _spinType, _spinAlignment);
      _spinControl.ParentControl = this;
      _spinControl.DimColor = DimColor;
      _spinControl.ShowRange = _showRange;
      _spinControl.Digits = _digits;
      _spinControl.SetReverse(_reverse);
      _spinControl.Orientation = _orientation;
      _spinControl.CycleItems = _cycleItems;
      _spinControl.SetShadow(_shadowAngle, _shadowDistance, _shadowColor);
      _spinControl.PrefixText = _prefixText;
      _spinControl.SuffixText = _suffixText;
      _spinControl.TextOffsetX = _spinTextOffsetX;
      _spinControl.TextOffsetY = _spinTextOffsetY;

      // Pass all of the subitems to the spin control.
      for (int i = 0; i < SubItemCount; ++i)
      {
        _spinControl.AddSubItem(GetSubItem(i));
      }
      for (int i = 0; i < SubItemCount; ++i)
      {
        RemoveSubItem(i);
      }
    }
 public override void FinalizeConstruction()
 {
   base.FinalizeConstruction();
   _upDownControl = new GUISpinControl(_controlId, _controlId, _spinControlPositionX, _spinControlPositionY,
                                       _spinControlWidth, _spinControlHeight, _upTextureName, _downTextureName,
                                       _upTextureNameFocus, _downTextureNameFocus, _fontName, _colorSpinColor,
                                       GUISpinControl.SpinType.SPIN_CONTROL_TYPE_INT, Alignment.ALIGN_LEFT);
   _upDownControl.ParentControl = this;
   _font = GUIFontManager.GetFont(_fontName);
   if (_property.IndexOf("#", StringComparison.Ordinal) >= 0)
   {
     _containsProperty = true;
   }
   SetText(_property);
 }
    /// <summary>
    /// This method gets called when the control is created and all properties has been set
    /// It allows the control todo any initialization
    /// </summary>
    public override void FinalizeConstruction()
    {
      base.FinalizeConstruction();
      _imageFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height,
                                           _focusedTextureName);
      _imageFocused.ParentControl = this;
      _imageFocused.Filtering = false;
      _imageFocused.DimColor = DimColor;
      _imageFocused.SetBorder(_strBorderTF, _borderPositionTF, _borderTextureRepeatTF, _borderTextureRotateTF,
        _borderTextureFileNameTF, _borderColorKeyTF, _borderHasCornersTF, _borderCornerTextureRotateTF);
      TileFillTF = _textureFocusTileFill;
      _imageFocused.MaskFileName = _strMaskTF;

      _imageNonFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height,
                                              _nonFocusedTextureName);
      _imageNonFocused.ParentControl = this;
      _imageNonFocused.Filtering = false;
      _imageNonFocused.DimColor = DimColor;
      _imageNonFocused.SetBorder(_strBorderTNF, _borderPositionTNF, _borderTextureRepeatTNF, _borderTextureRotateTNF,
        _borderTextureFileNameTNF, _borderColorKeyTNF, _borderHasCornersTNF, _borderCornerTextureRotateTNF);
      TileFillTNF = _textureNoFocusTileFill;
      _imageNonFocused.MaskFileName = _strMaskTNF;

      _prefixText = _prefixText + _prefixTextJoin;
      _suffixText = _suffixTextJoin + _suffixText;

      GUILocalizeStrings.LocalizeLabel(ref _label);
      GUILocalizeStrings.LocalizeLabel(ref _prefixText);
      GUILocalizeStrings.LocalizeLabel(ref _suffixText);
      GUILocalizeStrings.LocalizeLabel(ref _dialogTitle);

      if (_hoverFilename != string.Empty)
      {
        GUIGraphicsContext.ScaleRectToScreenResolution(ref _hoverX, ref _hoverY, ref _hoverWidth, ref _hoverHeight);
        _hoverImage = LoadAnimationControl(_parentControlId, _controlId, _hoverX, _hoverY, _hoverWidth, _hoverHeight,
                                           _hoverFilename);
        _hoverImage.ParentControl = this;
        _hoverImage.DimColor = DimColor;
        _hoverImage.ColourDiffuse = ColourDiffuse;
        _hoverImage.SetBorder(_strBorderH, _borderPositionH, _borderTextureRepeatH, _borderTextureRotateH,
          _borderTextureFileNameH, _borderColorKeyH, _borderHasCornersH, _borderCornerTextureRotateH);
        TileFillH = _hoverTileFill;
        _hoverImage.MaskFileName = _strMaskH;
      }

      if (_scrollStartDelay < 0)
      {
        _labelControl = new GUILabelControl(_parentControlId, 0, _positionX, _positionY, _width, _height, _fontName,
                                            _label, _textColor, Alignment.ALIGN_LEFT, VAlignment.ALIGN_TOP, false,
                                            _shadowAngle, _shadowDistance, _shadowColor);
        ((GUILabelControl)_labelControl).ParentControl = this;
        ((GUILabelControl)_labelControl).DimColor = DimColor;
        ((GUILabelControl)_labelControl).TextAlignment = _textAlignment;
        ((GUILabelControl)_labelControl).TextVAlignment = _textVAlignment;

        // If the value should be displayed in the button but the alignment is not left then we need another control to display the right aligned
        // button value.
        if (_valueTextInButtonAlignment == Alignment.ALIGN_RIGHT)
        {
          _valueLabelControl = new GUILabelControl(_parentControlId, 0, _positionX, _positionY, _width, _height, _fontName,
                                                   _label, _textColor, Alignment.ALIGN_RIGHT, VAlignment.ALIGN_TOP, false,
                                                   _shadowAngle, _shadowDistance, _shadowColor);
          ((GUILabelControl)_valueLabelControl).ParentControl = this;
          ((GUILabelControl)_valueLabelControl).DimColor = DimColor;
          ((GUILabelControl)_valueLabelControl).TextVAlignment = _textVAlignment;
        }
      }
      else
      {
        _labelControl = new GUIFadeLabel(_parentControlId, 0, _positionX, _positionY, _width, _height, _fontName,
                                         _textColor, Alignment.ALIGN_LEFT, VAlignment.ALIGN_TOP,
                                        _shadowAngle, _shadowDistance, _shadowColor,
                                         _userWrapString);
        ((GUIFadeLabel)_labelControl).TextAlignment = _textAlignment;
        ((GUIFadeLabel)_labelControl).TextVAlignment = _textVAlignment;
        ((GUIFadeLabel)_labelControl).AllowScrolling = false;
        ((GUIFadeLabel)_labelControl).AllowFadeIn = false;

        // If the value should be displayed in the button but the alignment is not left then we need another control to display the right aligned
        // button value.
        if (_valueTextInButtonAlignment == Alignment.ALIGN_RIGHT)
        {
          _valueLabelControl = new GUIFadeLabel(_parentControlId, 0, _positionX, _positionY, _width, _height, _fontName,
                                                _textColor, Alignment.ALIGN_RIGHT, VAlignment.ALIGN_TOP,
                                                _shadowAngle, _shadowDistance, _shadowColor,
                                                _userWrapString);
          ((GUIFadeLabel)_valueLabelControl).ParentControl = this;
          ((GUIFadeLabel)_valueLabelControl).DimColor = DimColor;
          ((GUIFadeLabel)_valueLabelControl).TextVAlignment = _textVAlignment;
          ((GUIFadeLabel)_valueLabelControl).AllowScrolling = false;
          ((GUIFadeLabel)_valueLabelControl).AllowFadeIn = false;
        }
      }

      // Build elements for the specified button mode.
      switch (_buttonMode)
      {
        case ButtonMode.BUTTON_MODE_SPIN_LIST:

          string spinFontName = _fontName;
          if (_valueTextInButton)
          {
            // When the spin control font name is null the spin control will not render the text.
            // _valueTextInButton will render the spin control text in the button label.
            spinFontName = null;
          }

          _spinControl = new GUISpinControl(GetID, 0, _positionX + _width - _spinWidth, _positionY, _spinWidth,
                                              _spinHeight, _upTextureName, _downTextureName,
                                              _upTextureNameFocus, _downTextureNameFocus,
                                              spinFontName, _textColor, _spinType, _spinAlignment);
          _spinControl.ParentControl = this;
          _spinControl.DimColor = DimColor;
          _spinControl.ShowRange = _showRange;
          _spinControl.Digits = _digits;
          _spinControl.SetReverse(_reverse);
          _spinControl.Orientation = _orientation;
          _spinControl.CycleItems = _cycleItems;
          _spinControl.SetShadow(_shadowAngle, _shadowDistance, _shadowColor);
          _spinControl.PrefixText = _prefixText;
          _spinControl.SuffixText = _suffixText;
          _spinControl.TextOffsetX = _spinTextOffsetX;
          _spinControl.TextOffsetY = _spinTextOffsetY;
          break;

        case ButtonMode.BUTTON_MODE_DIALOG_LIST:
          break;
      }

      // Add subitems to the menu.
      int value = 0;
      for (int i = 0; i < SubItemCount; ++i)
      {
        string strItem = GUIPropertyManager.GetProperty((string)GetSubItem(i));
        if (strItem == null || strItem == "")
        {
          // Refetch the subitem if a property value was not returned.
          strItem = (string)GetSubItem(i);
        }

        // Allow for the subitem to be a CSV list of values.  If it is then add each item in the CSV list.
        ArrayList items = new ArrayList(strItem.Split(new char[] { ',' }));
        for (int j=0; j < items.Count; j++)
        {
          AddItem(items[j].ToString(), value++);
        }
      }

      for (int i = 0; i < SubItemCount; ++i)
      {
        RemoveSubItem(i);
      }

      // If specified, bind the selection.
      if (_binding.Length > 0)
      {
        bindToValue(_binding);
      }

      // Initialize the controls properties.
      SetProperties();
    }