--- a/NoteBookView.st Thu Jan 27 10:31:23 2000 +0100
+++ b/NoteBookView.st Thu Jan 27 12:01:26 2000 +0100
@@ -643,6 +643,10 @@
savLyt := selTab layout.
selTab layout:lyt.
selTab redrawAt:direction selected:true on:self.
+
+ (self hasFocus and:[styleSheet name == #win95]) ifTrue:[
+ selTab drawWin95FocusFrameOn:self
+ ].
selTab layout:savLyt.
]
].
@@ -668,9 +672,9 @@
keyPress:aKey x:x y:y
"selection might change; look for corresponding list entry
"
- <resource: #keyboard (#CursorRight #CursorLeft)>
+ <resource: #keyboard (#CursorRight #CursorLeft #CursorUp #CursorDown)>
- |sensor size index n|
+ |sensor size index n key isHorizontal|
(enabled and:[(size := list size) > 1]) ifFalse:[
^ super keyPress:aKey x:x y:y
@@ -698,16 +702,26 @@
].
^ self
].
+ (aKey isSymbol and:[aKey startsWith:'Cursor']) ifFalse:[
+ ^ super keyPress:aKey x:x y:y
+ ].
- (aKey == #CursorRight or:[aKey == #CursorLeft]) ifFalse:[
- ^ super keyPress:aKey x:x y:y
+ self isHorizontal ifTrue:[
+ (aKey == #CursorRight or:[aKey == #CursorLeft]) ifFalse:[
+ ^ self
+ ].
+ key := aKey.
+ ] ifFalse:[
+ aKey == #CursorUp ifTrue:[key := #CursorLeft]
+ ifFalse:[aKey == #CursorDown ifTrue:[key := #CursorRight]
+ ifFalse:[ ^ self]].
].
(sensor := self sensor) notNil ifTrue:[
n := 1 + (sensor compressKeyPressEventsWithKey:aKey).
n := (n \\ size) max:1.
- aKey == #CursorRight ifTrue:[
+ key == #CursorRight ifTrue:[
index := selection ? 1.
[ (index := index + 1) > size ifTrue:[index := 1].
(self isSelectable:index) ifTrue:[n := n - 1].
@@ -737,6 +751,37 @@
]
! !
+!NoteBookView methodsFor:'focus handling'!
+
+showFocus:explicit
+ "got the keyboard focus
+ "
+ |tab|
+
+ styleSheet name == #win95 ifTrue:[
+ (tab := self selectedTab) notNil ifTrue:[
+ self invalidateTab:tab
+ ]
+ ] ifFalse:[
+ super showFocus:explicit
+ ]
+
+!
+
+showNoFocus:explicit
+ "lost the keyboard focus
+ "
+ |tab|
+
+ styleSheet name == #win95 ifTrue:[
+ (tab := self selectedTab) notNil ifTrue:[
+ self invalidateTab:tab
+ ]
+ ] ifFalse:[
+ super showNoFocus:explicit
+ ]
+! !
+
!NoteBookView methodsFor:'initialize / release'!
destroy
@@ -1583,13 +1628,22 @@
!
+drawWin95FocusFrameOn:aGC
+
+"/aGC notNil ifTrue:[^ self].
+
+ aGC displayDottedRectangleX:(layout left + 4)
+ y:(layout top + 4)
+ width:(layout width - 8)
+ height:(layout height - 8).
+!
+
redrawAt:aDirection selected:isSelected on:aGC
"redraw tab
"
|dispObj fgColor
y "{ Class:SmallInteger }"
x "{ Class:SmallInteger }"
- dI "{ Class:SmallInteger }"
|
isSelected ifTrue:[
@@ -1599,8 +1653,7 @@
aDirection == #top ifTrue:[self drawAtTopOn:aGC selected:isSelected]
ifFalse:[aDirection == #bottom ifTrue:[self drawAtBottomOn:aGC selected:isSelected]
ifFalse:[aDirection == #right ifTrue:[self drawAtRightOn:aGC selected:isSelected]
- ifFalse:[aDirection == #left ifTrue:[self drawAtLeftOn:aGC selected:isSelected]
- ifFalse:[^ self]]]].
+ ifFalse:[ self drawAtLeftOn:aGC selected:isSelected]]].
"/ REDRAW LABEL
(aGC isEnabled and:[self isEnabled]) ifTrue:[
@@ -1625,21 +1678,21 @@
].
aGC paint:fgColor.
- dI := 4.
+
(aDirection == #top or:[aDirection == #bottom]) ifTrue:[
- x := (layout left) + (layout width - extent x // 2).
+ x := layout left + (layout width - extent x // 2).
+ y := layout top + (layout height - extent y // 2).
- y := aDirection == #top ifTrue:[layout top + dI]
- ifFalse:[layout bottom - extent y - dI].
+ aDirection == #bottom ifTrue:[y := y - 1] ifFalse:[y := y + 1].
dispObj isImageOrForm ifFalse:[
y := y + aGC font ascent
- ].
+ ]
] ifFalse:[
- y := (layout top) + (layout height - extent x // 2).
+ x := layout left + (layout width - extent y // 2).
+ y := layout top + (layout height - extent x // 2).
- x := aDirection == #left ifTrue:[layout left + dI]
- ifFalse:[layout right - extent y - dI].
+ aDirection == #left ifTrue:[x := x + 1] ifFalse:[x := x - 1].
dispObj isImageOrForm ifFalse:[
x := x + aGC font descent.
@@ -1652,12 +1705,10 @@
^ aGC displayString:dispObj x:x y:y angle:90.
]
].
+
dispObj displayOn:aGC x:x y:y
-
-
-
""
@@ -1695,5 +1746,5 @@
!NoteBookView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg2/NoteBookView.st,v 1.24 2000-01-27 09:31:23 ca Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg2/NoteBookView.st,v 1.25 2000-01-27 11:01:26 ca Exp $'
! !