ActiveHelpView.st
author alkurz
Tue, 02 Jul 2019 14:10:25 +0200
changeset 4287 9e5dc8a88380
parent 4137 1de7f929d6b5
child 4458 508be27574c1
permissions -rw-r--r--
#FEATURE by alkurz class: ApplicationModel openDialogInterface:withBindings: accepts an already decoded spec as argument
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4115
1afedd824b71 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 4081
diff changeset
     1
"{ Encoding: utf8 }"
1afedd824b71 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 4081
diff changeset
     2
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
     3
"
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
     4
 COPYRIGHT (c) 1995 by Claus Gittinger
3318
20b0c3ec22d7 class: ActiveHelpView
Claus Gittinger <cg@exept.de>
parents: 3316
diff changeset
     5
              All Rights Reserved
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
     6
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
     7
 This software is furnished under a license and may be used
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
     8
 only in accordance with the terms of that license and with the
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
     9
 inclusion of the above copyright notice.   This software may not
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    10
 be provided or otherwise made available to, or used by, any
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    11
 other person.  No title to or ownership of the software is
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    12
 hereby transferred.
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    13
"
1485
54e215f2e816 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1261
diff changeset
    14
"{ Package: 'stx:libview2' }"
54e215f2e816 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1261
diff changeset
    15
3502
e5b5db8356f7 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 3396
diff changeset
    16
"{ NameSpace: Smalltalk }"
e5b5db8356f7 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 3396
diff changeset
    17
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    18
View subclass:#ActiveHelpView
3360
4d06d7ba9cb6 class: ActiveHelpView
Claus Gittinger <cg@exept.de>
parents: 3318
diff changeset
    19
	instanceVariableNames:'myView shapeStyle controllingHelpListener'
4d06d7ba9cb6 class: ActiveHelpView
Claus Gittinger <cg@exept.de>
parents: 3318
diff changeset
    20
	classVariableNames:''
4d06d7ba9cb6 class: ActiveHelpView
Claus Gittinger <cg@exept.de>
parents: 3318
diff changeset
    21
	poolDictionaries:''
4d06d7ba9cb6 class: ActiveHelpView
Claus Gittinger <cg@exept.de>
parents: 3318
diff changeset
    22
	category:'Interface-Help'
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    23
!
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    24
380
c553cc1bbfa7 commentary
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
    25
!ActiveHelpView class methodsFor:'documentation'!
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    26
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    27
copyright
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    28
"
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    29
 COPYRIGHT (c) 1995 by Claus Gittinger
3318
20b0c3ec22d7 class: ActiveHelpView
Claus Gittinger <cg@exept.de>
parents: 3316
diff changeset
    30
              All Rights Reserved
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    31
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    32
 This software is furnished under a license and may be used
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    33
 only in accordance with the terms of that license and with the
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    34
 inclusion of the above copyright notice.   This software may not
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    35
 be provided or otherwise made available to, or used by, any
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    36
 other person.  No title to or ownership of the software is
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    37
 hereby transferred.
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    38
"
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    39
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    40
138
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
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    43
documentation
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    44
"
635
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
    45
    a bubbleHelp view.
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
    46
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    47
    Instances of myself show up either as a comics-like talking
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    48
    view, or as a simple square popup. This is configured via the
4128
ece71c589eff #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4115
diff changeset
    49
    styleSheet. The default is simple-square.
ece71c589eff #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4115
diff changeset
    50
    
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
    51
    To get the fancy comics style, add a resource 'activeHelpStyle' with 
4128
ece71c589eff #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4115
diff changeset
    52
    a symbol-value of #cartoon to the stylesheet, or set the overwrite
ece71c589eff #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4115
diff changeset
    53
    in the userPrefs with:
ece71c589eff #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4115
diff changeset
    54
        UserPreferences current toolTipShapeStyle:#cartoon.
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    55
    However, be aware that some servers have performance problems with
4128
ece71c589eff #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4115
diff changeset
    56
    these view-shapes (or do not support shapes at all, like XQuartz on OSX).
635
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
    57
    Therefore, the default style is a rectangular popupView.
4128
ece71c589eff #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4115
diff changeset
    58
    If the prefs were changed, you can return back to the stylesheet's default with:
ece71c589eff #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4115
diff changeset
    59
        UserPreferences current toolTipShapeStyle:nil.
216
a5f97668e99a commentary
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
    60
221
ea942fe5dc04 documentation
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
    61
    [author:]
ea942fe5dc04 documentation
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
    62
        Claus Gittinger
ea942fe5dc04 documentation
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
    63
216
a5f97668e99a commentary
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
    64
    [See also:]
a5f97668e99a commentary
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
    65
        ActiveHelp
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    66
"
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    67
! !
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    68
380
c553cc1bbfa7 commentary
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
    69
!ActiveHelpView class methodsFor:'instance creation'!
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    70
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    71
for:someText
635
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
    72
    "create a bubble-view for some text"
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
    73
1676
cba066422dd1 added #for:onDevice:
Claus Gittinger <cg@exept.de>
parents: 1583
diff changeset
    74
    ^ self for:someText onDevice:Screen current.
cba066422dd1 added #for:onDevice:
Claus Gittinger <cg@exept.de>
parents: 1583
diff changeset
    75
cba066422dd1 added #for:onDevice:
Claus Gittinger <cg@exept.de>
parents: 1583
diff changeset
    76
    "
cba066422dd1 added #for:onDevice:
Claus Gittinger <cg@exept.de>
parents: 1583
diff changeset
    77
     |v|
cba066422dd1 added #for:onDevice:
Claus Gittinger <cg@exept.de>
parents: 1583
diff changeset
    78
cba066422dd1 added #for:onDevice:
Claus Gittinger <cg@exept.de>
parents: 1583
diff changeset
    79
     v := (ActiveHelpView for:'hello world\this is an ActiveHelpView' withCRs) shapeStyle:nil.
cba066422dd1 added #for:onDevice:
Claus Gittinger <cg@exept.de>
parents: 1583
diff changeset
    80
     v realize.
cba066422dd1 added #for:onDevice:
Claus Gittinger <cg@exept.de>
parents: 1583
diff changeset
    81
     Delay waitForSeconds:2.
cba066422dd1 added #for:onDevice:
Claus Gittinger <cg@exept.de>
parents: 1583
diff changeset
    82
     v destroy
cba066422dd1 added #for:onDevice:
Claus Gittinger <cg@exept.de>
parents: 1583
diff changeset
    83
    "
cba066422dd1 added #for:onDevice:
Claus Gittinger <cg@exept.de>
parents: 1583
diff changeset
    84
cba066422dd1 added #for:onDevice:
Claus Gittinger <cg@exept.de>
parents: 1583
diff changeset
    85
    "
cba066422dd1 added #for:onDevice:
Claus Gittinger <cg@exept.de>
parents: 1583
diff changeset
    86
     |v|
cba066422dd1 added #for:onDevice:
Claus Gittinger <cg@exept.de>
parents: 1583
diff changeset
    87
cba066422dd1 added #for:onDevice:
Claus Gittinger <cg@exept.de>
parents: 1583
diff changeset
    88
     v := (ActiveHelpView for:'hello world\this is an ActiveHelpView' withCRs) shapeStyle:#cartoon.
cba066422dd1 added #for:onDevice:
Claus Gittinger <cg@exept.de>
parents: 1583
diff changeset
    89
     v realize.
cba066422dd1 added #for:onDevice:
Claus Gittinger <cg@exept.de>
parents: 1583
diff changeset
    90
     Delay waitForSeconds:2.
cba066422dd1 added #for:onDevice:
Claus Gittinger <cg@exept.de>
parents: 1583
diff changeset
    91
     v destroy
cba066422dd1 added #for:onDevice:
Claus Gittinger <cg@exept.de>
parents: 1583
diff changeset
    92
    "
cba066422dd1 added #for:onDevice:
Claus Gittinger <cg@exept.de>
parents: 1583
diff changeset
    93
cba066422dd1 added #for:onDevice:
Claus Gittinger <cg@exept.de>
parents: 1583
diff changeset
    94
    "Modified: 28.6.1997 / 14:24:23 / cg"
cba066422dd1 added #for:onDevice:
Claus Gittinger <cg@exept.de>
parents: 1583
diff changeset
    95
!
cba066422dd1 added #for:onDevice:
Claus Gittinger <cg@exept.de>
parents: 1583
diff changeset
    96
cba066422dd1 added #for:onDevice:
Claus Gittinger <cg@exept.de>
parents: 1583
diff changeset
    97
for:someText onDevice:aDevice
cba066422dd1 added #for:onDevice:
Claus Gittinger <cg@exept.de>
parents: 1583
diff changeset
    98
    "create a bubble-view for some text"
cba066422dd1 added #for:onDevice:
Claus Gittinger <cg@exept.de>
parents: 1583
diff changeset
    99
3654
ef4d3adadd1e #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
   100
    |helpView textView textShown|
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   101
1714
85cd314f0916 Fix ActiveHelp for foreign displays
Stefan Vogel <sv@exept.de>
parents: 1676
diff changeset
   102
    helpView := self onDevice:aDevice.
3768
d9739e1f43f5 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 3728
diff changeset
   103
    someText isString ifFalse:[
d9739e1f43f5 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 3728
diff changeset
   104
        textView := Label onDevice:aDevice.
d9739e1f43f5 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 3728
diff changeset
   105
        textView logo:someText. 
d9739e1f43f5 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 3728
diff changeset
   106
        ^ (helpView withView:textView)
d9739e1f43f5 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 3728
diff changeset
   107
    ].
d9739e1f43f5 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 3728
diff changeset
   108
    
4137
1de7f929d6b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4128
diff changeset
   109
    ((someText startsWith:'<html>' caseSensitive:false) 
1de7f929d6b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4128
diff changeset
   110
      or:[ (someText startsWith:'<body>' caseSensitive:false)
1de7f929d6b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4128
diff changeset
   111
      or:[ (someText startsWith:'<!!doctype html ' caseSensitive:false)
1de7f929d6b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4128
diff changeset
   112
    ]]) ifTrue:[
3313
05f5ca07ddbf class: ActiveHelpView
Claus Gittinger <cg@exept.de>
parents: 3288
diff changeset
   113
        textView := HTMLView onDevice:aDevice.
05f5ca07ddbf class: ActiveHelpView
Claus Gittinger <cg@exept.de>
parents: 3288
diff changeset
   114
        textView level:0.
3318
20b0c3ec22d7 class: ActiveHelpView
Claus Gittinger <cg@exept.de>
parents: 3316
diff changeset
   115
        textView extent:(600@400).
3313
05f5ca07ddbf class: ActiveHelpView
Claus Gittinger <cg@exept.de>
parents: 3288
diff changeset
   116
        textView contents:someText.
05f5ca07ddbf class: ActiveHelpView
Claus Gittinger <cg@exept.de>
parents: 3288
diff changeset
   117
        textView preferredExtent:(textView extentOfContents + 20 min:(Display extent * 2 // 3)).
3318
20b0c3ec22d7 class: ActiveHelpView
Claus Gittinger <cg@exept.de>
parents: 3316
diff changeset
   118
        textView extent:(textView extentOfContents + 20 min:(Display extent * 2 // 3)).
20b0c3ec22d7 class: ActiveHelpView
Claus Gittinger <cg@exept.de>
parents: 3316
diff changeset
   119
        textView contents:someText.
3313
05f5ca07ddbf class: ActiveHelpView
Claus Gittinger <cg@exept.de>
parents: 3288
diff changeset
   120
        ^ helpView withView:textView 
05f5ca07ddbf class: ActiveHelpView
Claus Gittinger <cg@exept.de>
parents: 3288
diff changeset
   121
    ].
3655
1398556ec619 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3654
diff changeset
   122
    
1398556ec619 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3654
diff changeset
   123
    textShown := someText.
1398556ec619 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3654
diff changeset
   124
    (textShown isString) ifTrue:[
1398556ec619 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3654
diff changeset
   125
        textShown := textShown withoutTrailingSeparators.
1398556ec619 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3654
diff changeset
   126
    ].    
1398556ec619 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3654
diff changeset
   127
    textView := Label onDevice:aDevice.
3728
6b88a699ecf3 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 3655
diff changeset
   128
    textView font:(helpView deviceFont). 
3655
1398556ec619 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3654
diff changeset
   129
    ^ (helpView withView:textView) contents:textShown
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   130
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   131
    "
635
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   132
     |v|
285
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   133
635
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   134
     v := (ActiveHelpView for:'hello world\this is an ActiveHelpView' withCRs) shapeStyle:nil.
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   135
     v realize.
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   136
     Delay waitForSeconds:2.
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   137
     v destroy
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   138
    "
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   139
635
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   140
    "
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   141
     |v|
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   142
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   143
     v := (ActiveHelpView for:'hello world\this is an ActiveHelpView' withCRs) shapeStyle:#cartoon.
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   144
     v realize.
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   145
     Delay waitForSeconds:2.
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   146
     v destroy
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   147
    "
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   148
3939
a64b6880178b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3768
diff changeset
   149
    "Modified: / 06-03-2017 / 18:56:24 / cg"
4137
1de7f929d6b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4128
diff changeset
   150
    "Modified: / 29-06-2018 / 11:47:11 / Claus Gittinger"
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   151
!
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   152
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   153
with:aView
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   154
    "create a talking-view wrapping some other view"
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   155
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   156
    ^ self new withView:aView
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   157
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   158
    "
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   159
     (ActiveHelpView with:(TextView new)) realize
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   160
     (ActiveHelpView with:(TextView new)) open
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   161
     (ActiveHelpView with:(Button label:'ok')) open
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   162
    "
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   163
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   164
    "Modified: 27.4.1996 / 15:14:18 / cg"
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   165
! !
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   166
4115
1afedd824b71 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 4081
diff changeset
   167
!ActiveHelpView class methodsFor:'updateStyleCache'!
1afedd824b71 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 4081
diff changeset
   168
1afedd824b71 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 4081
diff changeset
   169
updateStyleCache
4128
ece71c589eff #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4115
diff changeset
   170
    <resource: #style (#'activeHelp.font')>
ece71c589eff #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4115
diff changeset
   171
4115
1afedd824b71 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 4081
diff changeset
   172
    super updateStyleCache.
1afedd824b71 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 4081
diff changeset
   173
    DefaultFont := StyleSheet fontAt:#'activeHelp.font' default:nil.
1afedd824b71 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 4081
diff changeset
   174
1afedd824b71 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 4081
diff changeset
   175
    "Created: / 07-06-2018 / 18:25:51 / Claus Gittinger"
4128
ece71c589eff #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4115
diff changeset
   176
    "Modified: / 14-06-2018 / 08:38:04 / Claus Gittinger"
4115
1afedd824b71 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 4081
diff changeset
   177
! !
1afedd824b71 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 4081
diff changeset
   178
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   179
!ActiveHelpView methodsFor:'accessing'!
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   180
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   181
contents:someText
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   182
    "set the text"
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   183
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   184
    (myView isKindOf:Label) ifTrue:[
3963
9e2d653b39e8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3939
diff changeset
   185
        myView label:someText asString withTabsExpanded.
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   186
        myView extent:(myView preferredExtent).
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   187
    ] ifFalse:[
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   188
        myView contents:someText.
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   189
    ].
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   190
    self resizeToFit
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   191
3963
9e2d653b39e8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3939
diff changeset
   192
    "Modified: / 13-07-2017 / 14:51:59 / cg"
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   193
!
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   194
3250
276f1af4583b handle key press and close help.
Claus Gittinger <cg@exept.de>
parents: 3249
diff changeset
   195
controllingHelpListener:something
276f1af4583b handle key press and close help.
Claus Gittinger <cg@exept.de>
parents: 3249
diff changeset
   196
    controllingHelpListener := something.
276f1af4583b handle key press and close help.
Claus Gittinger <cg@exept.de>
parents: 3249
diff changeset
   197
!
276f1af4583b handle key press and close help.
Claus Gittinger <cg@exept.de>
parents: 3249
diff changeset
   198
285
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   199
shapeStyle:aStyleSymbol
3218
cf42b08823d2 class: ActiveHelpView
Claus Gittinger <cg@exept.de>
parents: 3118
diff changeset
   200
    "set the shapeStyle.
cf42b08823d2 class: ActiveHelpView
Claus Gittinger <cg@exept.de>
parents: 3118
diff changeset
   201
     Currently, only nil and #cartoon are supported"
285
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   202
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   203
    shapeStyle := aStyleSymbol.
3246
d167d433053c class: ActiveHelpView
Claus Gittinger <cg@exept.de>
parents: 3242
diff changeset
   204
    Screen current supportsArbitraryShapedViews ifFalse:[
d167d433053c class: ActiveHelpView
Claus Gittinger <cg@exept.de>
parents: 3242
diff changeset
   205
        shapeStyle := nil
d167d433053c class: ActiveHelpView
Claus Gittinger <cg@exept.de>
parents: 3242
diff changeset
   206
    ].
285
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   207
    self resizeToFit.
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   208
    self computeShape.
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   209
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   210
    "Created: 29.5.1996 / 15:39:41 / cg"
635
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   211
    "Modified: 28.6.1997 / 14:15:22 / cg"
285
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   212
!
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   213
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   214
withView:aView
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   215
    "set the component view"
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   216
3118
f18d1909c51c class: ActiveHelpView
Claus Gittinger <cg@exept.de>
parents: 2802
diff changeset
   217
    |fg|
f18d1909c51c class: ActiveHelpView
Claus Gittinger <cg@exept.de>
parents: 2802
diff changeset
   218
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   219
    (aView isKindOf:Label) ifTrue:[
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   220
        aView viewBackground:viewBackground.
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   221
        aView backgroundColor:viewBackground.
3118
f18d1909c51c class: ActiveHelpView
Claus Gittinger <cg@exept.de>
parents: 2802
diff changeset
   222
        (fg := styleSheet colorAt:#'activeHelp.foregroundColor' default:nil) notNil ifTrue:[
f18d1909c51c class: ActiveHelpView
Claus Gittinger <cg@exept.de>
parents: 2802
diff changeset
   223
            aView foregroundColor:fg.    
f18d1909c51c class: ActiveHelpView
Claus Gittinger <cg@exept.de>
parents: 2802
diff changeset
   224
        ].
3313
05f5ca07ddbf class: ActiveHelpView
Claus Gittinger <cg@exept.de>
parents: 3288
diff changeset
   225
    ] ifFalse:[
05f5ca07ddbf class: ActiveHelpView
Claus Gittinger <cg@exept.de>
parents: 3288
diff changeset
   226
        (aView isKindOf:HTMLView) ifTrue:[
3393
5940cce2ee2c class: ActiveHelpView
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
   227
            aView scrolledView 
5940cce2ee2c class: ActiveHelpView
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
   228
                viewBackground:viewBackground;
5940cce2ee2c class: ActiveHelpView
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
   229
                backgroundColor:viewBackground.
3313
05f5ca07ddbf class: ActiveHelpView
Claus Gittinger <cg@exept.de>
parents: 3288
diff changeset
   230
            aView style viewBGColor:viewBackground.
3393
5940cce2ee2c class: ActiveHelpView
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
   231
            "/ Transcript showCR:aView scrolledView preferredExtent.
3313
05f5ca07ddbf class: ActiveHelpView
Claus Gittinger <cg@exept.de>
parents: 3288
diff changeset
   232
        ].
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   233
    ].
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   234
    self addSubView:aView.
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   235
    myView := aView.
4115
1afedd824b71 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 4081
diff changeset
   236
    myView borderWidth:0.
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   237
4115
1afedd824b71 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 4081
diff changeset
   238
    "Modified: / 27-04-1996 / 15:16:46 / cg"
1afedd824b71 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 4081
diff changeset
   239
    "Modified: / 07-06-2018 / 18:37:35 / Claus Gittinger"
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   240
! !
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   241
3250
276f1af4583b handle key press and close help.
Claus Gittinger <cg@exept.de>
parents: 3249
diff changeset
   242
!ActiveHelpView methodsFor:'event handling'!
276f1af4583b handle key press and close help.
Claus Gittinger <cg@exept.de>
parents: 3249
diff changeset
   243
276f1af4583b handle key press and close help.
Claus Gittinger <cg@exept.de>
parents: 3249
diff changeset
   244
keyPress:key x:x y:y
276f1af4583b handle key press and close help.
Claus Gittinger <cg@exept.de>
parents: 3249
diff changeset
   245
    controllingHelpListener hideHelp
276f1af4583b handle key press and close help.
Claus Gittinger <cg@exept.de>
parents: 3249
diff changeset
   246
! !
276f1af4583b handle key press and close help.
Claus Gittinger <cg@exept.de>
parents: 3249
diff changeset
   247
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   248
!ActiveHelpView methodsFor:'initialization'!
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   249
92
claus
parents: 60
diff changeset
   250
initStyle
380
c553cc1bbfa7 commentary
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   251
    "setup viewStyle specifics"
c553cc1bbfa7 commentary
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   252
725
3a52a52576cb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
   253
    <resource: #style (#'activeHelp.backgroundColor'
3a52a52576cb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
   254
                       #'activeHelp.borderWidth'
3502
e5b5db8356f7 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 3396
diff changeset
   255
                       #'activeHelp.borderColor'
1537
364eabac0aec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1485
diff changeset
   256
                       #'activeHelp.font'
725
3a52a52576cb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
   257
                       #'activeHelp.style')>
285
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   258
2776
7181bb9659ae comment/format in: #withView:
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
   259
    |bg defaultFont|
236
89a3cda02cbb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 233
diff changeset
   260
92
claus
parents: 60
diff changeset
   261
    super initStyle.
claus
parents: 60
diff changeset
   262
3218
cf42b08823d2 class: ActiveHelpView
Claus Gittinger <cg@exept.de>
parents: 3118
diff changeset
   263
    (shapeStyle := UserPreferences current toolTipShapeStyle) isNil ifTrue:[
cf42b08823d2 class: ActiveHelpView
Claus Gittinger <cg@exept.de>
parents: 3118
diff changeset
   264
        shapeStyle := styleSheet at:#'activeHelp.style' default:nil.
cf42b08823d2 class: ActiveHelpView
Claus Gittinger <cg@exept.de>
parents: 3118
diff changeset
   265
    ].
cf42b08823d2 class: ActiveHelpView
Claus Gittinger <cg@exept.de>
parents: 3118
diff changeset
   266
3360
4d06d7ba9cb6 class: ActiveHelpView
Claus Gittinger <cg@exept.de>
parents: 3318
diff changeset
   267
    defaultFont := self class defaultFont.
4d06d7ba9cb6 class: ActiveHelpView
Claus Gittinger <cg@exept.de>
parents: 3318
diff changeset
   268
    defaultFont isNil ifTrue:[
4d06d7ba9cb6 class: ActiveHelpView
Claus Gittinger <cg@exept.de>
parents: 3318
diff changeset
   269
        defaultFont := styleSheet fontAt:#'activeHelp.font' default:nil.
4d06d7ba9cb6 class: ActiveHelpView
Claus Gittinger <cg@exept.de>
parents: 3318
diff changeset
   270
    ].
2776
7181bb9659ae comment/format in: #withView:
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
   271
    defaultFont notNil ifTrue:[
7181bb9659ae comment/format in: #withView:
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
   272
        self font:defaultFont
1537
364eabac0aec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1485
diff changeset
   273
    ].
364eabac0aec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1485
diff changeset
   274
1583
36d82eed6873 Use #isWindowsStyle instead of comparing to style name.
Stefan Vogel <sv@exept.de>
parents: 1537
diff changeset
   275
    bg := styleSheet colorAt:#'activeHelp.backgroundColor' default:nil.
285
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   276
    bg notNil ifTrue:[
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   277
        viewBackground := bg
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   278
    ] ifFalse:[
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   279
        shapeStyle == #cartoon ifTrue:[
3288
711749d5cfd5 class: ActiveHelpView
Stefan Vogel <sv@exept.de>
parents: 3285
diff changeset
   280
            viewBackground := self whiteColor.
285
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   281
        ]
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   282
    ].
2773
eaec2e45bd8d no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents: 2413
diff changeset
   283
    self borderWidth:(styleSheet at:#'activeHelp.borderWidth' default:1).
3288
711749d5cfd5 class: ActiveHelpView
Stefan Vogel <sv@exept.de>
parents: 3285
diff changeset
   284
    self borderColor:(styleSheet at:#'activeHelp.borderColor' default:self blackColor).
236
89a3cda02cbb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 233
diff changeset
   285
725
3a52a52576cb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
   286
    "Modified: / 26.10.1997 / 17:02:09 / cg"
92
claus
parents: 60
diff changeset
   287
!
claus
parents: 60
diff changeset
   288
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   289
realize
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   290
    self create.
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   291
    self computeShape.
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   292
    self enableMotionEvents.
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   293
    self enableButtonMotionEvents.
1485
54e215f2e816 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1261
diff changeset
   294
    super realize
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   295
! !
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   296
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   297
!ActiveHelpView methodsFor:'private'!
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   298
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   299
computeShape
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   300
    "compute the shape, based upon the size of my component view"
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   301
3224
ce24ea76ae05 class: ActiveHelpView
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
   302
    |extent oldOrigin shapeForm borderForm y1 bw h w mirrorH mirrorV
3316
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   303
     p1 p2 p3 pB1 pB2 pB3 offs hEll h2 w2 w8 w78 mousePosition graphicsDevice|
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   304
4081
8cad82182237 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 3963
diff changeset
   305
    (shapeStyle ~~ #cartoon) ifTrue:[
3316
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   306
        ^ self.
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   307
    ].
3625
cc9005a9b132 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 3502
diff changeset
   308
    graphicsDevice := device.
3316
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   309
    graphicsDevice supportsArbitraryShapedViews ifTrue:[
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   310
        extent := self extent.
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   311
        oldOrigin := self origin.
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   312
        h := extent y.
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   313
        w := extent x.
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   314
        bw := 4.
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   315
        offs := 0.
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   316
        mousePosition := graphicsDevice pointerPosition.
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   317
3316
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   318
        ((mousePosition > (graphicsDevice width * (2/3)))
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   319
        or:[ self corner x > graphicsDevice usableWidth ]) ifTrue:[
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   320
            mirrorH := true.
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   321
            self origin:((oldOrigin x - w) @ (self origin y)).
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   322
            offs := bw * 2.
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   323
        ] ifFalse:[
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   324
            mirrorH := false
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   325
        ].
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   326
        ((mousePosition > (graphicsDevice height * (2/3)))
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   327
        or:[ self corner y > graphicsDevice usableHeight ]) ifTrue:[
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   328
            mirrorV := true.
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   329
            self origin:(oldOrigin x @ (self origin y - h)).
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   330
        ] ifFalse:[
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   331
            mirrorV := false
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   332
        ].
285
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   333
3316
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   334
        borderForm := Form width:w height:h.
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   335
        shapeForm := Form width:w height:h.
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   336
        borderForm fill:(Color noColor).
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   337
        shapeForm fill:(Color noColor).
635
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   338
3316
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   339
        hEll := (h // 3 * 2).
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   340
3316
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   341
        mirrorV ifTrue:[
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   342
            y1 := 0.
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   343
        ] ifFalse:[
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   344
            y1 := h // 4.
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   345
        ].
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   346
3316
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   347
        borderForm fillArcX:0 y:y1 
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   348
                   width:w height:hEll
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   349
                   from:0 angle:360.
635
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   350
3316
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   351
        myView origin:(width - myView width // 2) @ (y1 + ((hEll - myView height) // 2)).
1182
629ae33e4df7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1179
diff changeset
   352
3316
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   353
        h2 := h // 2.
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   354
        w2 := w // 2.
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   355
        w8 := w // 8.
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   356
        w78 := w * 7 // 8.
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   357
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   358
        mirrorH ifTrue:[
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   359
            mirrorV ifTrue:[
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   360
                p1 := w @ h. 
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   361
                p2 := (w78 @ h2).
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   362
                p3 := (w2 @ h2).
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   363
                pB1 := (w-bw) @ (h-bw). 
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   364
                pB2 := ((w78 - bw) @ (h2 - bw)).
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   365
                pB3 := ((w2 + bw) @ (h2 - bw))
635
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   366
            ] ifFalse:[
3316
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   367
                p1 := w @ 0. 
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   368
                p2 := (w78 @ h2).
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   369
                p3 := (w2 @ h2).
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   370
                pB1 := (w-bw) @ bw. 
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   371
                pB2 := ((w78 - bw) @ (h2 + bw)).
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   372
                pB3 := ((w2 + bw) @ (h2 + bw))
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   373
            ]
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   374
        ] ifFalse:[
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   375
            mirrorV ifTrue:[
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   376
                p1 := 0@h. 
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   377
                p2 := (w8 @ h2). 
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   378
                p3 := (w2 @ h2).
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   379
                pB1 := bw@(h-bw). 
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   380
                pB2 := ((w8 + bw) @ (h2 - bw)). 
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   381
                pB3 := ((w2 - bw) @ (h2 - bw)).
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   382
            ] ifFalse:[
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   383
                p1 := 0@0. 
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   384
                p2 := (w8 @ h2). 
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   385
                p3 := (w2 @ h2).
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   386
                pB1 := bw@bw. 
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   387
                pB2 := ((w8 + bw) @ (h2 + bw)). 
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   388
                pB3 := ((w2 - bw) @ (h2 + bw)).
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   389
            ]
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   390
        ].
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   391
3316
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   392
        borderForm fillPolygon:(Array with:p1 with:p2 with:p3).
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   393
        shapeForm fillPolygon:(Array with:pB1 with:pB2 with:pB3).
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   394
3316
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   395
        shapeForm lineWidth:bw.
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   396
        shapeForm paint:(Color noColor).
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   397
        shapeForm displayPolygon:(Array with:p3 with:p1 with:p2).
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   398
3316
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   399
        shapeForm paint:(Color colorId:1).
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   400
        shapeForm fillArcX:bw y:y1 + bw 
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   401
                  width:(w - (bw * 2)) height:(h // 3 * 2 - (bw * 2))
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   402
                  from:0 angle:360.
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   403
    ].
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   404
    borderForm notNil ifTrue:[
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   405
        self borderShape:borderForm.
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   406
        self viewShape:shapeForm
cbfe39899129 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
   407
    ].
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   408
4081
8cad82182237 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 3963
diff changeset
   409
    "Modified: / 05-06-1999 / 21:41:01 / cg"
8cad82182237 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 3963
diff changeset
   410
    "Modified: / 16-04-2018 / 11:43:55 / stefan"
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   411
!
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   412
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   413
resizeToFit
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   414
    "resize myself to make the component view fit"
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   415
3223
2f47681f1d62 class: ActiveHelpView
Claus Gittinger <cg@exept.de>
parents: 3218
diff changeset
   416
    |h w pref bw|
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   417
285
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   418
    pref := myView preferredExtent.
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   419
    shapeStyle == #cartoon ifTrue:[
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   420
        h := pref y. 
208c1e1ad9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   421
        w := pref x. 
3223
2f47681f1d62 class: ActiveHelpView
Claus Gittinger <cg@exept.de>
parents: 3218
diff changeset
   422
        self extent:((w / 0.85) @ (h * 4)) rounded.
92
claus
parents: 60
diff changeset
   423
    ] ifFalse:[
3223
2f47681f1d62 class: ActiveHelpView
Claus Gittinger <cg@exept.de>
parents: 3218
diff changeset
   424
        bw := self borderWidth.
2f47681f1d62 class: ActiveHelpView
Claus Gittinger <cg@exept.de>
parents: 3218
diff changeset
   425
        self extent:(pref + (bw * 2)).
2f47681f1d62 class: ActiveHelpView
Claus Gittinger <cg@exept.de>
parents: 3218
diff changeset
   426
        myView origin:(bw asPoint).
92
claus
parents: 60
diff changeset
   427
    ]
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   428
635
dfbc3a7b87c2 comments
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   429
    "Modified: 28.6.1997 / 14:23:49 / cg"
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   430
! !
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   431
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   432
!ActiveHelpView methodsFor:'queries'!
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   433
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   434
isPopUpView
261
6d7941a96ad0 commentary
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   435
    "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
   436
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   437
    ^ true
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   438
261
6d7941a96ad0 commentary
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   439
    "Modified: 12.5.1996 / 21:58:12 / cg"
3250
276f1af4583b handle key press and close help.
Claus Gittinger <cg@exept.de>
parents: 3249
diff changeset
   440
!
276f1af4583b handle key press and close help.
Claus Gittinger <cg@exept.de>
parents: 3249
diff changeset
   441
276f1af4583b handle key press and close help.
Claus Gittinger <cg@exept.de>
parents: 3249
diff changeset
   442
wantsFocusWithButtonPress
276f1af4583b handle key press and close help.
Claus Gittinger <cg@exept.de>
parents: 3249
diff changeset
   443
    ^ false
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   444
! !
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   445
380
c553cc1bbfa7 commentary
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   446
!ActiveHelpView class methodsFor:'documentation'!
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   447
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   448
version
3502
e5b5db8356f7 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 3396
diff changeset
   449
    ^ '$Header$'
2773
eaec2e45bd8d no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents: 2413
diff changeset
   450
!
eaec2e45bd8d no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents: 2413
diff changeset
   451
eaec2e45bd8d no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents: 2413
diff changeset
   452
version_CVS
3502
e5b5db8356f7 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 3396
diff changeset
   453
    ^ '$Header$'
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   454
! !
3118
f18d1909c51c class: ActiveHelpView
Claus Gittinger <cg@exept.de>
parents: 2802
diff changeset
   455