comparison org.eclipse.draw2d/src/org/eclipse/draw2d/SimpleRaisedBorder.d @ 12:bc29606a740c

Added dwt-addons in original directory structure of eclipse.org
author Frank Benoit <benoit@tionex.de>
date Sat, 14 Mar 2009 18:23:29 +0100
parents
children
comparison
equal deleted inserted replaced
11:43904fec5dca 12:bc29606a740c
1 /*******************************************************************************
2 * Copyright (c) 2000, 2005 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.draw2d.SimpleRaisedBorder;
14
15 import java.lang.all;
16
17 import org.eclipse.swt.graphics.Color;
18 import org.eclipse.draw2d.SchemeBorder;
19 import org.eclipse.draw2d.ColorConstants;
20
21 /**
22 * Provides a raised border.
23 */
24 public class SimpleRaisedBorder
25 : SchemeBorder
26 {
27
28 private static Scheme DOUBLE_;
29 private static Scheme DOUBLE(){
30 if( !initStaticCtor_done ) initStaticCtor();
31 assert(DOUBLE_);
32 return DOUBLE_;
33 }
34
35 private static bool initStaticCtor_done = false;
36 private static void initStaticCtor(){
37 synchronized( SimpleRaisedBorder.classinfo ){
38 if( !initStaticCtor_done ){
39 DOUBLE_ = new Scheme(
40 [ColorConstants.buttonLightest, ColorConstants.button],
41 [ColorConstants.buttonDarkest, ColorConstants.buttonDarker]
42 );
43 initStaticCtor_done = true;
44 }
45 }
46 }
47
48
49 /**
50 * Constructs a SimpleRaisedBorder with the predefined {@link SchemeBorder.SCHEMES#BUTTON_RAISED}
51 * Scheme set as default.
52 *
53 * @since 2.0
54 */
55 public this() {
56 super(SCHEMES.BUTTON_RAISED);
57 }
58
59 /**
60 * Constructs a SimpleRaisedBorder with the width of all sides provided as input. If
61 * width is 2, this SimpleRaisedBorder will use the local DOUBLE Scheme, otherwise it will
62 * use the {@link SchemeBorder.SCHEMES#BUTTON_RAISED} Scheme.
63 *
64 * @param width the width of all the sides of the border
65 * @since 2.0
66 */
67 public this(int width) {
68 super(width is 2 ? DOUBLE : SCHEMES.BUTTON_RAISED);
69 }
70
71 }