--- a/FramedBox.st Fri Oct 09 11:40:30 2015 +0200
+++ b/FramedBox.st Fri Oct 09 17:31:17 2015 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
"
COPYRIGHT (c) 1991 by Claus Gittinger
All Rights Reserved
@@ -11,10 +13,12 @@
"
"{ Package: 'stx:libwidg' }"
+"{ NameSpace: Smalltalk }"
+
SimpleView subclass:#FramedBox
instanceVariableNames:'label labelChannel labelPosition fgColor showFrame frame3D
- horizontalSpace verticalSpace innerHorizontalSpace
- innerVerticalSpace'
+ frameMacRounded horizontalSpace verticalSpace
+ innerHorizontalSpace innerVerticalSpace frameColor'
classVariableNames:''
poolDictionaries:''
category:'Views-Layout'
@@ -289,13 +293,13 @@
!
foregroundColor
- "return the frame labels foreground color"
+ "return the label's foreground color"
^ fgColor
!
foregroundColor:aColor
- "set the frame labels foreground color"
+ "set the frame label's foreground color"
aColor ~= fgColor ifTrue:[
fgColor := aColor.
@@ -305,9 +309,24 @@
"Modified: / 6.6.1998 / 19:23:14 / cg"
!
+frameColor
+ "return the frame's color"
+
+ ^ frameColor
+!
+
+frameColor:aColor
+ "set the frame's foreground color"
+
+ aColor ~= frameColor ifTrue:[
+ frameColor := aColor.
+ self invalidateRepairNow:true
+ ]
+!
+
frameShown
"return true, if frame is shown;
- if false, oly the label is shown.
+ if false, only the label is shown.
OBSOLETE; use #showFrame."
^ self showFrame
@@ -474,17 +493,21 @@
!FramedBox methodsFor:'accessing-channels'!
labelChannel
- "return the labelChannel - or nil"
+ "return the labelChannel - or nil.
+ If not nil, it should provide the actual label via #value
+ (and may send out change notifications).
+ If nil, the static label is used."
^ labelChannel.
-
-
!
labelChannel:aValueHolder
"set the labelChannel - a valueHolder holding a string
- which is shown as my logo
- "
+ which is shown as my logo.
+ If not nil, it should provide the actual label via #value
+ (and may send out change notifications).
+ If nil, the static label is used."
+
labelChannel notNil ifTrue:[
labelChannel removeDependent:self.
].
@@ -536,11 +559,15 @@
w := width - halfSepX - halfSepX.
h := height - halfSepY - halfSepY.
+ frameMacRounded ifTrue:[
+ ^ self.
+ ].
+
frame3D ifFalse:[
- self displayRectangleX:halfSepX
- y:halfSepY
- width:w
- height:h.
+ frameColor ~= fgColor ifTrue:[
+ self paint:frameColor
+ ].
+ self displayRectangleX:halfSepX y:halfSepY width:w height:h.
^ self
].
@@ -548,16 +575,10 @@
h := h + 1.
self paint:lightColor.
- self displayRectangleX:halfSepX
- y:halfSepY
- width:w
- height:h.
+ self displayRectangleX:halfSepX y:halfSepY width:w height:h.
self paint:shadowColor.
- self displayRectangleX:halfSepX-1
- y:halfSepY-1
- width:w
- height:h.
+ self displayRectangleX:halfSepX-1 y:halfSepY-1 width:w height:h.
"Modified: 17.2.1997 / 11:04:34 / cg"
!
@@ -649,7 +670,8 @@
super fetchDeviceResources.
fgColor := fgColor onDevice:self graphicsDevice.
-
+ frameColor := frameColor onDevice:self graphicsDevice.
+
"Created: 15.2.1997 / 16:57:56 / cg"
!
@@ -660,14 +682,18 @@
<resource: #style (#'framedBox.foregroundColor'
#'framedBox.labelPosition'
+ #'framedBox.frameColor'
#'framedBox.font'
+ #'framedBox.MacRoundFrame'
#'framedBox.3DFrame')>
super initStyle.
fgColor := StyleSheet at:'framedBox.foregroundColor' default:self blackColor.
+ frameColor := StyleSheet at:'framedBox.frameColor' default:fgColor.
labelPosition := StyleSheet at:'framedBox.labelPosition' default:#topCenter.
frame3D := StyleSheet at:'framedBox.3DFrame' default:true.
+ frameMacRounded := StyleSheet at:'framedBox.MacRoundFrame' default:false.
self basicFont:(StyleSheet at:'framedBox.font' default:(StyleSheet at:'label.font' default:self font)).
self borderWidth:0.
@@ -764,10 +790,10 @@
!FramedBox class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/FramedBox.st,v 1.59 2014-05-07 15:44:16 cg Exp $'
+ ^ '$Header$'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libwidg/FramedBox.st,v 1.59 2014-05-07 15:44:16 cg Exp $'
+ ^ '$Header$'
! !