MenuPanel.st
changeset 2337 7f384db88273
parent 2332 7e98cc0c92b7
child 2339 4dd599296b9f
equal deleted inserted replaced
2336:9977d831bb08 2337:7f384db88273
    19 		lastActiveMenu enteredItem prevFocusView previousPointerGrab
    19 		lastActiveMenu enteredItem prevFocusView previousPointerGrab
    20 		previousKeyboardGrab relativeGrabOrigin hasImplicitGrap
    20 		previousKeyboardGrab relativeGrabOrigin hasImplicitGrap
    21 		scrollActivity rightArrowShadow rightArrow fgColor verticalLayout
    21 		scrollActivity rightArrowShadow rightArrow fgColor verticalLayout
    22 		showSeparatingLines showGroupDivider implicitGrabView
    22 		showSeparatingLines showGroupDivider implicitGrabView
    23 		lastPointerView openDelayedMenuBlock preferredWidth application
    23 		lastPointerView openDelayedMenuBlock preferredWidth application
    24 		originator'
    24 		originator centerItems'
    25 	classVariableNames:'InitialSelectionQuerySignal Images LigthenedImages'
    25 	classVariableNames:'InitialSelectionQuerySignal Images LigthenedImages'
    26 	poolDictionaries:''
    26 	poolDictionaries:''
    27 	category:'Views-Menus'
    27 	category:'Views-Menus'
    28 !
    28 !
    29 
    29 
   438      the ImageEditor may not be able to read the specification."
   438      the ImageEditor may not be able to read the specification."
   439 
   439 
   440     "
   440     "
   441      self iconRadioGroupDisabledOn inspect
   441      self iconRadioGroupDisabledOn inspect
   442      ImageEditor openOnClass:self andSelector:#iconRadioGroupDisabledOn
   442      ImageEditor openOnClass:self andSelector:#iconRadioGroupDisabledOn
       
   443      Icon flushCachedIcons
   443     "
   444     "
   444 
   445 
   445     <resource: #image>
   446     <resource: #image>
   446 
   447 
   447     ^Icon
   448     ^Icon
   448 	constantNamed:#'MenuPanel iconRadioGroupDisabledOn'
   449         constantNamed:#'MenuPanel class iconRadioGroupDisabledOn'
   449 	ifAbsentPut:[(Depth2Image new) width: 15; height: 15; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@AUP@@E@AP@DJ*Y@DY@Z(AH@@+AI@@FLR@@@#D @@H1H@@BLRP@A#AX@@#@Z$A(0A** 0@C@C0@@O?@@') ; colorMapFromArray:#[0 0 0 85 85 85 170 170 170 255 255 255]; mask:((Depth1Image new) width: 15; height: 15; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'A<@_<C?8_?1??O?:??+?>/?:??)?=G?4O< HL@_@') ; yourself); yourself]
   450         ifAbsentPut:[(Depth2Image new) width: 15; height: 15; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@AUP@@E@AP@DJ*Y@DYUZ(AIUU+AIUUVLRUUU#D%UUX1IUUVLRUUU#AYUU#@Z%U(0A** 0@C@C0@@O?@@') ; colorMapFromArray:#[0 0 0 85 85 85 170 170 170 255 255 255]; mask:((Depth1Image new) width: 15; height: 15; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'A<@_<C?8_?1??O?:??+?>/?:??)?=G?4O< HL@_@') ; yourself); yourself]
   450 !
   451 !
   451 
   452 
   452 iconRadioGroupOff
   453 iconRadioGroupOff
   453     "This resource specification was automatically generated
   454     "This resource specification was automatically generated
   454      by the ImageEditor of ST/X."
   455      by the ImageEditor of ST/X."
  1674     "get the button active level
  1675     "get the button active level
  1675     "
  1676     "
  1676     ^ styleSheet at:#'menuPanel.buttonPassiveLevel'
  1677     ^ styleSheet at:#'menuPanel.buttonPassiveLevel'
  1677 !
  1678 !
  1678 
  1679 
       
  1680 centerItems
       
  1681     ^ centerItems ? false
       
  1682 !
       
  1683 
       
  1684 centerItems:aBoolean
       
  1685     centerItems := aBoolean
       
  1686 !
       
  1687 
  1679 fitFirstPanel
  1688 fitFirstPanel
  1680     "gets true if the first panel in the menu hierarchy must be fit 
  1689     "gets true if the first panel in the menu hierarchy must be fit 
  1681      to the extent of its superView
  1690      to the extent of its superView
  1682 
  1691 
  1683      NOT SUPPORTED
  1692      NOT SUPPORTED
  6036         menuPanel paint:bg.
  6045         menuPanel paint:bg.
  6037         menuPanel fillRectangle:layout.
  6046         menuPanel fillRectangle:layout.
  6038     ].
  6047     ].
  6039 
  6048 
  6040     x := layout left + menuPanel buttonPassiveLevel + HorizontalButtonInset.
  6049     x := layout left + menuPanel buttonPassiveLevel + HorizontalButtonInset.
       
  6050     (menuPanel centerItems 
       
  6051     and:[drawObject isImage]) ifTrue:[
       
  6052         x := x + (layout width - menuPanel buttonPassiveLevel - HorizontalButtonInset - 1 - drawObject width // 2).
       
  6053     ].
  6041 
  6054 
  6042     isSelected ifFalse:[
  6055     isSelected ifFalse:[
  6043         "check whether button should be drawn selected; indicator or radio button"
  6056         "check whether button should be drawn selected; indicator or radio button"
  6044 
  6057 
  6045         indication notNil ifTrue:[
  6058         indication notNil ifTrue:[
  6214     mfont := menuPanel setFont:font.
  6227     mfont := menuPanel setFont:font.
  6215     fontAscent := menuPanel font ascent.
  6228     fontAscent := menuPanel font ascent.
  6216     menuPanel paint:fg.
  6229     menuPanel paint:fg.
  6217 
  6230 
  6218     y := layout top + (layout height - rawLabelExtent y // 2) + yOffset.
  6231     y := layout top + (layout height - rawLabelExtent y // 2) + yOffset.
  6219 
  6232 "/  menuPanel centerItems ifTrue:[self halt].
  6220     aLabel isArray ifFalse:[
  6233     aLabel isArray ifFalse:[
  6221 	aLabel isImageOrForm ifFalse:[
  6234         aLabel isImageOrForm ifFalse:[
  6222 	    y := y + fontAscent.
  6235             y := y + fontAscent.
  6223 	].
  6236         ].
  6224 	aLabel displayOn:menuPanel x:x y:y.
  6237         aLabel displayOn:menuPanel x:x y:y.
  6225     ] ifTrue:[
  6238     ] ifTrue:[
  6226 	aLabel do:[:el|
  6239         aLabel do:[:el|
  6227 	    el notNil ifTrue:[
  6240             el notNil ifTrue:[
  6228 		el isImageOrForm ifFalse:[
  6241                 el isImageOrForm ifFalse:[
  6229 		    y0 := y + fontAscent
  6242                     y0 := y + fontAscent
  6230 		] ifTrue:[
  6243                 ] ifTrue:[
  6231 		    y0 := y
  6244                     y0 := y
  6232 		].
  6245                 ].
  6233 		x0 := x + (rawLabelExtent x - (el widthOn:menuPanel) // 2).
  6246                 x0 := x + (rawLabelExtent x - (el widthOn:menuPanel) // 2).
  6234 		el displayOn:menuPanel x:x0 y:y0.
  6247                 el displayOn:menuPanel x:x0 y:y0.
  6235 		y := y + 1 + (el heightOn:menuPanel)
  6248                 y := y + 1 + (el heightOn:menuPanel)
  6236 	    ] ifFalse:[
  6249             ] ifFalse:[
  6237 		y := y + 3   "/ see #label:
  6250                 y := y + 3   "/ see #label:
  6238 	    ]
  6251             ]
  6239 	].
  6252         ].
  6240     ].
  6253     ].
  6241     menuPanel setFont:mfont
  6254     menuPanel setFont:mfont
  6242 !
  6255 !
  6243 
  6256 
  6244 drawSeparatingLines
  6257 drawSeparatingLines
  7322 ! !
  7335 ! !
  7323 
  7336 
  7324 !MenuPanel class methodsFor:'documentation'!
  7337 !MenuPanel class methodsFor:'documentation'!
  7325 
  7338 
  7326 version
  7339 version
  7327     ^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.341 2002-10-26 15:51:56 ca Exp $'
  7340     ^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.342 2002-10-29 09:42:26 cg Exp $'
  7328 ! !
  7341 ! !
  7329 
  7342 
  7330 MenuPanel initialize!
  7343 MenuPanel initialize!