// "Therefore those skilled at the unorthodox
// are infinite as heaven and earth,
// inexhaustible as the great rivers.
// When they come to an end,
// they begin again,
// like the days and months;
// they die and are reborn,
// like the four seasons."
//
// - Sun Tsu,
// "The Art of War"
using TheArtOfDev.HtmlRenderer.Adapters.Entities;
using TheArtOfDev.HtmlRenderer.Core.Utils;
namespace TheArtOfDev.HtmlRenderer.Adapters
{
///
/// Adapter for platform specific control object - used to handle updating the control that the html is rendered on.
/// Not relevant for platforms that don't render HTML on UI element.
///
public abstract class RControl
{
///
/// The platform adapter.
///
private readonly RAdapter _adapter;
///
/// Init control with platform adapter.
///
protected RControl(RAdapter adapter)
{
ArgChecker.AssertArgNotNull(adapter, "adapter");
_adapter = adapter;
}
///
/// The platform adapter.
///
public RAdapter Adapter
{
get { return _adapter; }
}
///
/// Is the left mouse button is currently in pressed state
///
public abstract bool LeftMouseButton { get; }
///
/// Is the right mouse button is currently in pressed state
///
public abstract bool RightMouseButton { get; }
///
/// Get the current location of the mouse relative to the control
///
public abstract RPoint MouseLocation { get; }
///
/// Set the cursor over the control to default cursor
///
public abstract void SetCursorDefault();
///
/// Set the cursor over the control to hand cursor
///
public abstract void SetCursorHand();
///
/// Set the cursor over the control to I beam cursor
///
public abstract void SetCursorIBeam();
///
/// Do drag-drop copy operation for the given data object.
///
/// the drag-drop data object
public abstract void DoDragDropCopy(object dragDropData);
///
/// Measure the width of string under max width restriction calculating the number of characters that can fit and the width those characters take.
///
/// the string to measure
/// the font to measure string with
/// the max width to calculate fit characters
/// the number of characters that will fit under maxWidth restriction
/// the width that only the characters that fit into max width take
public abstract void MeasureString(string str, RFont font, double maxWidth, out int charFit, out double charFitWidth);
///
/// Invalidates the entire surface of the control and causes the control to be redrawn.
///
public abstract void Invalidate();
}
}