create an interface for GDIRenderer

This commit is contained in:
adelikat 2019-10-19 21:12:29 -05:00
parent c0e2529b20
commit 74450ee0a6
4 changed files with 800 additions and 771 deletions

View File

@ -566,6 +566,7 @@
<Compile Include="CoreFeatureAnalysis.Designer.cs">
<DependentUpon>CoreFeatureAnalysis.cs</DependentUpon>
</Compile>
<Compile Include="CustomControls\ControlRenderer\IControlRenderer.cs" />
<Compile Include="CustomControls\ExceptionBox.cs">
<SubType>Form</SubType>
</Compile>
@ -575,7 +576,7 @@
<Compile Include="CustomControls\FolderBrowserDialogEx.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="CustomControls\GDIRenderer.cs" />
<Compile Include="CustomControls\ControlRenderer\GDIRenderer.cs" />
<Compile Include="CustomControls\HexTextBox.cs">
<SubType>Component</SubType>
</Compile>

View File

@ -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);
}
}

View File

@ -15,7 +15,7 @@ namespace BizHawk.Client.EmuHawk
// Row width is specified for horizontal orientation
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 VScrollBar _vBar;