summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorCarolyn MacLeod <carolyn>2003-11-10 22:42:46 +0000
committerCarolyn MacLeod <carolyn>2003-11-10 22:42:46 +0000
commit702843eb176857b81eac916472012f8dfc2b10f1 (patch)
tree676b4644b4e3e7cc9dbb1518bc65d72a3e39b1d3 /examples
parente290f5aded526f25624e5b07650ec3f741d25c9e (diff)
downloadeclipse.platform.swt-702843eb176857b81eac916472012f8dfc2b10f1.tar.gz
eclipse.platform.swt-702843eb176857b81eac916472012f8dfc2b10f1.tar.xz
eclipse.platform.swt-702843eb176857b81eac916472012f8dfc2b10f1.zip
Added Group Tab.
Added border to TabFolder Tab.
Diffstat (limited to 'examples')
-rw-r--r--examples/org.eclipse.swt.examples/src/examples_control.properties1
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ControlExample.java1
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/GroupTab.java159
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TabFolderTab.java13
4 files changed, 174 insertions, 0 deletions
diff --git a/examples/org.eclipse.swt.examples/src/examples_control.properties b/examples/org.eclipse.swt.examples/src/examples_control.properties
index bb12e950d4..508501a9cd 100644
--- a/examples/org.eclipse.swt.examples/src/examples_control.properties
+++ b/examples/org.eclipse.swt.examples/src/examples_control.properties
@@ -38,6 +38,7 @@ Clear = Clear
Select_All = Select All
Deselect_All = Deselect All
OK = OK
+Title_Text = Title Text
Text_Labels = Text Labels
Image_Labels = Image Labels
Custom_Labels = Custom Labels
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ControlExample.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ControlExample.java
index e5844d4573..df7d173d88 100755
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ControlExample.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ControlExample.java
@@ -59,6 +59,7 @@ public class ControlExample {
new ComboTab (this),
new CoolBarTab (this),
new DialogTab (this),
+ new GroupTab (this),
new LabelTab (this),
new ListTab (this),
new ProgressBarTab (this),
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/GroupTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/GroupTab.java
new file mode 100644
index 0000000000..00f666ff8e
--- /dev/null
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/GroupTab.java
@@ -0,0 +1,159 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swt.examples.controlexample;
+
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.events.*;
+import org.eclipse.swt.layout.*;
+import org.eclipse.swt.widgets.*;
+
+class GroupTab extends Tab {
+ Button titleButton;
+
+ /* Example widgets and groups that contain them */
+ Group group1;
+ Group groupGroup;
+
+ /* Style widgets added to the "Style" group */
+ Button shadowEtchedInButton, shadowEtchedOutButton, shadowInButton, shadowOutButton, shadowNoneButton;
+
+ /**
+ * Creates the Tab within a given instance of ControlExample.
+ */
+ GroupTab(ControlExample instance) {
+ super(instance);
+ }
+
+ /**
+ * Creates the "Display" group.
+ */
+ void createDisplayGroup () {
+ super.createDisplayGroup ();
+
+ /* Create display controls specific to this example */
+ titleButton = new Button (displayGroup, SWT.CHECK);
+ titleButton.setText (ControlExample.getResourceString("Title_Text"));
+
+ /* Add the listeners */
+ titleButton.addSelectionListener (new SelectionAdapter () {
+ public void widgetSelected (SelectionEvent event) {
+ setTitleText ();
+ }
+ });
+ }
+
+ /**
+ * Creates the "Example" group.
+ */
+ void createExampleGroup () {
+ super.createExampleGroup ();
+
+ /* Create a group for the Group */
+ groupGroup = new Group (exampleGroup, SWT.NONE);
+ groupGroup.setLayout (new GridLayout ());
+ groupGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
+ groupGroup.setText ("Group");
+ }
+
+ /**
+ * Creates the "Example" widgets.
+ */
+ void createExampleWidgets () {
+
+ /* Compute the widget style */
+ int style = getDefaultStyle();
+ if (shadowEtchedInButton.getSelection ()) style |= SWT.SHADOW_ETCHED_IN;
+ if (shadowEtchedOutButton.getSelection ()) style |= SWT.SHADOW_ETCHED_OUT;
+ if (shadowInButton.getSelection ()) style |= SWT.SHADOW_IN;
+ if (shadowOutButton.getSelection ()) style |= SWT.SHADOW_OUT;
+ if (shadowNoneButton.getSelection ()) style |= SWT.SHADOW_NONE;
+ if (borderButton.getSelection ()) style |= SWT.BORDER;
+
+ /* Create the example widgets */
+ group1 = new Group (groupGroup, style);
+ }
+
+ /**
+ * Creates the "Style" group.
+ */
+ void createStyleGroup() {
+ super.createStyleGroup ();
+
+ /* Create the extra widgets */
+ shadowEtchedInButton = new Button (styleGroup, SWT.RADIO);
+ shadowEtchedInButton.setText ("SWT.SHADOW_ETCHED_IN");
+ shadowEtchedInButton.setSelection(true);
+ shadowEtchedOutButton = new Button (styleGroup, SWT.RADIO);
+ shadowEtchedOutButton.setText ("SWT.SHADOW_ETCHED_OUT");
+ shadowInButton = new Button (styleGroup, SWT.RADIO);
+ shadowInButton.setText ("SWT.SHADOW_IN");
+ shadowOutButton = new Button (styleGroup, SWT.RADIO);
+ shadowOutButton.setText ("SWT.SHADOW_OUT");
+ shadowNoneButton = new Button (styleGroup, SWT.RADIO);
+ shadowNoneButton.setText ("SWT.SHADOW_NONE");
+ borderButton = new Button (styleGroup, SWT.CHECK);
+ borderButton.setText ("SWT.BORDER");
+
+ /* Add the listeners */
+ SelectionListener selectionListener = new SelectionAdapter () {
+ public void widgetSelected(SelectionEvent event) {
+ if (!((Button) event.widget).getSelection ()) return;
+ recreateExampleWidgets ();
+ };
+ };
+ shadowEtchedInButton.addSelectionListener (selectionListener);
+ shadowEtchedOutButton.addSelectionListener (selectionListener);
+ shadowInButton.addSelectionListener (selectionListener);
+ shadowOutButton.addSelectionListener (selectionListener);
+ shadowNoneButton.addSelectionListener (selectionListener);
+ }
+
+ /**
+ * Gets the "Example" widget children.
+ */
+ Control [] getExampleWidgets () {
+ return new Control [] {group1};
+ }
+
+ /**
+ * Gets the text for the tab folder item.
+ */
+ String getTabText () {
+ return "Group";
+ }
+
+ /**
+ * Sets the title text of the "Example" widgets.
+ */
+ void setTitleText () {
+ if (titleButton.getSelection ()) {
+ group1.setText (ControlExample.getResourceString("Title_Text"));
+ } else {
+ group1.setText ("");
+ }
+ setExampleWidgetSize ();
+ }
+
+ /**
+ * Sets the state of the "Example" widgets.
+ */
+ void setExampleWidgetState () {
+ super.setExampleWidgetState ();
+ shadowEtchedInButton.setSelection ((group1.getStyle () & SWT.SHADOW_ETCHED_IN) != 0);
+ shadowEtchedOutButton.setSelection ((group1.getStyle () & SWT.SHADOW_ETCHED_OUT) != 0);
+ shadowInButton.setSelection ((group1.getStyle () & SWT.SHADOW_IN) != 0);
+ shadowOutButton.setSelection ((group1.getStyle () & SWT.SHADOW_OUT) != 0);
+ shadowNoneButton.setSelection ((group1.getStyle () & SWT.SHADOW_NONE) != 0);
+ borderButton.setSelection ((group1.getStyle () & SWT.BORDER) != 0);
+ setTitleText ();
+ }
+}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TabFolderTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TabFolderTab.java
index ba7d6f84f1..88789578ed 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TabFolderTab.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TabFolderTab.java
@@ -57,6 +57,7 @@ class TabFolderTab extends Tab {
int style = getDefaultStyle();
if (topButton.getSelection ()) style |= SWT.TOP;
if (bottomButton.getSelection ()) style |= SWT.BOTTOM;
+ if (borderButton.getSelection ()) style |= SWT.BORDER;
/* Create the example widgets */
tabFolder1 = new TabFolder (tabFolderGroup, style);
@@ -81,6 +82,8 @@ class TabFolderTab extends Tab {
topButton.setSelection(true);
bottomButton = new Button (styleGroup, SWT.RADIO);
bottomButton.setText ("SWT.BOTTOM");
+ borderButton = new Button (styleGroup, SWT.CHECK);
+ borderButton.setText ("SWT.BORDER");
/* Add the listeners */
SelectionListener selectionListener = new SelectionAdapter () {
@@ -115,4 +118,14 @@ class TabFolderTab extends Tab {
String getTabText () {
return "TabFolder";
}
+
+ /**
+ * Sets the state of the "Example" widgets.
+ */
+ void setExampleWidgetState () {
+ super.setExampleWidgetState ();
+ topButton.setSelection ((tabFolder1.getStyle () & SWT.TOP) != 0);
+ bottomButton.setSelection ((tabFolder1.getStyle () & SWT.BOTTOM) != 0);
+ borderButton.setSelection ((tabFolder1.getStyle () & SWT.BORDER) != 0);
+ }
}