Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarolyn MacLeod2004-12-07 21:45:00 +0000
committerCarolyn MacLeod2004-12-07 21:45:00 +0000
commit2d79f252b5f2c3546d09cf5d18597ac7d7b1e41a (patch)
treef04c7ac61477f7b461fa79b30e2537376ec1c74f /examples
parent53a34b63ee4638535f7a21480f7539d6a237b988 (diff)
downloadeclipse.platform.swt-2d79f252b5f2c3546d09cf5d18597ac7d7b1e41a.tar.gz
eclipse.platform.swt-2d79f252b5f2c3546d09cf5d18597ac7d7b1e41a.tar.xz
eclipse.platform.swt-2d79f252b5f2c3546d09cf5d18597ac7d7b1e41a.zip
*** empty log message ***
Diffstat (limited to 'examples')
-rw-r--r--examples/org.eclipse.swt.examples/src/examples_control.properties19
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/CoolBarTab.java21
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ToolBarTab.java45
3 files changed, 73 insertions, 12 deletions
diff --git a/examples/org.eclipse.swt.examples/src/examples_control.properties b/examples/org.eclipse.swt.examples/src/examples_control.properties
index bdbbbf4a04..bd3c327d72 100644
--- a/examples/org.eclipse.swt.examples/src/examples_control.properties
+++ b/examples/org.eclipse.swt.examples/src/examples_control.properties
@@ -76,6 +76,7 @@ Example_string = The quick brown fox jumps over the lazy dog.
Header_Visible = Header Visible
Lines_Visible = Lines Visible
Locked = Locked
+Combo_child = Combo Child
Node_1 = Node 1
Node_2 = Node 2
Node_3 = Node 3
@@ -139,15 +140,15 @@ ListData1_5 = Kiwi
ListData1_6 = Apricots
ListData1_7 = Strawberries
ListData1_8 = The Longest String
-DropDownData_0 = Apples
-DropDownData_1 = Oranges
-DropDownData_2 =
-DropDownData_3 = Grapefruit
-DropDownData_4 = Peaches
-DropDownData_5 = Kiwi
-DropDownData_6 =
-DropDownData_7 = Strawberries
-DropDownData_8 = The Longest String
+DropDownData_0 = Apples
+DropDownData_1 = Oranges
+DropDownData_2 =
+DropDownData_3 = Grapefruit
+DropDownData_4 = Peaches
+DropDownData_5 = Kiwi
+DropDownData_6 =
+DropDownData_7 = Strawberries
+DropDownData_8 = The Longest String
Colors = Colors and Font
Table_Item_Colors = Row 0 Colors and Font
Tree_Item_Colors = Node 1 Colors and Font
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/CoolBarTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/CoolBarTab.java
index 7c82b1ec4a..d78d25f6f6 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/CoolBarTab.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/CoolBarTab.java
@@ -18,13 +18,17 @@ import org.eclipse.swt.layout.*;
import org.eclipse.swt.events.*;
class CoolBarTab extends Tab {
- Button dropDownButton, lockedButton, flatButton;
-
/* Example widgets and group that contains them */
CoolBar coolBar;
- CoolItem pushItem, dropDownItem, radioItem, checkItem;
+ CoolItem pushItem, dropDownItem, radioItem, checkItem, textItem;
Group coolBarGroup;
+ /* Style widgets added to the "Style" group */
+ Button dropDownButton, flatButton;
+
+ /* Other widgets added to the "Other" group */
+ Button lockedButton;
+
Point[] sizes;
int[] wrapIndices;
int[] order;
@@ -167,6 +171,16 @@ class CoolBarTab extends Tab {
checkItem.setMinimumSize(item.getWidth(), checkSize.y);
checkItem.addSelectionListener (new CoolItemSelectionListener());
+ /* create the text */
+ Text text = new Text (coolBar, SWT.BORDER | SWT.SINGLE);
+ textItem = new CoolItem (coolBar, itemStyle);
+ textItem.setControl (text);
+ Point textSize = text.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ textSize = textItem.computeSize(textSize.x, textSize.y);
+ textItem.setSize(textSize);
+ textItem.setMinimumSize(textSize);
+ textItem.addSelectionListener (new CoolItemSelectionListener());
+
/* if we have saved state, restore it */
if (order != null) {
coolBar.setItemLayout(order, wrapIndices, sizes);
@@ -180,6 +194,7 @@ class CoolBarTab extends Tab {
dropDownItem.setPreferredSize(dropSize);
radioItem.setPreferredSize(radioSize);
checkItem.setPreferredSize(checkSize);
+ textItem.setPreferredSize(textSize);
}
else {
coolBar.setWrapIndices(new int[] {1, 3});
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ToolBarTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ToolBarTab.java
index fe9dfee209..2402ba3f2c 100755
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ToolBarTab.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ToolBarTab.java
@@ -25,6 +25,9 @@ class ToolBarTab extends Tab {
/* Style widgets added to the "Style" group */
Button horizontalButton, verticalButton, flatButton, shadowOutButton, wrapButton, rightButton;
+ /* Other widgets added to the "Other" group */
+ Button comboChildButton;
+
/**
* Creates the Tab within a given instance of ControlExample.
*/
@@ -104,6 +107,14 @@ class ToolBarTab extends Tab {
item.setToolTipText ("SWT.RADIO");
item = new ToolItem (imageToolBar, SWT.SEPARATOR);
item.setToolTipText("SWT.SEPARATOR");
+ if (comboChildButton.getSelection ()) {
+ Combo combo = new Combo (imageToolBar, SWT.NONE);
+ combo.setItems (new String [] {"250", "500", "750"});
+ combo.setText (combo.getItem (0));
+ combo.pack ();
+ item.setWidth (combo.getSize ().x);
+ item.setControl (combo);
+ }
item = new ToolItem (imageToolBar, SWT.DROP_DOWN);
item.setImage (instance.images[ControlExample.ciTarget]);
item.setToolTipText ("SWT.DROP_DOWN");
@@ -134,6 +145,14 @@ class ToolBarTab extends Tab {
item.setToolTipText("SWT.RADIO");
item = new ToolItem (textToolBar, SWT.SEPARATOR);
item.setToolTipText("SWT.SEPARATOR");
+ if (comboChildButton.getSelection ()) {
+ Combo combo = new Combo (textToolBar, SWT.NONE);
+ combo.setItems (new String [] {"250", "500", "750"});
+ combo.setText (combo.getItem (0));
+ combo.pack ();
+ item.setWidth (combo.getSize ().x);
+ item.setControl (combo);
+ }
item = new ToolItem (textToolBar, SWT.DROP_DOWN);
item.setText (ControlExample.getResourceString("Drop_Down"));
item.setToolTipText("SWT.DROP_DOWN");
@@ -171,6 +190,14 @@ class ToolBarTab extends Tab {
item.setToolTipText("SWT.RADIO");
item = new ToolItem (imageTextToolBar, SWT.SEPARATOR);
item.setToolTipText("SWT.SEPARATOR");
+ if (comboChildButton.getSelection ()) {
+ Combo combo = new Combo (imageTextToolBar, SWT.NONE);
+ combo.setItems (new String [] {"250", "500", "750"});
+ combo.setText (combo.getItem (0));
+ combo.pack ();
+ item.setWidth (combo.getSize ().x);
+ item.setControl (combo);
+ }
item = new ToolItem (imageTextToolBar, SWT.DROP_DOWN);
item.setImage (instance.images[ControlExample.ciTarget]);
item.setText (ControlExample.getResourceString("Drop_Down"));
@@ -186,6 +213,24 @@ class ToolBarTab extends Tab {
}
/**
+ * Creates the "Other" group.
+ */
+ void createOtherGroup () {
+ super.createOtherGroup ();
+
+ /* Create display controls specific to this example */
+ comboChildButton = new Button (otherGroup, SWT.CHECK);
+ comboChildButton.setText (ControlExample.getResourceString("Combo_child"));
+
+ /* Add the listeners */
+ comboChildButton.addSelectionListener (new SelectionAdapter () {
+ public void widgetSelected (SelectionEvent event) {
+ recreateExampleWidgets ();
+ }
+ });
+ }
+
+ /**
* Creates the "Style" group.
*/
void createStyleGroup() {

Back to the top