ActiveHelpView.st
changeset 138 492fb73ca439
parent 114 e577a2f332d0
child 216 a5f97668e99a
equal deleted inserted replaced
137:449db28201ec 138:492fb73ca439
    10  hereby transferred.
    10  hereby transferred.
    11 "
    11 "
    12 
    12 
    13 
    13 
    14 
    14 
    15 'From Smalltalk/X, Version:2.10.5 on 26-mar-1995 at 10:19:24 am'!
       
    16 
       
    17 View subclass:#ActiveHelpView
    15 View subclass:#ActiveHelpView
    18 	 instanceVariableNames:'myView'
    16 	 instanceVariableNames:'myView'
    19 	 classVariableNames:''
    17 	 classVariableNames:''
    20 	 poolDictionaries:''
    18 	 poolDictionaries:''
    21 	 category:'Interface-Help'
    19 	 category:'Interface-Help'
    22 !
    20 !
    23 
    21 
    24 !ActiveHelpView class methodsFor:'documentation'!
    22 !ActiveHelpView class methodsFor:'documentation'!
    25 
    23 
    26 version
    24 copyright
    27     ^ '$Header: /cvs/stx/stx/libview2/ActiveHelpView.st,v 1.5 1995-11-11 16:04:09 cg Exp $'
    25 "
       
    26  COPYRIGHT (c) 1995 by Claus Gittinger
       
    27 	      All Rights Reserved
       
    28 
       
    29  This software is furnished under a license and may be used
       
    30  only in accordance with the terms of that license and with the
       
    31  inclusion of the above copyright notice.   This software may not
       
    32  be provided or otherwise made available to, or used by, any
       
    33  other person.  No title to or ownership of the software is
       
    34  hereby transferred.
       
    35 "
       
    36 
       
    37 
    28 !
    38 !
    29 
    39 
    30 documentation
    40 documentation
    31 "
    41 "
    32     a talking view.
    42     a talking view.
    35     styleSheet; the default is simple-square. To get the fancy cmics
    45     styleSheet; the default is simple-square. To get the fancy cmics
    36     view, add a resource 'activeHelpStyle' with a symbol-value of #cartoon.
    46     view, add a resource 'activeHelpStyle' with a symbol-value of #cartoon.
    37     However, be aware that some servers have performance problems with
    47     However, be aware that some servers have performance problems with
    38     these view-shapes (or do not support shapes at all).
    48     these view-shapes (or do not support shapes at all).
    39 "
    49 "
    40 !
       
    41 
       
    42 copyright
       
    43 "
       
    44  COPYRIGHT (c) 1995 by Claus Gittinger
       
    45 	      All Rights Reserved
       
    46 
       
    47  This software is furnished under a license and may be used
       
    48  only in accordance with the terms of that license and with the
       
    49  inclusion of the above copyright notice.   This software may not
       
    50  be provided or otherwise made available to, or used by, any
       
    51  other person.  No title to or ownership of the software is
       
    52  hereby transferred.
       
    53 "
       
    54 
       
    55 
       
    56 ! !
    50 ! !
    57 
    51 
    58 !ActiveHelpView class methodsFor:'instance creation'!
    52 !ActiveHelpView class methodsFor:'instance creation'!
    59 
    53 
    60 for:someText
    54 for:someText
    80      (ActiveHelpView with:(TextView new)) open
    74      (ActiveHelpView with:(TextView new)) open
    81      (ActiveHelpView with:(Button label:'ok')) open
    75      (ActiveHelpView with:(Button label:'ok')) open
    82     "
    76     "
    83 ! !
    77 ! !
    84 
    78 
       
    79 !ActiveHelpView methodsFor:'accessing'!
       
    80 
       
    81 contents:someText
       
    82     (myView isKindOf:Label) ifTrue:[
       
    83 	myView label:someText asString.
       
    84 	myView extent:(myView preferredExtent).
       
    85     ] ifFalse:[
       
    86 	myView contents:someText.
       
    87     ].
       
    88     self resizeToFit
       
    89 !
       
    90 
       
    91 createOnTop
       
    92     ^ true
       
    93 !
       
    94 
       
    95 isPopUpView
       
    96     ^ true
       
    97 !
       
    98 
       
    99 withView:aView
       
   100     (aView isKindOf:Label) ifTrue:[
       
   101 	aView viewBackground:viewBackground.
       
   102 	aView backgroundColor:viewBackground.
       
   103     ].
       
   104     self addSubView:aView.
       
   105     myView := aView.
       
   106     myView borderWidth:0
       
   107 ! !
       
   108 
       
   109 !ActiveHelpView methodsFor:'events'!
       
   110 
       
   111 XXsizeChanged:how
       
   112     super sizeChanged:how.
       
   113     self computeShape
       
   114 !
       
   115 
       
   116 redraw
       
   117     self fill:White
       
   118 ! !
       
   119 
    85 !ActiveHelpView methodsFor:'initialization'!
   120 !ActiveHelpView methodsFor:'initialization'!
       
   121 
       
   122 initStyle
       
   123     super initStyle.
       
   124 
       
   125     viewBackground := styleSheet colorAt:'activeHelpBackgroundColor' default:viewBackground.
       
   126     borderWidth := styleSheet at:'activeHelpBorderWidth' default:1.
       
   127 !
       
   128 
       
   129 initialize
       
   130     super initialize.
       
   131     font := Font family:'helvetica' size:12.
       
   132     (styleSheet at:'activeHelpStyle' default:nil) == #cartoon ifTrue:[
       
   133 	self viewBackground:White
       
   134     ]
       
   135 !
    86 
   136 
    87 realize
   137 realize
    88     self create.
   138     self create.
    89     self computeShape.
   139     self computeShape.
    90     self enableMotionEvents.
   140     self enableMotionEvents.
    91     self enableButtonMotionEvents.
   141     self enableButtonMotionEvents.
    92     super realize
   142     super realize
    93 !
       
    94 
       
    95 initStyle
       
    96     super initStyle.
       
    97 
       
    98     viewBackground := styleSheet colorAt:'activeHelpBackgroundColor' default:viewBackground.
       
    99     borderWidth := styleSheet at:'activeHelpBorderWidth' default:1.
       
   100 !
       
   101 
       
   102 initialize
       
   103     super initialize.
       
   104     font := Font family:'helvetica' size:12.
       
   105     (styleSheet at:'activeHelpStyle' default:nil) == #cartoon ifTrue:[
       
   106 	self viewBackground:White
       
   107     ]
       
   108 ! !
       
   109 
       
   110 !ActiveHelpView methodsFor:'accessing'!
       
   111 
       
   112 withView:aView
       
   113     (aView isKindOf:Label) ifTrue:[
       
   114 	aView viewBackground:viewBackground.
       
   115 	aView backgroundColor:viewBackground.
       
   116     ].
       
   117     self addSubView:aView.
       
   118     myView := aView.
       
   119     myView borderWidth:0
       
   120 !
       
   121 
       
   122 createOnTop
       
   123     ^ true
       
   124 !
       
   125 
       
   126 isPopUpView
       
   127     ^ true
       
   128 !
       
   129 
       
   130 contents:someText
       
   131     (myView isKindOf:Label) ifTrue:[
       
   132 	myView label:someText asString.
       
   133 	myView extent:(myView preferredExtent).
       
   134     ] ifFalse:[
       
   135 	myView contents:someText.
       
   136     ].
       
   137     self resizeToFit
       
   138 ! !
   143 ! !
   139 
   144 
   140 !ActiveHelpView methodsFor:'private'!
   145 !ActiveHelpView methodsFor:'private'!
   141 
   146 
   142 computeShape
   147 computeShape
   258     ] ifFalse:[
   263     ] ifFalse:[
   259 	self extent:myView extent
   264 	self extent:myView extent
   260     ]
   265     ]
   261 ! !
   266 ! !
   262 
   267 
   263 !ActiveHelpView methodsFor:'events'!
   268 !ActiveHelpView class methodsFor:'documentation'!
   264 
   269 
   265 redraw
   270 version
   266     self fill:White
   271     ^ '$Header: /cvs/stx/stx/libview2/ActiveHelpView.st,v 1.6 1995-12-07 21:46:32 cg Exp $'
   267 !
   272 ! !
   268 
       
   269 XXsizeChanged:how
       
   270     super sizeChanged:how.
       
   271     self computeShape
       
   272 ! !