Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSilenio Quarti2002-05-15 02:05:21 +0000
committerSilenio Quarti2002-05-15 02:05:21 +0000
commit8b1352568a55021cfcd917938b196467d70767a8 (patch)
tree59749059f688db5526be131c7e096e7e815516f2
parent6fd629ad4013e400aaadc08cad57e1057b403f67 (diff)
downloadeclipse.platform.swt-8b1352568a55021cfcd917938b196467d70767a8.tar.gz
eclipse.platform.swt-8b1352568a55021cfcd917938b196467d70767a8.tar.xz
eclipse.platform.swt-8b1352568a55021cfcd917938b196467d70767a8.zip
parentingHandle
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Button.java2
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Combo.java2
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Composite.java24
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Control.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Group.java2
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Label.java2
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/List.java2
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ProgressBar.java2
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Sash.java2
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Scale.java2
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Scrollable.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Slider.java2
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/TabFolder.java77
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/TabItem.java7
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Text.java2
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ToolBar.java58
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ToolItem.java2
17 files changed, 135 insertions, 61 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Button.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Button.java
index 133817ac7b..ff99a70e78 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Button.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Button.java
@@ -190,7 +190,7 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
void createHandle (int index) {
state |= HANDLE;
Display display = getDisplay ();
- int parentHandle = parent.handle;
+ int parentHandle = parent.parentingHandle ();
/* ARROW button */
if ((style & SWT.ARROW) != 0) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Combo.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Combo.java
index 916df5e0f2..d356197dc2 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Combo.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Combo.java
@@ -176,7 +176,7 @@ void createHandle (int index) {
state |= HANDLE;
Display display = getDisplay ();
int clazz = display.PtComboBox;
- int parentHandle = parent.handle;
+ int parentHandle = parent.parentingHandle ();
int textFlags = (style & SWT.READ_ONLY) != 0 ? 0 : OS.Pt_EDITABLE;
int [] args = {
OS.Pt_ARG_TEXT_FLAGS, textFlags, OS.Pt_EDITABLE,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Composite.java
index b55d7ff097..1619d0e40f 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Composite.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Composite.java
@@ -69,15 +69,15 @@ public Composite (Composite parent, int style) {
Control [] _getChildren () {
int count = 0;
- int validParent = childrenParent ();
- int child = OS.PtWidgetChildFront (validParent);
+ int parentHandle = parentingHandle ();
+ int child = OS.PtWidgetChildFront (parentHandle);
while (child != 0) {
child = OS.PtWidgetBrotherBehind (child);
count++;
}
Control [] children = new Control [count];
int i = 0, j = 0;
- child = OS.PtWidgetChildFront (validParent);
+ child = OS.PtWidgetChildFront (parentHandle);
while (i < count) {
Widget widget = WidgetTable.get (child);
if (widget != null && widget != this) {
@@ -116,10 +116,6 @@ protected void checkSubclass () {
/* Do nothing - Subclassing is allowed */
}
-int childrenParent () {
- return handle;
-}
-
Control [] computeTabList () {
Control result [] = super.computeTabList ();
if (result.length == 0) return result;
@@ -159,7 +155,7 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
void createHandle (int index) {
state |= HANDLE | CANVAS;
- int parentHandle = parent.handle;
+ int parentHandle = parent.parentingHandle ();
createScrolledHandle (parentHandle);
}
@@ -322,8 +318,8 @@ public Control [] getChildren () {
int getChildrenCount () {
int count = 0;
- int validParent = childrenParent ();
- int child = OS.PtWidgetChildFront (validParent);
+ int parentHandle = parentingHandle ();
+ int child = OS.PtWidgetChildFront (parentHandle);
while (child != 0) {
child = OS.PtWidgetBrotherBehind (child);
count++;
@@ -416,6 +412,10 @@ Point minimumSize () {
return new Point (width, height);
}
+void moveToBack (int child) {
+ OS.PtWidgetToBack (child);
+}
+
/**
* If the receiver has a layout, asks the layout to <em>lay out</em>
* (that is, set the size and location of) the receiver's children.
@@ -441,6 +441,10 @@ public void layout (boolean changed) {
layout.layout (this, changed);
}
+int parentingHandle () {
+ return handle;
+}
+
int processMouse (int info) {
/* Set focus for a canvas with no children */
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Control.java
index 7ef422d609..5715e74f93 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Control.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Control.java
@@ -1037,7 +1037,7 @@ public void moveBelow (Control control) {
checkWidget();
int topHandle1 = topHandle ();
if (control == null) {
- OS.PtWidgetToBack (topHandle1);
+ if (parent != null) parent.moveToBack (topHandle1);
OS.PtWindowToBack (topHandle1);
return;
}
@@ -2251,7 +2251,7 @@ public void setToolTipText (String string) {
}
void setZOrder() {
- OS.PtWidgetToBack (topHandle ());
+ if (parent != null) parent.moveToBack (topHandle ());
}
void sort (int [] items) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Group.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Group.java
index 580dd0c443..c7bb43834a 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Group.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Group.java
@@ -104,7 +104,7 @@ void createHandle (int index) {
state |= HANDLE;
Display display = getDisplay ();
int clazz = display.PtPane;
- int parentHandle = parent.handle;
+ int parentHandle = parent.parentingHandle ();
int [] args = {
OS.Pt_ARG_RESIZE_FLAGS, 0, OS.Pt_RESIZE_XY_BITS,
};
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Label.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Label.java
index cebe3232fe..5fcf140f61 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Label.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Label.java
@@ -158,7 +158,7 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
void createHandle (int index) {
state |= HANDLE;
Display display = getDisplay ();
- int parentHandle = parent.handle;
+ int parentHandle = parent.parentingHandle ();
if ((style & SWT.SEPARATOR) != 0) {
int clazz = display.PtSeparator;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/List.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/List.java
index 66ae0b5b94..27a2b73378 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/List.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/List.java
@@ -228,7 +228,7 @@ void createHandle (int index) {
state |= HANDLE;
Display display = getDisplay ();
int clazz = display.PtList;
- int parentHandle = parent.handle;
+ int parentHandle = parent.parentingHandle ();
int mode = OS.Pt_SELECTION_MODE_SINGLE | OS.Pt_SELECTION_MODE_AUTO;
if ((style & SWT.MULTI) != 0) {
if ((style & SWT.SIMPLE) != 0) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ProgressBar.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ProgressBar.java
index 1ef964195b..653e7c10e0 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ProgressBar.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ProgressBar.java
@@ -97,7 +97,7 @@ void createHandle (int index) {
state |= HANDLE;
Display display = getDisplay ();
int clazz = display.PtProgress;
- int parentHandle = parent.handle;
+ int parentHandle = parent.parentingHandle ();
int [] args = {
OS.Pt_ARG_FLAGS, 0, OS.Pt_GETS_FOCUS,
// OS.Pt_ARG_GAUGE_FLAGS, OS.Pt_GAUGE_LIVE, OS.Pt_GAUGE_LIVE,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Sash.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Sash.java
index 27c1d9b447..710a4433b3 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Sash.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Sash.java
@@ -120,7 +120,7 @@ void createHandle (int index) {
state |= HANDLE;
Display display = getDisplay ();
int clazz = display.PtContainer;
- int parentHandle = parent.handle;
+ int parentHandle = parent.parentingHandle ();
int cursor = ((style & SWT.HORIZONTAL) != 0) ? OS.Ph_CURSOR_DRAG_VERTICAL : OS.Ph_CURSOR_DRAG_HORIZONTAL;
int [] args = {
OS.Pt_ARG_FLAGS, 0, OS.Pt_GETS_FOCUS,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Scale.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Scale.java
index 83fc77604e..625ee8343a 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Scale.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Scale.java
@@ -124,7 +124,7 @@ void createHandle (int index) {
state |= HANDLE;
Display display = getDisplay ();
int clazz = display.PtSlider;
- int parentHandle = parent.handle;
+ int parentHandle = parent.parentingHandle ();
int [] args = {
OS.Pt_ARG_MAXIMUM, 100, 0,
OS.Pt_ARG_PAGE_INCREMENT, 10, 0,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Scrollable.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Scrollable.java
index 64ac669ade..1ccfeb2ac6 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Scrollable.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Scrollable.java
@@ -148,9 +148,9 @@ public Rectangle computeTrim (int x, int y, int width, int height) {
public Rectangle getClientArea () {
checkWidget();
PhRect_t rect = new PhRect_t ();
- int vParent = OS.PtValidParent (handle, OS.PtContainer ());
+ int validParent = OS.PtValidParent (handle, OS.PtContainer ());
if (!OS.PtWidgetIsRealized (handle)) OS.PtExtentWidgetFamily (handle);
- OS.PtCalcCanvas (vParent, rect);
+ OS.PtCalcCanvas (validParent, rect);
int width = rect.lr_x - rect.ul_x + 1;
int height = rect.lr_y - rect.ul_y + 1;
return new Rectangle (0, 0, width, height);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Slider.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Slider.java
index 76682cd49b..a5c225cb25 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Slider.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Slider.java
@@ -160,7 +160,7 @@ void createHandle (int index) {
state |= HANDLE;
Display display = getDisplay ();
int clazz = display.PtScrollbar;
- int parentHandle = parent.handle;
+ int parentHandle = parent.parentingHandle ();
int [] args = {
OS.Pt_ARG_MAXIMUM, 100, 0,
OS.Pt_ARG_PAGE_INCREMENT, 10, 0,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/TabFolder.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/TabFolder.java
index 4a28d2a628..28b9a9a739 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/TabFolder.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/TabFolder.java
@@ -35,6 +35,7 @@ import org.eclipse.swt.events.*;
* </p>
*/
public class TabFolder extends Composite {
+ int parentingHandle;
TabItem [] items;
int itemCount;
@@ -117,15 +118,6 @@ protected void checkSubclass () {
if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
}
-int childrenParent () {
- /*
- * Feature in Photon. Tabfolders have an extra widget which
- * is the parent of all tab items. PtValidParent() can not be
- * used, since it does not return that widget.
- */
- return OS.PtWidgetChildBack (handle);
-}
-
public Point computeSize (int wHint, int hHint, boolean changed) {
checkWidget();
PhDim_t dim = new PhDim_t();
@@ -172,12 +164,17 @@ public Rectangle computeTrim (int x, int y, int width, int height) {
void createHandle (int index) {
state |= HANDLE;
Display display = getDisplay ();
- int clazz = display.PtPanelGroup;
- int parentHandle = parent.handle;
+ int parentHandle = parent.parentingHandle ();
int [] args = {
OS.Pt_ARG_RESIZE_FLAGS, 0, OS.Pt_RESIZE_XY_BITS,
};
- handle = OS.PtCreateWidget (clazz, parentHandle, args.length / 3, args);
+ parentingHandle = OS.PtCreateWidget (OS.PtContainer (), parentHandle, args.length / 3, args);
+ if (parentingHandle == 0) error (SWT.ERROR_NO_HANDLES);
+ int clazz = display.PtPanelGroup;
+ args = new int []{
+ OS.Pt_ARG_RESIZE_FLAGS, 0, OS.Pt_RESIZE_XY_BITS,
+ };
+ handle = OS.PtCreateWidget (clazz, parentingHandle, args.length / 3, args);
if (handle == 0) error (SWT.ERROR_NO_HANDLES);
}
@@ -187,8 +184,6 @@ void createWidget (int index) {
}
void createItem (TabItem item, int index) {
- int [] args = {OS.Pt_ARG_PG_PANEL_TITLES, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
int count = itemCount;
if (!(0 <= index && index <= count)) error (SWT.ERROR_INVALID_RANGE);
if (count == items.length) {
@@ -196,6 +191,8 @@ void createItem (TabItem item, int index) {
System.arraycopy (items, 0, newItems, 0, items.length);
items = newItems;
}
+ int [] args = {OS.Pt_ARG_PG_PANEL_TITLES, 0, 0};
+ OS.PtGetResources (handle, args.length / 3, args);
int oldPtr = args [1];
int newPtr = OS.malloc ((count + 1) * 4);
if (newPtr == 0) error (SWT.ERROR_ITEM_NOT_ADDED);
@@ -225,15 +222,20 @@ void createItem (TabItem item, int index) {
itemCount++;
}
+void deregister () {
+ super.deregister ();
+ if (parentingHandle != 0) WidgetTable.remove (parentingHandle);
+}
+
void destroyItem (TabItem item) {
- int [] args = {OS.Pt_ARG_PG_PANEL_TITLES, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
int count = itemCount;
int index = 0;
while (index < count) {
if (items [index] == item) break;
index++;
}
+ int [] args = {OS.Pt_ARG_PG_PANEL_TITLES, 0, 0};
+ OS.PtGetResources (handle, args.length / 3, args);
int oldPtr = args [1];
int newPtr = OS.malloc ((count - 1) * 4);
if (newPtr == 0) error (SWT.ERROR_ITEM_NOT_ADDED);
@@ -265,6 +267,15 @@ void destroyItem (TabItem item) {
itemCount--;
}
+public Rectangle getClientArea () {
+ checkWidget();
+ PhArea_t area = new PhArea_t ();
+ if (!OS.PtWidgetIsRealized (handle)) OS.PtExtentWidgetFamily (handle);
+ int clientHandle = OS.PtWidgetChildBack (handle);
+ OS.PtWidgetArea (clientHandle, area);
+ return new Rectangle (area.pos_x, area.pos_y, area.size_w, area.size_h);
+}
+
/**
* Returns the item at the given, zero-relative index in the
* receiver. Throws an exception if the index is out of range.
@@ -391,13 +402,20 @@ void hookEvents () {
public int indexOf (TabItem item) {
checkWidget();
if (item == null) error (SWT.ERROR_NULL_ARGUMENT);
- int count = getItemCount ();
- for (int i=0; i<count; i++) {
+ for (int i=0; i<itemCount; i++) {
if (items [i] == item) return i;
}
return -1;
}
+void moveToBack (int child) {
+ OS.PtWidgetInsert (child, handle, 0);
+}
+
+int parentingHandle () {
+ return parentingHandle;
+}
+
int processPaint (int damage) {
OS.PtSuperClassDraw (OS.PtPanelGroup (), handle, damage);
sendPaintEvent (damage);
@@ -431,6 +449,16 @@ int processSelection (int info) {
return OS.Pt_CONTINUE;
}
+void register () {
+ super.register ();
+ if (parentingHandle != 0) WidgetTable.put (parentingHandle, this);
+}
+
+void releaseHandle () {
+ super.releaseHandle ();
+ parentingHandle = 0;
+}
+
void releaseWidget () {
for (int i=0; i<itemCount; i++) {
TabItem item = items [i];
@@ -471,7 +499,10 @@ public void removeSelectionListener (SelectionListener listener) {
boolean setBounds (int x, int y, int width, int height, boolean move, boolean resize) {
boolean changed = super.setBounds (x, y, width, height, move, resize);
if (changed && resize) {
- int [] args = {OS.Pt_ARG_PG_CURRENT_INDEX, 0, 0};
+ int [] args = {OS.Pt_ARG_WIDTH, 0, 0, OS.Pt_ARG_HEIGHT, 0, 0};
+ OS.PtGetResources (parentingHandle, args.length / 3, args);
+ OS.PtSetResources (handle, args.length / 3, args);
+ args = new int [] {OS.Pt_ARG_PG_CURRENT_INDEX, 0, 0};
OS.PtGetResources (handle, args.length / 3, args);
int index = args [1];
if (index != OS.Pt_PG_INVALID) {
@@ -515,10 +546,10 @@ void setSelection (int index, boolean notify) {
}
}
OS.PtSetResource (handle, OS.Pt_ARG_PG_CURRENT_INDEX, index, 0);
- args = new int[]{OS.Pt_ARG_PG_CURRENT_INDEX, 0, 0};
+ args [1] = 0;
OS.PtGetResources (handle, args.length / 3, args);
int newIndex = args [1];
- if (newIndex != -1) {
+ if (newIndex != OS.Pt_PG_INVALID) {
TabItem item = items [newIndex];
Control control = item.control;
if (control != null && !control.isDisposed ()) {
@@ -572,4 +603,8 @@ boolean traversePage (boolean next) {
return true;
}
+int topHandle () {
+ return parentingHandle;
+}
+
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/TabItem.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/TabItem.java
index 6ba4682f6e..7dd53226ac 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/TabItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/TabItem.java
@@ -213,9 +213,10 @@ public void setImage (Image image) {
//NOT SUPPORTED
}
-public void setText (String text) {
+public void setText (String string) {
checkWidget();
- super.setText (text);
+ if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
+ super.setText (string);
int index = parent.indexOf (this);
int [] args = {OS.Pt_ARG_PG_PANEL_TITLES, 0, 0};
OS.PtGetResources (parent.handle, args.length / 3, args);
@@ -225,7 +226,7 @@ public void setText (String text) {
for (int i=0; i<count; i++) {
int str;
if (i == index) {
- byte [] buffer = Converter.wcsToMbcs (null, text);
+ byte [] buffer = Converter.wcsToMbcs (null, string);
str = OS.malloc (buffer.length + 1);
OS.memmove (str, buffer, buffer.length);
} else {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Text.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Text.java
index a65f9c37c0..e100000bc3 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Text.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Text.java
@@ -137,7 +137,7 @@ public void clearSelection () {
void createHandle (int index) {
state |= HANDLE;
Display display = getDisplay ();
- int parentHandle = parent.handle;
+ int parentHandle = parent.parentingHandle ();
boolean hasBorder = (style & SWT.BORDER) != 0;
int textFlags = (style & SWT.READ_ONLY) != 0 ? 0 : OS.Pt_EDITABLE;
if ((style & SWT.SINGLE) != 0) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ToolBar.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ToolBar.java
index 9bb278ee7f..57e65bcd4e 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ToolBar.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ToolBar.java
@@ -33,6 +33,7 @@ import org.eclipse.swt.graphics.*;
* </p>
*/
public class ToolBar extends Composite {
+ int parentingHandle;
int itemCount;
ToolItem [] items;
@@ -83,6 +84,7 @@ public ToolBar (Composite parent, int style) {
int orientation = (style & SWT.VERTICAL) == 0 ? OS.Pt_HORIZONTAL : OS.Pt_VERTICAL;
OS.PtSetResource (handle, OS.Pt_ARG_ORIENTATION, orientation, 0);
}
+
static int checkStyle (int style) {
/*
* Even though it is legal to create this widget
@@ -98,15 +100,6 @@ protected void checkSubclass () {
if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
}
-int childrenParent () {
- /*
- * Feature in Photon. Toolbars have an extra widget which
- * is the parent of all tool items. PtValidParent() can not be
- * used, since it does not return that widget.
- */
- return OS.PtWidgetChildBack (handle);
-}
-
public Point computeSize (int wHint, int hHint, boolean changed) {
checkWidget();
if (layout != null) {
@@ -131,15 +124,19 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
void createHandle (int index) {
state |= HANDLE;
Display display = getDisplay ();
- int parentHandle = parent.handle;
-
+ int parentHandle = parent.parentingHandle ();
int [] args = {
+ OS.Pt_ARG_RESIZE_FLAGS, 0, OS.Pt_RESIZE_XY_BITS,
+ };
+ parentingHandle = OS.PtCreateWidget (OS.PtContainer (), parentHandle, args.length / 3, args);
+ if (parentingHandle == 0) error (SWT.ERROR_NO_HANDLES);
+ args = new int [] {
OS.Pt_ARG_FLAGS, (style & SWT.NO_FOCUS) != 0 ? 0 : OS.Pt_GETS_FOCUS, OS.Pt_GETS_FOCUS,
OS.Pt_ARG_FLAGS, hasBorder () ? OS.Pt_HIGHLIGHTED : 0, OS.Pt_HIGHLIGHTED,
OS.Pt_ARG_TOOLBAR_FLAGS, 0, OS.Pt_TOOLBAR_DRAGGABLE | OS.Pt_TOOLBAR_END_SEPARATOR,
OS.Pt_ARG_RESIZE_FLAGS, 0, OS.Pt_RESIZE_XY_BITS,
};
- handle = OS.PtCreateWidget (OS.PtToolbar (), parentHandle, args.length / 3, args);
+ handle = OS.PtCreateWidget (OS.PtToolbar (), parentingHandle, args.length / 3, args);
if (handle == 0) error (SWT.ERROR_NO_HANDLES);
}
@@ -161,6 +158,11 @@ void createWidget (int index) {
itemCount = 0;
}
+void deregister () {
+ super.deregister ();
+ if (parentingHandle != 0) WidgetTable.remove (parentingHandle);
+}
+
void destroyItem (ToolItem item) {
int index = 0;
while (index < itemCount) {
@@ -314,6 +316,14 @@ public int indexOf (ToolItem item) {
return -1;
}
+void moveToBack (int child) {
+ OS.PtWidgetInsert (child, handle, 0);
+}
+
+int parentingHandle () {
+ return parentingHandle;
+}
+
int processMouseEnter (int info) {
if (info == 0) return OS.Pt_END;
PtCallbackInfo_t cbinfo = new PtCallbackInfo_t ();
@@ -329,6 +339,16 @@ int processMouseEnter (int info) {
return super.processMouseEnter (info);
}
+void register () {
+ super.register ();
+ if (parentingHandle != 0) WidgetTable.put (parentingHandle, this);
+}
+
+void releaseHandle () {
+ super.releaseHandle ();
+ parentingHandle = 0;
+}
+
void releaseWidget () {
for (int i=0; i<items.length; i++) {
ToolItem item = items [i];
@@ -339,6 +359,16 @@ void releaseWidget () {
}
items = null;
super.releaseWidget ();
+}
+
+boolean setBounds (int x, int y, int width, int height, boolean move, boolean resize) {
+ boolean changed = super.setBounds (x, y, width, height, move, resize);
+ if (changed && resize) {
+ int [] args = {OS.Pt_ARG_WIDTH, 0, 0, OS.Pt_ARG_HEIGHT, 0, 0};
+ OS.PtGetResources (parentingHandle, args.length / 3, args);
+ OS.PtSetResources (handle, args.length / 3, args);
+ }
+ return changed;
}
boolean setTabGroupFocus () {
@@ -353,4 +383,8 @@ boolean setTabGroupFocus () {
return super.setTabGroupFocus ();
}
+int topHandle () {
+ return parentingHandle;
+}
+
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ToolItem.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ToolItem.java
index 7692c6f975..1b9ce06d02 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ToolItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ToolItem.java
@@ -583,7 +583,7 @@ public void setControl (Control control) {
Control oldControl = this.control;
this.control = control;
if (oldControl != null) {
- OS.PtReParentWidget(oldControl.handle, parent.handle);
+ OS.PtReParentWidget(oldControl.handle, parent.parentingHandle ());
}
if (control != null && !control.isDisposed ()) {
OS.PtReParentWidget(control.handle, handle);

Back to the top