create an interface for GDIRenderer
This commit is contained in:
parent
c0e2529b20
commit
74450ee0a6
|
@ -566,6 +566,7 @@
|
||||||
<Compile Include="CoreFeatureAnalysis.Designer.cs">
|
<Compile Include="CoreFeatureAnalysis.Designer.cs">
|
||||||
<DependentUpon>CoreFeatureAnalysis.cs</DependentUpon>
|
<DependentUpon>CoreFeatureAnalysis.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="CustomControls\ControlRenderer\IControlRenderer.cs" />
|
||||||
<Compile Include="CustomControls\ExceptionBox.cs">
|
<Compile Include="CustomControls\ExceptionBox.cs">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
@ -575,7 +576,7 @@
|
||||||
<Compile Include="CustomControls\FolderBrowserDialogEx.cs">
|
<Compile Include="CustomControls\FolderBrowserDialogEx.cs">
|
||||||
<SubType>Component</SubType>
|
<SubType>Component</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="CustomControls\GDIRenderer.cs" />
|
<Compile Include="CustomControls\ControlRenderer\GDIRenderer.cs" />
|
||||||
<Compile Include="CustomControls\HexTextBox.cs">
|
<Compile Include="CustomControls\HexTextBox.cs">
|
||||||
<SubType>Component</SubType>
|
<SubType>Component</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
|
|
@ -10,7 +10,7 @@ namespace BizHawk.Client.EmuHawk.CustomControls
|
||||||
/// Wrapper for GDI rendering functions
|
/// Wrapper for GDI rendering functions
|
||||||
/// This class is not thread-safe as GDI functions should be called from the UI thread
|
/// This class is not thread-safe as GDI functions should be called from the UI thread
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class GDIRenderer : IDisposable
|
public sealed class GDIRenderer : IControlRenderer
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// used for <see cref="MeasureString(string, System.Drawing.Font, float, out int, out int)"/> calculation.
|
/// used for <see cref="MeasureString(string, System.Drawing.Font, float, out int, out int)"/> calculation.
|
||||||
|
@ -96,7 +96,7 @@ namespace BizHawk.Client.EmuHawk.CustomControls
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required to use before calling drawing methods
|
/// Required to use before calling drawing methods
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public GdiGraphicsLock LockGraphics(Graphics g)
|
public IDisposable LockGraphics(Graphics g)
|
||||||
{
|
{
|
||||||
_g = g;
|
_g = g;
|
||||||
_hdc = g.GetHdc();
|
_hdc = g.GetHdc();
|
|
@ -0,0 +1,28 @@
|
||||||
|
using System;
|
||||||
|
using System.Drawing;
|
||||||
|
|
||||||
|
namespace BizHawk.Client.EmuHawk.CustomControls
|
||||||
|
{
|
||||||
|
public interface IControlRenderer : IDisposable
|
||||||
|
{
|
||||||
|
IDisposable LockGraphics(Graphics g);
|
||||||
|
|
||||||
|
void StartOffScreenBitmap(int width, int height);
|
||||||
|
void EndOffScreenBitmap();
|
||||||
|
void CopyToScreen();
|
||||||
|
|
||||||
|
Size MeasureString(string str, Font font);
|
||||||
|
|
||||||
|
void SetBrush(Color color);
|
||||||
|
void SetSolidPen(Color color);
|
||||||
|
|
||||||
|
// TODO: use the Font version
|
||||||
|
void PrepDrawString(IntPtr hFont, Color color);
|
||||||
|
void DrawString(string str, Point point);
|
||||||
|
|
||||||
|
void DrawRectangle(int nLeftRect, int nTopRect, int nRightRect, int nBottomRect);
|
||||||
|
void FillRectangle(int x, int y, int w, int h);
|
||||||
|
void DrawBitmap(Bitmap bitmap, Point point, bool blend = false);
|
||||||
|
void Line(int x1, int y1, int x2, int y2);
|
||||||
|
}
|
||||||
|
}
|
|
@ -15,7 +15,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
// Row width is specified for horizontal orientation
|
// Row width is specified for horizontal orientation
|
||||||
public partial class InputRoll : Control
|
public partial class InputRoll : Control
|
||||||
{
|
{
|
||||||
private readonly GDIRenderer _gdi;
|
private readonly IControlRenderer _gdi;
|
||||||
private readonly SortedSet<Cell> _selectedItems = new SortedSet<Cell>(new SortCell());
|
private readonly SortedSet<Cell> _selectedItems = new SortedSet<Cell>(new SortCell());
|
||||||
|
|
||||||
private readonly VScrollBar _vBar;
|
private readonly VScrollBar _vBar;
|
||||||
|
|
Loading…
Reference in New Issue