78
|
1 /*******************************************************************************
|
|
2 * Copyright (c) 2000, 2007 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 examples.controlexample.ScrollableTab;
|
|
14
|
|
15
|
|
16
|
|
17 import dwt.DWT;
|
|
18 import dwt.widgets.Button;
|
|
19 import dwt.widgets.Widget;
|
|
20
|
|
21 import examples.controlexample.Tab;
|
|
22 import examples.controlexample.ControlExample;
|
|
23
|
|
24 abstract class ScrollableTab : Tab {
|
|
25 /* Style widgets added to the "Style" group */
|
|
26 Button singleButton, multiButton, horizontalButton, verticalButton;
|
|
27
|
|
28 /**
|
|
29 * Creates the Tab within a given instance of ControlExample.
|
|
30 */
|
|
31 this(ControlExample instance) {
|
|
32 super(instance);
|
|
33 }
|
|
34
|
|
35 /**
|
|
36 * Creates the "Style" group.
|
|
37 */
|
|
38 void createStyleGroup () {
|
|
39 super.createStyleGroup ();
|
|
40
|
|
41 /* Create the extra widgets */
|
|
42 singleButton = new Button (styleGroup, DWT.RADIO);
|
|
43 singleButton.setText ("DWT.SINGLE");
|
|
44 multiButton = new Button (styleGroup, DWT.RADIO);
|
|
45 multiButton.setText ("DWT.MULTI");
|
|
46 horizontalButton = new Button (styleGroup, DWT.CHECK);
|
|
47 horizontalButton.setText ("DWT.H_SCROLL");
|
|
48 horizontalButton.setSelection(true);
|
|
49 verticalButton = new Button (styleGroup, DWT.CHECK);
|
|
50 verticalButton.setText ("DWT.V_SCROLL");
|
|
51 verticalButton.setSelection(true);
|
|
52 borderButton = new Button (styleGroup, DWT.CHECK);
|
|
53 borderButton.setText ("DWT.BORDER");
|
|
54 }
|
|
55
|
|
56 /**
|
|
57 * Sets the state of the "Example" widgets.
|
|
58 */
|
|
59 void setExampleWidgetState () {
|
|
60 super.setExampleWidgetState ();
|
|
61 Widget [] widgets = getExampleWidgets ();
|
|
62 if (widgets.length !is 0){
|
|
63 singleButton.setSelection ((widgets [0].getStyle () & DWT.SINGLE) !is 0);
|
|
64 multiButton.setSelection ((widgets [0].getStyle () & DWT.MULTI) !is 0);
|
|
65 horizontalButton.setSelection ((widgets [0].getStyle () & DWT.H_SCROLL) !is 0);
|
|
66 verticalButton.setSelection ((widgets [0].getStyle () & DWT.V_SCROLL) !is 0);
|
|
67 borderButton.setSelection ((widgets [0].getStyle () & DWT.BORDER) !is 0);
|
|
68 }
|
|
69 }
|
|
70 }
|