summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarolyn MacLeod <carolyn>2006-03-15 22:12:08 +0000
committerCarolyn MacLeod <carolyn>2006-03-15 22:12:08 +0000
commit9cd0d4de6355d4d0066bab43b8e4477623e6c49c (patch)
tree9c4271de53f131d870440cf12d2d1d1b59b3b208
parenta3f3c0a14d75a822c0092e9b55ca6370d0811ead (diff)
downloadeclipse.platform.swt-9cd0d4de6355d4d0066bab43b8e4477623e6c49c.tar.gz
eclipse.platform.swt-9cd0d4de6355d4d0066bab43b8e4477623e6c49c.tar.xz
eclipse.platform.swt-9cd0d4de6355d4d0066bab43b8e4477623e6c49c.zip
Added "pack columns" button in size group.
User now has to manually re-pack columns after setting font.
-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/TableTab.java49
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TreeTab.java37
3 files changed, 52 insertions, 35 deletions
diff --git a/examples/org.eclipse.swt.examples/src/examples_control.properties b/examples/org.eclipse.swt.examples/src/examples_control.properties
index 2d557e4226..c35b29c268 100644
--- a/examples/org.eclipse.swt.examples/src/examples_control.properties
+++ b/examples/org.eclipse.swt.examples/src/examples_control.properties
@@ -201,6 +201,7 @@ Underline = Underline
Strikeout = Strikeout
Fill_X = Horizontal Fill
Fill_Y = Vertical Fill
+Pack_Columns = Pack Columns
TabItem1_0 = Tab 0
TabItem1_1 = Tab 1
TabItem1_2 = Tab 2
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TableTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TableTab.java
index d9291aa1fd..61b5a1df62 100755
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TableTab.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TableTab.java
@@ -22,6 +22,9 @@ class TableTab extends ScrollableTab {
Table table1;
Group tableGroup;
+ /* Size widgets added to the "Size" group */
+ Button packColumnsButton;
+
/* Style widgets added to the "Style" group */
Button checkButton, fullSelectionButton, hideSelectionButton;
@@ -311,6 +314,24 @@ class TableTab extends ScrollableTab {
}
/**
+ * Creates the "Size" group. The "Size" group contains
+ * controls that allow the user to change the size of
+ * the example widgets.
+ */
+ void createSizeGroup () {
+ super.createSizeGroup();
+
+ packColumnsButton = new Button (sizeGroup, SWT.PUSH);
+ packColumnsButton.setText (ControlExample.getResourceString("Pack_Columns"));
+ packColumnsButton.addSelectionListener(new SelectionAdapter () {
+ public void widgetSelected (SelectionEvent event) {
+ packColumns ();
+ setExampleWidgetSize ();
+ }
+ });
+ }
+
+ /**
* Creates the "Style" group.
*/
void createStyleGroup () {
@@ -359,6 +380,14 @@ class TableTab extends ScrollableTab {
return (methodRoot.equals("SelectionIndex")) ? "setSelection" : "set" + methodRoot;
}
+ void packColumns () {
+ int columnCount = table1.getColumnCount();
+ for (int i = 0; i < columnCount; i++) {
+ TableColumn tableColumn = table1.getColumn(i);
+ tableColumn.pack();
+ }
+ }
+
Object[] parameterForType(String typeName, String value, Control control) {
if (value.equals("")) return new Object[] {new TableItem[0]}; // bug in Table?
if (typeName.equals("org.eclipse.swt.widgets.TableItem")) {
@@ -463,7 +492,6 @@ class TableTab extends ScrollableTab {
void setCellFont () {
if (!instance.startup) {
table1.getItem (0).setFont (1, cellFont);
- packColumns ();
}
/* Set the font item's image to match the font of the item. */
Font ft = cellFont;
@@ -514,7 +542,6 @@ class TableTab extends ScrollableTab {
void setItemFont () {
if (!instance.startup) {
table1.getItem (0).setFont (itemFont);
- packColumns ();
}
/* Set the font item's image to match the font of the item. */
Font ft = itemFont;
@@ -528,24 +555,6 @@ class TableTab extends ScrollableTab {
}
/**
- * Sets the font of the "Example" widgets.
- */
- void setExampleWidgetFont () {
- super.setExampleWidgetFont();
- if (!instance.startup) {
- packColumns ();
- }
- }
-
- void packColumns () {
- int columnCount = table1.getColumnCount();
- for (int i = 0; i < columnCount; i++) {
- TableColumn tableColumn = table1.getColumn(i);
- tableColumn.pack();
- }
- }
-
- /**
* Sets the moveable columns state of the "Example" widgets.
*/
void setColumnsMoveable () {
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TreeTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TreeTab.java
index 69a1f3f64b..ba45d7d595 100755
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TreeTab.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TreeTab.java
@@ -23,6 +23,9 @@ class TreeTab extends ScrollableTab {
TreeItem textNode1, imageNode1;
Group treeGroup, imageTreeGroup, itemGroup;
+ /* Size widgets added to the "Size" group */
+ Button packColumnsButton;
+
/* Style widgets added to the "Style" group */
Button checkButton, fullSelectionButton;
@@ -370,6 +373,25 @@ class TreeTab extends ScrollableTab {
}
/**
+ * Creates the "Size" group. The "Size" group contains
+ * controls that allow the user to change the size of
+ * the example widgets.
+ */
+ void createSizeGroup () {
+ super.createSizeGroup();
+
+ packColumnsButton = new Button (sizeGroup, SWT.PUSH);
+ packColumnsButton.setText (ControlExample.getResourceString("Pack_Columns"));
+ packColumnsButton.addSelectionListener(new SelectionAdapter () {
+ public void widgetSelected (SelectionEvent event) {
+ packColumns (tree1);
+ packColumns (tree2);
+ setExampleWidgetSize ();
+ }
+ });
+ }
+
+ /**
* Creates the "Style" group.
*/
void createStyleGroup() {
@@ -571,8 +593,6 @@ class TreeTab extends ScrollableTab {
if (!instance.startup) {
textNode1.setFont (1, cellFont);
imageNode1.setFont (1, cellFont);
- packColumns (tree1);
- packColumns (tree2);
}
/* Set the font item's image to match the font of the item. */
Font ft = cellFont;
@@ -626,8 +646,6 @@ class TreeTab extends ScrollableTab {
if (!instance.startup) {
textNode1.setFont (itemFont);
imageNode1.setFont (itemFont);
- packColumns (tree1);
- packColumns (tree2);
}
/* Set the font item's image to match the font of the item. */
Font ft = itemFont;
@@ -641,17 +659,6 @@ class TreeTab extends ScrollableTab {
}
/**
- * Sets the font of the "Example" widgets.
- */
- void setExampleWidgetFont () {
- super.setExampleWidgetFont();
- if (!instance.startup) {
- packColumns (tree1);
- packColumns (tree2);
- }
- }
-
- /**
* Sets the header visible state of the "Example" widgets.
*/
void setWidgetHeaderVisible () {