Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarolyn MacLeod2004-03-22 19:05:11 +0000
committerCarolyn MacLeod2004-03-22 19:05:11 +0000
commit14315da21127a120d1deca5c3e9a0861f78b90d6 (patch)
tree4f066a39ab523360951e767c52a164f1a3f8c9dc /examples
parentd2652086fa75879630d7bdac8db64fa7976563eb (diff)
downloadeclipse.platform.swt-14315da21127a120d1deca5c3e9a0861f78b90d6.tar.gz
eclipse.platform.swt-14315da21127a120d1deca5c3e9a0861f78b90d6.tar.xz
eclipse.platform.swt-14315da21127a120d1deca5c3e9a0861f78b90d6.zip
*** empty log message ***
Diffstat (limited to 'examples')
-rw-r--r--examples/org.eclipse.swt.examples/src/examples_control.properties2
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/CTabFolderTab.java66
2 files changed, 67 insertions, 1 deletions
diff --git a/examples/org.eclipse.swt.examples/src/examples_control.properties b/examples/org.eclipse.swt.examples/src/examples_control.properties
index 29d819572e..2b27a80d93 100644
--- a/examples/org.eclipse.swt.examples/src/examples_control.properties
+++ b/examples/org.eclipse.swt.examples/src/examples_control.properties
@@ -169,6 +169,8 @@ CTabItem1_1 = CTab 1
CTabItem1_2 = CTab 2
CItem_Colors = CTabItem Colors
CTabItem_content = CTabItem Content
+Set_Simple_Tabs = Simple Tabs
+Set_Image = Image
TableTree_column = Column
MenuItem_Cut = Cu&t Ctrl+X
MenuItem_Copy = &Copy Ctrl+C
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/CTabFolderTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/CTabFolderTab.java
index 7bdeed1709..0ffb77a5ab 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/CTabFolderTab.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/CTabFolderTab.java
@@ -25,12 +25,15 @@ class CTabFolderTab extends Tab {
Group tabFolderGroup;
/* Style widgets added to the "Style" group */
- Button topButton, bottomButton, flatButton;
+ Button topButton, bottomButton, flatButton, closeButton;
static String [] CTabItems1 = {ControlExample.getResourceString("CTabItem1_0"),
ControlExample.getResourceString("CTabItem1_1"),
ControlExample.getResourceString("CTabItem1_2")};
+ /* Other widgets added to the "Other" group */
+ Button setSimpleTabButton, setImageButton;
+
/**
* Creates the Tab within a given instance of ControlExample.
*/
@@ -39,6 +42,31 @@ class CTabFolderTab extends Tab {
}
/**
+ * Creates the "Other" group.
+ */
+ void createOtherGroup () {
+ super.createOtherGroup ();
+
+ /* Create display controls specific to this example */
+ setSimpleTabButton = new Button (otherGroup, SWT.CHECK);
+ setSimpleTabButton.setText (ControlExample.getResourceString("Set_Simple_Tabs"));
+ setImageButton = new Button (otherGroup, SWT.CHECK);
+ setImageButton.setText (ControlExample.getResourceString("Set_Image"));
+
+ /* Add the listeners */
+ setSimpleTabButton.addSelectionListener (new SelectionAdapter () {
+ public void widgetSelected (SelectionEvent event) {
+ setSimpleTabs();
+ }
+ });
+ setImageButton.addSelectionListener (new SelectionAdapter () {
+ public void widgetSelected (SelectionEvent event) {
+ setImages();
+ }
+ });
+ }
+
+ /**
* Creates the "Example" group.
*/
void createExampleGroup () {
@@ -62,6 +90,7 @@ class CTabFolderTab extends Tab {
if (bottomButton.getSelection ()) style |= SWT.BOTTOM;
if (borderButton.getSelection ()) style |= SWT.BORDER;
if (flatButton.getSelection ()) style |= SWT.FLAT;
+ if (closeButton.getSelection ()) style |= SWT.CLOSE;
/* Create the example widgets */
tabFolder1 = new CTabFolder (tabFolderGroup, style);
@@ -97,6 +126,8 @@ class CTabFolderTab extends Tab {
flatButton = new Button (styleGroup, SWT.CHECK);
flatButton.setText ("SWT.FLAT");
flatButton.setEnabled(false);
+ closeButton = new Button (styleGroup, SWT.CHECK);
+ closeButton.setText ("SWT.CLOSE");
/* Add the listeners */
SelectionListener selectionListener = new SelectionAdapter () {
@@ -111,6 +142,7 @@ class CTabFolderTab extends Tab {
bottomButton.addSelectionListener (selectionListener);
borderButton.addSelectionListener (selectionListener);
flatButton.addSelectionListener (selectionListener);
+ closeButton.addSelectionListener (selectionListener);
borderButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
flatButton.setEnabled(borderButton.getSelection());
@@ -162,4 +194,36 @@ class CTabFolderTab extends Tab {
});
}
}
+
+ /**
+ * Sets the state of the "Example" widgets.
+ */
+ void setExampleWidgetState () {
+ super.setExampleWidgetState ();
+ setSimpleTabs ();
+ setImages ();
+ }
+
+ /**
+ * Sets the header visible state of the "Example" widgets.
+ */
+ void setSimpleTabs () {
+ tabFolder1.setSimpleTab (setSimpleTabButton.getSelection ());
+ }
+
+ /**
+ * Sets an image into each item of the "Example" widgets.
+ */
+ void setImages () {
+ boolean setImage = setImageButton.getSelection ();
+ CTabItem items[] = tabFolder1.getItems ();
+ for (int i = 0; i < items.length; i++) {
+ if (setImage) {
+ items[i].setImage (instance.images[ControlExample.ciClosedFolder]);
+ } else {
+ items[i].setImage (null);
+ }
+ }
+ setExampleWidgetSize ();
+ }
}

Back to the top