Opentk/Source/Utilities/Fonts/TextHandle.cs

79 lines
2.1 KiB
C#
Raw Normal View History

2007-11-08 15:54:58 +00:00
#region --- License ---
/* Copyright (c) 2006, 2007 Stefanos Apostolopoulos
* See license.txt for license info
*/
#endregion
using System;
2007-11-06 20:59:15 +00:00
using System.Collections.Generic;
using System.Text;
namespace OpenTK.Graphics
2007-11-06 20:59:15 +00:00
{
2007-11-08 15:54:58 +00:00
/// <summary>
/// Represents a handle to cached text.
/// </summary>
public abstract class TextHandle : IDisposable
2007-11-06 20:59:15 +00:00
{
/// <summary>
/// Constructs a new TextHandle,
/// </summary>
/// <param name="handle"></param>
public TextHandle(int handle)
2007-11-06 20:59:15 +00:00
{
Handle = handle;
}
private int handle;
protected TextureFont font;
protected bool disposed;
2007-11-08 15:54:58 +00:00
/// <summary>
/// Gets the handle of the cached text run. Call the OpenTK.Graphics.ITextPrinter.Draw() method
2007-11-08 15:54:58 +00:00
/// to draw the text represented by this TextHandle.
/// </summary>
public int Handle
{
get { return handle; }
protected set { handle = value; }
}
/// <summary>
/// Gets the TextureFont used for this text run.
/// </summary>
public TextureFont Font
{
get { return font; }
internal set { font = value; }
}
2007-11-08 15:54:58 +00:00
#region public override string ToString()
2007-11-06 20:59:15 +00:00
2007-11-08 15:54:58 +00:00
/// <summary>
/// Returns a System.String that represents the current TextHandle.
/// </summary>
/// <returns>a System.String that descibes the current TextHandle.</returns>
2007-11-06 20:59:15 +00:00
public override string ToString()
{
return String.Format("TextHandle: {0}", Handle);
}
2007-11-08 15:54:58 +00:00
#endregion
#region --- IDisposable Members ---
/// <summary>
/// Frees the resource consumed by the TextHandle.
/// </summary>
2007-11-08 15:54:58 +00:00
public void Dispose()
{
this.Dispose(true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool manual) { }
~TextHandle() { this.Dispose(false); }
#endregion
2007-11-06 20:59:15 +00:00
}
}