public DrawingFont(IToolkit toolkit, System.Drawing.Font properties, float dpi) { this.toolkit = toolkit; this.properties = properties; this.dpi = dpi; CreateFont(); }
// Get the toolkit version of this font for a specific toolkit. internal IToolkitFont GetFont(IToolkit toolkit, float dpi) { lock (this) { if (this.toolkitFont == null) { // We don't yet have a toolkit font yet. this.toolkitFont = toolkit.CreateFont(this, dpi); this.toolkit = toolkit; return(this.toolkitFont); } else if (this.toolkit == toolkit) { // Same toolkit - return the cached pen information. return(this.toolkitFont); } else { // We have a font object for another toolkit, // so dispose it and create for this toolkit. // We null out "toolkitFont" before calling // "CreateFont()" just in case an exception // is thrown while creating the toolkit font. this.toolkitFont.Dispose(); this.toolkitFont = null; this.toolkitFont = toolkit.CreateFont(this, dpi); this.toolkit = toolkit; return(this.toolkitFont); } } }
public DrawingTopLevelWindow(Widget parent, String name, int x, int y, int width, int height) : base(parent, name, x, y, width, height) { this.toolkit = ((IToolkitWindow)(parent.Parent)).Toolkit; this.AutoMapChildren = false; }
public void ToLogFont(Object lf, Graphics graphics) { IToolkitGraphics g; if (graphics != null) { g = graphics.ToolkitGraphics; } else { g = null; } lock (this) { if (toolkitFont == null) { if (g != null) { GetFont(g.Toolkit, graphics.DpiY); } else { IToolkit toolkit = ToolkitManager.Toolkit; float dpiY = toolkit.GetDefaultGraphics().DpiY; GetFont(toolkit, dpiY); } } toolkitFont.ToLogFont(lf, g); } }
// Constructor. public DrawingGraphics(IToolkit toolkit, Xsharp.Graphics graphics) : base(toolkit) { this.graphics = graphics; this.font = null; this.gaveHdc = false; }
// Constructor. public DrawingWindowBuffer(IToolkitWindow windowToBuffer) { toolkit = windowToBuffer.Toolkit; widget = windowToBuffer as InputOutputWidget; buffer = null; graphics = null; }
public DrawingTopLevelWindow(Widget parent, String name, int x, int y, int width, int height) : base(parent, name, x, y, width, height) { this.toolkit = ((IToolkitWindow)(parent.Parent)).Toolkit; this.AutoMapChildren = false; }
// Get the toolkit version of this brush for a specific toolkit. internal IToolkitBrush GetBrush(IToolkit toolkit) { lock (this) { if (this.toolkitBrush == null) { // We don't yet have a toolkit brush yet. this.toolkitBrush = CreateBrush(toolkit); this.toolkit = toolkit; return(this.toolkitBrush); } else if (this.toolkit == toolkit) { // Same toolkit - return the cached brush information. return(this.toolkitBrush); } else { // We have a brush for another toolkit, // so dispose it and create for this toolkit. // We null out "toolkitBrush" before calling // "CreateBrush()" just in case an exception // is thrown while creating the toolkit brush. this.toolkitBrush.Dispose(); this.toolkitBrush = null; this.toolkitBrush = CreateBrush(toolkit); this.toolkit = toolkit; return(this.toolkitBrush); } } }
// Get the toolkit version of this brush for a specific toolkit. internal IToolkitBrush GetBrush(IToolkit toolkit) { lock(this) { if(this.toolkitBrush == null) { // We don't yet have a toolkit brush yet. this.toolkitBrush = CreateBrush(toolkit); this.toolkit = toolkit; return this.toolkitBrush; } else if(this.toolkit == toolkit) { // Same toolkit - return the cached brush information. return this.toolkitBrush; } else { // We have a brush for another toolkit, // so dispose it and create for this toolkit. // We null out "toolkitBrush" before calling // "CreateBrush()" just in case an exception // is thrown while creating the toolkit brush. this.toolkitBrush.Dispose(); this.toolkitBrush = null; this.toolkitBrush = CreateBrush(toolkit); this.toolkit = toolkit; return this.toolkitBrush; } } }
public DrawingXorBrush(IToolkit toolkit, IToolkitBrush innerBrush) : base(toolkit, System.Drawing.Color.Black) { // TODO: create the XOR brush. this.innerBrush = innerBrush; hBrush = IntPtr.Zero; }
// Constructor. public DrawingWindowBuffer(IToolkitWindow windowToBuffer) { toolkit = windowToBuffer.Toolkit; widget = windowToBuffer as InputOutputWidget; buffer = null; graphics = null; }
// Constructor. public DrawingGraphics(IToolkit toolkit, Xsharp.Graphics graphics) : base(toolkit) { this.graphics = graphics; this.font = null; this.gaveHdc = false; }
public DrawingFont(IToolkit toolkit, System.Drawing.Font properties, float dpi) { this.toolkit = toolkit; this.properties = properties; this.dpi = dpi; CreateFont(); }
// Get the toolkit version of this pen for a specific toolkit. internal IToolkitPen GetPen(IToolkit toolkit) { lock (this) { if (toolkitPen == null) { // We don't yet have a toolkit pen yet. toolkitPen = toolkit.CreatePen(this); this.toolkit = toolkit; return(toolkitPen); } else if (this.toolkit == toolkit) { // Same toolkit - return the cached pen information. return(toolkitPen); } else { // We have a pen for another toolkit, // so dispose it and create for this toolkit. // We null out "toolkitPen" before calling // "CreatePen()" just in case an exception // is thrown while creating the toolkit pen. toolkitPen.Dispose(); toolkitPen = null; toolkitPen = toolkit.CreatePen(this); this.toolkit = toolkit; return(toolkitPen); } } }
public DrawingXorBrush(IToolkit toolkit, IToolkitBrush innerBrush) : base(toolkit, System.Drawing.Color.Black) { // TODO: create the XOR brush. this.innerBrush = innerBrush; hBrush = IntPtr.Zero; }
// Constructor. public DrawingPen(IToolkit toolkit, Pen properties) : base(properties.Color, (int)properties.Width) { this.toolkit = toolkit; this.properties = properties; //TODO: Rest of the properties win32Color = DrawingGraphics.ColorToWin32(properties.Color); hPen = Win32.Api.CreatePen((int)properties.DashStyle, (int)properties.Width, win32Color); }
// Constructor. public PostscriptGraphics(IToolkit toolkit, TextWriter writer, PostscriptPrintSession session) : base(toolkit) { this.writer = writer; this.session = session; this.selectObject = null; }
// Constructors. public DrawingTopLevelWindow(IToolkit toolkit, String name, int width, int height, IToolkitEventSink sink) : base(name, width, height) { this.sink = sink; this.toolkit = toolkit; this.AutoMapChildren = false; }
// Constructors. public DrawingTopLevelWindow(IToolkit toolkit, String name, int width, int height, IToolkitEventSink sink) : base(name, width, height) { this.sink = sink; this.toolkit = toolkit; this.AutoMapChildren = false; }
// Constructor. public DrawingPen(IToolkit toolkit, Pen properties) : base(properties.Color, (int)properties.Width) { this.toolkit = toolkit; this.properties = properties; //TODO: Rest of the properties win32Color = DrawingGraphics.ColorToWin32(properties.Color); hPen = Win32.Api.CreatePen((int)properties.DashStyle, (int)properties.Width, win32Color); }
// Constructor. public PostscriptGraphics(IToolkit toolkit, TextWriter writer, PostscriptPrintSession session) : base(toolkit) { this.writer = writer; this.session = session; this.selectObject = null; }
// Constructor. public DrawingMdiClient (IToolkit toolkit, Widget parent, int x, int y, int width, int height, IToolkitEventSink sink) : base(parent, x, y, width, height) { this.sink = sink; this.toolkit = toolkit; this.AutoMapChildren = false; }
// Constructor. public DrawingPopupWindow (IToolkit toolkit, int x, int y, int width, int height, IToolkitEventSink sink) : base(x, y, width, height) { this.sink = sink; this.toolkit = toolkit; this.AutoMapChildren = false; }
// Create this brush for a specific toolkit. Inner part of "GetBrush()". internal override IToolkitBrush CreateBrush(IToolkit toolkit) { if (image.toolkitImage == null) { image.toolkitImage = toolkit.CreateImage(image.dgImage, 0); } return(toolkit.CreateTextureBrush(this, image.toolkitImage, dstRect, imageAttr)); }
protected override void Dispose(bool disposing) { base.Dispose(disposing); if (m_toolkit != null) { m_toolkit.Dispose(); m_toolkit = null; } }
// Constructor. public DrawingTextureBrush(IToolkit toolkit, TextureBrush properties, IToolkitImage image, RectangleF dstRect, ImageAttributes imageAttr) : base(toolkit, Color.Black) { this.properties = properties; this.image = image as DrawingImage; this.dstRect = dstRect; this.imageAttr = imageAttr; }
// Constructor. public DrawingMdiClient (IToolkit toolkit, Widget parent, int x, int y, int width, int height, IToolkitEventSink sink) : base(parent, x, y, width, height) { this.sink = sink; this.toolkit = toolkit; this.AutoMapChildren = false; }
protected override void Dispose(bool disposing) { base.Dispose(disposing); if (m_toolkit != null) { m_toolkit.Dispose(); m_toolkit = null; } }
// Constructor. public DrawingTextureBrush(IToolkit toolkit, TextureBrush properties, IToolkitImage image, RectangleF dstRect, ImageAttributes imageAttr) : base(toolkit, Color.Black) { this.properties = properties; this.image = image as DrawingImage; this.dstRect = dstRect; this.imageAttr = imageAttr; }
// Constructor. public DrawingPopupWindow (IToolkit toolkit, int x, int y, int width, int height, IToolkitEventSink sink) : base(x, y, width, height) { this.sink = sink; this.toolkit = toolkit; this.AutoMapChildren = false; }
// Constructor. public PostscriptPrintSession(String printerName, PrintDocument document) { this.printerName = printerName; this.document = document; this.writer = null; this.encoding = Encoding.Default; this.toolkit = new PostscriptToolkit(); this.onPage = false; this.pageNum = 1; }
// Constructor. public PostscriptPrintSession(String printerName, PrintDocument document) { this.printerName = printerName; this.document = document; this.writer = null; this.encoding = Encoding.Default; this.toolkit = new PostscriptToolkit(); this.onPage = false; this.pageNum = 1; }
// Convert this object into a native font handle. public IntPtr ToHfont() { if (toolkitFont == null) { IToolkit toolkit = ToolkitManager.Toolkit; float dpiY = toolkit.GetDefaultGraphics().DpiY; GetFont(toolkit, dpiY); } return(toolkitFont.GetHfont()); }
/// <summary> /// Gets the vat code list. /// </summary> /// <param name="toolkit">The toolkit.</param> /// <param name="sort">if set to <c>true</c> [sort].</param> /// <returns></returns> public static List <VatCode> GetVatCodeList(IToolkit toolkit, bool sort = false) { string[] VATCodesToInclude = { "S", "E", "Z", "1", "2", "3", "4", "5", "6", "7", "8", "9", "T", "X", "B", "C", "F", "G", "R", "W", "Y" }; List <VatCode> VATCodeList = new List <VatCode>(); int iVATCode = 0; //Fill List for (iVATCode = 0; iVATCode <= VATCodesToInclude.Length - 1; iVATCode++) { VATCodeList.Add( new VatCode(toolkit.SystemSetup.ssVATRates[VATCodesToInclude[iVATCode]].svCode, Convert.ToDecimal(toolkit.SystemSetup.ssVATRates[VATCodesToInclude[iVATCode]].svRate), toolkit.SystemSetup.ssVATRates[VATCodesToInclude[iVATCode]].svDesc)); } //NF: 22/02/2011 Added Acquisitions / Despatches to the VAT Code list VATCodeList.Add(new VatCode("A", Convert.ToDecimal(toolkit.SystemSetup.ssVATRates["3"].svRate), "Acquisitions")); VATCodeList.Add(new VatCode("D", Convert.ToDecimal(toolkit.SystemSetup.ssVATRates["4"].svRate), "Despatches")); //Sort List by VATCode ? if (sort) { IEnumerable <VatCode> SortedVATCodeList = VATCodeList.OrderBy(x => x.Code); return(new List <VatCode>(SortedVATCodeList)); } else { return(VATCodeList); } }
static ToolkitHandler() { if (ToolkitManager.toolkitOverride != null) { toolkit = ToolkitManager.toolkitOverride; } else { toolkit = CreateDefaultToolkit(); } }
// Destroy this window and all of its children. void IToolkitWindow.Destroy() { Destroy(); /* * if the window is destroyed, set toolkit and sink to zero. * otherwise, we couold get events like LostFocus... */ toolkit = null; sink = null; }
// Convert this object into a native font handle. public IntPtr ToHfont() { if (_toolkitFont == null) { IToolkit toolkit = ToolkitManager.Toolkit; // TODO: this is the next place we need to extend portable GDI. Use the FontReaderCs stuff float dpiY = toolkit.GetDefaultGraphics().DpiY; GetFont(toolkit, dpiY); } return _toolkitFont.GetHfont(); }
// Mark this brush as modified, and flush all previous brush information. // Used when a subclass modifies a brush's properties. internal void Modified() { lock (this) { if (toolkitBrush != null) { toolkitBrush.Dispose(); toolkitBrush = null; } toolkit = null; } }
// Dispose of this object. public void Dispose() { lock (this) { if (toolkitFont != null) { toolkitFont.Dispose(); toolkitFont = null; } toolkit = null; } }
// Mark this brush as modified, and flush all previous brush information. // Used when a subclass modifies a brush's properties. internal void Modified() { lock(this) { if(toolkitBrush != null) { toolkitBrush.Dispose(); toolkitBrush = null; } toolkit = null; } }
// Constructor. protected ToolkitGraphicsBase(IToolkit toolkit) { this.toolkit = toolkit; clip = null; compositingMode = CompositingMode.SourceOver; compositingQuality = CompositingQuality.Default; interpolationMode = InterpolationMode.Default; pixelOffsetMode = PixelOffsetMode.Default; renderingOrigin = new Point(0, 0); smoothingMode = SmoothingMode.Default; textContrast = 4; textRenderingHint = TextRenderingHint.SystemDefault; dirtyFlags = DirtyFlags.All; }
// Constructor. protected ToolkitGraphicsBase(IToolkit toolkit) { this.toolkit = toolkit; clip = null; compositingMode = CompositingMode.SourceOver; compositingQuality = CompositingQuality.Default; interpolationMode = InterpolationMode.Default; pixelOffsetMode = PixelOffsetMode.Default; renderingOrigin = new Point(0, 0); smoothingMode = SmoothingMode.Default; textContrast = 4; textRenderingHint = TextRenderingHint.SystemDefault; dirtyFlags = DirtyFlags.All; }
// Dispose of this pen. public void Dispose() { lock (this) { if (toolkitPen != null) { toolkitPen.Dispose(); toolkitPen = null; } toolkit = null; if (brush != null) { brush.Modified(); } } }
public DrawingHatchBrush(IToolkit toolkit, HatchStyle style, System.Drawing.Color foreColor, System.Drawing.Color backColor) : base (toolkit, backColor) { this.foreColor = DrawingGraphics.ColorToWin32(foreColor); this.backColor = DrawingGraphics.ColorToWin32(backColor); IntPtr hBi; lock(typeof(DrawingHatchBrush)) { hBi = GetBitmap(style); } if (hBi != IntPtr.Zero) { hBrush = Win32.Api.CreatePatternBrush(hBi); } else //not one of the types we recognize, so make it a solid brush hBrush = DrawingSolidBrush.CreateSolidBrush(foreColor); }
// Dispose of this pen. public void Dispose() { if (_disposed) { return; } lock (this) { _disposed = true; if (toolkitPen != null) { toolkitPen.Dispose(); toolkitPen = null; } toolkit = null; if (brush != null) { brush.Modified(); } } }
/// <summary> /// Gets the company code by data directory. /// </summary> /// <param name="toolkit">The toolkit.</param> /// <param name="dataDirectory">The data directory.</param> /// <returns></returns> public static string GetCompanyCodeByDataDirectory(IToolkit toolkit, string dataDirectory) { string result = null; DirectoryInfo dataDirectoryInfo = new DirectoryInfo(dataDirectory); for (int i = 1; i <= toolkit.Company.cmCount; i++) { int compareResult = 0; compareResult = string.Compare(toolkit.Company.cmCompany[i].coPath.Trim(), dataDirectoryInfo.GetShortName(), StringComparison.InvariantCultureIgnoreCase); if ((compareResult == 0)) { result = toolkit.Company.cmCompany[i].coCode.Trim(); break; } } return(result); }
// Create this brush for a specific toolkit. Inner part of "GetBrush()". internal override IToolkitBrush CreateBrush(IToolkit toolkit) { IToolkitBrush brush; if (mode != (LinearGradientMode)(-1)) { brush = toolkit.CreateLinearGradientBrush (rect, color1, color2, mode); } else { brush = toolkit.CreateLinearGradientBrush (rect, color1, color2, angle, isAngleScaleable); } if (brush == null) { // The toolkit doesn't support gradients, so back // off to a solid brush using "color1". brush = toolkit.CreateSolidBrush(color1); } return(brush); }
public DrawingBrush(IToolkit toolkit, Color color) : base (color) { this.toolkit = toolkit; }
public DrawingGraphics(IToolkit toolkit, IntPtr hdc) : base(toolkit) { this.hdc = hdc; this.gaveHdc = false; }
public DrawingGraphicsImage(IToolkit toolkit, IToolkitImage image) : base(toolkit, image) {}
// Dispose of this pen. public void Dispose() { lock(this) { if(toolkitPen != null) { toolkitPen.Dispose(); toolkitPen = null; } toolkit = null; if(brush != null) { brush.Modified(); } } }
// Create this brush for a specific toolkit. Inner part of "GetBrush()". internal override IToolkitBrush CreateBrush(IToolkit toolkit) { if(image.toolkitImage == null) { image.toolkitImage = toolkit.CreateImage(image.dgImage, 0); } return toolkit.CreateTextureBrush(this, image.toolkitImage, dstRect, imageAttr); }
protected ToolkitGraphicsImageBase(IToolkit toolkit, IToolkitImage image) : base(toolkit) { this.image = image as ToolkitImageBase; }
// Create this brush for a specific toolkit. Inner part of "GetBrush()". internal virtual IToolkitBrush CreateBrush(IToolkit toolkit) { // Normally overridden in subclasses. throw new InvalidOperationException(); }
// Constructor. internal Brush() { toolkit = null; toolkitBrush = null; }
private Font(IToolkitFont font) { this.toolkit = toolkit; this.toolkitFont = font; // TODO: load the font information from the IToolkitFont }
// Dispose of this object. public void Dispose() { lock(this) { if(toolkitFont != null) { toolkitFont.Dispose(); toolkitFont = null; } toolkit = null; } }
// Get the toolkit version of this font for a specific toolkit. internal IToolkitFont GetFont(IToolkit toolkit, float dpi) { lock(this) { if(this.toolkitFont == null) { // We don't yet have a toolkit font yet. this.toolkitFont = toolkit.CreateFont(this, dpi); this.toolkit = toolkit; return this.toolkitFont; } else if(this.toolkit == toolkit) { // Same toolkit - return the cached pen information. return this.toolkitFont; } else { // We have a font object for another toolkit, // so dispose it and create for this toolkit. // We null out "toolkitFont" before calling // "CreateFont()" just in case an exception // is thrown while creating the toolkit font. this.toolkitFont.Dispose(); this.toolkitFont = null; this.toolkitFont = toolkit.CreateFont(this, dpi); this.toolkit = toolkit; return this.toolkitFont; } } }
// Get the toolkit version of this pen for a specific toolkit. internal IToolkitPen GetPen(IToolkit toolkit) { lock(this) { if(this.toolkitPen == null) { // We don't yet have a toolkit pen yet. this.toolkitPen = toolkit.CreatePen(this); this.toolkit = toolkit; return this.toolkitPen; } else if(this.toolkit == toolkit) { // Same toolkit - return the cached pen information. return this.toolkitPen; } else { // We have a pen for another toolkit, // so dispose it and create for this toolkit. // We null out "toolkitPen" before calling // "CreatePen()" just in case an exception // is thrown while creating the toolkit pen. this.toolkitPen.Dispose(); this.toolkitPen = null; this.toolkitPen = toolkit.CreatePen(this); this.toolkit = toolkit; return this.toolkitPen; } } }
// Create this brush for a specific toolkit. Inner part of "GetBrush()". internal override IToolkitBrush CreateBrush(IToolkit toolkit) { return toolkit.CreateHatchBrush(style, foreColor, backColor); }