Inform GC (DeviceGraphicsContext) when it's size or children's size or origin changes jv
authorJan Vrany <jan.vrany@fit.cvut.cz>
Sat, 02 Apr 2016 15:47:26 +0100
branchjv
changeset 7253 1b427e95d77c
parent 7252 3c580d36b5b8
child 7254 dd5c3a4a295a
Inform GC (DeviceGraphicsContext) when it's size or children's size or origin changes By default, do nothing special (in DeviceGraphicsContext), but alternative graphics library, e.g., Cairo, may use this to update it's own internal state.
DeviceGraphicsContext.st
SimpleView.st
--- a/DeviceGraphicsContext.st	Sat Apr 02 14:17:33 2016 +0100
+++ b/DeviceGraphicsContext.st	Sat Apr 02 15:47:26 2016 +0100
@@ -629,12 +629,6 @@
 <conflict>
 !
 
-drawableId
-    "return the id of the drawable on the device"
-
-    ^ drawableId
-!
-
 font
     "return the font for drawing - here, a device font is returned if
      the GC is realized."
@@ -1351,6 +1345,7 @@
     "Modified: / 22.8.1998 / 15:15:52 / cg"
 ! !
 
+
 !DeviceGraphicsContext methodsFor:'copying'!
 
 postCopy
@@ -3994,6 +3989,27 @@
     drawableId := aDrawbleId
 
     "Created: / 6.2.1998 / 12:44:45 / cg"
+!
+
+subViewChangedSizeOrOrigin
+    "Internal. Called whenever one of the owner's
+     subview changes size or origin (i.e., when moved)    
+     See SimpleView>>pixelOrigin:extent:.
+     Can be used to adjust internal state."
+
+    "/ Nothing by default
+
+    "Created: / 02-04-2016 / 15:35:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+width: width height: height
+    "Internal. Called by SimpleView when resized. 
+     See SimpleView>>pixelOrigin:extent:.
+     Can be used to adjust internal state."
+
+    "/ Nothing by default
+
+    "Created: / 02-04-2016 / 14:34:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !DeviceGraphicsContext methodsFor:'queries'!
--- a/SimpleView.st	Sat Apr 02 14:17:33 2016 +0100
+++ b/SimpleView.st	Sat Apr 02 15:47:26 2016 +0100
@@ -1769,6 +1769,7 @@
     "Created: / 13.2.1999 / 10:31:39 / cg"
 ! !
 
+
 !SimpleView methodsFor:'accessing-behavior'!
 
 disable
@@ -6635,9 +6636,12 @@
      in that here, but some geometry managers redefine this, to reorganize
      components if that happens."
 
+    "/ Inform the GC
+    gc subViewChangedSizeOrOrigin.
     ^ self
 
-    "Created: 22.9.1995 / 14:44:59 / claus"
+    "Created: / 22-09-1995 / 14:44:59 / claus"
+    "Modified: / 02-04-2016 / 15:36:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 terminate
@@ -8248,6 +8252,7 @@
     ^ aMenu startUpFor:self
 ! !
 
+
 !SimpleView methodsFor:'native widget support'!
 
 nativeWindowType
@@ -8672,6 +8677,9 @@
                                            width:width height:height.
         ].
 
+        "Tell the GC that the size has changed"
+        gc width:width height:height.
+
         "if view becomes bigger, send sizeChanged after"
         false "(how ~~ #smaller)" ifTrue:[
             self sizeChanged:how
@@ -8736,7 +8744,8 @@
         self changed:#origin.
     ].
 
-    "Modified: / 25.5.1999 / 14:49:56 / cg"
+    "Modified: / 25-05-1999 / 14:49:56 / cg"
+    "Modified: / 02-04-2016 / 14:35:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 pointFromRelative:p
@@ -10590,6 +10599,7 @@
     ^ self
 ! !
 
+
 !SimpleView methodsFor:'scrolling'!
 
 halfPageDown
@@ -11611,11 +11621,6 @@
     ^ false
 !
 
-isCodeView2
-
-    ^ false
-!
-
 isComboView
     ^ false
 !
@@ -11846,4 +11851,5 @@
 
 ! !
 
+
 SimpleView initialize!