ActiveHelpView.st
author Claus Gittinger <cg@exept.de>
Fri, 05 Jul 1996 18:10:36 +0200
changeset 314 a239541adbc9
parent 285 208c1e1ad9a8
child 380 c553cc1bbfa7
permissions -rw-r--r--
use #graphicsDevice instead of #device.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
     1
"
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
     2
 COPYRIGHT (c) 1995 by Claus Gittinger
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
     3
	      All Rights Reserved
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
     4
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    11
"
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    12
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    13
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    14
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    15
View subclass:#ActiveHelpView
285
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
    16
	instanceVariableNames:'myView shapeStyle'
216
a5f97668e99a commentary
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
    17
	classVariableNames:''
a5f97668e99a commentary
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
    18
	poolDictionaries:''
a5f97668e99a commentary
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
    19
	category:'Interface-Help'
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    20
!
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    21
314
a239541adbc9 use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 285
diff changeset
    22
!ActiveHelpView  class methodsFor:'documentation'!
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    23
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    24
copyright
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    25
"
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    26
 COPYRIGHT (c) 1995 by Claus Gittinger
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    27
	      All Rights Reserved
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    28
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    29
 This software is furnished under a license and may be used
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    30
 only in accordance with the terms of that license and with the
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    31
 inclusion of the above copyright notice.   This software may not
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    32
 be provided or otherwise made available to, or used by, any
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    33
 other person.  No title to or ownership of the software is
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    34
 hereby transferred.
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    35
"
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    36
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    37
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    38
!
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    39
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    40
documentation
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    41
"
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    42
    a talking view.
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
    43
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    44
    Instances of myself show up either as a comics-like talking
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    45
    view, or as a simple square popup. This is configured via the
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
    46
    styleSheet; the default is simple-square. 
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
    47
    To get the fancy comics style, add a resource 'activeHelpStyle' with 
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
    48
    a symbol-value of #cartoon.
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    49
    However, be aware that some servers have performance problems with
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    50
    these view-shapes (or do not support shapes at all).
216
a5f97668e99a commentary
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
    51
221
ea942fe5dc04 documentation
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
    52
    [author:]
ea942fe5dc04 documentation
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
    53
        Claus Gittinger
ea942fe5dc04 documentation
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
    54
216
a5f97668e99a commentary
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
    55
    [See also:]
a5f97668e99a commentary
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
    56
        ActiveHelp
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    57
"
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    58
! !
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    59
314
a239541adbc9 use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 285
diff changeset
    60
!ActiveHelpView  class methodsFor:'instance creation'!
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    61
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    62
for:someText
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
    63
    "create a talking-view for some text"
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
    64
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    65
    |helpView textView|
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    66
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    67
    helpView := self new.
285
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
    68
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
    69
    textView := Label new.
314
a239541adbc9 use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 285
diff changeset
    70
    textView font:(helpView font on:textView graphicsDevice).
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    71
    ^ (helpView withView:textView) contents:someText
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    72
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    73
    "
285
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
    74
     (ActiveHelpView for:'hello world\this is an ActiveHelpView' withCRs) 
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
    75
        shapeStyle:nil; realize
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
    76
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
    77
     (ActiveHelpView for:'hello world\this is an ActiveHelpView' withCRs) 
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
    78
        shapeStyle:#cartoon; realize
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    79
    "
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
    80
314
a239541adbc9 use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 285
diff changeset
    81
    "Modified: 5.7.1996 / 17:59:23 / cg"
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    82
!
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    83
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    84
with:aView
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
    85
    "create a talking-view wrapping some other view"
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
    86
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    87
    ^ self new withView:aView
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    88
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    89
    "
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    90
     (ActiveHelpView with:(TextView new)) realize
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    91
     (ActiveHelpView with:(TextView new)) open
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    92
     (ActiveHelpView with:(Button label:'ok')) open
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    93
    "
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
    94
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
    95
    "Modified: 27.4.1996 / 15:14:18 / cg"
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    96
! !
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    97
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    98
!ActiveHelpView methodsFor:'accessing'!
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    99
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   100
contents:someText
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   101
    "set the text"
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   102
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   103
    (myView isKindOf:Label) ifTrue:[
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   104
        myView label:someText asString.
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   105
        myView extent:(myView preferredExtent).
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   106
    ] ifFalse:[
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   107
        myView contents:someText.
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   108
    ].
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   109
    self resizeToFit
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   110
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   111
    "Modified: 27.4.1996 / 15:14:56 / cg"
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   112
!
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   113
285
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   114
shapeStyle:aStyleSymbol
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   115
    "set the shapeStyle
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   116
     currently, only nil or #cartoon are supported"
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   117
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   118
    shapeStyle := aStyleSymbol.
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   119
    self resizeToFit.
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   120
    self computeShape.
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   121
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   122
    "Created: 29.5.1996 / 15:39:41 / cg"
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   123
    "Modified: 29.5.1996 / 15:43:54 / cg"
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   124
!
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   125
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   126
withView:aView
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   127
    "set the component view"
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   128
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   129
    (aView isKindOf:Label) ifTrue:[
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   130
        aView viewBackground:viewBackground.
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   131
        aView backgroundColor:viewBackground.
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   132
    ].
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   133
    self addSubView:aView.
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   134
    myView := aView.
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   135
    myView borderWidth:0
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   136
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   137
    "Modified: 27.4.1996 / 15:16:46 / cg"
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   138
! !
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   139
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   140
!ActiveHelpView methodsFor:'initialization'!
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   141
92
claus
parents: 60
diff changeset
   142
initStyle
285
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   143
    <resource: #style (#activeHelpBackgroundColor
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   144
                       #activeHelpBorderWidth
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   145
                       #activeHelpStyle)>
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   146
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   147
    |bg|
236
89a3cda02cbb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 233
diff changeset
   148
92
claus
parents: 60
diff changeset
   149
    super initStyle.
claus
parents: 60
diff changeset
   150
285
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   151
    shapeStyle := styleSheet at:'activeHelpStyle' default:nil.
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   152
    bg := styleSheet colorAt:'activeHelpBackgroundColor' default:nil.
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   153
    bg notNil ifTrue:[
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   154
        viewBackground := bg
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   155
    ] ifFalse:[
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   156
        shapeStyle == #cartoon ifTrue:[
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   157
            viewBackground := White
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   158
        ]
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   159
    ].
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   160
92
claus
parents: 60
diff changeset
   161
    borderWidth := styleSheet at:'activeHelpBorderWidth' default:1.
236
89a3cda02cbb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 233
diff changeset
   162
285
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   163
    "Modified: 29.5.1996 / 15:48:49 / cg"
92
claus
parents: 60
diff changeset
   164
!
claus
parents: 60
diff changeset
   165
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   166
initialize
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   167
    super initialize.
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   168
    font := Font family:'helvetica' size:12.
285
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   169
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   170
    "Modified: 29.5.1996 / 15:37:40 / cg"
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   171
!
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   172
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   173
realize
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   174
    self create.
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   175
    self computeShape.
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   176
    self enableMotionEvents.
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   177
    self enableButtonMotionEvents.
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   178
    super realize
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   179
! !
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   180
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   181
!ActiveHelpView methodsFor:'private'!
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   182
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   183
computeShape
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   184
    "compute the shape, based upon the size of my component view"
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   185
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   186
    |extent shapeForm borderForm y1 bw h w mirrorH mirrorV
285
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   187
     p1 p2 p3 pB1 pB2 pB3 offs hEll|
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   188
285
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   189
    shapeStyle ~~ #cartoon ifTrue:[^ self].
92
claus
parents: 60
diff changeset
   190
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   191
    extent := self extent.
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   192
    h := extent y.
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   193
    w := extent x.
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   194
    bw := 4.
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   195
    offs := 0.
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   196
314
a239541adbc9 use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 285
diff changeset
   197
    self corner x > device width ifTrue:[
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   198
        mirrorH := true.
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   199
        self origin:((self origin x - w) @ (self origin y)).
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   200
        offs := bw * 2.
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   201
    ] ifFalse:[
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   202
        mirrorH := false
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   203
    ].
314
a239541adbc9 use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 285
diff changeset
   204
    self corner y > device height ifTrue:[
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   205
        mirrorV := true.
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   206
        self origin:(self origin x @ (self origin y - h)).
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   207
    ] ifFalse:[
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   208
        mirrorV := false
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   209
    ].
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   210
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   211
    borderForm := Form width:w height:h.
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   212
    shapeForm := Form width:w height:h.
237
79c3071addae checkin from browser
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   213
    borderForm fill:(Color noColor).
79c3071addae checkin from browser
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   214
    shapeForm fill:(Color noColor).
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   215
285
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   216
    hEll := (h // 3 * 2).
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   217
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   218
    mirrorV ifTrue:[
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   219
        y1 := 0.
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   220
    ] ifFalse:[
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   221
        y1 := h // 4.
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   222
    ].
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   223
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   224
    borderForm fillArcX:0 
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   225
                      y:y1 
241
30383e124f8c fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   226
                  width:w
285
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   227
                 height:hEll
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   228
                   from:0
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   229
                  angle:360.
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   230
285
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   231
    myView origin:(width - myView width // 2) @ (y1 + ((hEll - myView height) // 2)).
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   232
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   233
    mirrorH ifTrue:[
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   234
        mirrorV ifTrue:[
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   235
            p1 := w @ h. 
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   236
            p2 := ((w * 7 // 8) @ (h // 2)).
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   237
            p3 := ((w // 2) @ (h // 2)).
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   238
            pB1 := (w-bw) @ (h-bw). 
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   239
            pB2 := ((w * 7 // 8 - bw) @ (h // 2 - bw)).
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   240
            pB3 := ((w // 2 + bw) @ (h // 2 - bw))
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   241
        ] ifFalse:[
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   242
            p1 := w @ 0. 
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   243
            p2 := ((w * 7 // 8) @ (h // 2)).
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   244
            p3 := ((w // 2) @ (h // 2)).
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   245
            pB1 := (w-bw) @ bw. 
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   246
            pB2 := ((w * 7 // 8 - bw) @ (h // 2 + bw)).
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   247
            pB3 := ((w // 2 + bw) @ (h // 2 + bw))
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   248
        ]
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   249
    ] ifFalse:[
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   250
        mirrorV ifTrue:[
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   251
            p1 := 0@h. 
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   252
            p2 := ((w // 8) @ (h // 2)). 
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   253
            p3 := ((w // 2) @ (h // 2)).
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   254
            pB1 := bw@(h-bw). 
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   255
            pB2 := ((w // 8 + bw) @ (h // 2 - bw)). 
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   256
            pB3 := ((w // 2 - bw) @ (h // 2 - bw)).
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   257
        ] ifFalse:[
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   258
            p1 := 0@0. 
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   259
            p2 := ((w // 8) @ (h // 2)). 
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   260
            p3 := ((w // 2) @ (h // 2)).
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   261
            pB1 := bw@bw. 
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   262
            pB2 := ((w // 8 + bw) @ (h // 2 + bw)). 
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   263
            pB3 := ((w // 2 - bw) @ (h // 2 + bw)).
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   264
        ]
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   265
    ].
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   266
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   267
    borderForm fillPolygon:(Array with:p1 with:p2 with:p3).
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   268
    shapeForm fillPolygon:(Array with:pB1 with:pB2 with:pB3).
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   269
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   270
    shapeForm lineWidth:bw.
237
79c3071addae checkin from browser
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   271
    shapeForm paint:(Color noColor).
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   272
    shapeForm displayPolygon:(Array with:p3 with:p1 with:p2).
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   273
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   274
    shapeForm paint:(Color colorId:1).
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   275
    shapeForm fillArcX:bw 
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   276
                     y:y1 + bw 
241
30383e124f8c fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   277
                 width:(w - (bw * 2))
30383e124f8c fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   278
                height:(h // 3 * 2 - (bw * 2))
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   279
                  from:0
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   280
                 angle:360.
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   281
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   282
    self borderShape:borderForm.
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   283
    self viewShape:shapeForm
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   284
314
a239541adbc9 use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 285
diff changeset
   285
    "Modified: 5.7.1996 / 17:59:05 / cg"
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   286
!
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   287
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   288
resizeToFit
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   289
    "resize myself to make the component view fit"
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   290
285
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   291
    |h w pref|
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   292
285
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   293
    pref := myView preferredExtent.
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   294
    shapeStyle == #cartoon ifTrue:[
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   295
        h := pref y. 
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   296
        w := pref x. 
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   297
        self extent:((w / 0.85) rounded asInteger)
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   298
                     @ 
285
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   299
                    ((h * 4) rounded asInteger)
92
claus
parents: 60
diff changeset
   300
    ] ifFalse:[
285
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   301
        self extent:pref
92
claus
parents: 60
diff changeset
   302
    ]
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   303
285
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   304
    "Modified: 29.5.1996 / 15:54:23 / cg"
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   305
! !
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   306
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   307
!ActiveHelpView methodsFor:'queries'!
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   308
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   309
isPopUpView
261
6d7941a96ad0 commentary
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   310
    "return true - I am a popUp type of view (no decoration, pop-to-top)"
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   311
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   312
    ^ true
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   313
261
6d7941a96ad0 commentary
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   314
    "Modified: 12.5.1996 / 21:58:12 / cg"
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   315
! !
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   316
314
a239541adbc9 use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 285
diff changeset
   317
!ActiveHelpView  class methodsFor:'documentation'!
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   318
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   319
version
314
a239541adbc9 use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 285
diff changeset
   320
    ^ '$Header: /cvs/stx/stx/libview2/ActiveHelpView.st,v 1.15 1996-07-05 16:10:36 cg Exp $'
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   321
! !