summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Barnes <krbarnes>2007-03-15 16:14:27 +0000
committerKevin Barnes <krbarnes>2007-03-15 16:14:27 +0000
commit3fc63c59d547ae3cc2deae1e2e3aff5112b57365 (patch)
tree02eb6e18a7e31a9104d7bc6ee1a520f694cfc73e
parentb650ebdb03d117557d4cf3729e6a7941b244f318 (diff)
downloadeclipse.platform.swt-3fc63c59d547ae3cc2deae1e2e3aff5112b57365.tar.gz
eclipse.platform.swt-3fc63c59d547ae3cc2deae1e2e3aff5112b57365.tar.xz
eclipse.platform.swt-3fc63c59d547ae3cc2deae1e2e3aff5112b57365.zip
Added ScrollViewer to ExpandBar
-rw-r--r--bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.wpf.OS.properties2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os.cpp13
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os_stats.cpp5
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os_stats.h1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/wpf/org/eclipse/swt/internal/wpf/OS.java1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/ExpandBar.java33
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/Scrollable.java2
7 files changed, 48 insertions, 9 deletions
diff --git a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.wpf.OS.properties b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.wpf.OS.properties
index 6967df61dd..2b597b3d20 100644
--- a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.wpf.OS.properties
+++ b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.wpf.OS.properties
@@ -3817,6 +3817,8 @@ OS_gcnew_ScrollEventHandler=flags=no_gen
OS_gcnew_ScrollEventHandler_0=
OS_gcnew_ScrollEventHandler_1=
+OS_gcnew_ScrollViewer=flags=gcnew
+
OS_gcnew_SelectionChangedEventHandler=flags=no_gen
OS_gcnew_SelectionChangedEventHandler_0=
OS_gcnew_SelectionChangedEventHandler_1=
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os.cpp b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os.cpp
index c753639a5e..ecdcaf8379 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os.cpp
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os.cpp
@@ -13620,6 +13620,19 @@ JNIEXPORT jint JNICALL OS_NATIVE(gcnew_1ScrollBar)
}
#endif
+#ifndef NO_gcnew_1ScrollViewer
+extern "C" JNIEXPORT jint JNICALL OS_NATIVE(gcnew_1ScrollViewer)(JNIEnv *env, jclass that);
+JNIEXPORT jint JNICALL OS_NATIVE(gcnew_1ScrollViewer)
+ (JNIEnv *env, jclass that)
+{
+ jint rc = 0;
+ OS_NATIVE_ENTER(env, that, gcnew_1ScrollViewer_FUNC);
+ rc = (jint)TO_HANDLE(gcnew ScrollViewer());
+ OS_NATIVE_EXIT(env, that, gcnew_1ScrollViewer_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO_gcnew_1Separator
extern "C" JNIEXPORT jint JNICALL OS_NATIVE(gcnew_1Separator)(JNIEnv *env, jclass that);
JNIEXPORT jint JNICALL OS_NATIVE(gcnew_1Separator)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os_stats.cpp b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os_stats.cpp
index 32bd0621ea..fc3b7e755f 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os_stats.cpp
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os_stats.cpp
@@ -14,8 +14,8 @@
#ifdef NATIVE_STATS
-int OS_nativeFunctionCount = 1183;
-int OS_nativeFunctionCallCount[1183];
+int OS_nativeFunctionCount = 1184;
+int OS_nativeFunctionCallCount[1184];
char * OS_nativeFunctionNames[] = {
"AccessText_1AccessKey",
"AccessText_1Text",
@@ -1156,6 +1156,7 @@ char * OS_nativeFunctionNames[] = {
"gcnew_1ScaleTransform",
"gcnew_1ScrollBar",
"gcnew_1ScrollEventHandler",
+ "gcnew_1ScrollViewer",
"gcnew_1SelectionChangedEventHandler",
"gcnew_1Separator",
"gcnew_1Setter",
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os_stats.h
index e28843f27e..e9586e97e7 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os_stats.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os_stats.h
@@ -1164,6 +1164,7 @@ typedef enum {
gcnew_1ScaleTransform_FUNC,
gcnew_1ScrollBar_FUNC,
gcnew_1ScrollEventHandler_FUNC,
+ gcnew_1ScrollViewer_FUNC,
gcnew_1SelectionChangedEventHandler_FUNC,
gcnew_1Separator_FUNC,
gcnew_1Setter_FUNC,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/org/eclipse/swt/internal/wpf/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/org/eclipse/swt/internal/wpf/OS.java
index 40ce30d32c..4a163dcf14 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/org/eclipse/swt/internal/wpf/OS.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/org/eclipse/swt/internal/wpf/OS.java
@@ -1509,6 +1509,7 @@ public static final native int gcnew_RowDefinition();
public static final native int gcnew_Run();
public static final native int gcnew_SaveFileDialog();
public static final native int gcnew_ScrollBar();
+public static final native int gcnew_ScrollViewer();
public static final native int gcnew_Separator();
public static final native int gcnew_Setter(int dp, int value);
public static final native int gcnew_Size();
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/ExpandBar.java b/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/ExpandBar.java
index 4609494e04..ea76759eda 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/ExpandBar.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/ExpandBar.java
@@ -129,25 +129,28 @@ protected void checkSubclass () {
static int checkStyle (int style) {
style &= ~SWT.H_SCROLL;
- //TODO implement scrollbar for this widget
- style &= ~SWT.V_SCROLL;
return style | SWT.NO_BACKGROUND;
}
public Point computeSize (int wHint, int hHint, boolean changed) {
checkWidget ();
- return computeSize (handle, wHint, hHint, changed);
+ Point size = computeSize (handle, wHint, hHint, changed);
+ Rectangle trim = computeTrim (0, 0, size.x, size.y);
+ return new Point (trim.width, trim.height);
}
void createHandle () {
state |= THEME_BACKGROUND;
parentingHandle = OS.gcnew_Canvas ();
if (parentingHandle == 0) error (SWT.ERROR_NO_HANDLES);
+ scrolledHandle = OS.gcnew_ScrollViewer ();
+ if (scrolledHandle == 0) error (SWT.ERROR_NO_HANDLES);
handle = OS.gcnew_StackPanel ();
if (handle == 0) error (SWT.ERROR_NO_HANDLES);
int children = OS.Panel_Children (parentingHandle);
- OS.UIElementCollection_Add (children, handle);
+ OS.UIElementCollection_Add (children, scrolledHandle);
OS.GCHandle_Free (children);
+ OS.ContentControl_Content (scrolledHandle, handle);
}
void createItem (ExpandItem item, int style, int index) {
@@ -184,6 +187,13 @@ void destroyItem (ExpandItem item) {
itemCount--;
}
+void fixScrollbarVisibility () {
+ OS.ScrollViewer_SetHorizontalScrollBarVisibility (scrolledHandle, OS.ScrollBarVisibility_Hidden);
+ if ((style & SWT.V_SCROLL) != 0) {
+ OS.ScrollViewer_SetVerticalScrollBarVisibility (scrolledHandle, OS.ScrollBarVisibility_Auto);
+ }
+}
+
Point getLocation (Control child) {
int topHandle = child.topHandle ();
int point = OS.gcnew_Point (0, 0);
@@ -269,6 +279,17 @@ public ExpandItem [] getItems () {
return result;
}
+int getScrollBarHandle (int style) {
+ if ((style & SWT.H_SCROLL) != 0) return 0;
+ updateLayout (handle);
+ int template = OS.Control_Template (scrolledHandle);
+ int part = createDotNetString ("PART_VerticalScrollBar", false);
+ int scrollbar = OS.FrameworkTemplate_FindName (template, part, scrolledHandle);
+ OS.GCHandle_Free (part);
+ OS.GCHandle_Free (template);
+ return scrollbar;
+}
+
/**
* Returns the receiver's spacing.
*
@@ -393,8 +414,8 @@ public void removeExpandListener (ExpandListener listener) {
int setBounds (int x, int y, int width, int height, int flags) {
int result = super.setBounds (x, y, width, height, flags);
if ((result & RESIZED) != 0) {
- OS.FrameworkElement_Height (handle, height);
- OS.FrameworkElement_Width (handle, width);
+ OS.FrameworkElement_Height (scrolledHandle, height);
+ OS.FrameworkElement_Width (scrolledHandle, width);
}
return result;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/Scrollable.java b/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/Scrollable.java
index 4e677b363c..a48c99bab6 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/Scrollable.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/Scrollable.java
@@ -216,7 +216,7 @@ int getScrollBarHandle (int style) {
OS.GCHandle_Free (enumerator);
OS.GCHandle_Free (children);
} else {
- if (!OS.FrameworkElement_IsLoaded (handle)) updateLayout (handle);
+ updateLayout (handle);
int scrollViewerType = OS.ScrollViewer_typeid ();
int scrollViewer = findScrollViewer (handle, scrollViewerType);
int template = OS.Control_Template (scrollViewer);