#region CPL License /* Nuclex Framework Copyright (C) 2002-2010 Nuclex Development Labs This library is free software; you can redistribute it and/or modify it under the terms of the IBM Common Public License as published by the IBM Corporation; either version 1.0 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the IBM Common Public License for more details. You should have received a copy of the IBM Common Public License along with this library */ #endregion using System; using System.Collections.Generic; using Microsoft.Xna.Framework; namespace Nuclex.UserInterface.Visuals.Flat { /// Provides drawing methods for GUI controls /// /// Analogous to System.Drawing.Graphics, but provides specialized methods for /// drawing a GUI with a dynamic, switchable theme. /// public interface IFlatGuiGraphics { /// Sets the clipping region for any future drawing commands /// Clipping region that will be set /// /// An object that will unset the clipping region upon its destruction. /// /// /// Clipping regions can be stacked, though this is not very typical for /// a game GUI and also not recommended practice due to performance constraints. /// Unless clipping is implemented in software, setting up a clip region /// on current hardware requires the drawing queue to be flushed, negatively /// impacting rendering performance (in technical terms, a clipping region /// change likely causes 2 more DrawPrimitive() calls from the painter). /// IDisposable SetClipRegion(RectangleF clipRegion); /// Draws a GUI element onto the drawing buffer /// Class of the element to draw /// Region that will be covered by the drawn element /// /// /// GUI elements are the basic building blocks of a GUI: /// /// void DrawElement(string frameName, RectangleF bounds); /// Draws text into the drawing buffer for the specified element /// Class of the element for which to draw text /// Region that will be covered by the drawn element /// Text that will be drawn void DrawString(string frameName, RectangleF bounds, string text); /// Draws a caret for text input at the specified index /// Class of the element for which to draw a caret /// Region that will be covered by the drawn element /// Text for which a caret will be drawn /// Index the caret will be drawn at void DrawCaret(string frameName, RectangleF bounds, string text, int index); /// Measures the extents of a string in the frame's area /// Class of the element whose text will be measured /// Region that will be covered by the drawn element /// Text that will be measured /// /// The size and extents of the specified string within the frame /// RectangleF MeasureString(string frameName, RectangleF bounds, string text); /// /// Locates the closest gap between two letters to the provided position /// /// Class of the element in which to find the gap /// Region that will be covered by the drawn element /// Text in which the closest gap will be found /// Position of which to determien the closest gap /// The index of the gap the position is closest to int GetClosestOpening( string frameName, RectangleF bounds, string text, Vector2 position ); } } // namespace Nuclex.UserInterface.Visuals.Flat