1 /******************************************************************************* 2 * Copyright (c) 2000, 2008 IBM Corporation and others. 3 * All rights reserved. This program and the accompanying materials 4 * are made available under the terms of the Eclipse Public License v1.0 5 * which accompanies this distribution, and is available at 6 * http://www.eclipse.org/legal/epl-v10.html 7 * 8 * Contributors: 9 * IBM Corporation - initial API and implementation 10 * Port to the D programming language: 11 * Frank Benoit <benoit@tionex.de> 12 *******************************************************************************/ 13 module org.eclipse.swt.graphics.LineAttributes; 14 15 import java.lang.all; 16 17 import org.eclipse.swt.SWT; 18 19 /** 20 * <code>LineAttributes</code> defines a set of line attributes that 21 * can be modified in a GC. 22 * <p> 23 * Application code does <em>not</em> need to explicitly release the 24 * resources managed by each instance when those instances are no longer 25 * required, and thus no <code>dispose()</code> method is provided. 26 * </p> 27 * 28 * @see GC#getLineAttributes() 29 * @see GC#setLineAttributes(LineAttributes) 30 * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> 31 * 32 * @since 3.3 33 */ 34 public class LineAttributes { 35 36 /** 37 * The line width. 38 */ 39 public float width = 0; 40 41 /** 42 * The line style. 43 * 44 * @see org.eclipse.swt.SWT#LINE_CUSTOM 45 * @see org.eclipse.swt.SWT#LINE_DASH 46 * @see org.eclipse.swt.SWT#LINE_DASHDOT 47 * @see org.eclipse.swt.SWT#LINE_DASHDOTDOT 48 * @see org.eclipse.swt.SWT#LINE_DOT 49 * @see org.eclipse.swt.SWT#LINE_SOLID 50 */ 51 public int style; 52 53 /** 54 * The line cap style. 55 * 56 * @see org.eclipse.swt.SWT#CAP_FLAT 57 * @see org.eclipse.swt.SWT#CAP_ROUND 58 * @see org.eclipse.swt.SWT#CAP_SQUARE 59 */ 60 public int cap; 61 62 /** 63 * The line join style. 64 * 65 * @see org.eclipse.swt.SWT#JOIN_BEVEL 66 * @see org.eclipse.swt.SWT#JOIN_MITER 67 * @see org.eclipse.swt.SWT#JOIN_ROUND 68 */ 69 public int join; 70 71 /** 72 * The line dash style for SWT.LINE_CUSTOM. 73 */ 74 public float[] dash; 75 76 /** 77 * The line dash style offset for SWT.LINE_CUSTOM. 78 */ 79 public float dashOffset = 0; 80 81 /** 82 * The line miter limit. 83 */ 84 public float miterLimit = 0; 85 86 /** 87 * Create a new line attributes with the specified line width. 88 * 89 * @param width the line width 90 */ 91 public this(float width) { 92 this(width, SWT.CAP_FLAT, SWT.JOIN_MITER, SWT.LINE_SOLID, null, 0, 10); 93 } 94 95 /** 96 * Create a new line attributes with the specified line cap, join and width. 97 * 98 * @param width the line width 99 * @param cap the line cap style 100 * @param join the line join style 101 */ 102 public this(float width, int cap, int join) { 103 this(width, cap, join, SWT.LINE_SOLID, null, 0, 10); 104 } 105 106 /** 107 * Create a new line attributes with the specified arguments. 108 * 109 * @param width the line width 110 * @param cap the line cap style 111 * @param join the line join style 112 * @param style the line style 113 * @param dash the line dash style 114 * @param dashOffset the line dash style offset 115 * @param miterLimit the line miter limit 116 */ 117 public this(float width, int cap, int join, int style, float[] dash, float dashOffset, float miterLimit) { 118 this.width = width; 119 this.cap = cap; 120 this.join = join; 121 this.style = style; 122 this.dash = dash; 123 this.dashOffset = dashOffset; 124 this.miterLimit = miterLimit; 125 } 126 }