MenuView.st
changeset 65 b33e4f3a264e
parent 63 f4eaf04d1eaf
child 70 14443a9ea4ec
equal deleted inserted replaced
64:c4e3323a5348 65:b33e4f3a264e
    30 
    30 
    31 MenuView comment:'
    31 MenuView comment:'
    32 COPYRIGHT (c) 1989 by Claus Gittinger
    32 COPYRIGHT (c) 1989 by Claus Gittinger
    33 	      All Rights Reserved
    33 	      All Rights Reserved
    34 
    34 
    35 $Header: /cvs/stx/stx/libwidg/MenuView.st,v 1.12 1994-11-17 14:38:13 claus Exp $
    35 $Header: /cvs/stx/stx/libwidg/MenuView.st,v 1.13 1994-11-21 16:45:34 claus Exp $
    36 '!
    36 '!
    37 
    37 
    38 !MenuView class methodsFor:'documentation'!
    38 !MenuView class methodsFor:'documentation'!
    39 
    39 
    40 copyright
    40 copyright
    51 "
    51 "
    52 !
    52 !
    53 
    53 
    54 version
    54 version
    55 "
    55 "
    56 $Header: /cvs/stx/stx/libwidg/MenuView.st,v 1.12 1994-11-17 14:38:13 claus Exp $
    56 $Header: /cvs/stx/stx/libwidg/MenuView.st,v 1.13 1994-11-21 16:45:34 claus Exp $
    57 "
    57 "
    58 !
    58 !
    59 
    59 
    60 documentation
    60 documentation
    61 "
    61 "
   408     list at:i put:aString.
   408     list at:i put:aString.
   409 
   409 
   410     "create onOff flags, if this label has a check-mark"
   410     "create onOff flags, if this label has a check-mark"
   411     (aString startsWith:'\c') ifTrue:[
   411     (aString startsWith:'\c') ifTrue:[
   412 	onOffFlags isNil ifTrue:[
   412 	onOffFlags isNil ifTrue:[
   413 	    onOffFlags := Array new:(list size) withAll:false
   413 	    onOffFlags := Array new:(list size)
   414 	] ifFalse:[
   414 	] ifFalse:[
   415 	    [onOffFlags size < list size] whileTrue:[
   415 	    [onOffFlags size < list size] whileTrue:[
   416 		onOffFlags := onOffFlags copyWith:false
   416 		onOffFlags := onOffFlags copyWith:nil 
   417 	    ]
   417 	    ]
   418 	].
   418 	].
   419 	onOffFlags at:i put:false
   419 	onOffFlags at:i put:false
   420     ].
   420     ].
   421     self recomputeSize
   421     self recomputeSize
   719 checkToggleAt:indexOrName put:aBoolean
   719 checkToggleAt:indexOrName put:aBoolean
   720     "set/clear a check-toggle"
   720     "set/clear a check-toggle"
   721 
   721 
   722     |index|
   722     |index|
   723 
   723 
   724     onOffFlags isNil ifTrue:[
       
   725 	onOffFlags := Array new:(list size) withAll:false
       
   726     ].
       
   727     index := self indexOf:indexOrName.
   724     index := self indexOf:indexOrName.
   728     index == 0 ifTrue:[^ self].
   725     index == 0 ifTrue:[^ self].
       
   726 
       
   727     onOffFlags isNil ifTrue:[
       
   728 	onOffFlags := Array new:(list size)
       
   729     ].
   729     onOffFlags at:index put:aBoolean.
   730     onOffFlags at:index put:aBoolean.
   730     shown ifTrue:[
   731     shown ifTrue:[
   731 	self redrawLine:index
   732 	self redrawLine:index
   732     ]
   733     ]
   733 !
   734 !
   876 
   877 
   877     |w h y x l check|
   878     |w h y x l check|
   878 
   879 
   879     l := self visibleLineToListLine:visLineNr.
   880     l := self visibleLineToListLine:visLineNr.
   880     onOffFlags isNil ifTrue:[
   881     onOffFlags isNil ifTrue:[
   881 	onOffFlags := Array new:(list size) withAll:false.
       
   882 	check := false
   882 	check := false
   883     ] ifFalse:[
   883     ] ifFalse:[
   884 	check := onOffFlags at:l.
   884 	check := (onOffFlags at:l) == true.
   885     ].
   885     ].
   886 
   886 
   887     w := font widthOf:'\c'.
   887     w := font widthOf:'\c'.
   888     h := font ascent.
       
   889 
   888 
   890     x := (self xOfCol:1 inVisibleLine:visLineNr) - leftOffset.
   889     x := (self xOfCol:1 inVisibleLine:visLineNr) - leftOffset.
   891     y := self yOfVisibleLine:visLineNr.
   890     y := self yOfVisibleLine:visLineNr.
   892 
   891 
   893     self paint:bg.
   892     self paint:bg.
   894     self fillRectangleX:x y:y width:w height:fontHeight.
   893     self fillRectangleX:x y:y width:w height:fontHeight.
   895     self paint:fg.
   894     self paint:fg.
   896 
   895 
   897     check ifTrue:[
   896     check ifTrue:[
       
   897 	h := font ascent.
   898 	self paint:checkColor.
   898 	self paint:checkColor.
   899 	self displayLineFromX:x 
   899 	self displayLineFromX:x 
   900 			    y:(y + (h // 2))
   900 			    y:(y + (h // 2))
   901 			  toX:(x + (w // 3))
   901 			  toX:(x + (w // 3))
   902 			    y:(y + h - 1).
   902 			    y:(y + h - 1).
  1203 buttonPress:button x:x y:y
  1203 buttonPress:button x:x y:y
  1204     self setSelectionForX:x y:y
  1204     self setSelectionForX:x y:y
  1205 !
  1205 !
  1206 
  1206 
  1207 buttonMotion:state x:x y:y
  1207 buttonMotion:state x:x y:y
  1208     self setSelectionForX:x y:y
  1208     state ~~ 0 ifTrue:[
       
  1209         self setSelectionForX:x y:y
       
  1210     ]
  1209 !
  1211 !
  1210 
  1212 
  1211 pointerLeave:state
  1213 pointerLeave:state
  1212     subMenuShown notNil ifTrue:[
  1214     subMenuShown notNil ifTrue:[
  1213 	^ self
  1215 	^ self