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