MenuPanel.st
changeset 2003 732fbaf5864f
parent 2000 94bc3e5bba84
child 2004 cf701a027108
equal deleted inserted replaced
2002:d8a0fba7b75a 2003:732fbaf5864f
  1760     ].
  1760     ].
  1761 
  1761 
  1762 !
  1762 !
  1763 
  1763 
  1764 level:anInt
  1764 level:anInt
  1765     super level:anInt.
  1765     anInt ~~ level ifTrue:[
  1766     mustRearrange := true
  1766         super level:anInt.
       
  1767         mustRearrange := true
       
  1768     ]
  1767 !
  1769 !
  1768 
  1770 
  1769 rightArrow
  1771 rightArrow
  1770     ^ rightArrow
  1772     ^ rightArrow
  1771 !
  1773 !
  3313 !
  3315 !
  3314 
  3316 
  3315 fetchDeviceResources
  3317 fetchDeviceResources
  3316     "fetch device colors, to avoid reallocation at redraw time"
  3318     "fetch device colors, to avoid reallocation at redraw time"
  3317 
  3319 
  3318     |bw lvl|
       
  3319 
       
  3320     super fetchDeviceResources.
  3320     super fetchDeviceResources.
  3321 
  3321 
  3322     "/ thats a kludge - will be replaced by values from the styleSheet ...
  3322     "/ thats a kludge - will be replaced by values from the styleSheet ...
  3323     "/ (i.e. read menu.buttonActiveLevel & menu.buttonPassiveLevel)
  3323     "/ (i.e. read menu.buttonActiveLevel & menu.buttonPassiveLevel)
  3324 
  3324 
  3325     onLevel := styleSheet at:#'menu.hilightLevel' default:0.
  3325     onLevel := styleSheet at:#'menu.hilightLevel' default:0.
  3326 
       
  3327     self isPopUpView ifTrue:[
       
  3328         bw  := styleSheet at:#'popup.borderWidth' default:1.
       
  3329         lvl := styleSheet at:#'popup.level'       default:0.
       
  3330     ] ifFalse:[
       
  3331         bw  := styleSheet is3D ifFalse:[1] ifTrue:[0].
       
  3332     ].
       
  3333     self borderWidth:bw.
       
  3334     self level:lvl.
       
  3335 
  3326 
  3336     superMenu isNil ifTrue:[
  3327     superMenu isNil ifTrue:[
  3337         fgColor                   := DefaultForegroundColor         onDevice:device.
  3328         fgColor                   := DefaultForegroundColor         onDevice:device.
  3338         activeBgColor             := DefaultHilightBackgroundColor  onDevice:device.
  3329         activeBgColor             := DefaultHilightBackgroundColor  onDevice:device.
  3339         activeFgColor             := DefaultHilightForegroundColor  onDevice:device.
  3330         activeFgColor             := DefaultHilightForegroundColor  onDevice:device.
  3389     itemSpace        := DefaultItemSpace.
  3380     itemSpace        := DefaultItemSpace.
  3390     groupDividerSize := DefaultGroupDividerSize.
  3381     groupDividerSize := DefaultGroupDividerSize.
  3391     fitFirstPanel    := false.
  3382     fitFirstPanel    := false.
  3392     font             := MenuView defaultFont onDevice:device.
  3383     font             := MenuView defaultFont onDevice:device.
  3393 
  3384 
  3394     super level:(styleSheet is3D ifTrue:[1] ifFalse:[0]).
  3385     self updateLevelAndBorder.
  3395 !
  3386 !
  3396 
  3387 
  3397 initialize
  3388 initialize
  3398     "set default configuration
  3389     "set default configuration
  3399     "
  3390     "
  3451          shadowView must be realized before self"
  3442          shadowView must be realized before self"
  3452         self hiddenOnRealize:true.
  3443         self hiddenOnRealize:true.
  3453         super realize.
  3444         super realize.
  3454         self resize.
  3445         self resize.
  3455         self makeFullyVisible.
  3446         self makeFullyVisible.
       
  3447 "/        self mustRearrange.
  3456         shadowView notNil ifTrue:[
  3448         shadowView notNil ifTrue:[
  3457             shadowView realize.
  3449             shadowView realize.
  3458         ].
  3450         ].
  3459         self raise.
  3451         self raise.
  3460         self map.
  3452         self map.
  3508 "/         self doUngrab:(superMenu isNil)
  3500 "/         self doUngrab:(superMenu isNil)
  3509 "/    ].
  3501 "/    ].
  3510 
  3502 
  3511     super unmap.
  3503     super unmap.
  3512     shadowView notNil ifTrue:[shadowView unmap].
  3504     shadowView notNil ifTrue:[shadowView unmap].
       
  3505 !
       
  3506 
       
  3507 updateLevelAndBorder
       
  3508     "update level & border, when it is known if I am a popUpView"
       
  3509 
       
  3510     |bw lvl|
       
  3511 
       
  3512     self isPopUpView ifTrue:[
       
  3513         bw  := styleSheet at:#'popup.borderWidth' default:1.
       
  3514         lvl := styleSheet at:#'popup.level'       default:0.
       
  3515     ] ifFalse:[
       
  3516         bw  := styleSheet is3D ifFalse:[1] ifTrue:[0].
       
  3517     ].
       
  3518     self borderWidth:bw.
       
  3519     self level:lvl.
  3513 ! !
  3520 ! !
  3514 
  3521 
  3515 !MenuPanel methodsFor:'keyboard control'!
  3522 !MenuPanel methodsFor:'keyboard control'!
  3516 
  3523 
  3517 mnemonicViewNext:aKeyEvent
  3524 mnemonicViewNext:aKeyEvent
  3687 
  3694 
  3688 superMenu:aSuperMenu
  3695 superMenu:aSuperMenu
  3689     "set my supermenu from which i'am activated
  3696     "set my supermenu from which i'am activated
  3690     "
  3697     "
  3691     (superMenu := aSuperMenu) notNil ifTrue:[
  3698     (superMenu := aSuperMenu) notNil ifTrue:[
  3692         super font:(superMenu font)
  3699         super font:(superMenu font).
  3693     ].
  3700     ].
  3694 !
  3701 !
  3695 
  3702 
  3696 topMenu
  3703 topMenu
  3697     "returns the topMenu; the one having no superMenu
  3704     "returns the topMenu; the one having no superMenu
  3988 
  3995 
  3989 ! !
  3996 ! !
  3990 
  3997 
  3991 !MenuPanel methodsFor:'queries'!
  3998 !MenuPanel methodsFor:'queries'!
  3992 
  3999 
       
  4000 container:aView
       
  4001     super container:aView.
       
  4002     aView notNil ifTrue:[
       
  4003         "/ I am no longer a popUpView
       
  4004         self updateLevelAndBorder
       
  4005     ].
       
  4006 !
       
  4007 
  3993 containsPoint:aPoint
  4008 containsPoint:aPoint
  3994     "returns true if point is contained by the view
  4009     "returns true if point is contained by the view
  3995     "
  4010     "
  3996     ^ self containsPointX:(aPoint x) y:(aPoint y)
  4011     ^ self containsPointX:(aPoint x) y:(aPoint y)
  3997 !
  4012 !
  4120 
  4135 
  4121         ActiveHelp isActive ifTrue:[
  4136         ActiveHelp isActive ifTrue:[
  4122             hlp := ActiveHelp currentHelpListener.
  4137             hlp := ActiveHelp currentHelpListener.
  4123             hlp initiateHelpFor:self atX:nil y:nil now:true.
  4138             hlp initiateHelpFor:self atX:nil y:nil now:true.
  4124         ].
  4139         ].
  4125         realized ifTrue:[self rearrangeItems].
  4140         shown "realized" ifTrue:[self rearrangeItems].
  4126         selection selected:true.
  4141         selection selected:true.
  4127     ].
  4142     ].
  4128 !
  4143 !
  4129 
  4144 
  4130 selectionIndex
  4145 selectionIndex
  6258 ! !
  6273 ! !
  6259 
  6274 
  6260 !MenuPanel class methodsFor:'documentation'!
  6275 !MenuPanel class methodsFor:'documentation'!
  6261 
  6276 
  6262 version
  6277 version
  6263     ^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.270 2001-09-10 15:09:04 cg Exp $'
  6278     ^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.271 2001-09-13 14:12:49 cg Exp $'
  6264 ! !
  6279 ! !
  6265 MenuPanel initialize!
  6280 MenuPanel initialize!