some Motif emulation
authorcg
Mon, 18 Dec 2000 19:30:11 +0000
changeset 702 9c8a2e687b9b
parent 701 4d62047c1358
child 703 37d2ddc947ed
some Motif emulation
JavaVM.st
--- a/JavaVM.st	Mon Dec 18 16:43:45 2000 +0000
+++ b/JavaVM.st	Mon Dec 18 19:30:11 2000 +0000
@@ -8363,6 +8363,161 @@
     "Created: / 28.1.1998 / 01:50:22 / cg"
 ! !
 
+!JavaVM class methodsFor:'native - sun.awt.motif'!
+
+_MButtonPeer_create:nativeContext
+    ^ self _WButtonPeer_create:nativeContext
+!
+
+_MComponentPeer_handleEvent:nativeContext
+    ^ self _WComponentPeer_handleEvent:nativeContext
+
+    "Created: / 18.11.1998 / 00:21:17 / cg"
+!
+
+_MComponentPeer_nativeHandleEvent:nativeContext
+    ^ self _WComponentPeer_nativeHandleEvent:nativeContext
+!
+
+_MComponentPeer_pSetBackground:nativeContext
+    |view jClr rgb clr|
+
+    view := self viewForWPeer:nativeContext.
+    jClr := nativeContext argAt:1.
+    rgb := jClr instVarNamed:'value'.
+
+    clr := Color rgbValue:rgb.
+
+    clr := clr on:(view device).
+    (view isKindOf:ScrollableView) ifTrue:[
+        view := view scrolledView
+    ].
+    view viewBackground:clr.
+    view backgroundPaint:clr.
+!
+
+_MComponentPeer_pSetFont:nativeContext
+    |view jFont stFont |
+
+    view := self viewForWPeer:nativeContext.
+    jFont := nativeContext argAt:1.
+
+    stFont := jFont instVarNamed:'pData'.
+    (stFont isNil or:[stFont == 0]) ifTrue:[
+self halt.
+    ] ifFalse:[
+        view font:stFont
+    ].
+
+    ^ nil
+!
+
+_MComponentPeer_pSetForeground:nativeContext
+    |view jClr rgb clr|
+
+    view := self viewForWPeer:nativeContext.
+    jClr := nativeContext argAt:1.
+    rgb := jClr instVarNamed:'value'.
+
+    clr := Color rgbValue:rgb.
+
+    clr := clr on:(view device).
+
+    (view isKindOf:ScrollableView) ifTrue:[
+        view := view scrolledView
+    ].
+    view foregroundColor:clr.
+!
+
+_MComponentPeer_pShow:nativeContext
+    |view|
+
+    view := self viewForWPeer:nativeContext.
+
+    "/ frame views are under my browsers own control
+    (view isMemberOf:JavaEmbeddedFrameView) ifFalse:[
+	view beVisible.
+	view realize.
+    ].
+
+"/    view windowGroup notNil ifTrue:[
+"/        windowServer addGroup:(view windowGroup)
+"/    ].
+
+    ^ nil
+
+"/ self halt.
+
+    "Modified: / 25.1.1998 / 09:54:07 / cg"
+    "Created: / 18.11.1998 / 00:21:51 / cg"
+!
+
+_X11FontMetrics_getMFCharSegmentWidth:nativeContext
+    "get multi-font string-segment width.
+     Not yet supported - use standard strings width"
+
+    |jMetrics jFont jFontDescr stFont w
+     bool1 cp offs lenght bp int1|
+
+    jMetrics := nativeContext receiver.
+    jFont := nativeContext argAt:1.
+    jFontDescr := nativeContext argAt:2.
+    cp := nativeContext argAt:3.
+    lenght := nativeContext argAt:4.
+
+    stFont := jFont instVarNamed:'pData'.
+    (stFont isNil or:[stFont == 0]) ifTrue:[
+        self halt
+    ].
+
+    stFont device isNil ifTrue:[
+        stFont := stFont on:Display.
+        jFont instVarNamed:'pData' put:stFont.
+    ].
+    w := stFont widthOf:cp from:1 to:lenght.
+    ^ w.
+!
+
+_X11FontMetrics_init:nativeContext
+    ^ self _WFontMetrics_init:nativeContext
+!
+
+_X11Graphics_changeClip:nativeContext
+    ^ self _WGraphics_changeClip:nativeContext
+!
+
+_X11Graphics_createFromComponent:nativeContext
+    ^ self _WGraphics_createFromComponent:nativeContext
+!
+
+_X11Graphics_disposeImpl:nativeContext
+    ^ self _WGraphics_dispose:nativeContext
+!
+
+_X11Graphics_drawMFCharsSegment:nativeContext
+    ^ self _WGraphics_drawMFCharsSegment:nativeContext
+!
+
+_X11Graphics_drawRect:nativeContext
+    ^ self _WGraphics_drawRect:nativeContext
+!
+
+_X11Graphics_fillOval:nativeContext
+    ^ self _WGraphics_fillOval:nativeContext
+!
+
+_X11Graphics_fillRect:nativeContext
+    ^ self _WGraphics_fillRect:nativeContext
+!
+
+_X11Graphics_pSetFont:nativeContext
+    ^ self _WGraphics_pSetFont:nativeContext
+!
+
+_X11Graphics_pSetForeground:nativeContext
+    ^ self _WGraphics_pSetForeground:nativeContext
+! !
+
 !JavaVM class methodsFor:'native - sun.awt.motif - jdk1.2'!
 
 _InputThread_run:nativeContext
@@ -8430,35 +8585,6 @@
 
 !JavaVM class methodsFor:'native - sun.awt.windows'!
 
-_MComponentPeer_handleEvent:nativeContext
-    ^ self _WComponentPeer_handleEvent:nativeContext
-
-    "Created: / 18.11.1998 / 00:21:17 / cg"
-!
-
-_MComponentPeer_pShow:nativeContext
-    |view|
-
-    view := self viewForWPeer:nativeContext.
-
-    "/ frame views are under my browsers own control
-    (view isMemberOf:JavaEmbeddedFrameView) ifFalse:[
-	view beVisible.
-	view realize.
-    ].
-
-"/    view windowGroup notNil ifTrue:[
-"/        windowServer addGroup:(view windowGroup)
-"/    ].
-
-    ^ nil
-
-"/ self halt.
-
-    "Modified: / 25.1.1998 / 09:54:07 / cg"
-    "Created: / 18.11.1998 / 00:21:51 / cg"
-!
-
 _WButtonPeer_create:nativeContext
     |jButtonPeer jButton jFrame frame button
      lbl|
@@ -9276,10 +9402,10 @@
 
     stFont := Font family:family size:size.
     stFont isNil ifTrue:[
-	stFont := Font family:'helvetica' size:size.
+        stFont := Font family:'helvetica' size:size.
     ].
     stFont := stFont on:Display.
-
+self halt.
 "/    stFont := jFont instVarNamed:'pData'.
 "/    stFont isNil ifTrue:[
 "/        self halt
@@ -9299,7 +9425,7 @@
 
     widths := Array new:256.
     0 to:255 do:[:i |
-	widths at:(i+1) put:(stFont widthOf:(Character value:i))
+        widths at:(i+1) put:(stFont widthOf:(Character value:i))
     ].
     jMetrics instVarNamed:'widths' put:widths.
 "/ self halt.
@@ -9977,7 +10103,10 @@
     gc := self gcForWGraphics:nativeContext.
 
     rgb := nativeContext argAt:1.
-
+    rgb isInteger ifFalse:[
+        "/ its a java.awt.Color
+        rgb := rgb instVarNamed:'value'.
+    ].
     clr := Color rgbValue:rgb.
     gc paint:(clr nearestOn:gc device).
 
@@ -12695,6 +12824,6 @@
 !JavaVM class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaVM.st,v 1.177 2000/12/18 16:43:17 cg Exp $'
+    ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaVM.st,v 1.178 2000/12/18 19:30:11 cg Exp $'
 ! !
 JavaVM initialize!