Tools__BrowserList.st
changeset 14196 88445b43e752
parent 14164 e638a1c10eef
child 14378 f72e7478174e
equal deleted inserted replaced
14195:f05be0ea5069 14196:88445b43e752
    28 !
    28 !
    29 
    29 
    30 Object subclass:#SearchHandler
    30 Object subclass:#SearchHandler
    31 	instanceVariableNames:'listView listViewVisualBlock listViewSelectedVisualBlock
    31 	instanceVariableNames:'listView listViewVisualBlock listViewSelectedVisualBlock
    32 		listHolder listSelectionHolder searchField searchWindow
    32 		listHolder listSelectionHolder searchField searchWindow
    33 		searchHolder'
    33 		searchHolder nextDelegate'
    34 	classVariableNames:''
    34 	classVariableNames:''
    35 	poolDictionaries:''
    35 	poolDictionaries:''
    36 	privateIn:BrowserList
    36 	privateIn:BrowserList
    37 !
    37 !
    38 
    38 
  1642     "Created: / 27-07-2011 / 20:30:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1642     "Created: / 27-07-2011 / 20:30:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1643 ! !
  1643 ! !
  1644 
  1644 
  1645 !BrowserList::SearchHandler methodsFor:'event handling'!
  1645 !BrowserList::SearchHandler methodsFor:'event handling'!
  1646 
  1646 
       
  1647 buttonMotion:button x:x y:y view:aView
       
  1648     nextDelegate notNil ifTrue:[
       
  1649         ^ (nextDelegate respondsTo: #buttonMotion:x:y:view:)
       
  1650             and:[nextDelegate buttonMotion:button x:x y:y view:aView]
       
  1651     ].
       
  1652     ^false
       
  1653 
       
  1654     "Created: / 10-04-2014 / 11:43:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
  1655 !
       
  1656 
       
  1657 buttonPress:button x:x y:y view:aView
       
  1658     nextDelegate notNil ifTrue:[
       
  1659         ^ (nextDelegate respondsTo: #buttonPress:x:y:view:)
       
  1660             and:[nextDelegate buttonPress:button x:x y:y view:aView]
       
  1661     ].
       
  1662     ^false
       
  1663 
       
  1664     "Created: / 10-04-2014 / 11:43:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
  1665 !
       
  1666 
  1647 keyPress:key x:x y:y view:aView
  1667 keyPress:key x:x y:y view:aView
  1648     <resource: #keyboard (#Escape #Accept #Return #CursorUp #CursorDown)>
  1668     <resource: #keyboard (#Escape #Accept #Return #CursorUp #CursorDown)>
  1649 
  1669 
  1650     | v |
  1670     | v |
  1651 
  1671 
  1666         ].
  1686         ].
  1667 
  1687 
  1668         searchWindow isNil ifTrue:[
  1688         searchWindow isNil ifTrue:[
  1669             key isCharacter ifTrue:[
  1689             key isCharacter ifTrue:[
  1670                 searchHolder setValue: key asString.
  1690                 searchHolder setValue: key asString.
  1671                 self startSearch
  1691                 self startSearch.
       
  1692                 ^ self
  1672             ]
  1693             ]
  1673         ] ifFalse:[
  1694         ] ifFalse:[
  1674             key == #Escape ifTrue:[self stopSearch].
  1695             key == #Escape ifTrue:[self stopSearch. ^ self].
  1675             key == #Accept ifTrue:[self stopSearch].
  1696             key == #Accept ifTrue:[self stopSearch. ^ self].
  1676             key == #Return ifTrue:[self stopSearch].
  1697             key == #Return ifTrue:[self stopSearch. ^ self].
  1677         ]
  1698         ]
  1678     ].
  1699     ].
  1679 
  1700 
  1680     aView == searchField ifTrue:[
  1701     aView == searchField ifTrue:[
  1681         key == #Escape ifTrue:[self stopSearch].
  1702         key == #Escape ifTrue:[self stopSearch. ^ self].
  1682         key == #Accept ifTrue:[self stopSearch].
  1703         key == #Accept ifTrue:[self stopSearch. ^ self].
  1683         key == #Return ifTrue:[self stopSearch].
  1704         key == #Return ifTrue:[self stopSearch. ^ self].
  1684         (key == #CursorUp or:[key == #CursorDown]) ifTrue:[
  1705         (key == #CursorUp or:[key == #CursorDown]) ifTrue:[
  1685             listView sensor setCtrlDown: false.
  1706             listView sensor setCtrlDown: false.
  1686             listView sensor setShiftDown: false.
  1707             listView sensor setShiftDown: false.
  1687             listView keyPress:key x:x y:y
  1708             listView keyPress:key x:x y:y.
       
  1709             ^ self
  1688         ].
  1710         ].
  1689 
  1711     ].
  1690     ]
  1712 
       
  1713     nextDelegate notNil ifTrue:[
       
  1714         ^ (nextDelegate respondsTo: #keyPress:x:y:view:)
       
  1715             and:[nextDelegate keyPress:key x:x y:y view:aView]
       
  1716     ].
  1691 
  1717 
  1692     "Created: / 27-07-2011 / 20:39:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1718     "Created: / 27-07-2011 / 20:39:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
  1719     "Modified: / 10-04-2014 / 11:44:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
  1720 !
       
  1721 
       
  1722 keyRelease:key x:x y:y view:aView
       
  1723     nextDelegate notNil ifTrue:[
       
  1724         ^ (nextDelegate respondsTo: #keyRelease:x:y:view:)
       
  1725             and:[nextDelegate keyRelease:key x:x y:y view:aView]
       
  1726     ].
       
  1727     ^false
       
  1728 
       
  1729     "Created: / 10-04-2014 / 11:41:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1693 ! !
  1730 ! !
  1694 
  1731 
  1695 !BrowserList::SearchHandler methodsFor:'event handling-queries'!
  1732 !BrowserList::SearchHandler methodsFor:'event handling-queries'!
       
  1733 
       
  1734 handlesButtonMotion:something inView:aView
       
  1735     "I am not interested in button events"
       
  1736 
       
  1737     nextDelegate notNil ifTrue:[
       
  1738         ^ (nextDelegate respondsTo: #handlesButtonMotion:inView:)
       
  1739             and:[nextDelegate handlesButtonMotion:something inView:aView]
       
  1740     ].
       
  1741     ^false
       
  1742 
       
  1743     "Modified: / 10-04-2014 / 11:40:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
  1744 !
       
  1745 
       
  1746 handlesButtonPress:something inView:aView
       
  1747     "I am not interested in button events"
       
  1748 
       
  1749     nextDelegate notNil ifTrue:[
       
  1750         ^ (nextDelegate respondsTo: #handlesButtonPress:inView:)
       
  1751             and:[nextDelegate handlesButtonPress:something inView:aView]
       
  1752     ].
       
  1753     ^false
       
  1754 
       
  1755     "Modified: / 10-04-2014 / 11:40:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
  1756 !
  1696 
  1757 
  1697 handlesKeyPress:key inView:aView
  1758 handlesKeyPress:key inView:aView
  1698     <resource: #keyboard (#Escape #Accept #Return #CursorUp #CursorDown)>
  1759     <resource: #keyboard (#Escape #Accept #Return #CursorUp #CursorDown)>
  1699 
  1760 
  1700     aView == listView ifTrue:[
  1761     aView == listView ifTrue:[
  1705     aView == searchField ifTrue:[
  1766     aView == searchField ifTrue:[
  1706         (#(#Escape #Accept #Return #CursorUp #CursorDown) includes: key) ifTrue:[
  1767         (#(#Escape #Accept #Return #CursorUp #CursorDown) includes: key) ifTrue:[
  1707             ^true
  1768             ^true
  1708         ]
  1769         ]
  1709     ].
  1770     ].
       
  1771 
       
  1772     nextDelegate notNil ifTrue:[
       
  1773         ^ (nextDelegate respondsTo: #handlesKeyPress:inView:)
       
  1774             and:[nextDelegate handlesKeyPress:key inView:aView]
       
  1775     ].
  1710     ^false
  1776     ^false
  1711 
  1777 
  1712     "Created: / 27-07-2011 / 20:39:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1778     "Created: / 27-07-2011 / 20:39:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
  1779     "Modified: / 10-04-2014 / 11:39:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
  1780 !
       
  1781 
       
  1782 handlesKeyRelease:key inView:aView
       
  1783     "this is the query from the sensor to ask me if I would like to
       
  1784      get a keyRelease event for key from aView. Return true, if I want so,
       
  1785      false otherwise."
       
  1786 
       
  1787     nextDelegate notNil ifTrue:[
       
  1788         ^ (nextDelegate respondsTo: #handlesKeyRelease:inView:)
       
  1789             and:[nextDelegate handlesKeyRelease:key inView:aView]
       
  1790     ].
       
  1791     ^false
       
  1792 
       
  1793     "Modified: / 10-04-2014 / 11:40:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1713 ! !
  1794 ! !
  1714 
  1795 
  1715 !BrowserList::SearchHandler methodsFor:'initialization'!
  1796 !BrowserList::SearchHandler methodsFor:'initialization'!
  1716 
  1797 
  1717 initializeFor: aView
  1798 initializeFor: aView
  1719     aView isScrollWrapper ifTrue:[
  1800     aView isScrollWrapper ifTrue:[
  1720         listView := aView scrolledView
  1801         listView := aView scrolledView
  1721     ] ifFalse:[
  1802     ] ifFalse:[
  1722         listView := aView.
  1803         listView := aView.
  1723     ].
  1804     ].
       
  1805     nextDelegate := listView delegate.
  1724     listView delegate: self.
  1806     listView delegate: self.
  1725     searchHolder := ValueHolder with: nil.
  1807     searchHolder := ValueHolder with: nil.
  1726     searchHolder onChangeSend: #updateList to: self.
  1808     searchHolder onChangeSend: #updateList to: self.
  1727 
  1809 
  1728     "Created: / 27-07-2011 / 20:32:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1810     "Created: / 27-07-2011 / 20:32:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
  1811     "Modified: / 10-04-2014 / 11:36:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1729 ! !
  1812 ! !
  1730 
  1813 
  1731 !BrowserList::SearchHandler methodsFor:'private'!
  1814 !BrowserList::SearchHandler methodsFor:'private'!
  1732 
  1815 
  1733 absoluteLeftOfListView
  1816 absoluteLeftOfListView
  1927 ! !
  2010 ! !
  1928 
  2011 
  1929 !BrowserList class methodsFor:'documentation'!
  2012 !BrowserList class methodsFor:'documentation'!
  1930 
  2013 
  1931 version
  2014 version
  1932     ^ '$Header: /cvs/stx/stx/libtool/Tools__BrowserList.st,v 1.65 2014-03-26 10:00:25 vrany Exp $'
  2015     ^ '$Header: /cvs/stx/stx/libtool/Tools__BrowserList.st,v 1.66 2014-04-10 09:56:57 vrany Exp $'
  1933 !
  2016 !
  1934 
  2017 
  1935 version_CVS
  2018 version_CVS
  1936     ^ '$Header: /cvs/stx/stx/libtool/Tools__BrowserList.st,v 1.65 2014-03-26 10:00:25 vrany Exp $'
  2019     ^ '$Header: /cvs/stx/stx/libtool/Tools__BrowserList.st,v 1.66 2014-04-10 09:56:57 vrany Exp $'
  1937 ! !
  2020 ! !
  1938 
  2021