added query for lines/cols - prefExt
authorClaus Gittinger <cg@exept.de>
Fri, 24 May 1996 20:13:23 +0200
changeset 678 c1967a46b2c1
parent 677 5cacd1adea6a
child 679 c702b3d82f01
added query for lines/cols - prefExt
HVScrView.st
HVScrollableView.st
ListView.st
ScrView.st
ScrollableView.st
--- a/HVScrView.st	Fri May 24 18:35:29 1996 +0200
+++ b/HVScrView.st	Fri May 24 20:13:23 1996 +0200
@@ -45,7 +45,7 @@
 "
 ! !
 
-!HVScrollableView methodsFor:'accessing'!
+!HVScrollableView methodsFor:'accessing - components'!
 
 horizontalScrollBar
     "return the horizontal scrollbar"
@@ -281,10 +281,28 @@
     ^ super preferredExtent.
 
     "Modified: 23.4.1996 / 00:15:25 / cg"
+!
+
+preferredExtentForLines:numLines cols:numCols
+    "return my preferredExtent for given number of lines and cols."
+
+    |pref m2|
+
+    scrolledView notNil ifTrue:[ 
+        m2 := innerMargin * 2.
+        pref := scrolledView preferredExtentForLines:numLines cols:numCols.
+        ^ (pref x + scrollBar width + m2) 
+          @ 
+          (pref y + hScrollBar height + m2).
+    ].
+    ^ super preferredExtent.
+
+    "Modified: 23.4.1996 / 00:15:25 / cg"
+    "Created: 24.5.1996 / 17:15:43 / cg"
 ! !
 
 !HVScrollableView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/Attic/HVScrView.st,v 1.16 1996-04-25 17:16:19 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/Attic/HVScrView.st,v 1.17 1996-05-24 18:12:39 cg Exp $'
 ! !
--- a/HVScrollableView.st	Fri May 24 18:35:29 1996 +0200
+++ b/HVScrollableView.st	Fri May 24 20:13:23 1996 +0200
@@ -45,7 +45,7 @@
 "
 ! !
 
-!HVScrollableView methodsFor:'accessing'!
+!HVScrollableView methodsFor:'accessing - components'!
 
 horizontalScrollBar
     "return the horizontal scrollbar"
@@ -281,10 +281,28 @@
     ^ super preferredExtent.
 
     "Modified: 23.4.1996 / 00:15:25 / cg"
+!
+
+preferredExtentForLines:numLines cols:numCols
+    "return my preferredExtent for given number of lines and cols."
+
+    |pref m2|
+
+    scrolledView notNil ifTrue:[ 
+        m2 := innerMargin * 2.
+        pref := scrolledView preferredExtentForLines:numLines cols:numCols.
+        ^ (pref x + scrollBar width + m2) 
+          @ 
+          (pref y + hScrollBar height + m2).
+    ].
+    ^ super preferredExtent.
+
+    "Modified: 23.4.1996 / 00:15:25 / cg"
+    "Created: 24.5.1996 / 17:15:43 / cg"
 ! !
 
 !HVScrollableView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/HVScrollableView.st,v 1.16 1996-04-25 17:16:19 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/HVScrollableView.st,v 1.17 1996-05-24 18:12:39 cg Exp $'
 ! !
--- a/ListView.st	Fri May 24 18:35:29 1996 +0200
+++ b/ListView.st	Fri May 24 20:13:23 1996 +0200
@@ -2066,6 +2066,14 @@
     ^ self size
 !
 
+preferredExtentForLines:numLines cols:numCols
+    ^ (((font widthOf:'x') * numCols + margin + margin) 
+      @ 
+      (fontHeight * numLines + margin + margin + font descent)).
+
+    "Modified: 24.5.1996 / 17:16:36 / cg"
+!
+
 widthOfContents
     "return the width of the contents in pixels
      - used for scrollbar interface"
@@ -3224,5 +3232,5 @@
 !ListView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.89 1996-05-22 14:29:43 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.90 1996-05-24 18:13:23 cg Exp $'
 ! !
--- a/ScrView.st	Fri May 24 18:35:29 1996 +0200
+++ b/ScrView.st	Fri May 24 20:13:23 1996 +0200
@@ -521,7 +521,7 @@
     "Modified: 1.3.1996 / 13:46:39 / cg"
 ! !
 
-!ScrollableView methodsFor:'accessing'!
+!ScrollableView methodsFor:'accessing - components'!
 
 scrollBar
     "return the scrollbar"
@@ -888,6 +888,20 @@
     ^ super preferredExtent.
 
     "Modified: 23.4.1996 / 00:17:53 / cg"
+!
+
+preferredExtentForLines:numLines cols:numCols
+    "return my preferredExtent for given number of lines and cols."
+
+    scrolledView notNil ifTrue:[ 
+       | pref |
+       pref := scrolledView preferredExtentForLines:numLines cols:numCols.
+       ^ (pref x + scrollBar width + (innerMargin * 2)) @ pref y.
+    ].
+    ^ super preferredExtent.
+
+    "Created: 24.5.1996 / 17:13:26 / cg"
+    "Modified: 24.5.1996 / 17:15:50 / cg"
 ! !
 
 !ScrollableView methodsFor:'slave-view messages'!
@@ -957,5 +971,5 @@
 !ScrollableView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/Attic/ScrView.st,v 1.32 1996-04-30 15:37:44 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/Attic/ScrView.st,v 1.33 1996-05-24 18:12:54 cg Exp $'
 ! !
--- a/ScrollableView.st	Fri May 24 18:35:29 1996 +0200
+++ b/ScrollableView.st	Fri May 24 20:13:23 1996 +0200
@@ -521,7 +521,7 @@
     "Modified: 1.3.1996 / 13:46:39 / cg"
 ! !
 
-!ScrollableView methodsFor:'accessing'!
+!ScrollableView methodsFor:'accessing - components'!
 
 scrollBar
     "return the scrollbar"
@@ -888,6 +888,20 @@
     ^ super preferredExtent.
 
     "Modified: 23.4.1996 / 00:17:53 / cg"
+!
+
+preferredExtentForLines:numLines cols:numCols
+    "return my preferredExtent for given number of lines and cols."
+
+    scrolledView notNil ifTrue:[ 
+       | pref |
+       pref := scrolledView preferredExtentForLines:numLines cols:numCols.
+       ^ (pref x + scrollBar width + (innerMargin * 2)) @ pref y.
+    ].
+    ^ super preferredExtent.
+
+    "Created: 24.5.1996 / 17:13:26 / cg"
+    "Modified: 24.5.1996 / 17:15:50 / cg"
 ! !
 
 !ScrollableView methodsFor:'slave-view messages'!
@@ -957,5 +971,5 @@
 !ScrollableView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/ScrollableView.st,v 1.32 1996-04-30 15:37:44 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/ScrollableView.st,v 1.33 1996-05-24 18:12:54 cg Exp $'
 ! !