#FEATURE by exept
authorClaus Gittinger <cg@exept.de>
Fri, 18 Oct 2019 01:46:33 +0200
changeset 8844 71867baa556e
parent 8843 6a876fd40a2e
child 8845 6e7cbf194cd9
#FEATURE by exept class: ElectronWorkstation added: #moveWindow:x:y: #resizeWindow:width:height: changed: #mapWindow: #unmapWindow: class: ElectronWorkstation class added: #example3a #example3b #example4 #example5 #example5b removed: #example3
ElectronWorkstation.st
--- a/ElectronWorkstation.st	Thu Oct 17 22:07:50 2019 +0200
+++ b/ElectronWorkstation.st	Fri Oct 18 01:46:33 2019 +0200
@@ -67,7 +67,28 @@
     "
 !
 
-example3
+example3a
+    |v1 dpy|
+
+    Smalltalk at:#Display2 put:(dpy := ElectronWorkstation newFor:'localhost:8888').
+
+    v1 := (TopView onDevice:dpy)
+            extent:(200 @ 150);
+            label:'Hello1';
+            open.
+
+    Delay waitForSeconds:1.
+    v1 close.
+
+    Delay waitForSeconds:1.
+    dpy close.
+
+    "
+     Display2 close
+    "
+!
+
+example3b
     |v1 v2 dpy|
 
     Smalltalk at:#Display2 put:(dpy := ElectronWorkstation newFor:'localhost:8888').
@@ -91,6 +112,92 @@
     "
      Display2 close
     "
+!
+
+example4
+    |v1 v2 dpy|
+
+    Smalltalk at:#Display2 put:(dpy := ElectronWorkstation newFor:'localhost:8888').
+
+    v1 := (TopView onDevice:dpy)
+            extent:(200 @ 150);
+            label:'Hello1';
+            open.
+    v2 := (TopView onDevice:dpy)
+            extent:(200 @ 150);
+            label:'Hello2';
+            open.
+
+    Delay waitForSeconds:1.
+    v1 unrealize.
+    Delay waitForSeconds:1.
+    v1 realize.
+    Delay waitForSeconds:1.
+    v1 close.
+
+    Delay waitForSeconds:1.
+    v2 unrealize.
+    Delay waitForSeconds:1.
+    v2 realize.
+    Delay waitForSeconds:1.
+    v2 close.
+
+    Delay waitForSeconds:1.
+    dpy close.
+
+    "
+     Display2 close
+    "
+!
+
+example5
+    |v1 dpy|
+
+    Smalltalk at:#Display2 put:(dpy := ElectronWorkstation newFor:'localhost:8888').
+
+    v1 := (TopView onDevice:dpy)
+            extent:(200 @ 150);
+            label:'Hello1';
+            open.
+
+    Delay waitForSeconds:1.
+    v1 extent:(400@300).
+    Delay waitForSeconds:1.
+    v1 extent:(200@150).
+    Delay waitForSeconds:1.
+    v1 close.
+
+    Delay waitForSeconds:1.
+    dpy close.
+
+    "
+     Display2 close
+    "
+!
+
+example5b
+    |v1 dpy|
+
+    Smalltalk at:#Display2 put:(dpy := ElectronWorkstation newFor:'localhost:8888').
+
+    v1 := (TopView onDevice:dpy)
+            extent:(200 @ 150);
+            label:'Hello1';
+            open.
+
+    Delay waitForSeconds:1.
+    v1 origin:(0@0).
+    Delay waitForSeconds:1.
+    v1 origin:(200@200).
+    Delay waitForSeconds:1.
+    v1 close.
+
+    Delay waitForSeconds:1.
+    dpy close.
+
+    "
+     Display2 close
+    "
 ! !
 
 !ElectronWorkstation class methodsFor:'class initialization'!
@@ -325,7 +432,34 @@
 mapWindow:aWindowId
     "map a window"
 
-    Logger info:'unimplemented: mapWindow:'.
+    aWindowId show.
+
+!
+
+moveWindow:aWindowId x:x y:y
+    "move a window"
+
+    |sz1 sz2|
+
+    sz1 := aWindowId getPosition.
+    aWindowId setPosition:x _:y .
+    sz2 := aWindowId getPosition.
+!
+
+resizeWindow:aWindowId width:w height:h
+    "resize a window"
+
+    |sz1 sz2 cs1 cs2|
+
+    sz1 := aWindowId getSize.
+    aWindowId setSize:w _:h .
+    sz2 := aWindowId getSize.
+
+    cs1 := aWindowId getContentSize.
+    aWindowId setContentSize:w _:h .
+    cs2 := aWindowId getContentSize.
+
+    self halt.
 !
 
 setWindowBackground:aColorIndex in:aWindowId
@@ -343,7 +477,8 @@
 unmapWindow:aWindowId
     "unmap a window"
 
-    Logger info:'unimplemented: unmapWindow:'.
+    aWindowId hide.
+
 ! !
 
 !ElectronWorkstation::ElectronGraphicsContext class methodsFor:'documentation'!