WindowEvent.st
branchjv
changeset 9049 d0233524dfd8
parent 6312 fd183f4f73b5
equal deleted inserted replaced
9048:0df4950e6214 9049:d0233524dfd8
     9  other person.  No title to or ownership of the software is
     9  other person.  No title to or ownership of the software is
    10  hereby transferred.
    10  hereby transferred.
    11 "
    11 "
    12 "{ Package: 'stx:libview' }"
    12 "{ Package: 'stx:libview' }"
    13 
    13 
       
    14 "{ NameSpace: Smalltalk }"
       
    15 
    14 Event subclass:#WindowEvent
    16 Event subclass:#WindowEvent
    15 	instanceVariableNames:'delegatedFrom consumed'
    17 	instanceVariableNames:'delegatedFrom consumed'
    16 	classVariableNames:''
    18 	classVariableNames:''
    17 	poolDictionaries:''
    19 	poolDictionaries:''
    18 	category:'Interface-Support-UI'
    20 	category:'Interface-Support-UI'
   101 	poolDictionaries:''
   103 	poolDictionaries:''
   102 	privateIn:WindowEvent
   104 	privateIn:WindowEvent
   103 !
   105 !
   104 
   106 
   105 WindowEvent::InputEvent subclass:#KeyboardEvent
   107 WindowEvent::InputEvent subclass:#KeyboardEvent
   106 	instanceVariableNames:'rawKey'
   108 	instanceVariableNames:'untranslatedKey rawKey isDeadKey'
   107 	classVariableNames:''
   109 	classVariableNames:''
   108 	poolDictionaries:''
   110 	poolDictionaries:''
   109 	privateIn:WindowEvent
   111 	privateIn:WindowEvent
   110 !
   112 !
   111 
   113 
   143 	poolDictionaries:''
   145 	poolDictionaries:''
   144 	privateIn:WindowEvent
   146 	privateIn:WindowEvent
   145 !
   147 !
   146 
   148 
   147 WindowEvent subclass:#MessageSendEvent
   149 WindowEvent subclass:#MessageSendEvent
   148 	instanceVariableNames:''
   150 	instanceVariableNames:'generatedBy'
   149 	classVariableNames:''
   151 	classVariableNames:'Debug'
   150 	poolDictionaries:''
   152 	poolDictionaries:''
   151 	privateIn:WindowEvent
   153 	privateIn:WindowEvent
   152 !
   154 !
   153 
   155 
   154 WindowEvent::ButtonEvent subclass:#MouseWheelMotionEvent
   156 WindowEvent::ButtonEvent subclass:#MouseWheelMotionEvent
   155 	instanceVariableNames:''
   157 	instanceVariableNames:'repeatCount'
   156 	classVariableNames:''
   158 	classVariableNames:''
   157 	poolDictionaries:''
   159 	poolDictionaries:''
   158 	privateIn:WindowEvent
   160 	privateIn:WindowEvent
   159 !
   161 !
   160 
   162 
   200 	privateIn:WindowEvent
   202 	privateIn:WindowEvent
   201 !
   203 !
   202 
   204 
   203 WindowEvent subclass:#VisibilityChangeEvent
   205 WindowEvent subclass:#VisibilityChangeEvent
   204 	instanceVariableNames:'visibility'
   206 	instanceVariableNames:'visibility'
       
   207 	classVariableNames:''
       
   208 	poolDictionaries:''
       
   209 	privateIn:WindowEvent
       
   210 !
       
   211 
       
   212 WindowEvent subclass:#WidgetSelectionEvent
       
   213 	instanceVariableNames:''
   205 	classVariableNames:''
   214 	classVariableNames:''
   206 	poolDictionaries:''
   215 	poolDictionaries:''
   207 	privateIn:WindowEvent
   216 	privateIn:WindowEvent
   208 !
   217 !
   209 
   218 
   232 
   241 
   233 documentation
   242 documentation
   234 "
   243 "
   235     Instances of WindowEvent are created for every event coming from the graphics device. 
   244     Instances of WindowEvent are created for every event coming from the graphics device. 
   236     Usually, they are enqueued by the event dispatcher process into
   245     Usually, they are enqueued by the event dispatcher process into
   237     a sensors input queue, and dequeued & processed by a windowGroup process
   246     a sensor's input queue, and dequeued & processed by a windowGroup process
   238     in its event loop.
   247     in its event loop.
   239 
   248 
   240     WindowEvents hold the event type and additional information (such as key,
   249     WindowEvents hold the event type and additional information (such as key,
   241     x/y coordinates etc). Also, windowEvents know how to send themself to some
   250     x/y coordinates etc). Also, windowEvents know how to send themself to some
   242     destination. To provide a common (single) place where event dispatching is
   251     destination. To provide a common (single) place where event dispatching is
   435 hotkeyWithId:aHotkeyId rawKey:keyWithModifier view:aView
   444 hotkeyWithId:aHotkeyId rawKey:keyWithModifier view:aView
   436 
   445 
   437     |ev|
   446     |ev|
   438 
   447 
   439      ev := (HotKeyEvent new)
   448      ev := (HotKeyEvent new)
   440           for:aView
   449                 for:aView
   441           type:#hotkeyWithId:rawKey:
   450                 type:#hotkeyWithId:rawKey:
   442           arguments:(Array with:keyWithModifier with:0 with:0).
   451                 arguments:(Array with:keyWithModifier with:0 with:0).
   443      ev rawKey:keyWithModifier.
   452      ev rawKey:keyWithModifier.
   444      ev hotkeyIdentifier:aHotkeyId.
   453      ev hotkeyIdentifier:aHotkeyId.
   445     ^ ev
   454     ^ ev
   446 !
   455 !
   447 
   456 
   451     x:x y:y view:aView
   460     x:x y:y view:aView
   452 
   461 
   453     |ev|
   462     |ev|
   454 
   463 
   455     ev := self keyPress:key x:x y:y view:aView.
   464     ev := self keyPress:key x:x y:y view:aView.
   456     ev rawKey:untranslatedKey.
   465     ev rawKey:untranslatedKey untranslatedKey:untranslatedKey.
   457     ev  hasShift:shiftDown ctrl:ctrlDown alt:altDown meta:metaDown
   466     ev  hasShift:shiftDown ctrl:ctrlDown alt:altDown meta:metaDown
   458         button1:leftButtonDown button2:middleButtonDown button3:rightButtonDown.
   467         button1:leftButtonDown button2:middleButtonDown button3:rightButtonDown.
   459     ^ ev
   468     ^ ev
   460 !
   469 !
   461 
   470 
   472     x:x y:y view:aView
   481     x:x y:y view:aView
   473 
   482 
   474     |ev|
   483     |ev|
   475 
   484 
   476     ev := self keyRelease:key x:x y:y view:aView.
   485     ev := self keyRelease:key x:x y:y view:aView.
   477     ev rawKey:untranslatedKey.
   486     ev rawKey:untranslatedKey untranslatedKey:untranslatedKey.
   478     ev  hasShift:shiftDown ctrl:ctrlDown alt:altDown meta:metaDown
   487     ev  hasShift:shiftDown ctrl:ctrlDown alt:altDown meta:metaDown
   479         button1:leftButtonDown button2:middleButtonDown button3:rightButtonDown.
   488         button1:leftButtonDown button2:middleButtonDown button3:rightButtonDown.
   480     ^ ev
   489     ^ ev
   481 !
   490 !
   482 
   491 
   498         for:aView 
   507         for:aView 
   499         type:#mapped
   508         type:#mapped
   500 !
   509 !
   501 
   510 
   502 messageSend:receiver selector:aSelector arguments:arguments
   511 messageSend:receiver selector:aSelector arguments:arguments
   503     ^ MessageSendEvent
   512     "create and return a new messageSend for sending
   504          for:receiver
   513      aSelector-message with arguments to receiver.
   505          type:aSelector
   514      Usually, these are placed into the eventQueue, to ensure synchronized operation of change-update notifications"
   506          arguments:arguments
   515 
       
   516     ^ MessageSendEvent for:receiver type:aSelector arguments:arguments
   507 !
   517 !
   508 
   518 
   509 mouseWheelMotion:state x:x y:y amount:amount deltaTime:deltaTime view:aView
   519 mouseWheelMotion:state x:x y:y amount:amount deltaTime:deltaTime view:aView
   510     ^ MouseWheelMotionEvent
   520     ^ MouseWheelMotionEvent
   511              for:aView
   521              for:aView
   602              arguments:(Array with:how).
   612              arguments:(Array with:how).
   603 
   613 
   604     "Created: / 23-01-2012 / 09:51:03 / cg"
   614     "Created: / 23-01-2012 / 09:51:03 / cg"
   605 ! !
   615 ! !
   606 
   616 
       
   617 !WindowEvent class methodsFor:'class access'!
       
   618 
       
   619 buttonMotionEvent
       
   620     ^ ButtonMotionEvent
       
   621 
       
   622     "Created: / 13-02-2019 / 12:55:25 / Claus Gittinger"
       
   623 !
       
   624 
       
   625 buttonPressEvent
       
   626     ^ ButtonPressEvent
       
   627 
       
   628     "Created: / 13-02-2019 / 12:54:38 / Claus Gittinger"
       
   629 !
       
   630 
       
   631 buttonReleaseEvent
       
   632     ^ ButtonReleaseEvent
       
   633 
       
   634     "Created: / 13-02-2019 / 12:54:31 / Claus Gittinger"
       
   635 ! !
       
   636 
   607 !WindowEvent class methodsFor:'constants'!
   637 !WindowEvent class methodsFor:'constants'!
   608 
   638 
   609 dropType_directory
   639 dropType_directory
   610     ^ #directory
   640     ^ #directory
   611 
   641 
   634 
   664 
   635 for:aView type:aSymbol
   665 for:aView type:aSymbol
   636     "create and return a new windowEvent for sending
   666     "create and return a new windowEvent for sending
   637      aSymbol-message with no arguments to aView"
   667      aSymbol-message with no arguments to aView"
   638 
   668 
       
   669     self == WindowEvent ifTrue:[
       
   670         '----------------' errorPrint.
       
   671         'WindowEvent is abstract - use/add explicit creation message' errorPrintCR.
       
   672         thisContext fullPrintAll.
       
   673         self abstractClassInstantiationError.
       
   674     ].
   639     ^ self new for:aView type:aSymbol
   675     ^ self new for:aView type:aSymbol
   640 !
   676 !
   641 
   677 
   642 for:aView type:aSymbol arguments:argArray
   678 for:aView type:aSymbol arguments:argArray
   643     "create and return a new windowEvent for sending
   679     "create and return a new windowEvent for sending
   644      aSymbol-message with arguments to aView"
   680      aSymbol-message with arguments to aView"
   645 
   681 
       
   682     self == WindowEvent ifTrue:[
       
   683         '----------------' errorPrint.
       
   684         'WindowEvent is abstract - use/add explicit creation message' errorPrintCR.
       
   685         thisContext fullPrintAll.
       
   686         self abstractClassInstantiationError.
       
   687     ].
   646     ^ self new for:aView type:aSymbol arguments:argArray
   688     ^ self new for:aView type:aSymbol arguments:argArray
   647 !
   689 !
   648 
   690 
   649 new
   691 new
   650     self == WindowEvent ifTrue:[
   692     self == WindowEvent ifTrue:[
   676     "return the value of the instance variable 'delegatedFrom' (automatically generated)"
   718     "return the value of the instance variable 'delegatedFrom' (automatically generated)"
   677 
   719 
   678     ^ delegatedFrom
   720     ^ delegatedFrom
   679 !
   721 !
   680 
   722 
   681 delegatedFrom:something
   723 delegatedFrom:someOne
   682     "set the value of the instance variable 'delegatedFrom' (automatically generated)"
   724     "set the value of the instance variable 'delegatedFrom' (automatically generated)"
   683 
   725 
   684     delegatedFrom := something.
   726     delegatedFrom := someOne.
   685 !
   727 !
   686 
   728 
   687 key
   729 key
   688     "return the key - nil is returned here.
   730     "return the key - nil is returned here.
   689      This is redefined in KeyboardEvent."
   731      This is redefined in KeyboardEvent."
   750 !
   792 !
   751 
   793 
   752 dispatchWithViewArgumentTo:anObject
   794 dispatchWithViewArgumentTo:anObject
   753     "send this event to anObject, and pass an additional view argument"
   795     "send this event to anObject, and pass an additional view argument"
   754 
   796 
   755     args size = 0 ifTrue:[
   797     args size == 0 ifTrue:[
   756         ^ anObject 
   798         ^ anObject 
   757             perform:selector asMutator
   799             perform:selector asMutator
   758             with:receiver
   800             with:receiver
   759     ].
   801     ].
   760 
   802 
   765 
   807 
   766 !WindowEvent methodsFor:'printing & storing'!
   808 !WindowEvent methodsFor:'printing & storing'!
   767 
   809 
   768 displayOn:aGCOrStream
   810 displayOn:aGCOrStream
   769     "Compatibility
   811     "Compatibility
   770      append a printed desription on some stream (Dolphin,  Squeak)
   812       append a printed desription on some stream (Dolphin,  Squeak)
   771      OR:
   813      OR:
   772      display the receiver in a graphicsContext at 0@0 (ST80).
   814       display the receiver in a graphicsContext at 0@0 (ST80).
   773      This method allows for any object to be displayed in some view
   815      This method allows for any object to be displayed in some view
   774      (although the fallBack is to display its printString ...)"
   816      (although the fallBack is to display its printString ...)"
   775 
   817 
   776     "/ what a kludge - Dolphin and Squeak mean: printOn: a stream;
   818     "/ what a kludge - Dolphin and Squeak mean: printOn: a stream;
   777     "/ ST/X (and some old ST80's) mean: draw-yourself on a GC.
   819     "/ old ST80 means: draw-yourself on a GC.
   778     aGCOrStream isStream ifFalse:[
   820     aGCOrStream isStream ifFalse:[
   779         ^ super displayOn:aGCOrStream.
   821         ^ super displayOn:aGCOrStream.
   780     ].
   822     ].
   781 
   823 
   782     aGCOrStream 
   824     aGCOrStream 
   783         nextPutAll:self class name;
   825         nextPutAll:self className;
   784         nextPut:$(.
   826         nextPut:$(.
   785 
   827 
   786     selector storeOn:aGCOrStream. 
   828     selector storeOn:aGCOrStream. 
   787     aGCOrStream
   829     aGCOrStream
   788         nextPutAll:' view: '; 
   830         nextPutAll:' view: '; 
   790         nextPutAll:' args: '.
   832         nextPutAll:' args: '.
   791 
   833 
   792     args displayOn:aGCOrStream.
   834     args displayOn:aGCOrStream.
   793     aGCOrStream nextPut:$)
   835     aGCOrStream nextPut:$)
   794 
   836 
   795     "Created: 7.3.1996 / 14:55:50 / cg"
   837     "Created: / 07-03-1996 / 14:55:50 / cg"
   796     "Modified: 20.9.1997 / 11:42:11 / cg"
   838     "Modified: / 20-09-1997 / 11:42:11 / cg"
       
   839     "Modified (comment): / 22-02-2017 / 16:53:02 / cg"
       
   840     "Modified: / 28-06-2019 / 09:23:38 / Claus Gittinger"
   797 ! !
   841 ! !
   798 
   842 
   799 !WindowEvent methodsFor:'private-accessing'!
   843 !WindowEvent methodsFor:'private-accessing'!
   800 
   844 
   801 for:aView type:aSymbol
   845 for:aView type:aSymbol
  1082 !
  1126 !
  1083 
  1127 
  1084 isUserEvent
  1128 isUserEvent
  1085     "return true, if this event is a user event (i.e. mouse, keyboard or button)"
  1129     "return true, if this event is a user event (i.e. mouse, keyboard or button)"
  1086 
  1130 
  1087     self isButtonEvent       ifTrue:[^ true].
  1131     ^ false
  1088     self isKeyEvent          ifTrue:[^ true].
  1132 
  1089     self isTerminateEvent    ifTrue:[^ true].
  1133     "Modified: / 05-03-1997 / 11:27:40 / cg"
  1090 
  1134     "Modified: / 16-03-2018 / 11:07:59 / stefan"
  1091     self isPointerEnterEvent ifTrue:[^ true].
       
  1092     "/ self isPointerLeaveEvent ifTrue:[^ true].     -- why disabled ?
       
  1093 
       
  1094     ^ false
       
  1095 
       
  1096     "Modified: 5.3.1997 / 11:27:40 / cg"
       
  1097 ! !
  1135 ! !
  1098 
  1136 
  1099 !WindowEvent::ApplicationEvent methodsFor:'blocked'!
  1137 !WindowEvent::ApplicationEvent methodsFor:'blocked'!
  1100 
  1138 
  1101 view
  1139 view
  1343     "return true, if this event is a button event"
  1381     "return true, if this event is a button event"
  1344 
  1382 
  1345     ^ true
  1383     ^ true
  1346 
  1384 
  1347     "Created: 4.4.1997 / 13:44:11 / cg"
  1385     "Created: 4.4.1997 / 13:44:11 / cg"
       
  1386 !
       
  1387 
       
  1388 isUserEvent
       
  1389     "return true, if this event from a user"
       
  1390 
       
  1391     ^ true
       
  1392 
       
  1393     "Created: / 16-03-2018 / 11:05:26 / stefan"
  1348 ! !
  1394 ! !
  1349 
  1395 
  1350 !WindowEvent::ButtonPressEvent methodsFor:'testing'!
  1396 !WindowEvent::ButtonPressEvent methodsFor:'testing'!
  1351 
  1397 
  1352 isButtonPressEvent
  1398 isButtonPressEvent
  1457     "return true, if this event is a pointer-leave event"
  1503     "return true, if this event is a pointer-leave event"
  1458 
  1504 
  1459     ^ selector == #'pointerLeave:'
  1505     ^ selector == #'pointerLeave:'
  1460 
  1506 
  1461     "Created: 9.1.1996 / 15:51:36 / cg"
  1507     "Created: 9.1.1996 / 15:51:36 / cg"
       
  1508 !
       
  1509 
       
  1510 isUserEvent
       
  1511     "return true, if this event from a user"
       
  1512 
       
  1513     ^ self isPointerEnterEvent
       
  1514     "why not true for pointerLeave?"
       
  1515 
       
  1516     "Created: / 16-03-2018 / 11:07:04 / stefan"
  1462 ! !
  1517 ! !
  1463 
  1518 
  1464 !WindowEvent::FocusEvent methodsFor:'testing'!
  1519 !WindowEvent::FocusEvent methodsFor:'testing'!
  1465 
  1520 
  1466 isFocusEvent
  1521 isFocusEvent
  1485     ^ (selector == #focusOut)
  1540     ^ (selector == #focusOut)
  1486 
  1541 
  1487     "Created: / 21.5.1999 / 19:45:04 / cg"
  1542     "Created: / 21.5.1999 / 19:45:04 / cg"
  1488 ! !
  1543 ! !
  1489 
  1544 
       
  1545 !WindowEvent::KeyboardEvent class methodsFor:'documentation'!
       
  1546 
       
  1547 documentation
       
  1548 "
       
  1549     documentation to be added.
       
  1550 
       
  1551     class:
       
  1552         <a short class summary here, describing what instances represent>
       
  1553 
       
  1554     responsibilities:    
       
  1555         <describing what my main role is>
       
  1556 
       
  1557     collaborators:    
       
  1558         <describing with whom and how I talk to>
       
  1559 
       
  1560     API:
       
  1561         <public api and main messages>
       
  1562         
       
  1563     example:
       
  1564         <a one-line examples on how to use - can also be in a separate example method>
       
  1565 
       
  1566     implementation:
       
  1567         <implementation points>
       
  1568 
       
  1569     [author:]
       
  1570         exept MBP
       
  1571 
       
  1572     [instance variables:]
       
  1573 
       
  1574     [class variables:]
       
  1575 
       
  1576     [see also:]
       
  1577 
       
  1578 "
       
  1579 ! !
       
  1580 
  1490 !WindowEvent::KeyboardEvent methodsFor:'accessing'!
  1581 !WindowEvent::KeyboardEvent methodsFor:'accessing'!
  1491 
  1582 
       
  1583 isDeadKey:aBoolean
       
  1584     "set (by the sensor) if this is an event for a deadKey.
       
  1585      Consumers may want to mark deadKeys specially 
       
  1586      (eg. by highlighting it, as done in the editTextView)"
       
  1587 
       
  1588     isDeadKey := aBoolean
       
  1589 
       
  1590     "Created: 4.4.1997 / 13:47:15 / cg"
       
  1591 !
       
  1592 
  1492 key
  1593 key
  1493     "return the key of the key-event."
  1594     "return the (translated) key of the key-event.
       
  1595      i.e. if the keyboardMap maps #Ctrlc to #Copy,
       
  1596      then key will be #Copy and untranslatedKey will be #Ctrlc
       
  1597      and rawKey will be $c."
  1494 
  1598 
  1495     ^ args at:1
  1599     ^ args at:1
  1496 
  1600 
  1497     "Created: 1.8.1997 / 13:55:19 / cg"
  1601     "Created: 1.8.1997 / 13:55:19 / cg"
  1498 !
  1602 !
  1499 
  1603 
  1500 key:aCharacterOrSymbol
  1604 key:aCharacterOrSymbol
  1501     "change the key of the key-event."
  1605     "set the (translated) key of the key-event.
       
  1606      i.e. if the keyboardMap maps #Ctrlc to #Copy,
       
  1607      then key will be #Copy and untranslatedKey will be #Ctrlc
       
  1608      and rawKey will be $c."
  1502 
  1609 
  1503     args at:1 put:aCharacterOrSymbol
  1610     args at:1 put:aCharacterOrSymbol
  1504 
  1611 
  1505     "Created: 1.8.1997 / 13:55:19 / cg"
  1612     "Created: 1.8.1997 / 13:55:19 / cg"
  1506 !
  1613 !
  1507 
  1614 
  1508 rawKey
  1615 rawKey
       
  1616     "return the (raw) key of the key-event.
       
  1617      i.e. if the keyboardMap maps #Ctrlc to #Copy,
       
  1618      then key will be #Copy and untranslatedKey will be #Ctrlc
       
  1619      and rawKey will be $c."
       
  1620 
       
  1621     rawKey isNil ifTrue:[^ self key].
  1509     ^ rawKey
  1622     ^ rawKey
  1510 
  1623 
  1511     "Created: 4.4.1997 / 13:47:15 / cg"
  1624     "Created: 4.4.1997 / 13:47:15 / cg"
  1512 !
  1625 !
  1513 
  1626 
  1514 rawKey:aKey
  1627 rawKey:aKey
       
  1628     "set the (raw) key of the key-event.
       
  1629      i.e. if the keyboardMap maps #Ctrlc to #Copy,
       
  1630      then key will be #Copy and untranslatedKey will be #Ctrlc
       
  1631      and rawKey will be $c."
       
  1632 
  1515     rawKey := aKey
  1633     rawKey := aKey
       
  1634 
       
  1635     "Created: 4.4.1997 / 13:47:10 / cg"
       
  1636 !
       
  1637 
       
  1638 rawKey:rKey untranslatedKey:uKey
       
  1639     "set the (raw) key of the key-event.
       
  1640      i.e. if the keyboardMap maps #Ctrlc to #Copy,
       
  1641      then key will be #Copy and untranslatedKey will be #Ctrlc
       
  1642      and rawKey will be $c."
       
  1643 
       
  1644     rawKey := rKey.
       
  1645     untranslatedKey := uKey.
       
  1646 
       
  1647     "Created: 4.4.1997 / 13:47:10 / cg"
       
  1648 !
       
  1649 
       
  1650 untranslatedKey
       
  1651     "return the untranslated key of the key-event;
       
  1652      i.e. if the keyboardMap maps #Ctrlc to #Copy,
       
  1653      then key will be #Copy and untranslatedKey will be #Ctrlc
       
  1654      (and rawKey will be $c)."
       
  1655 
       
  1656     untranslatedKey isNil ifTrue:[^ self key].
       
  1657     ^ untranslatedKey
       
  1658 
       
  1659     "Created: 4.4.1997 / 13:47:15 / cg"
       
  1660 !
       
  1661 
       
  1662 untranslatedKey:aKey
       
  1663     "set the untranslated key of the key-event.
       
  1664      i.e. if the keyboardMap maps #Ctrlc to #Copy,
       
  1665      then key will be #Copy and untranslatedKey will be #Ctrlc
       
  1666      and rawKey will be $c."
       
  1667 
       
  1668     untranslatedKey := aKey
  1516 
  1669 
  1517     "Created: 4.4.1997 / 13:47:10 / cg"
  1670     "Created: 4.4.1997 / 13:47:10 / cg"
  1518 !
  1671 !
  1519 
  1672 
  1520 x
  1673 x
  1548     ^ args at:3 put:anInteger
  1701     ^ args at:3 put:anInteger
  1549 ! !
  1702 ! !
  1550 
  1703 
  1551 !WindowEvent::KeyboardEvent methodsFor:'testing'!
  1704 !WindowEvent::KeyboardEvent methodsFor:'testing'!
  1552 
  1705 
       
  1706 isDeadKey
       
  1707     "return true, if this event is for a deadKey"
       
  1708 
       
  1709     ^ isDeadKey ? false
       
  1710 
       
  1711 
       
  1712 !
       
  1713 
  1553 isDelegatedToFocusView
  1714 isDelegatedToFocusView
  1554     "return true, if this event will be forwarded to a focusView."
  1715     "return true, if this event will be forwarded to a focusView."
  1555 
  1716 
  1556     ^ true
  1717     ^ true
  1557 !
  1718 !
  1560     "return true, if this event is a keyboard event"
  1721     "return true, if this event is a keyboard event"
  1561 
  1722 
  1562     ^ true
  1723     ^ true
  1563 
  1724 
  1564     "Created: 4.4.1997 / 13:39:59 / cg"
  1725     "Created: 4.4.1997 / 13:39:59 / cg"
       
  1726 !
       
  1727 
       
  1728 isUserEvent
       
  1729     "return true, if this event from a user"
       
  1730 
       
  1731     ^ true
       
  1732 
       
  1733     "Created: / 16-03-2018 / 11:05:50 / stefan"
  1565 ! !
  1734 ! !
  1566 
  1735 
  1567 !WindowEvent::ButtonMotionEvent methodsFor:'testing'!
  1736 !WindowEvent::ButtonMotionEvent methodsFor:'testing'!
  1568 
  1737 
  1569 isButtonMotionEvent
  1738 isButtonMotionEvent
  1619     "return true, if this event is a keyboard focus event"
  1788     "return true, if this event is a keyboard focus event"
  1620 
  1789 
  1621     ^ true
  1790     ^ true
  1622 ! !
  1791 ! !
  1623 
  1792 
       
  1793 !WindowEvent::MessageSendEvent class methodsFor:'documentation'!
       
  1794 
       
  1795 documentation
       
  1796 "
       
  1797     documentation to be added.
       
  1798 
       
  1799     class:
       
  1800         <a short class summary here, describing what instances represent>
       
  1801 
       
  1802     responsibilities:    
       
  1803         <describing what my main role is>
       
  1804 
       
  1805     collaborators:    
       
  1806         <describing with whom and how I talk to>
       
  1807 
       
  1808     API:
       
  1809         <public api and main messages>
       
  1810         
       
  1811     example:
       
  1812         <a one-line examples on how to use - can also be in a separate example method>
       
  1813 
       
  1814     implementation:
       
  1815         <implementation points>
       
  1816 
       
  1817     [author:]
       
  1818         cg
       
  1819 
       
  1820     [instance variables:]
       
  1821 
       
  1822     [class variables:]
       
  1823 
       
  1824     [see also:]
       
  1825 
       
  1826 "
       
  1827 ! !
       
  1828 
       
  1829 !WindowEvent::MessageSendEvent class methodsFor:'instance creation-basic'!
       
  1830 
       
  1831 for:aView type:aSymbol
       
  1832     "create and return a new windowEvent for sending
       
  1833      aSymbol-message with no arguments to aView"
       
  1834 
       
  1835     ^ (super for:aView type:aSymbol) rememberSender
       
  1836 !
       
  1837 
       
  1838 for:aView type:aSymbol arguments:argArray
       
  1839     "create and return a new windowEvent for sending
       
  1840      aSymbol-message with arguments to aView"
       
  1841 
       
  1842     ^ (super for:aView type:aSymbol arguments:argArray) rememberSender
       
  1843 ! !
       
  1844 
       
  1845 !WindowEvent::MessageSendEvent methodsFor:'accessing'!
       
  1846 
       
  1847 rememberSender
       
  1848     "possibly (i.e if Debug is true) remember the context where the message was generated.
       
  1849      Somewhat heuristicly skip uninterresting contexts."
       
  1850 
       
  1851     |con|
       
  1852 
       
  1853     (Debug ? false) ifFalse:[^ self].
       
  1854 
       
  1855     con := thisContext sender.
       
  1856     [
       
  1857         con notNil 
       
  1858           and:[ (con receiver == self)
       
  1859                 or:[(con receiver == self class)
       
  1860                 or:[(con receiver == WindowEvent)
       
  1861                 or:[(con receiver class == WindowSensor)
       
  1862                 or:[(con receiver class == RecursionLock)
       
  1863                 or:[(con receiver isBlock) 
       
  1864                 or:[(con selector == #enqueueMessage:for:arguments:)
       
  1865                 or:[(con selector == #enqueueMessage:for:)
       
  1866                ]]]]]]]  
       
  1867           ]
       
  1868     ] whileTrue:[
       
  1869         con := con sender.
       
  1870     ].
       
  1871     generatedBy := con.
       
  1872 ! !
       
  1873 
  1624 !WindowEvent::MessageSendEvent methodsFor:'blocked'!
  1874 !WindowEvent::MessageSendEvent methodsFor:'blocked'!
  1625 
  1875 
  1626 view
  1876 view
  1627     ^ nil
  1877     ^ nil
  1628 ! !
  1878 ! !
  1636 
  1886 
  1637 
  1887 
  1638 
  1888 
  1639 ! !
  1889 ! !
  1640 
  1890 
       
  1891 !WindowEvent::MouseWheelMotionEvent class methodsFor:'documentation'!
       
  1892 
       
  1893 documentation
       
  1894 "
       
  1895     documentation to be added.
       
  1896 
       
  1897     class:
       
  1898         <a short class summary here, describing what instances represent>
       
  1899 
       
  1900     responsibilities:    
       
  1901         <describing what my main role is>
       
  1902 
       
  1903     collaborators:    
       
  1904         <describing with whom and how I talk to>
       
  1905 
       
  1906     API:
       
  1907         <public api and main messages>
       
  1908         
       
  1909     example:
       
  1910         <a one-line examples on how to use - can also be in a separate example method>
       
  1911 
       
  1912     implementation:
       
  1913         <implementation points>
       
  1914 
       
  1915     [author:]
       
  1916         exept MBP
       
  1917 
       
  1918     [instance variables:]
       
  1919 
       
  1920     [class variables:]
       
  1921 
       
  1922     [see also:]
       
  1923 
       
  1924 "
       
  1925 ! !
       
  1926 
  1641 !WindowEvent::MouseWheelMotionEvent methodsFor:'accessing'!
  1927 !WindowEvent::MouseWheelMotionEvent methodsFor:'accessing'!
       
  1928 
       
  1929 addAmount:moreAmount
       
  1930     "used to compress multiple mouse-wheel motions into one"
       
  1931 
       
  1932     args at:4 put:(args at:4) + moreAmount
       
  1933 !
  1642 
  1934 
  1643 amount
  1935 amount
  1644     "return the amount of the mouse wheel motion event   "
  1936     "return the amount of the mouse wheel motion event   "
  1645 
  1937 
  1646     ^ args at:4
  1938     ^ args at:4
  1648 
  1940 
  1649 deltaTime
  1941 deltaTime
  1650     "return the deltaTime of the mouse wheel motion event   "
  1942     "return the deltaTime of the mouse wheel motion event   "
  1651 
  1943 
  1652     ^ args at:5
  1944     ^ args at:5
       
  1945 !
       
  1946 
       
  1947 incrementRepeatCount
       
  1948     repeatCount := (repeatCount ? 0) + 1.
       
  1949 !
       
  1950 
       
  1951 repeatCount
       
  1952     "used to compress multiple mouse-wheel motions into one"
       
  1953 
       
  1954     ^ repeatCount ? 1
  1653 ! !
  1955 ! !
  1654 
  1956 
  1655 !WindowEvent::MouseWheelMotionEvent methodsFor:'testing'!
  1957 !WindowEvent::MouseWheelMotionEvent methodsFor:'testing'!
  1656 
  1958 
  1657 isDelegatedToFocusView
  1959 isDelegatedToFocusView
  1690 
  1992 
  1691 !WindowEvent::TerminateEvent methodsFor:'testing'!
  1993 !WindowEvent::TerminateEvent methodsFor:'testing'!
  1692 
  1994 
  1693 isTerminateEvent
  1995 isTerminateEvent
  1694     ^ true
  1996     ^ true
       
  1997 !
       
  1998 
       
  1999 isUserEvent
       
  2000     "return true, if this event from a user"
       
  2001 
       
  2002     ^ true
       
  2003 
       
  2004     "Created: / 16-03-2018 / 11:06:05 / stefan"
  1695 ! !
  2005 ! !
  1696 
  2006 
  1697 !WindowEvent::TrayActionEvent methodsFor:'accessing'!
  2007 !WindowEvent::TrayActionEvent methodsFor:'accessing'!
  1698 
  2008 
  1699 event
  2009 event
  1722     ^ self new
  2032     ^ self new
  1723 
  2033 
  1724     "Created: / 23-01-2012 / 10:02:42 / cg"
  2034     "Created: / 23-01-2012 / 10:02:42 / cg"
  1725 ! !
  2035 ! !
  1726 
  2036 
       
  2037 !WindowEvent::WidgetSelectionEvent class methodsFor:'documentation'!
       
  2038 
       
  2039 copyright
       
  2040 "
       
  2041  COPYRIGHT (c) 2008 by eXept Software AG
       
  2042               All Rights Reserved
       
  2043 
       
  2044  This software is furnished under a license and may be used
       
  2045  only in accordance with the terms of that license and with the
       
  2046  inclusion of the above copyright notice.   This software may not
       
  2047  be provided or otherwise made available to, or used by, any
       
  2048  other person.  No title to or ownership of the software is
       
  2049  hereby transferred.
       
  2050 
       
  2051 "
       
  2052 ! !
       
  2053 
       
  2054 !WindowEvent::WidgetSelectionEvent methodsFor:'accessing'!
       
  2055 
       
  2056 widget:aWidget
       
  2057     selector := #'widgetSelected:'.
       
  2058     args := Array with:aWidget class name.
       
  2059     receiver := aWidget.
       
  2060     timeStamp := Timestamp now.
       
  2061 !
       
  2062 
       
  2063 widgetClassName
       
  2064 
       
  2065     ^ args at: 1 
       
  2066 ! !
       
  2067 
  1727 !WindowEvent::WindowMapUnmapEvent methodsFor:'testing'!
  2068 !WindowEvent::WindowMapUnmapEvent methodsFor:'testing'!
  1728 
  2069 
  1729 isMapEvent
  2070 isMapEvent
  1730     "return true, if this is a map event"
  2071     "return true, if this is a map event"
  1731 
  2072 
  1744 ! !
  2085 ! !
  1745 
  2086 
  1746 !WindowEvent class methodsFor:'documentation'!
  2087 !WindowEvent class methodsFor:'documentation'!
  1747 
  2088 
  1748 version_CVS
  2089 version_CVS
  1749 
  2090     ^ '$Header$'
  1750     ^  '$Header: /cvs/stx/stx/libview/WindowEvent.st,v 1.111 2014-03-05 22:13:18 cg Exp $'
       
  1751 !
  2091 !
  1752 
  2092 
  1753 version_SVN
  2093 version_SVN
  1754     ^ '$ Id $'
  2094     ^ '$ Id $'
  1755 ! !
  2095 ! !