--- a/NoteBookView.st Mon Jan 20 13:02:46 2003 +0100
+++ b/NoteBookView.st Wed Jan 22 09:02:53 2003 +0100
@@ -18,9 +18,9 @@
direction numberOfLines selectConditionBlock accessTabMenuAction
canvas canvasInset canvasHolder halfLightColor halfShadowColor
fitLastRow tabModus lastComputedExtent keepCanvas
- activeForegroundColor drawLightColor edgeStyle
- disabledForegroundColor tabLevel tabTopMargin tabBottomMargin
- selectionInsetX selectionInsetY'
+ activeForegroundColor drawLightColor edgeStyle tabInset
+ tabLabelInset disabledForegroundColor tabLevel tabTopMargin
+ tabBottomMargin selectionInsetX selectionInsetY'
classVariableNames:'DefaultForegroundColor DefaultActiveForegroundColor
DefaultShadowColor DefaultHalfShadowColor DefaultLightColor
DefaultHalfLightColor DefaultEdgeStyle DisabledForegroundColor'
@@ -172,7 +172,7 @@
!NoteBookView methodsFor:'accepting - items'!
tabAtIndex:tabIndex put:newLabel
- |tab layout prefX prefY|
+ |tab layout prefX prefY tabExtent|
"/ a single items label has changed
tab := list at:tabIndex ifAbsent:nil.
@@ -182,9 +182,10 @@
"/ no resizing, if the new string fits
"/ and is not too small for current tab-layout
layout := tab layout.
-
- ( (prefX := tab preferredExtentX) <= layout width
- and:[(prefY := tab preferredExtentY) <= layout height]
+ tabExtent := self preferredExtentForTab:tab.
+
+ ( (prefX := tabExtent x) <= layout width
+ and:[(prefY := tabExtent y) <= layout height]
) ifTrue:[
"/ the new string fits into current tab-layout
@@ -560,8 +561,9 @@
size ~~ 0 ifTrue:[
list do:[:aTab|
- x := x + (aTab preferredExtentX).
- y := y max:(aTab preferredExtentY).
+ extent := self preferredExtentForTab:aTab.
+ x := extent x + x.
+ y := extent y max:y.
].
].
y := y + selectionInsetY + level + tabTopMargin + tabBottomMargin.
@@ -585,7 +587,13 @@
].
isHorizontal ifTrue:[ ^ x @ y ].
- ^ y @ x
+ ^ y @ x
+!
+
+preferredExtentForTab:aTab
+ "returns the preferred extent of a tabulator
+ "
+ ^ aTab extent + tabLabelInset
! !
!NoteBookView methodsFor:'accessing-style'!
@@ -672,6 +680,28 @@
].
!
+tabLabelInset
+ "inset (a point) of the label relative to its frame
+ preferredExtent of Tab: label extent + tabLabelInset
+ "
+ ^ tabLabelInset
+!
+
+tabLabelInset:aPoint
+ "inset (a point) of the label relative to its frame
+ preferredExtent of Tab: label extent + tabLabelInset
+ "
+ |p|
+
+ aPoint isNumber ifTrue:[ p := Point x:aPoint y:aPoint ]
+ ifFalse:[ p := aPoint ].
+
+ p ~= tabLabelInset ifTrue:[
+ tabLabelInset := p.
+ self styleChanged.
+ ].
+!
+
tabLevel
"the level of the tabs and noteBook frame
"
@@ -1412,7 +1442,7 @@
canvasInset := StyleSheet at:#'noteBook.canvasInset' default:1@1.
keepCanvas := false.
tabLevel := StyleSheet at:#'noteBook.tabLevel' default:1.
-
+ tabLabelInset := StyleSheet at:#'noteBook.tabLabelInset' default:4@4.
selectionInsetX := (2 max:(tabLevel abs)) + 1.
selectionInsetY := (2 max:(tabLevel abs)) + 1.
@@ -1580,7 +1610,7 @@
recomputeListHorizontal
"recompute list
"
- |layout lastLyt
+ |layout lastLyt tabExtent
xLeft "{ Class:SmallInteger }"
xRight "{ Class:SmallInteger }"
yTop "{ Class:SmallInteger }"
@@ -1604,8 +1634,9 @@
xLeft := minLeft.
list do:[:aTab|
- tabWidth := aTab preferredExtentX + border.
- tabHeight := (aTab preferredExtentY) max:tabHeight.
+ tabExtent := self preferredExtentForTab:aTab.
+ tabWidth := tabExtent x + border.
+ tabHeight := tabExtent y max:tabHeight.
xRight := xLeft + tabWidth.
xRight > maxRight ifTrue:[
@@ -1686,7 +1717,7 @@
recomputeListVertical
"recompute list
"
- |layout lastLyt
+ |layout lastLyt tabExtent
xTop "{ Class:SmallInteger }"
yTop "{ Class:SmallInteger }"
yBottom "{ Class:SmallInteger }"
@@ -1710,8 +1741,9 @@
yTop := minTop.
list do:[:aTab|
- tabWidth := aTab preferredExtentX + border.
- tabHeight := (aTab preferredExtentY) max:tabHeight.
+ tabExtent := self preferredExtentForTab:aTab.
+ tabWidth := tabExtent x + border.
+ tabHeight := tabExtent y max:tabHeight.
yBottom := yTop + tabWidth.
yBottom > maxBottom ifTrue:[
@@ -2233,18 +2265,6 @@
layout := aLayout
-!
-
-preferredExtentX
- "returns my preferred extent x
- "
- ^ 2 + extent x
-!
-
-preferredExtentY
- "returns my preferred extent y
- "
- ^ 2 + extent y
! !
!NoteBookView::Tab methodsFor:'accessing-mvc'!
@@ -2413,5 +2433,5 @@
!NoteBookView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg2/NoteBookView.st,v 1.75 2002-11-27 07:22:36 ca Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg2/NoteBookView.st,v 1.76 2003-01-22 08:02:53 ca Exp $'
! !