ActiveHelpView.st
author Claus Gittinger <cg@exept.de>
Thu, 27 May 1999 14:23:04 +0200
changeset 1179 a906c91087be
parent 725 3a52a52576cb
child 1182 629ae33e4df7
permissions -rw-r--r--
hasShape -> supportsArbitraryShapedViews
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
380
c553cc1bbfa7 commentary
Claus Gittinger <cg@exept.de>
parents: 314
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
"
635
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
    42
    a bubbleHelp 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).
635
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
    51
    Therefore, the default style is a rectangular popupView.
216
a5f97668e99a commentary
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
    52
221
ea942fe5dc04 documentation
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
    53
    [author:]
ea942fe5dc04 documentation
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
    54
        Claus Gittinger
ea942fe5dc04 documentation
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
    55
216
a5f97668e99a commentary
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
    56
    [See also:]
a5f97668e99a commentary
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
    57
        ActiveHelp
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    58
"
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    59
! !
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    60
380
c553cc1bbfa7 commentary
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
    61
!ActiveHelpView class methodsFor:'instance creation'!
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    62
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    63
for:someText
635
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
    64
    "create a bubble-view for some text"
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
    65
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    66
    |helpView textView|
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    67
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    68
    helpView := self new.
285
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
    69
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
    70
    textView := Label new.
314
a239541adbc9 use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 285
diff changeset
    71
    textView font:(helpView font on:textView graphicsDevice).
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    72
    ^ (helpView withView:textView) contents:someText
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    73
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    74
    "
635
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
    75
     |v|
285
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
    76
635
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
    77
     v := (ActiveHelpView for:'hello world\this is an ActiveHelpView' withCRs) shapeStyle:nil.
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
    78
     v realize.
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
    79
     Delay waitForSeconds:2.
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
    80
     v destroy
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    81
    "
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
    82
635
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
    83
    "
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
    84
     |v|
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
    85
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
    86
     v := (ActiveHelpView for:'hello world\this is an ActiveHelpView' withCRs) shapeStyle:#cartoon.
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
    87
     v realize.
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
    88
     Delay waitForSeconds:2.
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
    89
     v destroy
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
    90
    "
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
    91
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
    92
    "Modified: 28.6.1997 / 14:24:23 / cg"
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    93
!
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    94
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    95
with:aView
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
    96
    "create a talking-view wrapping some other view"
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
    97
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    98
    ^ self new withView:aView
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    99
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   100
    "
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   101
     (ActiveHelpView with:(TextView new)) realize
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   102
     (ActiveHelpView with:(TextView new)) open
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   103
     (ActiveHelpView with:(Button label:'ok')) open
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   104
    "
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   105
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   106
    "Modified: 27.4.1996 / 15:14:18 / cg"
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   107
! !
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   108
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   109
!ActiveHelpView methodsFor:'accessing'!
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   110
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   111
contents:someText
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   112
    "set the text"
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   113
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   114
    (myView isKindOf:Label) ifTrue:[
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   115
        myView label:someText asString.
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   116
        myView extent:(myView preferredExtent).
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   117
    ] ifFalse:[
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   118
        myView contents:someText.
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   119
    ].
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   120
    self resizeToFit
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   121
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   122
    "Modified: 27.4.1996 / 15:14:56 / cg"
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   123
!
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   124
285
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   125
shapeStyle:aStyleSymbol
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   126
    "set the shapeStyle
635
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   127
     currently, only nil, #cartoon or #cartoon2 are supported"
285
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   128
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   129
    shapeStyle := aStyleSymbol.
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   130
    self resizeToFit.
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   131
    self computeShape.
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   132
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   133
    "Created: 29.5.1996 / 15:39:41 / cg"
635
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   134
    "Modified: 28.6.1997 / 14:15:22 / cg"
285
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   135
!
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   136
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   137
withView:aView
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   138
    "set the component view"
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   139
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   140
    (aView isKindOf:Label) ifTrue:[
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   141
        aView viewBackground:viewBackground.
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   142
        aView backgroundColor:viewBackground.
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   143
    ].
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   144
    self addSubView:aView.
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   145
    myView := aView.
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   146
    myView borderWidth:0
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   147
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   148
    "Modified: 27.4.1996 / 15:16:46 / cg"
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   149
! !
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   150
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   151
!ActiveHelpView methodsFor:'initialization'!
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   152
92
claus
parents: 60
diff changeset
   153
initStyle
380
c553cc1bbfa7 commentary
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   154
    "setup viewStyle specifics"
c553cc1bbfa7 commentary
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   155
725
3a52a52576cb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
   156
    <resource: #style (#'activeHelp.backgroundColor'
3a52a52576cb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
   157
                       #'activeHelp.borderWidth'
3a52a52576cb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
   158
                       #'activeHelp.style')>
285
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
    |bg|
236
89a3cda02cbb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 233
diff changeset
   161
92
claus
parents: 60
diff changeset
   162
    super initStyle.
claus
parents: 60
diff changeset
   163
725
3a52a52576cb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
   164
    shapeStyle := styleSheet at:'activeHelp.style' default:nil.
3a52a52576cb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
   165
    bg := styleSheet colorAt:'activeHelp.backgroundColor' default:nil.
285
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   166
    bg notNil ifTrue:[
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   167
        viewBackground := bg
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   168
    ] ifFalse:[
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   169
        shapeStyle == #cartoon ifTrue:[
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   170
            viewBackground := White
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   171
        ]
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   172
    ].
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   173
725
3a52a52576cb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
   174
    borderWidth := styleSheet at:'activeHelp.borderWidth' default:1.
236
89a3cda02cbb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 233
diff changeset
   175
725
3a52a52576cb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
   176
    "Modified: / 26.10.1997 / 17:02:09 / cg"
92
claus
parents: 60
diff changeset
   177
!
claus
parents: 60
diff changeset
   178
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   179
initialize
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   180
    super initialize.
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   181
    font := Font family:'helvetica' size:12.
285
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   182
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   183
    "Modified: 29.5.1996 / 15:37:40 / cg"
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   184
!
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   185
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   186
realize
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   187
    self create.
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   188
    self computeShape.
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   189
    self enableMotionEvents.
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   190
    self enableButtonMotionEvents.
688
b95c0e8c9573 Call open instead of realize to assign a window group.
ca
parents: 635
diff changeset
   191
    super open
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   192
! !
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   193
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   194
!ActiveHelpView methodsFor:'private'!
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   195
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   196
computeShape
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   197
    "compute the shape, based upon the size of my component view"
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   198
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   199
    |extent shapeForm borderForm y1 bw h w mirrorH mirrorV
285
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   200
     p1 p2 p3 pB1 pB2 pB3 offs hEll|
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   201
1179
a906c91087be hasShape -> supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 725
diff changeset
   202
    Display supportsArbitraryShapedViews ifTrue:[
635
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   203
        (shapeStyle == #cartoon) ifTrue:[
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   204
            extent := self extent.
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   205
            h := extent y.
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   206
            w := extent x.
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   207
            bw := 4.
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   208
            offs := 0.
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   209
635
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   210
            self corner x > device width ifTrue:[
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   211
                mirrorH := true.
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   212
                self origin:((self origin x - w) @ (self origin y)).
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   213
                offs := bw * 2.
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   214
            ] ifFalse:[
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   215
                mirrorH := false
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   216
            ].
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   217
            self corner y > device height ifTrue:[
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   218
                mirrorV := true.
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   219
                self origin:(self origin x @ (self origin y - h)).
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   220
            ] ifFalse:[
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   221
                mirrorV := false
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   222
            ].
285
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   223
635
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   224
            borderForm := Form width:w height:h.
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   225
            shapeForm := Form width:w height:h.
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   226
            borderForm fill:(Color noColor).
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   227
            shapeForm fill:(Color noColor).
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   228
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   229
            hEll := (h // 3 * 2).
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   230
635
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   231
            mirrorV ifTrue:[
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   232
                y1 := 0.
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   233
            ] ifFalse:[
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   234
                y1 := h // 4.
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   235
            ].
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   236
635
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   237
            borderForm fillArcX:0 y:y1 
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   238
                          width:w height:hEll
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   239
                           from:0 angle:360.
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   240
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   241
            myView origin:(width - myView width // 2) @ (y1 + ((hEll - myView height) // 2)).
285
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   242
635
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   243
            mirrorH ifTrue:[
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   244
                mirrorV ifTrue:[
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   245
                    p1 := w @ h. 
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   246
                    p2 := ((w * 7 // 8) @ (h // 2)).
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   247
                    p3 := ((w // 2) @ (h // 2)).
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   248
                    pB1 := (w-bw) @ (h-bw). 
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   249
                    pB2 := ((w * 7 // 8 - bw) @ (h // 2 - bw)).
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   250
                    pB3 := ((w // 2 + bw) @ (h // 2 - bw))
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   251
                ] ifFalse:[
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   252
                    p1 := w @ 0. 
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   253
                    p2 := ((w * 7 // 8) @ (h // 2)).
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   254
                    p3 := ((w // 2) @ (h // 2)).
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   255
                    pB1 := (w-bw) @ bw. 
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   256
                    pB2 := ((w * 7 // 8 - bw) @ (h // 2 + bw)).
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   257
                    pB3 := ((w // 2 + bw) @ (h // 2 + bw))
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   258
                ]
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   259
            ] ifFalse:[
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   260
                mirrorV ifTrue:[
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   261
                    p1 := 0@h. 
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   262
                    p2 := ((w // 8) @ (h // 2)). 
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   263
                    p3 := ((w // 2) @ (h // 2)).
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   264
                    pB1 := bw@(h-bw). 
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   265
                    pB2 := ((w // 8 + bw) @ (h // 2 - bw)). 
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   266
                    pB3 := ((w // 2 - bw) @ (h // 2 - bw)).
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   267
                ] ifFalse:[
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   268
                    p1 := 0@0. 
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   269
                    p2 := ((w // 8) @ (h // 2)). 
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   270
                    p3 := ((w // 2) @ (h // 2)).
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   271
                    pB1 := bw@bw. 
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   272
                    pB2 := ((w // 8 + bw) @ (h // 2 + bw)). 
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   273
                    pB3 := ((w // 2 - bw) @ (h // 2 + bw)).
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   274
                ]
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   275
            ].
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   276
635
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   277
            borderForm fillPolygon:(Array with:p1 with:p2 with:p3).
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   278
            shapeForm fillPolygon:(Array with:pB1 with:pB2 with:pB3).
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   279
635
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   280
            shapeForm lineWidth:bw.
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   281
            shapeForm paint:(Color noColor).
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   282
            shapeForm displayPolygon:(Array with:p3 with:p1 with:p2).
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   283
635
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   284
            shapeForm paint:(Color colorId:1).
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   285
            shapeForm fillArcX:bw y:y1 + bw 
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   286
                         width:(w - (bw * 2)) height:(h // 3 * 2 - (bw * 2))
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   287
                          from:0 angle:360.
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   288
        ].
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   289
        borderForm notNil ifTrue:[
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   290
            self borderShape:borderForm.
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   291
            self viewShape:shapeForm
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   292
        ].
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   293
    ]
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   294
635
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   295
    "Modified: 28.6.1997 / 14:23:39 / cg"
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   296
!
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   297
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   298
resizeToFit
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   299
    "resize myself to make the component view fit"
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   300
285
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   301
    |h w pref|
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   302
285
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   303
    pref := myView preferredExtent.
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   304
    shapeStyle == #cartoon ifTrue:[
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   305
        h := pref y. 
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   306
        w := pref x. 
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   307
        self extent:((w / 0.85) rounded asInteger)
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   308
                     @ 
285
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   309
                    ((h * 4) rounded asInteger)
92
claus
parents: 60
diff changeset
   310
    ] ifFalse:[
285
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   311
        self extent:pref
92
claus
parents: 60
diff changeset
   312
    ]
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   313
635
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   314
    "Modified: 28.6.1997 / 14:23:49 / cg"
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   315
! !
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   316
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   317
!ActiveHelpView methodsFor:'queries'!
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   318
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   319
isPopUpView
261
6d7941a96ad0 commentary
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   320
    "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
   321
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   322
    ^ true
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   323
261
6d7941a96ad0 commentary
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   324
    "Modified: 12.5.1996 / 21:58:12 / cg"
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   325
! !
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   326
380
c553cc1bbfa7 commentary
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   327
!ActiveHelpView class methodsFor:'documentation'!
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   328
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   329
version
1179
a906c91087be hasShape -> supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 725
diff changeset
   330
    ^ '$Header: /cvs/stx/stx/libview2/ActiveHelpView.st,v 1.20 1999-05-27 12:23:04 cg Exp $'
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   331
! !