The class implementing a GUIButton.
Inheritance: GUIControl
Ejemplo n.º 1
0
        public NavigationObject(GUIListControl control, string title, string itemtype, string nbobjects, string moviecontext, int pos, 
            MyFilms.Layout curview, Configuration curconf, GUISortButtonControl srtButton, GUIButtonControl viewButton, GUIButtonControl layoutButton,
            CoverState coverstate, DateTime lastDBupdate)
        {
            Items = new List<GUIListItem>();
              GetItems(control, title, itemtype, pos, curview);
              ViewStatus = new ViewState();
              GetViewStatus(curconf);

              DbDfltSelect = curconf.DbSelection[0];
              DbSelect = curconf.DbSelection[1];
              DbField = curconf.DbSelection[2];
              DbSort = curconf.DbSelection[3];
              bool showall;
              DbShowAll = (Boolean.TryParse(curconf.DbSelection[4], out showall)) && showall;
              bool extrasort;
              DbExtraSort = (Boolean.TryParse(curconf.DbSelection[4], out extrasort)) && extrasort;

              NbObjects = nbobjects;
              MovieContext = moviecontext;

              CurrentView = curview;

              SortButtonEnabled = srtButton.IsEnabled;
              SortButtonAsc = srtButton.IsAscending;
              SortButtonLabel = srtButton.Label;
              ViewAsButtonLabel = viewButton.Label;
              LayoutButtonLabel = layoutButton.Label;
              CoverStatus = coverstate;
              LastDbUpdate = lastDBupdate;
        }
Ejemplo n.º 2
0
    private void Calculate()
    {
      float fWidth = 0, fHeight = 0;

      // height of 1 item = folder image height + text row height + space in between
      _font.GetTextExtent("y", ref fWidth, ref fHeight);

      fWidth = (float)_itemWidth;
      fHeight = (float)_itemHeight;
      float fTotalHeight = (float)(_height - 5);
      _rowCount = (int)(fTotalHeight / fHeight);
      _columnCount = (int)(_width / fWidth);

      int iItemsPerPage = _rowCount * _columnCount;
      int iPages = iItemsPerPage == 0 ? 0 : _listItems.Count / iItemsPerPage;
      if (iItemsPerPage != 0)
      {
        if ((_listItems.Count % iItemsPerPage) != 0)
        {
          iPages++;
        }
      }
      _controlUpDown.SetRange(1, iPages);
      _controlUpDown.Value = 1;

      // Dispose used buttoncontrols
      if (_listButtons != null)
      {
        for (int i = 0; i < _listButtons.Count; ++i)
        {
          GUIButtonControl cntl = _listButtons[i];
          cntl.SafeDispose();
        }
      }
      _listButtons = null;

      if (_listLabels != null)
      {
        for (int i = 0; i < _listLabels.Count; ++i)
        {
          GUIFadeLabel cntl = _listLabels[i];
          cntl.SafeDispose();
        }
      }
      _listLabels = null;

      // Create new buttoncontrols
      _listButtons = new List<GUIButtonControl>();
      _listLabels = new List<GUIFadeLabel>();
      for (int i = 0; i < _columnCount * _rowCount; ++i)
      {
        GUIButtonControl btn = new GUIButtonControl(_parentControlId, _controlId, _positionX, _positionY, _textureWidth,
                                                    _textureHeight, _imageFolderNameFocus, _imageFolderName,
                                                    _shadowAngle, _shadowDistance, _shadowColor);
        btn.ParentControl = this;
        btn.SetFocusedTextureMask(_textureMask);
        btn.SetNonFocusedTextureMask(_textureMask);
        btn.SetHoverTextureMask(_textureMask);
        btn.AllocResources();

        _listButtons.Add(btn);

        GUIFadeLabel fadelabel = new GUIFadeLabel(_parentControlId, _controlId, _positionX, _positionY, _textureWidth,
                                                  _textureHeight, _fontName, _textColor, Alignment.ALIGN_LEFT,
                                                  VAlignment.ALIGN_TOP, _shadowAngle, _shadowDistance, _shadowColor,
                                                  " | ");
        fadelabel.DimColor = DimColor;
        fadelabel.ParentControl = this;
        fadelabel.AllowScrolling = false;
        //fadelabel.AllowFadeIn = false;
        fadelabel.AllocResources();

        _listLabels.Add(fadelabel);
      }
    }
Ejemplo n.º 3
0
 protected virtual void AllocButtons()
 {
   for (int i = 0; i < _itemsPerPage; ++i)
   {
     GUIButtonControl cntl = new GUIButtonControl(_controlId, 0, _spinControlPositionX, _spinControlPositionY, _width,
                                                  _itemHeight, _buttonFocusName, _buttonNonFocusName,
                                                  _shadowAngle, _shadowDistance, _shadowColor) {ParentControl = this};
     cntl.SetBorderTF(_strBorderBF,
                      _borderPositionBF,
                      _borderTextureRepeatBF,
                      _borderTextureRotateBF,
                      _borderTextureFileNameBF,
                      _borderColorKeyBF,
                      _borderHasCornersBF,
                      _borderCornerTextureRotateBF);
     cntl.SetBorderTNF(_strBorderBNF,
                       _borderPositionBNF,
                       _borderTextureRepeatBNF,
                       _borderTextureRotateBNF,
                       _borderTextureFileNameBNF,
                       _borderColorKeyBNF,
                       _borderHasCornersBNF,
                       _borderCornerTextureRotateBNF);
     cntl.AllocResources();
     cntl.DimColor = DimColor;
     _listButtons.Add(cntl);
   }
 }
Ejemplo n.º 4
0
      public Key(Xkey key, int iwidth, GUIKeyboard kb)
      {
        xKey = key;
        dwWidth = iwidth;

        // Create a button control template.
        if (button != null)
        {
          button.Dispose();
        }
        button = new GUIButtonControl(kb.GetID, -1, 0, 0, 0, 0, kb._keyTextureFocus, kb._keyTextureNoFocus,
                                      kb._keyTextShadowAngle, kb._keyTextShadowDistance, kb._keyTextShadowColor);

        button.SetBorderTF(
          kb._strBorderKTF,
          kb._borderPositionKTF,
          kb._borderTextureRepeatKTF,
          kb._borderTextureRotateKTF,
          kb._borderTextureFileNameKTF,
          kb._borderColorKeyKTF,
          kb._borderHasCornersKTF,
          kb._borderCornerTextureRotateKTF);

        button.SetBorderTNF(
          kb._strBorderKTNF,
          kb._borderPositionKTNF,
          kb._borderTextureRepeatKTNF,
          kb._borderTextureRotateKTNF,
          kb._borderTextureFileNameKTNF,
          kb._borderColorKeyKTNF,
          kb._borderHasCornersKTNF,
          kb._borderCornerTextureRotateKTNF);

        button.AllocResources();

        // Special keys get their own names
        switch (xKey)
        {
          case Xkey.XK_SPACE:
            name = "SPACE";
            break;
          case Xkey.XK_BACKSPACE:
            name = "BKSP";
            break;
          case Xkey.XK_SHIFT:
            name = "SHIFT";
            break;
          case Xkey.XK_CAPSLOCK:
            name = "CAPS";
            break;
          case Xkey.XK_ALPHABET:
            name = "ALPHABET";
            break;
          case Xkey.XK_SYMBOLS:
            name = "SYMB";
            break;
          case Xkey.XK_ACCENTS:
            name = "ACCENTS";
            break;
          case Xkey.XK_SMS:
            name = "SMS";
            break;
          case Xkey.XK_OK:
            name = GUILocalizeStrings.Get(804);
            break;
          case Xkey.XK_SEARCH_CONTAINS:
            name = GUILocalizeStrings.Get(801);
            break;
          case Xkey.XK_SEARCH_ENDS_WITH:
            name = GUILocalizeStrings.Get(802);
            break;
          case Xkey.XK_SEARCH_START_WITH:
            name = GUILocalizeStrings.Get(800);
            break;
          case Xkey.XK_SEARCH_IS:
            name = GUILocalizeStrings.Get(803);
            break;
          case Xkey.XK_SMS0:
            name = "0 [ ]";
            break;
        }
      }
Ejemplo n.º 5
0
 /// <summary>
 /// Creates the element and retrieves all information from the control
 /// </summary>
 /// <param name="control">GUIControl</param>
 public ButtonElement(GUIControl control)
     : base(control)
 {
     _button = control as GUIButtonControl;
       if (_button != null)
       {
     _font = GetFont(_button.FontName);
     _focusBitmap = LoadBitmap(_button.TexutureFocusName);
     _noFocusBitmap = LoadBitmap(_button.TexutureNoFocusName);
     _hoverBitmap = LoadBitmap(_button.HoverFilename);
     _textColor = GetColor(_button.TextColor);
     _textColorNoFocus = GetColor(_button.TextColorNoFocus);
     _disabledColor = GetColor(_button.DisabledColor);
     _label = _button.Label;
     _focus = _button.Focus;
       }
 }