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