public static GetFont ( int iFont ) : MediaPortal.GUI.Library.GUIFont | ||
iFont | int | The font number |
Результат | MediaPortal.GUI.Library.GUIFont |
/// <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 sealed void FinalizeConstruction() { base.FinalizeConstruction(); GUILocalizeStrings.LocalizeLabel(ref _label); // The labelTail is used to fill the backend of a scrolling label for both wrapping and non-wrapping labels // The wrapString is the text that joins the back to the front of a wrapping label (not used if the label should not wrap). if (_userWrapString.Length > 0) { _labelTail = "" + _userWrapString[_userWrapString.Length - 1]; _wrapString = _userWrapString.Substring(0, _userWrapString.Length - 1); } _labelControl = new GUILabelControl(_parentControlId, 0, _positionX, _positionY, _width, _height, _fontName, _label, _textColor, _textAlignment, _textVAlignment, false, _shadowAngle, _shadowDistance, _shadowColor) { CacheFont = false, ParentControl = this }; _labelControl.SetAnimations(Animations); if (_fontName != "" && _fontName != "-") { _font = GUIFontManager.GetFont(_fontName); } if (_label.IndexOf("#", System.StringComparison.Ordinal) >= 0) { _containsProperty = true; } }
/// <summary> /// Allocates the control its DirectX resources. /// </summary> public override void AllocResources() { base.AllocResources(); _imageCheckMarkFocused.AllocResources(); _imageCheckMarkNonFocused.AllocResources(); _font = GUIFontManager.GetFont(_fontName); }
/// <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 sealed void FinalizeConstruction() { base.FinalizeConstruction(); if (_fontName == null) { _fontName = string.Empty; } if (_fontName != "" && _fontName != "-") { _font = GUIFontManager.GetFont(_fontName); } GUILocalizeStrings.LocalizeLabel(ref _labelText); if (_labelText == null) { _labelText = string.Empty; } if (_labelText.IndexOf("#") >= 0) { _containsProperty = true; } CachedLabel(); }
public override void PreAllocResources() { base.PreAllocResources(); float fWidth = 0, fHeight = 0; _font = GUIFontManager.GetFont(_fontName); if (null == _font) { return; } _font.GetTextExtent("afy", ref fWidth, ref fHeight); try { _itemHeight = (int)(fHeight); float fTotalHeight = (float)_height; _itemsPerPage = (int)Math.Floor(fTotalHeight / (fHeight * _lineSpacing)); if (_itemsPerPage == 0) { _itemsPerPage = 1; } } catch (Exception) { _itemHeight = 1; _itemsPerPage = 1; } }
public override void FinalizeConstruction() { base.FinalizeConstruction(); int x1 = 16; int y1 = 16; GUIGraphicsContext.ScalePosToScreenResolution(ref x1, ref y1); _imageFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height, _textureFocusName); _imageFocused.ParentControl = this; _imageFocused.DimColor = DimColor; _imageNonFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height, _textureNoFocusName); _imageNonFocused.ParentControl = this; _imageNonFocused.DimColor = DimColor; _imageBackground = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height, _backgroundTextureName); _imageBackground.ParentControl = this; _imageBackground.DimColor = DimColor; _imageLeft = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _leftTextureWidth, _leftTextureHeight, _leftTextureName); _imageLeft.DimColor = DimColor; _imageLeft.ParentControl = this; _imageLeftFocus = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _leftTextureFocusWidth, _leftTextureFocusHeight, _leftFocusName); _imageLeftFocus.ParentControl = this; _imageLeftFocus.DimColor = DimColor; _imageRight = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _rightTextureWidth, _rightTextureHeight, _rightTextureName); _imageRight.ParentControl = this; _imageRight.DimColor = DimColor; _imageRightFocus = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _rightTextureFocusWidth, _rightTextureFocusHeight, _rightFocusName); _imageRightFocus.ParentControl = this; _imageRightFocus.DimColor = DimColor; if (_fontName != "" && _fontName != "-") { _font = GUIFontManager.GetFont(_fontName); } GUILocalizeStrings.LocalizeLabel(ref _label); _imageFocused.Filtering = false; _imageNonFocused.Filtering = false; _imageBackground.Filtering = false; _imageLeft.Filtering = false; _imageLeftFocus.Filtering = false; _imageRight.Filtering = false; _imageRightFocus.Filtering = false; _labelControl = new GUILabelControl(_parentControlId); _labelControl.CacheFont = true; _labelControl.ParentControl = this; _labelControl.SetShadow(_shadowAngle, _shadowDistance, _shadowColor); }
public override void FinalizeConstruction() { base.FinalizeConstruction(); _font = GUIFontManager.GetFont(_fontName); if (_property.IndexOf("#", StringComparison.Ordinal) >= 0) { _containsProperty = true; } }
/// <summary> /// Set the text of the control. /// </summary> /// <param name="strFontName">The font name.</param> /// <param name="strLabel">The text.</param> /// <param name="dwColor">The font color.</param> public void SetLabel(string strFontName, string strLabel, long dwColor) { if (strFontName == null || strLabel == null) { return; } _label = strLabel; _textColor = dwColor; _fontName = strFontName; _font = GUIFontManager.GetFont(_fontName); }
public override void AllocResources() { if (null == _font) { return; } base.AllocResources(); _upDownControl.AllocResources(); _font = GUIFontManager.GetFont(_fontName); _upDownControl.WindowId = this._windowId; Calculate(); }
/// <summary> /// Allocate any direct3d sources /// </summary> public override void AllocResources() { _propertyHasChanged = true; if (_registeredForEvent == false) { GUIPropertyManager.OnPropertyChanged -= GUIPropertyManager_OnPropertyChanged; GUIPropertyManager.OnPropertyChanged += GUIPropertyManager_OnPropertyChanged; _registeredForEvent = true; } _font = GUIFontManager.GetFont(_fontName); Update(); base.AllocResources(); }
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("#") >= 0) { _containsProperty = true; } SetText(_property); }
public override void AllocResources() { base.AllocResources(); _font = GUIFontManager.GetFont(_fontName); _imageTop.AllocResources(); _imageBottom.AllocResources(); _imageMid.AllocResources(); _imageRight.AllocResources(); _imageLeft.AllocResources(); _imageFillBackground.AllocResources(); _imageFill1.AllocResources(); _imageFill2.AllocResources(); _imageFill3.AllocResources(); if (_imageFillMarker != null) { _imageFillMarker.AllocResources(); _imageFillMarker.Height = _height - 6; _imageFillMarker.Filtering = false; } _imageTick.AllocResources(); _imageLogo.AllocResources(); _imageTop.Filtering = false; _imageBottom.Filtering = false; _imageMid.Filtering = false; _imageRight.Filtering = false; _imageLeft.Filtering = false; _imageFill1.Filtering = false; _imageFill2.Filtering = false; _imageFill3.Filtering = false; _imageTick.Filtering = false; if (_height == 0) { _height = _imageRight.TextureHeight; } // _imageTop.Height=_height; _imageRight.Height = _height; _imageLeft.Height = _height; _imageMid.Height = _height; _imageFill1.Height = _height - 6; _imageFill2.Height = _height - 6; _imageFill3.Height = _height - 6; //_imageTick.Height=_height; }
/// <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(); _imageCheckMarkFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _checkMarkWidth, _checkMarkHeight, _checkMarkFocusTextureName); _imageCheckMarkFocused.ParentControl = this; _imageCheckMarkFocused.DimColor = DimColor; _imageCheckMarkNonFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _checkMarkWidth, _checkMarkHeight, _checkMarkNoFocusTextureName); _imageCheckMarkNonFocused.ParentControl = this; _imageCheckMarkNonFocused.DimColor = DimColor; if (_fontName != "" && _fontName != "-") { _font = GUIFontManager.GetFont(_fontName); } GUILocalizeStrings.LocalizeLabel(ref _label); }
/// <summary> /// Allocates the control its DirectX resources. /// </summary> public override void AllocResources() { base.AllocResources(); _frameCounter = 0; _imageFocused.AllocResources(); _imageNonFocused.AllocResources(); _width = _imageFocused.Width; _height = _imageFocused.Height; _imageBackground.AllocResources(); _imageLeft.AllocResources(); _imageLeftFocus.AllocResources(); _imageRight.AllocResources(); _imageRightFocus.AllocResources(); _font = GUIFontManager.GetFont(_fontName); PositionLeftAndRightImages(); _labelControl.AllocResources(); }
/// <summary> /// Renders the control. /// </summary> public override void Render(float timePassed) { if (GUIGraphicsContext.EditMode == false) { if (!IsVisible) { base.Render(timePassed); return; } } string strValue = ""; float fRange = 0.0f; float fPos = 0.0f; float fPercent = 0.0f; float fTextWidth = 0, fTextHeight = 0; GUIFont _font = GUIFontManager.GetFont(_valueFont); switch (_spinType) { // Float based slider case GUISpinControl.SpinType.SPIN_CONTROL_TYPE_FLOAT: if (null != _font && _showValue) { strValue = String.Format("{0}", _floatValue); _font.DrawText((float)_positionX, (float)_positionY, _textColor, strValue, Alignment.ALIGN_LEFT, -1); _font.GetTextExtent(strValue, ref fTextWidth, ref fTextHeight); _imageBackGround.SetPosition(_positionX + (int)fTextWidth + 10, _positionY); } fRange = (float)(_floatEndValue - _floatStartValue); fPos = (float)(_floatValue - _floatStartValue); fPercent = (fPos / fRange) * 100.0f; _percentage = (int)fPercent; break; // Integer based slider case GUISpinControl.SpinType.SPIN_CONTROL_TYPE_INT: if (null != _font && _showValue) { strValue = String.Format("{0}/{1}", _intValue, _intEndValue); _font.DrawText((float)_positionX, (float)_positionY, _textColor, strValue, Alignment.ALIGN_LEFT, -1); _font.GetTextExtent(strValue, ref fTextWidth, ref fTextHeight); _imageBackGround.SetPosition(_positionX + (int)fTextWidth + 10, _positionY); } fRange = (float)(_intEndValue - _intStartValue); fPos = (float)(_intValue - _intStartValue); _percentage = (int)((fPos / fRange) * 100.0f); break; } //int iHeight=25; _imageBackGround.Render(timePassed); //_imageBackGround.SetHeight(iHeight); //_height = _imageBackGround.Height; //_width = _imageBackGround.Width + (int)fTextWidth + 10; float fWidth = (float)(_imageBackGround.TextureWidth - _imageMid.TextureWidth); //-20.0f; fPos = (float)_percentage; fPos /= 100.0f; fPos *= fWidth; fPos += (float)_imageBackGround.XPosition; //fPos += 10.0f; if ((int)fWidth > 1) { if (Focus) { _imageMidFocus.SetPosition((int)fPos, _imageBackGround.YPosition); _imageMidFocus.Render(timePassed); } else { _imageMid.SetPosition((int)fPos, _imageBackGround.YPosition); _imageMid.Render(timePassed); } } base.Render(timePassed); }
/// <summary> /// Allocates the control its DirectX resources. /// </summary> public override void AllocResources() { _font = GUIFontManager.GetFont(_fontName); }