| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199 |
- /**
- * Namespace: System.Web.UI.WebControls
- * Class: FontInfo
- *
- * Author: Gaurav Vaish
- * Maintainer: [email protected]
- * Contact: <[email protected]>, <[email protected]>
- * Implementation: yes
- * Status: 80%
- *
- * (C) Gaurav Vaish (2001)
- */
- using System;
- using System.Reflection;
- using System.Web;
- using System.Web.UI;
- using System.Drawing;
- namespace System.Web.UI.WebControls
- {
- public sealed class FontInfo
- {
- private bool bold;
- private bool italic;
- private bool overline;
- private bool strikeout;
- private bool underline;
- private string name; //TODO: This will have the value of names[0] by default
- private string[] names; //TODO: How do get the list of fonts available?
- private FontUnit size = FontUnit.Empty;
-
- internal FontInfo()
- {
- bold = false;
- italic = false;
- overline = false;
- strikeout = false;
- underline = false;
- name = string.Empty;
- }
-
- public bool Bold
- {
- get
- {
- return bold;
- }
- set
- {
- bold = value;
- }
- }
-
- public bool Italic
- {
- get
- {
- return italic;
- }
- set
- {
- italic = value;
- }
- }
-
- public bool Overline
- {
- get
- {
- return overline;
- }
- set
- {
- overline = value;
- }
- }
-
- public bool Strikeout
- {
- get
- {
- return strikeout;
- }
- set
- {
- strikeout = value;
- }
- }
-
- public bool Underline
- {
- get
- {
- return underline;
- }
- set
- {
- underline = value;
- }
- }
-
- public string Name
- {
- get
- {
- return name;
- }
- set
- {
- name = value;
- }
- }
-
- public string[] Names
- {
- get
- {
- return names;
- }
- set
- {
- names = value;
- name = names[0];
- }
- }
- //TODO: To throw exception if the index is negative
- public FontUnit Size
- {
- get
- {
- return size;
- }
- set
- {
- size = value;
- }
- }
-
- public void CopyFrom(FontInfo from)
- {
- //TODO: What a rubbish way to accomplish the task
- /*this.bold = from.Bold;
- this.italic = from.Italic;
- this.name = from.Name;
- this.names = from.Names;
- this.overline = from.Overline;
- this.size = from.Size;*/
- //TODO: Let me try Relflection
- Type t = from.GetType();
- MethodInfo[] fi = t.GetMethods();
- foreach(MethodInfo f in fi)
- {
- //System.Console.WriteLine("Field: {0}", f.Name);
- if(f.Name.StartsWith("get_"))
- {
- System.Console.WriteLine("\tStarts with get_");
- }
- }
- }
-
- private void ListFields(FontInfo from)
- {
- Type t = from.GetType();
- MethodInfo[] fi = t.GetMethods();
- foreach(MethodInfo f in fi)
- {
- System.Console.WriteLine("Field: {0}", f.Name);
- if(f.Name.StartsWith("get_"))
- {
- System.Console.WriteLine("\tStarts with get_");
- }
- }
- }
- //TODO: after CopyFrom is implemented
- public void MergeWith(FontInfo with)
- {
- }
- public override string ToString()
- {
- string retVal = this.name;
- if(this.size != FontUnit.Empty)
- {
- this.name += ("," + this.size);
- }
- return retVal;
- }
- /*
- protected object MemberwiseClone()
- {
- }
- //*/
- }
- }
|