root/branches/0.2/controlexample/scrollabletab.d

Revision 46, 2.3 kB (checked in by JJR, 4 years ago)

* 0.2 Branch added: New working DWT version submitted by Shawn Liu.

Line 
1 /*******************************************************************************
2  * Copyright (c) 2000, 2003 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Common Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/cpl-v10.html
7  *
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  *******************************************************************************/
11 module controlexample.scrollabletab;
12
13 private {
14 import swt.all;
15 import controlexample.tab;
16 import controlexample.controlexample;
17 }
18
19
20 abstract class ScrollableTab : Tab {
21     /* Style widgets added to the "Style" group */ 
22     Button singleButton, multiButton, horizontalButton, verticalButton, borderButton;
23
24     /**
25      * Creates the Tab within a given instance_ren of ControlExample.
26      */
27     this(ControlExample instance_ren) {
28         super(instance_ren);
29     }
30
31     /**
32      * Creates the "Style" group.
33      */
34     void createStyleGroup () {
35         super.createStyleGroup ();
36    
37         /* Create the extra widgets */
38         singleButton = new Button (styleGroup, SWT.RADIO);
39         singleButton.setText ("SWT.SINGLE");
40         multiButton = new Button (styleGroup, SWT.RADIO);
41         multiButton.setText ("SWT.MULTI");
42         horizontalButton = new Button (styleGroup, SWT.CHECK);
43         horizontalButton.setText ("SWT.H_SCROLL");
44         horizontalButton.setSelection(true);
45         verticalButton = new Button (styleGroup, SWT.CHECK);
46         verticalButton.setText ("SWT.V_SCROLL");
47         verticalButton.setSelection(true);
48         borderButton = new Button (styleGroup, SWT.CHECK);
49         borderButton.setText ("SWT.BORDER");
50     }
51    
52     /**
53      * Sets the state of the "Example" widgets.
54      */
55     void setExampleWidgetState () {
56         super.setExampleWidgetState ();
57         Control [] controls = getExampleWidgets ();
58         if (controls.length != 0){
59             singleButton.setSelection ((controls [0].getStyle () & SWT.SINGLE) != 0);
60             multiButton.setSelection ((controls [0].getStyle () & SWT.MULTI) != 0);
61             horizontalButton.setSelection ((controls [0].getStyle () & SWT.H_SCROLL) != 0);
62             verticalButton.setSelection ((controls [0].getStyle () & SWT.V_SCROLL) != 0);
63             borderButton.setSelection ((controls [0].getStyle () & SWT.BORDER) != 0);
64         }
65     }
66 }
Note: See TracBrowser for help on using the browser.