comparison dwtx/draw2d/Toggle.d @ 98:95307ad235d9

Added Draw2d code, still work in progress
author Frank Benoit <benoit@tionex.de>
date Sun, 03 Aug 2008 00:52:14 +0200
parents
children
comparison
equal deleted inserted replaced
96:b492ba44e44d 98:95307ad235d9
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 dwtx.draw2d.Toggle;
14
15 import dwt.dwthelper.utils;
16
17 import dwt.graphics.Image;
18 import dwtx.draw2d.Clickable;
19 import dwtx.draw2d.IFigure;
20 import dwtx.draw2d.Label;
21
22 /**
23 * Basic Rule for Toggle: Whoever creates the toggle is reponsible for response changes
24 * for it (selection, rollover, etc). Only {@link dwtx.draw2d.CheckBox} does its
25 * own listening.
26 */
27 public class Toggle
28 : Clickable
29 {
30
31 /**
32 * Constructs a Toggle with no text or icon.
33 *
34 * @since 2.0
35 */
36 public this() {
37 super();
38 setStyle(STYLE_TOGGLE);
39 }
40
41 /**
42 * Constructs a Toggle with passed text and icon
43 *
44 * @param text the text
45 * @param icon the icon
46 * @since 2.0
47 */
48 public this(String text, Image icon) {
49 super(new Label(text, icon), STYLE_TOGGLE);
50 }
51
52 /**
53 * Constructs a Toggle with passed IFigure as its contents.
54 *
55 * @param contents the contents
56 * @since 2.0
57 */
58 public this(IFigure contents) {
59 super(contents, STYLE_TOGGLE);
60 }
61
62 /**
63 * Constructs a Toggle with the passed figure as its contents and the given style.
64 * @param contents the contents
65 * @param style the style
66 */
67 public this(IFigure contents, int style) {
68 super(contents, style);
69 }
70
71 }