FlyByWindowInformation.st
author Claus Gittinger <cg@exept.de>
Tue, 26 Feb 2008 11:43:02 +0100
changeset 2305 bb3668dab082
parent 2300 afddc24415dc
child 2314 e65082256c46
permissions -rw-r--r--
automatically generated by browser
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2300
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"{ Package: 'stx:libtool2' }"
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
FlyByHelp subclass:#FlyByWindowInformation
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
	instanceVariableNames:'lastApplication lastView cleanupAction finishSemaphore'
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
	classVariableNames:''
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
	poolDictionaries:''
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
	category:'Interface-Help'
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
!
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
!FlyByWindowInformation class methodsFor:'documentation'!
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
examples
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
"
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
    self shownInformationOfViewUnderMouseUntilButtonIsPressed
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
"
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
!
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
shownInformationOfViewUnderMouseUntilButtonIsPressed
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
    self start waitUntilFinished
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
    "
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
     self shownInformationOfViewUnderMouseUntilButtonIsPressed
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
    "
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
! !
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
!FlyByWindowInformation methodsFor:'accessing'!
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
cleanupAction:something
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
    cleanupAction := something.
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
!
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
lastApplication
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
    ^ lastApplication
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
!
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
lastView
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
    ^ lastView
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
! !
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
!FlyByWindowInformation methodsFor:'event handling'!
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
buttonMotion:state x:x y:y view:aView
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
    super buttonMotion:state x:x y:y view:aView.
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
    ^ true
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
!
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
buttonPress:button x:x y:y view:aView
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
    self stop.
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
    ^ true
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
!
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
keyPress:key x:x y:y view:aView
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
    |obj action|
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
    key == #Escape ifTrue:[
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
        self stop.
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
        ^ true
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
    ].
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
    key asLowercase == $a ifTrue:[
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
        obj := lastApplication
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
    ].
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
    key asLowercase == $m ifTrue:[
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
        obj := lastApplication masterApplication
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
    ].
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
    key asLowercase == $v ifTrue:[
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
        obj := lastView
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
    ].
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
    key asLowercase == $t ifTrue:[
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
        obj := lastView topView
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
    ].
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
    obj notNil ifTrue:[
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
        key isLowercase ifTrue:[
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
            action := [ obj inspect ].
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
        ] ifFalse:[
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
            action := [ obj browse ].
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
        ].
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
        action forkAt:8.
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
    ].
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
    ^ true
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    82
! !
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    83
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    84
!FlyByWindowInformation methodsFor:'help texts'!
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    85
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    86
helpTextFor:aView at:aPointOrNil
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
    lastView := aView.
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    88
    lastApplication := aView application.
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    89
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
    ^ String streamContents:[:s |
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
        s nextPutLine:('View: ' , aView class name).
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
        aView topView ~~ aView ifTrue:[
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
            s nextPutLine:('Topview: ' , aView topView class name).
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    94
        ].
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    95
        lastApplication notNil ifTrue:[
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
            s nextPutLine:('Application: ' , lastApplication class name).
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    97
            lastApplication masterApplication notNil ifTrue:[
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
                s nextPutLine:('Masterapplication: ' , lastApplication masterApplication class name).
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    99
            ].
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   100
        ].
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   101
        s cr.
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   102
        s nextPutLine:'Press:'.
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   103
        s nextPutLine:'    v to inspect view (V to browse)'.
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   104
        aView topView ~~ aView ifTrue:[
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   105
            s nextPutLine:'    t to inspect topView (T to browse)'.
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   106
        ].
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   107
        lastApplication notNil ifTrue:[
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   108
            s nextPutLine:'    a to inspect application (A to browse)'.
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   109
            lastApplication masterApplication notNil ifTrue:[
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   110
                s nextPutLine:'    m to inspect masterApplication (M to browse)'.
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   111
            ].
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   112
        ].
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   113
        s nextPutAll:'    ESC or button to leave'.
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   114
    ]
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   115
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   116
    "
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   117
     self shownInformationOfViewUnderMouseUntilButtonIsPressed
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   118
    "
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   119
! !
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   120
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   121
!FlyByWindowInformation methodsFor:'queries'!
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   122
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   123
toolTipFollowsMouse
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   124
    ^ true
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   125
! !
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   126
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   127
!FlyByWindowInformation methodsFor:'start & stop'!
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   128
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   129
start
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   130
    |l|
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   131
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   132
    l := FlyByHelp currentHelpListener.
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   133
    l notNil ifTrue:[
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   134
        FlyByHelp stop.
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   135
        cleanupAction := [ FlyByHelp start ].
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   136
    ].
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   137
    finishSemaphore := Semaphore new.
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   138
    super start.
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   139
!
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   140
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   141
stop
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   142
    super stop.
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   143
    cleanupAction value.
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   144
    finishSemaphore notNil ifTrue:[
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   145
        finishSemaphore signalIf.
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   146
    ].
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   147
!
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   148
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   149
waitUntilFinished
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   150
    finishSemaphore wait.
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   151
! !
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   152
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   153
!FlyByWindowInformation class methodsFor:'documentation'!
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   154
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   155
version
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   156
    ^ '$Header$'
afddc24415dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   157
! !