mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-27 06:25:40 +00:00
79 lines
2.1 KiB
C#
79 lines
2.1 KiB
C#
#region --- License ---
|
|
/* Copyright (c) 2006, 2007 Stefanos Apostolopoulos
|
|
* See license.txt for license info
|
|
*/
|
|
#endregion
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
|
|
namespace OpenTK.Graphics
|
|
{
|
|
/// <summary>
|
|
/// Represents a handle to cached text.
|
|
/// </summary>
|
|
public abstract class TextHandle : IDisposable
|
|
{
|
|
/// <summary>
|
|
/// Constructs a new TextHandle,
|
|
/// </summary>
|
|
/// <param name="handle"></param>
|
|
public TextHandle(int handle)
|
|
{
|
|
Handle = handle;
|
|
}
|
|
|
|
private int handle;
|
|
protected TextureFont font;
|
|
protected bool disposed;
|
|
|
|
/// <summary>
|
|
/// Gets the handle of the cached text run. Call the OpenTK.Graphics.ITextPrinter.Draw() method
|
|
/// 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; }
|
|
}
|
|
|
|
#region public override string ToString()
|
|
|
|
/// <summary>
|
|
/// Returns a System.String that represents the current TextHandle.
|
|
/// </summary>
|
|
/// <returns>a System.String that descibes the current TextHandle.</returns>
|
|
public override string ToString()
|
|
{
|
|
return String.Format("TextHandle: {0}", Handle);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region --- IDisposable Members ---
|
|
|
|
/// <summary>
|
|
/// Frees the resource consumed by the TextHandle.
|
|
/// </summary>
|
|
public void Dispose()
|
|
{
|
|
this.Dispose(true);
|
|
GC.SuppressFinalize(this);
|
|
}
|
|
protected virtual void Dispose(bool manual) { }
|
|
~TextHandle() { this.Dispose(false); }
|
|
|
|
#endregion
|
|
}
|
|
}
|