ElectronWorkstation.st
changeset 8925 ddfbf2ff2b3b
parent 8844 71867baa556e
child 8929 6ab4163076c1
--- a/ElectronWorkstation.st	Sat Dec 14 22:29:02 2019 +0100
+++ b/ElectronWorkstation.st	Sun Dec 15 01:47:51 2019 +0100
@@ -250,13 +250,28 @@
     "return true, if there is a valid connection to the display"
 
     ^ bridge notNil and:[bridge isConnected]
+!
+
+supportsPNGImages
+    "return true, if this device directly supports png images.
+     Currently none does (except browser windows)"    
+
+    ^ true
 ! !
 
 !ElectronWorkstation methodsFor:'event handling'!
 
+eventMaskFor:anEventSymbol
+    ^ 1
+!
+
 eventPending 
     ^ eventQueue notNil and:[eventQueue notEmpty]
 
+!
+
+setEventMask:eventMask in:drawableId
+    ^ self
 ! !
 
 !ElectronWorkstation methodsFor:'font stuff'!
@@ -402,9 +417,9 @@
         label:label owner:owner
         icon:icn iconMask:icnM iconView:icnV
 
-    "returns a remote window handler"
+    "returns a remote window handle"
 
-    |result|
+    |result arg|
 
     "/ does not work - BrowserWindow is invisible 
 "/    result := bridge 
@@ -415,9 +430,16 @@
 "/                                    });
 "/                      return makeRef(win, "electronWindow");'
 "/                withArguments:{ ext x . ext y }.
+    arg := OrderedDictionary new
+            at:'width' put:ext x;
+            at:'heigth' put:ext y;
+            at:'x' put:org x;
+            at:'y' put:org y;
+            yourself.
+
     result := bridge 
                 callFunction:'createWindow' 
-                withArguments:{ ext x . ext y }.
+                withArguments:{ arg "ext x . ext y" }.
     ^ result
 !
 
@@ -446,32 +468,55 @@
     sz2 := aWindowId getPosition.
 !
 
-resizeWindow:aWindowId width:w height:h
+resizeWindow:aWindowHandle width:w height:h
     "resize a window"
 
-    |sz1 sz2 cs1 cs2|
-
-    sz1 := aWindowId getSize.
-    aWindowId setSize:w _:h .
-    sz2 := aWindowId getSize.
+    bridge 
+        callFunction:'win_setBounds'
+        withArguments:{ aWindowHandle   .
+                    (OrderedDictionary new
+                        at:'width' put:w;
+                        at:'height' put:h;
+                        yourself)
+                   }
 
-    cs1 := aWindowId getContentSize.
-    aWindowId setContentSize:w _:h .
-    cs2 := aWindowId getContentSize.
-
-    self halt.
+"/
+"/    |sz1 sz2 cs1 cs2|
+"/
+"/    sz1 := aWindowHandle getBounds. "/ OrderedDictionary('x'->10 'y'->23 'width'->853 'height'->518)
+"/    sz1 at:'width' put:w.
+"/    sz1 at:'height' put:h.
+"/    aWindowHandle setBounds:sz1 .
+"/    ^ self.
+"/
+"/    sz1 := aWindowHandle getSize.
+"/    aWindowHandle setSize:w _:h .
+"/    sz2 := aWindowHandle getSize.
+"/
+"/    cs1 := aWindowHandle getContentSize.
+"/    aWindowHandle setContentSize:w _:h .
+"/    cs2 := aWindowHandle getContentSize.
+"/
+"/    "/ self halt.
 !
 
-setWindowBackground:aColorIndex in:aWindowId
+setWindowBackground:aColorIndex in:aWindowHandle
     "set a windows background color"
 
-    Logger info:'unimplemented: setWindowBackground:'.
+    "/ aWindowHandle getBackgroundColor
+    aWindowHandle setBackgroundColor:(aColorIndex printfPrintString:'#%06x')
+    "/ Logger info:'unimplemented: setWindowBackground:'.
 !
 
-setWindowName:aString in:aWindowId
+setWindowName:aString in:aWindowHandle
     "define a windows name (i.e. windowTitle)"
 
-    Logger info:'unimplemented: setWindowName:'.
+    aWindowHandle setTitle:aString.
+    "/ Logger info:'unimplemented: setWindowName:'.
+!
+
+testResize:windowHandle
+    bridge callFunction:'testResize' withArguments:{ windowHandle }.
 !
 
 unmapWindow:aWindowId