PopUpBanner.st
author Claus Gittinger <cg@exept.de>
Tue, 03 Sep 2013 17:23:55 +0200
changeset 3228 187a4158a51a
parent 1772 cb41f5dbcdf4
child 4323 3dc16bb0b7db
permissions -rw-r--r--
class: FlyByHelp changed: #initiateHelpFor:at:now: #showHelp:for: changed the flyBy suppression slightly: if the same text is to be shown again, do not show it except if the help is for another widget. (used to check for the text only previously)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1319
f6a32ecf2b0c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
     1
"
f6a32ecf2b0c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
     2
 COPYRIGHT (c) 2000 by eXept Software AG
f6a32ecf2b0c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
     3
              All Rights Reserved
f6a32ecf2b0c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
     4
f6a32ecf2b0c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
     5
 This software is furnished under a license and may be used
f6a32ecf2b0c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
     6
 only in accordance with the terms of that license and with the
f6a32ecf2b0c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
f6a32ecf2b0c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
     8
 be provided or otherwise made available to, or used by, any
f6a32ecf2b0c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
     9
 other person.  No title to or ownership of the software is
f6a32ecf2b0c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
    10
 hereby transferred.
f6a32ecf2b0c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
    11
"
f6a32ecf2b0c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
    12
f6a32ecf2b0c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
    13
1480
b6c43e967b2a Dismiss view on click.
Stefan Vogel <sv@exept.de>
parents: 1348
diff changeset
    14
"{ Package: 'stx:libview2' }"
b6c43e967b2a Dismiss view on click.
Stefan Vogel <sv@exept.de>
parents: 1348
diff changeset
    15
1318
39e9b3f4202b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
PopUpView subclass:#PopUpBanner
39e9b3f4202b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
	instanceVariableNames:''
39e9b3f4202b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
	classVariableNames:''
39e9b3f4202b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
	poolDictionaries:''
39e9b3f4202b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
	category:'Views-Basic'
39e9b3f4202b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
!
39e9b3f4202b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
1319
f6a32ecf2b0c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
    23
!PopUpBanner class methodsFor:'documentation'!
f6a32ecf2b0c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
    24
f6a32ecf2b0c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
    25
copyright
f6a32ecf2b0c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
    26
"
f6a32ecf2b0c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
    27
 COPYRIGHT (c) 2000 by eXept Software AG
f6a32ecf2b0c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
    28
              All Rights Reserved
f6a32ecf2b0c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
    29
f6a32ecf2b0c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
    30
 This software is furnished under a license and may be used
f6a32ecf2b0c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
    31
 only in accordance with the terms of that license and with the
f6a32ecf2b0c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
    32
 inclusion of the above copyright notice.   This software may not
f6a32ecf2b0c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
    33
 be provided or otherwise made available to, or used by, any
f6a32ecf2b0c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
    34
 other person.  No title to or ownership of the software is
f6a32ecf2b0c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
    35
 hereby transferred.
f6a32ecf2b0c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
    36
"
f6a32ecf2b0c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
    37
f6a32ecf2b0c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
    38
!
f6a32ecf2b0c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
    39
f6a32ecf2b0c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
    40
documentation
f6a32ecf2b0c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
    41
"
1338
aead0c7924f8 example
Claus Gittinger <cg@exept.de>
parents: 1320
diff changeset
    42
    Shows a banner popUp (splash window);
1319
f6a32ecf2b0c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
    43
    can be used at startup to make wait-time a bit more interesting.
f6a32ecf2b0c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
    44
    See use in smalltalk.rc / showBanner.rc / hideBanner.rc.
f6a32ecf2b0c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
    45
f6a32ecf2b0c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
    46
    [author:]
f6a32ecf2b0c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
    47
        Claus Gittinger
f6a32ecf2b0c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
    48
"
f6a32ecf2b0c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
    49
1338
aead0c7924f8 example
Claus Gittinger <cg@exept.de>
parents: 1320
diff changeset
    50
!
aead0c7924f8 example
Claus Gittinger <cg@exept.de>
parents: 1320
diff changeset
    51
aead0c7924f8 example
Claus Gittinger <cg@exept.de>
parents: 1320
diff changeset
    52
examples
aead0c7924f8 example
Claus Gittinger <cg@exept.de>
parents: 1320
diff changeset
    53
"
aead0c7924f8 example
Claus Gittinger <cg@exept.de>
parents: 1320
diff changeset
    54
                                                [exBegin]
aead0c7924f8 example
Claus Gittinger <cg@exept.de>
parents: 1320
diff changeset
    55
    |img bannerView|
aead0c7924f8 example
Claus Gittinger <cg@exept.de>
parents: 1320
diff changeset
    56
aead0c7924f8 example
Claus Gittinger <cg@exept.de>
parents: 1320
diff changeset
    57
    img := Image fromFile:'banner1.xpm'.
aead0c7924f8 example
Claus Gittinger <cg@exept.de>
parents: 1320
diff changeset
    58
    bannerView := PopUpBanner forImage:img.
aead0c7924f8 example
Claus Gittinger <cg@exept.de>
parents: 1320
diff changeset
    59
    bannerView showCentered.
aead0c7924f8 example
Claus Gittinger <cg@exept.de>
parents: 1320
diff changeset
    60
aead0c7924f8 example
Claus Gittinger <cg@exept.de>
parents: 1320
diff changeset
    61
    Delay waitForSeconds:2.
aead0c7924f8 example
Claus Gittinger <cg@exept.de>
parents: 1320
diff changeset
    62
    bannerView destroy
aead0c7924f8 example
Claus Gittinger <cg@exept.de>
parents: 1320
diff changeset
    63
                                                [exEnd]
aead0c7924f8 example
Claus Gittinger <cg@exept.de>
parents: 1320
diff changeset
    64
"
aead0c7924f8 example
Claus Gittinger <cg@exept.de>
parents: 1320
diff changeset
    65
1319
f6a32ecf2b0c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
    66
! !
1318
39e9b3f4202b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
39e9b3f4202b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
!PopUpBanner class methodsFor:'instance creation'!
39e9b3f4202b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
39e9b3f4202b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
forImage:anImage
39e9b3f4202b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
    |v|
39e9b3f4202b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
39e9b3f4202b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
    v := self new.
39e9b3f4202b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
    v viewBackground:anImage.
1338
aead0c7924f8 example
Claus Gittinger <cg@exept.de>
parents: 1320
diff changeset
    75
    v cursor:Cursor wait.
1318
39e9b3f4202b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
    ^ v
39e9b3f4202b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
! !
39e9b3f4202b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
1772
cb41f5dbcdf4 method category rename
Claus Gittinger <cg@exept.de>
parents: 1721
diff changeset
    79
!PopUpBanner methodsFor:'activation & deactivation'!
1318
39e9b3f4202b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
39e9b3f4202b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
open
39e9b3f4202b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    82
    "default for popUpBanners is to come up modeless"
39e9b3f4202b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    83
1339
9635acd44db9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1338
diff changeset
    84
    |center r1 r2|
9635acd44db9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1338
diff changeset
    85
1340
6c5fdafe90a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
    86
    "/ sorry - zooming does not work during early initialization;
6c5fdafe90a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
    87
    "/ REASON: at smalltalk.rc reading time, scheduling does not yet take place;
6c5fdafe90a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
    88
    "/ therefore, Delaydoes not work. 
6c5fdafe90a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
    89
    "/ sigh.
6c5fdafe90a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
    90
"/    center := self center.
6c5fdafe90a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
    91
"/    r1 := (center corner:center) insetBy:-5.
6c5fdafe90a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
    92
"/    r2 := self origin corner:self corner.
6c5fdafe90a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
    93
"/    self device zoom:r1 to:r2 duration:300.
1339
9635acd44db9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1338
diff changeset
    94
1320
69348f686417 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
    95
    self realize
1318
39e9b3f4202b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
39e9b3f4202b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    97
!
39e9b3f4202b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
39e9b3f4202b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    99
showCentered
39e9b3f4202b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   100
    self extent:viewBackground extent.
39e9b3f4202b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   101
    self showAt:((self device extent // 2) - (viewBackground extent // 2))
39e9b3f4202b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   102
39e9b3f4202b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   103
39e9b3f4202b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   104
! !
39e9b3f4202b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   105
1339
9635acd44db9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1338
diff changeset
   106
!PopUpBanner methodsFor:'deactivation'!
9635acd44db9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1338
diff changeset
   107
9635acd44db9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1338
diff changeset
   108
destroy
1340
6c5fdafe90a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   109
    "/ sorry - zooming does not work during early initialization;
6c5fdafe90a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   110
    "/ REASON: at smalltalk.rc reading time, scheduling does not yet take place;
1721
61b4b99ffce6 unused vars removed
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
   111
    "/ therefore, Delay does not work, therefore zoom:to:duratio: does not work. 
61b4b99ffce6 unused vars removed
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
   112
    "/ - sigh.
1340
6c5fdafe90a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   113
   
1721
61b4b99ffce6 unused vars removed
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
   114
"/    |screen center r1 r2|
61b4b99ffce6 unused vars removed
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
   115
"/
1340
6c5fdafe90a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   116
"/    screen := self device.
6c5fdafe90a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   117
"/    center := self center.
6c5fdafe90a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   118
"/    r1 := (center corner:center) insetBy:-5.
6c5fdafe90a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   119
"/    r2 := self origin corner:self corner.
1721
61b4b99ffce6 unused vars removed
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
   120
1339
9635acd44db9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1338
diff changeset
   121
    super destroy.
9635acd44db9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1338
diff changeset
   122
1340
6c5fdafe90a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   123
"/    screen zoom:r2 to:r1 duration:300.
1339
9635acd44db9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1338
diff changeset
   124
! !
9635acd44db9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1338
diff changeset
   125
1480
b6c43e967b2a Dismiss view on click.
Stefan Vogel <sv@exept.de>
parents: 1348
diff changeset
   126
!PopUpBanner methodsFor:'event handling'!
b6c43e967b2a Dismiss view on click.
Stefan Vogel <sv@exept.de>
parents: 1348
diff changeset
   127
b6c43e967b2a Dismiss view on click.
Stefan Vogel <sv@exept.de>
parents: 1348
diff changeset
   128
buttonPress:button x:x y:y
b6c43e967b2a Dismiss view on click.
Stefan Vogel <sv@exept.de>
parents: 1348
diff changeset
   129
   "destroy view when user clicks into"
b6c43e967b2a Dismiss view on click.
Stefan Vogel <sv@exept.de>
parents: 1348
diff changeset
   130
b6c43e967b2a Dismiss view on click.
Stefan Vogel <sv@exept.de>
parents: 1348
diff changeset
   131
    self destroy
b6c43e967b2a Dismiss view on click.
Stefan Vogel <sv@exept.de>
parents: 1348
diff changeset
   132
! !
b6c43e967b2a Dismiss view on click.
Stefan Vogel <sv@exept.de>
parents: 1348
diff changeset
   133
1318
39e9b3f4202b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   134
!PopUpBanner methodsFor:'queries'!
39e9b3f4202b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   135
39e9b3f4202b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   136
grabWhenMapped
39e9b3f4202b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   137
    ^ false
39e9b3f4202b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   138
! !
39e9b3f4202b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   139
39e9b3f4202b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   140
!PopUpBanner class methodsFor:'documentation'!
39e9b3f4202b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   141
39e9b3f4202b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   142
version
1772
cb41f5dbcdf4 method category rename
Claus Gittinger <cg@exept.de>
parents: 1721
diff changeset
   143
    ^ '$Header: /cvs/stx/stx/libview2/PopUpBanner.st,v 1.10 2003-05-07 15:18:41 cg Exp $'
1318
39e9b3f4202b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   144
! !