| 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.sashformtab; |
|---|
| 12 |
|
|---|
| 13 |
private { |
|---|
| 14 |
import swt.all; |
|---|
| 15 |
import controlexample.tab; |
|---|
| 16 |
import controlexample.controlexample; |
|---|
| 17 |
} |
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
class SashFormTab : Tab { |
|---|
| 21 |
/* Example widgets and groups that contain them */ |
|---|
| 22 |
SashForm fullForm, topForm; |
|---|
| 23 |
List list1, list2, list3; |
|---|
| 24 |
Text text; |
|---|
| 25 |
|
|---|
| 26 |
static String [] ListData0; |
|---|
| 27 |
static String [] ListData1; |
|---|
| 28 |
|
|---|
| 29 |
/* Constants */ |
|---|
| 30 |
static int SASH_WIDTH = 3; |
|---|
| 31 |
|
|---|
| 32 |
/** |
|---|
| 33 |
* Creates the Tab within a given instance_ren of ControlExample. |
|---|
| 34 |
*/ |
|---|
| 35 |
this(ControlExample instance_ren) { |
|---|
| 36 |
if(ListData0 is null){ |
|---|
| 37 |
ListData0 ~= ControlExample.getResourceString("ListData0_0"); |
|---|
| 38 |
ListData0 ~= ControlExample.getResourceString("ListData0_1"); |
|---|
| 39 |
ListData0 ~= ControlExample.getResourceString("ListData0_2"); |
|---|
| 40 |
ListData0 ~= ControlExample.getResourceString("ListData0_3"); |
|---|
| 41 |
ListData0 ~= ControlExample.getResourceString("ListData0_4"); |
|---|
| 42 |
ListData0 ~= ControlExample.getResourceString("ListData0_5"); |
|---|
| 43 |
ListData0 ~= ControlExample.getResourceString("ListData0_6"); |
|---|
| 44 |
ListData0 ~= ControlExample.getResourceString("ListData0_7"); |
|---|
| 45 |
ListData0 ~= ControlExample.getResourceString("ListData0_8"); |
|---|
| 46 |
} |
|---|
| 47 |
if(ListData1 is null){ |
|---|
| 48 |
ListData1 ~= ControlExample.getResourceString("ListData1_0"); |
|---|
| 49 |
ListData1 ~= ControlExample.getResourceString("ListData1_1"); |
|---|
| 50 |
ListData1 ~= ControlExample.getResourceString("ListData1_2"); |
|---|
| 51 |
ListData1 ~= ControlExample.getResourceString("ListData1_3"); |
|---|
| 52 |
ListData1 ~= ControlExample.getResourceString("ListData1_4"); |
|---|
| 53 |
ListData1 ~= ControlExample.getResourceString("ListData1_5"); |
|---|
| 54 |
ListData1 ~= ControlExample.getResourceString("ListData1_6"); |
|---|
| 55 |
ListData1 ~= ControlExample.getResourceString("ListData1_7"); |
|---|
| 56 |
ListData1 ~= ControlExample.getResourceString("ListData1_8"); |
|---|
| 57 |
} |
|---|
| 58 |
super(instance_ren); |
|---|
| 59 |
} |
|---|
| 60 |
|
|---|
| 61 |
/** |
|---|
| 62 |
* Creates the tab folder page. |
|---|
| 63 |
*/ |
|---|
| 64 |
Composite createTabFolderPage (TabFolder tabFolder) { |
|---|
| 65 |
tabFolderPage = new Composite(tabFolder, SWT.BORDER); |
|---|
| 66 |
tabFolderPage.setLayout(new FillLayout()); |
|---|
| 67 |
|
|---|
| 68 |
fullForm = new SashForm (tabFolderPage, SWT.HORIZONTAL); |
|---|
| 69 |
fullForm.setLayout(new FillLayout()); |
|---|
| 70 |
topForm = new SashForm (fullForm, SWT.VERTICAL); |
|---|
| 71 |
topForm.setLayout(new FillLayout()); |
|---|
| 72 |
|
|---|
| 73 |
list1 = new List (topForm, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER); |
|---|
| 74 |
list1.setItems (ListData0); |
|---|
| 75 |
list2 = new List (topForm, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER); |
|---|
| 76 |
list2.setItems (ListData1); |
|---|
| 77 |
text = new Text (fullForm, SWT.MULTI | SWT.BORDER); |
|---|
| 78 |
text.setText (ControlExample.getResourceString("Multi_line")); |
|---|
| 79 |
|
|---|
| 80 |
int[] intArr = new int[2]; |
|---|
| 81 |
intArr[] = 2; |
|---|
| 82 |
fullForm.setWeights(intArr); |
|---|
| 83 |
topForm.setWeights(intArr); |
|---|
| 84 |
|
|---|
| 85 |
return tabFolderPage; |
|---|
| 86 |
} |
|---|
| 87 |
|
|---|
| 88 |
/** |
|---|
| 89 |
* Gets the "Example" widget children. |
|---|
| 90 |
*/ |
|---|
| 91 |
Control [] getExampleWidgets () { |
|---|
| 92 |
Control[] result; |
|---|
| 93 |
result ~= fullForm; |
|---|
| 94 |
result ~= topForm; |
|---|
| 95 |
return result; |
|---|
| 96 |
} |
|---|
| 97 |
|
|---|
| 98 |
/** |
|---|
| 99 |
* Gets the text for the tab folder item. |
|---|
| 100 |
*/ |
|---|
| 101 |
String getTabText () { |
|---|
| 102 |
return "SashForm"; |
|---|
| 103 |
} |
|---|
| 104 |
|
|---|
| 105 |
/** |
|---|
| 106 |
* Recreates the "Example" widgets. |
|---|
| 107 |
*/ |
|---|
| 108 |
void recreateExampleWidgets () { |
|---|
| 109 |
// this tab does not use this framework mechanism |
|---|
| 110 |
} |
|---|
| 111 |
} |
|---|