PullDownMenu.st
changeset 4955 d5ac89b4093d
parent 4710 8a081c228e90
child 4959 76b3fff9c9bb
equal deleted inserted replaced
4954:31675dac0db2 4955:d5ac89b4093d
   643 
   643 
   644     titleArray keysAndValuesDo:[:index :entry |
   644     titleArray keysAndValuesDo:[:index :entry |
   645         |e|
   645         |e|
   646 
   646 
   647         entry isImage ifTrue:[
   647         entry isImage ifTrue:[
   648             e := entry onDevice:device
   648             e := entry onDevice:self graphicsDevice
   649         ] ifFalse:[
   649         ] ifFalse:[
   650             e := entry printString
   650             e := entry printString
   651         ].
   651         ].
   652         titles at:index put:e
   652         titles at:index put:e
   653     ].
   653     ].
   818 backgroundColor:aColor
   818 backgroundColor:aColor
   819     "set the background drawing color.
   819     "set the background drawing color.
   820      You should not use this method; instead leave the value as
   820      You should not use this method; instead leave the value as
   821      defined in the styleSheet."
   821      defined in the styleSheet."
   822 
   822 
   823     bgColor := aColor onDevice:device
   823     bgColor := aColor onDevice:self graphicsDevice
   824 !
   824 !
   825 
   825 
   826 font:aFont
   826 font:aFont
   827     "set the menus font.
   827     "set the menus font.
   828      adjusts menu-origins when font changes.
   828      adjusts menu-origins when font changes.
   832              this method is going to be obsoleted by a textStyle
   832              this method is going to be obsoleted by a textStyle
   833              method, which allows specific control over
   833              method, which allows specific control over
   834              normalFont/boldFont/italicFont parameters."
   834              normalFont/boldFont/italicFont parameters."
   835 
   835 
   836     aFont ~~ font ifTrue:[
   836     aFont ~~ font ifTrue:[
   837         super font:(aFont onDevice:device).
   837         super font:(aFont onDevice:self graphicsDevice).
   838         self height:(font height + (font descent * 2)).
   838         self height:(font height + (font descent * 2)).
   839         shown ifTrue:[
   839         shown ifTrue:[
   840             self setMenuOrigins
   840             self setMenuOrigins
   841         ]
   841         ]
   842     ]
   842     ]
   847 foregroundColor:aColor
   847 foregroundColor:aColor
   848     "set the foreground drawing color.
   848     "set the foreground drawing color.
   849      You should not use this method; instead leave the value as
   849      You should not use this method; instead leave the value as
   850      defined in the styleSheet."
   850      defined in the styleSheet."
   851 
   851 
   852     fgColor := aColor onDevice:device
   852     fgColor := aColor onDevice:self graphicsDevice
   853 !
   853 !
   854 
   854 
   855 showSeparatingLines:aBoolean
   855 showSeparatingLines:aBoolean
   856     "turn on/off drawing of separating lines.
   856     "turn on/off drawing of separating lines.
   857      You should not use this method; instead leave the value as
   857      You should not use this method; instead leave the value as
   952         self displayOpaqueString:stringOrImage x:x y:y
   952         self displayOpaqueString:stringOrImage x:x y:y
   953     ] ifFalse:[
   953     ] ifFalse:[
   954         stringOrImage isImageOrForm ifTrue:[
   954         stringOrImage isImageOrForm ifTrue:[
   955             stringOrImage depth == 1 ifTrue:[
   955             stringOrImage depth == 1 ifTrue:[
   956                 (map := stringOrImage colorMap) notNil ifTrue:[
   956                 (map := stringOrImage colorMap) notNil ifTrue:[
   957                     map at:1 put:((map at:1) onDevice:device).
   957                     map at:1 put:((map at:1) onDevice:self graphicsDevice).
   958                     map at:2 put:((map at:2) onDevice:device).
   958                     map at:2 put:((map at:2) onDevice:self graphicsDevice).
   959 
   959 
   960                     self paint:(map at:2) on:(map at:1).
   960                     self paint:(map at:2) on:(map at:1).
   961                     self displayOpaqueForm:stringOrImage x:x y:y.
   961                     self displayOpaqueForm:stringOrImage x:x y:y.
   962                     ^ self
   962                     ^ self
   963                 ]
   963                 ]
  1429 fetchDeviceResources
  1429 fetchDeviceResources
  1430     "fetch device colors, to avoid reallocation at redraw time"
  1430     "fetch device colors, to avoid reallocation at redraw time"
  1431 
  1431 
  1432     super fetchDeviceResources.
  1432     super fetchDeviceResources.
  1433 
  1433 
  1434     bgColor notNil ifTrue:[bgColor := bgColor onDevice:device].
  1434     bgColor notNil ifTrue:[bgColor := bgColor onDevice:self graphicsDevice].
  1435     fgColor notNil ifTrue:[fgColor := fgColor onDevice:device].
  1435     fgColor notNil ifTrue:[fgColor := fgColor onDevice:self graphicsDevice].
  1436 
  1436 
  1437     activeBgColor notNil ifTrue:[activeBgColor := activeBgColor onDevice:device].
  1437     activeBgColor notNil ifTrue:[activeBgColor := activeBgColor onDevice:self graphicsDevice].
  1438     activeFgColor notNil ifTrue:[activeFgColor := activeFgColor onDevice:device].
  1438     activeFgColor notNil ifTrue:[activeFgColor := activeFgColor onDevice:self graphicsDevice].
  1439 
  1439 
  1440     "Created: 13.1.1997 / 23:25:14 / cg"
  1440     "Created: 13.1.1997 / 23:25:14 / cg"
  1441 !
  1441 !
  1442 
  1442 
  1443 initCursor
  1443 initCursor
  1457 
  1457 
  1458     super initStyle.
  1458     super initStyle.
  1459 
  1459 
  1460     showSeparatingLines := DefaultSeparatingLines. "/ false.
  1460     showSeparatingLines := DefaultSeparatingLines. "/ false.
  1461     DefaultViewBackground notNil ifTrue:[
  1461     DefaultViewBackground notNil ifTrue:[
  1462         viewBackground := DefaultViewBackground onDevice:device
  1462         viewBackground := DefaultViewBackground onDevice:self graphicsDevice
  1463     ].
  1463     ].
  1464 
  1464 
  1465     DefaultForegroundColor notNil ifTrue:[
  1465     DefaultForegroundColor notNil ifTrue:[
  1466         fgColor := DefaultForegroundColor
  1466         fgColor := DefaultForegroundColor
  1467     ] ifFalse:[
  1467     ] ifFalse:[
  1474     ].
  1474     ].
  1475     onLevel := DefaultHilightLevel.
  1475     onLevel := DefaultHilightLevel.
  1476     offLevel := DefaultLevel.
  1476     offLevel := DefaultLevel.
  1477 
  1477 
  1478     self is3D ifTrue:[
  1478     self is3D ifTrue:[
  1479         device hasColors ifTrue:[
  1479         self graphicsDevice hasColors ifTrue:[
  1480             activeFgColor := Color name:'yellow'
  1480             activeFgColor := Color name:'yellow'
  1481         ] ifFalse:[
  1481         ] ifFalse:[
  1482             activeFgColor := White
  1482             activeFgColor := White
  1483         ].
  1483         ].
  1484         device hasGrayscales ifTrue:[
  1484         self graphicsDevice hasGrayscales ifTrue:[
  1485             activeBgColor := bgColor.
  1485             activeBgColor := bgColor.
  1486         ] ifFalse:[
  1486         ] ifFalse:[
  1487             activeBgColor := fgColor.
  1487             activeBgColor := fgColor.
  1488         ].
  1488         ].
  1489         topMargin := 2.
  1489         topMargin := 2.
  1527 !
  1527 !
  1528 
  1528 
  1529 initialize
  1529 initialize
  1530     super initialize.
  1530     super initialize.
  1531 
  1531 
  1532     font := font onDevice:device.
  1532     font := font onDevice:self graphicsDevice.
  1533     self origin:(0.0 @ 0.0)
  1533     self origin:(0.0 @ 0.0)
  1534          extent:(1.0 @ self preferredHeight)
  1534          extent:(1.0 @ self preferredHeight)
  1535 "/         extent:(1.0 @ (font height + (font descent * 2)  + topMargin)).
  1535 "/         extent:(1.0 @ (font height + (font descent * 2)  + topMargin)).
  1536 !
  1536 !
  1537 
  1537 
  1631 !
  1631 !
  1632 
  1632 
  1633 setMenuOrigins
  1633 setMenuOrigins
  1634     "adjust origins of menus when font changes"
  1634     "adjust origins of menus when font changes"
  1635 
  1635 
  1636     (font graphicsDevice == device) ifTrue:[
  1636     (font graphicsDevice == self graphicsDevice) ifTrue:[
  1637 	menus notNil ifTrue:[
  1637         menus notNil ifTrue:[
  1638 	    menus keysAndValuesDo:[:index :aMenu |
  1638             menus keysAndValuesDo:[:index :aMenu |
  1639 		aMenu notNil ifTrue:[
  1639                 aMenu notNil ifTrue:[
  1640 		    aMenu origin:((left + (self titleLenUpTo:index)) 
  1640                     aMenu origin:((left + (self titleLenUpTo:index)) 
  1641 				  @
  1641                                   @
  1642 				  (height + aMenu borderWidth))
  1642                                   (height + aMenu borderWidth))
  1643 		].
  1643                 ].
  1644 	    ]
  1644             ]
  1645 	]
  1645         ]
  1646     ]
  1646     ]
  1647 
  1647 
  1648     "Modified: 5.7.1996 / 17:55:08 / cg"
  1648     "Modified: 5.7.1996 / 17:55:08 / cg"
  1649 !
  1649 !
  1650 
  1650 
  1812 ! !
  1812 ! !
  1813 
  1813 
  1814 !PullDownMenu class methodsFor:'documentation'!
  1814 !PullDownMenu class methodsFor:'documentation'!
  1815 
  1815 
  1816 version
  1816 version
  1817     ^ '$Header: /cvs/stx/stx/libwidg/PullDownMenu.st,v 1.108 2013-08-31 17:19:38 cg Exp $'
  1817     ^ '$Header: /cvs/stx/stx/libwidg/PullDownMenu.st,v 1.109 2014-03-19 10:04:23 stefan Exp $'
  1818 !
  1818 !
  1819 
  1819 
  1820 version_CVS
  1820 version_CVS
  1821     ^ '$Header: /cvs/stx/stx/libwidg/PullDownMenu.st,v 1.108 2013-08-31 17:19:38 cg Exp $'
  1821     ^ '$Header: /cvs/stx/stx/libwidg/PullDownMenu.st,v 1.109 2014-03-19 10:04:23 stefan Exp $'
  1822 ! !
  1822 ! !
  1823 
  1823