TextStyle.cs :  » Game » Balder » Fireball » Syntax » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » Game » Balder 
Balder » Fireball » Syntax » TextStyle.cs
using System;
using System.ComponentModel;
using System.Windows;
using System.Windows.Media;

namespace Fireball.Syntax{
  /// <summary>
  /// TextStyles are used to describe the apperance of text.
  /// </summary>
  public class TextStyle : ICloneable
  {
    public event EventHandler Change = null;

    protected virtual void OnChange()
    {
      if (Change != null)
        Change(this, EventArgs.Empty);
    }

    /// <summary>
    /// Name of the style
    /// </summary>
    public string Name = null;

    /// <summary>
    /// Gets or Sets if the style uses a Bold font
    /// </summary>

    #region PUBLIC PROPERTY BOLD
    private bool _Bold;

    [Category("Font")]
    [Description("Gets or Sets if the style uses a BOLD font")]
    public bool Bold
    {
      get { return _Bold; }
      set
      {
        _Bold = value;
        OnChange();
      }
    }

    #endregion

    /// <summary>
    /// Gets or Sets if the style uses an Italic font
    /// </summary>

    #region PUBLIC PROPERTY ITALIC
    private bool _Italic;

    [Category("Font")]
    [Description("Gets or Sets if the style uses an ITALIC font")]
    public bool Italic
    {
      get { return _Italic; }
      set
      {
        _Italic = value;
        OnChange();
      }
    }

    #endregion

    /// <summary>
    /// Gets or Sets if the style uses an Underlined font
    /// </summary>

    #region PUBLIC PROPERTY UNDERLINE
    private bool _Underline;

    [Category("Font")]
    [Description("Gets or Sets if the style uses an UNDERLINED font")]
    public bool Underline
    {
      get { return _Underline; }
      set
      {
        _Underline = value;
        OnChange();
      }
    }

    #endregion

    /// <summary>
    /// Gets or Sets the ForeColor of the style
    /// </summary>

    #region PUBLIC PROPERTY FORECOLOR
    private Color _ForeColor = Colors.Black;

    [Category("Color")]
    [Description("Gets or Sets the fore color of the style")]
    public Color ForeColor
    {
      get { return _ForeColor; }
      set
      {
        _ForeColor = value;
        OnChange();
      }
    }

    #endregion

    /// <summary>
    /// Gets or Sets the BackColor of the style
    /// </summary>

    #region PUBLIC PROPERTY BACKCOLOR
    private Color _BackColor = new Color();

    [Category("Color")]
    [Description("Gets or Sets the background color of the style")]
    public Color BackColor
    {
      get { return _BackColor; }
      set
      {
        _BackColor = value;
        OnChange();
      }
    }

    #endregion

    /// <summary>
    /// Default constructor
    /// </summary>
    public TextStyle()
    {
      ForeColor = new Color().FromHex("#FF000000");
      BackColor = Colors.Transparent;
    }

    /// <summary>
    /// Returns true if no color have been assigned to the backcolor
    /// </summary>
    //[Browsable(false)]
    public bool Transparent
    {
      get { return (BackColor.A == 0); }
    }

    public override string ToString()
    {
      if (this.Name == null)
        return "TextStyle";

      return this.Name;
    }

    #region Implementation of ICloneable

    public object Clone()
    {
      TextStyle ts = new TextStyle();
      ts.BackColor = this.BackColor;
      ts.Bold = this.Bold;
      ts.ForeColor = this.ForeColor;
      ts.Italic = this.Italic;
      ts.Underline = this.Underline;
      ts.Name = this.Name;
      return ts;
    }

    #endregion
  }
}

namespace System
{
  public interface ICloneable
  {
      object Clone();
  }
}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.