`MenuPanel`: renamed `#verticalLayout:` to `#hasVerticalLayout:` jv
authorJan Vrany <jan.vrany@labware.com>
Mon, 06 Sep 2021 14:23:55 +0100
branchjv
changeset 6258 74671fcd6bb4
parent 6257 8d5c522fb553
child 6259 e37c6e062e3e
`MenuPanel`: renamed `#verticalLayout:` to `#hasVerticalLayout:` to catch up with change made in 6effdd4ff48a.
MenuPanel.st
--- a/MenuPanel.st	Thu Aug 19 22:15:18 2021 +0100
+++ b/MenuPanel.st	Mon Sep 06 14:23:55 2021 +0100
@@ -145,7 +145,7 @@
 
     labels := #( 'foo' 'bar' 'baz' 'test' 'claus' ).
     mview level:2.
-    mview verticalLayout:false.
+    mview hasVerticalLayout:false.
     img := Image fromFile:'bitmaps/SBrowser.xbm'.
     lbs := Array with:'foo' with:'bar' with:img with:'baz' with:'test' with:'ludwig'.
     mview labels:lbs.
@@ -186,7 +186,7 @@
     top  := StandardSystemView extent:240@100.
     menu := MenuPanel in:top.
     menu labels:#( 'foo' 'Application' 'Clock' ).
-    menu verticalLayout:false.
+    menu hasVerticalLayout:false.
 
     menu subMenuAt:1 put:(MenuPanel labels:#( 'bar' 'baz' )).
     menu subMenuAt:2 put:(MenuPanel labels:#( 'foo' 'bar' 'baz' )).
@@ -279,7 +279,7 @@
               nil
          ) decodeAsLiteralArray.
 
-    menu verticalLayout:false.
+    menu hasVerticalLayout:false.
     Transcript showCR:(menu startUp).
                                                                                 [exEnd]
 
@@ -1831,13 +1831,13 @@
 
     currentFont := gc font.
     (aFont notNil and:[aFont ~= currentFont]) ifTrue:[
-	super font:aFont.
+        super font:aFont.
     ].
     ^ currentFont
 !
 
 suppressSeparatingLines
-    ^ self verticalLayout not
+    ^ self hasVerticalLayout not
     and:[ (styleSheet at:#'menu.suppressSeparatingLinesInToolbar' default:false) ] 
 ! !
 
@@ -1971,7 +1971,7 @@
     y := 0.
     groupDividerSize := self groupDividerSize.
 
-    self verticalLayout ifFalse:[
+    self hasVerticalLayout ifFalse:[
         items keysAndValuesDo:[:key :el| |eX eY|
             extent := el preferredExtent.
 
@@ -2092,7 +2092,7 @@
 
     stringOffsetX isNil ifTrue:[
         stringOffsetX := 0.
-        (self isPopUpView or:[self verticalLayout]) ifTrue:[
+        (self isPopUpView or:[self hasVerticalLayout]) ifTrue:[
             stringOffsetX := self font height + Item horizontalInset. 
             self do:[:el|
                 stringOffsetX := stringOffsetX max: el preferredExtent y.
@@ -2267,11 +2267,43 @@
     ^ false
 !
 
-fitFirstPanel:aState
-    "sets true if the first panel in the menu hierarchy must be fit
-     to the extent of its superView
-
-     NOT SUPPORTED"
+fitFirstPanel:aBoolean
+    "NOT SUPPORTED.
+     should return true if the first panel in the menu hierarchy must fit
+     to the extent of its superView"
+
+    "Modified (comment): / 04-02-2017 / 21:33:36 / cg"
+!
+
+hasVerticalLayout
+    "return true if the layout is vertical"
+    "horizontal: false"
+
+    verticalLayout isNil ifTrue:[
+        superMenu notNil ifTrue:[ 
+            verticalLayout := true 
+        ] ifFalse:[ 
+            verticalLayout := self isPopUpView 
+        ].
+    ].
+    ^ verticalLayout
+
+    "Modified: / 11-07-2018 / 09:56:45 / Claus Gittinger"
+!
+
+hasVerticalLayout:aBoolean
+    "set the layout: vertical( true ) or horizontal( false )"
+
+    aBoolean ~~ verticalLayout ifTrue:[
+        verticalLayout isNil ifTrue:[
+            verticalLayout := aBoolean
+        ] ifFalse:[
+            verticalLayout := aBoolean.
+            self mustRearrange.
+        ].
+    ].
+
+    "Modified (format): / 04-02-2017 / 21:33:58 / cg"
 !
 
 level:anInt
@@ -2328,26 +2360,20 @@
 !
 
 verticalLayout
-    "get the layout: vertical( true ) or horizontal( false )"
-
-    verticalLayout notNil ifTrue:[ ^ verticalLayout ].
-
-    superMenu notNil ifTrue:[ verticalLayout := true ]
-		    ifFalse:[ verticalLayout := self isPopUpView ].
-    ^ verticalLayout
-!
-
-verticalLayout:aState
-    "set the layout: vertical( true ) or horizontal( false )"
-
-    aState ~~ verticalLayout ifTrue:[
-	verticalLayout isNil ifTrue:[
-	    verticalLayout := aState
-	] ifFalse:[
-	    verticalLayout := aState.
-	    self mustRearrange.
-	].
-    ].
+    "return true if the layout is vertical"
+    "horizontal: false"
+
+    self obsoleteMethodWarning:'use hasVerticalLayout'.
+    ^ self hasVerticalLayout
+
+
+!
+
+verticalLayout:aBoolean
+    "set to true if the layout is vertical; false for horizontal"
+
+    self obsoleteMethodWarning:'use hasVerticalLayout:'.
+    ^ self hasVerticalLayout:aBoolean
 ! !
 
 !MenuPanel methodsFor:'accessing-style'!
@@ -2827,7 +2853,7 @@
     |
 
     size := items size.
-    isVertical := self verticalLayout.
+    isVertical := self hasVerticalLayout.
 
     isVertical ifTrue:[
         start := items findFirst:[:el| |l| l := el layout. l notNil and:[l bottom > y]].
@@ -2935,7 +2961,7 @@
     ].
 
     self isPopUpView ifFalse:[
-        self verticalLayout ifFalse:[
+        self hasVerticalLayout ifFalse:[
             aDirection == #NEXT ifTrue:[
                 icon := scrolling class iconScrollRightM    
             ] ifFalse:[
@@ -3015,7 +3041,7 @@
      start "{ Class:SmallInteger }"
     |
 
-    (self isPopUpView or:[self verticalLayout]) ifTrue:[
+    (self isPopUpView or:[self hasVerticalLayout]) ifTrue:[
         ^ self
     ].
 
@@ -3086,7 +3112,7 @@
 "/                                    tries to get uninitialized layout from second item.
 "/ This happens in a modal debugger!!
 "/    mustRearrange := false.
-    isVertical       := self verticalLayout.
+    isVertical       := self hasVerticalLayout.
     groupDividerSize := self groupDividerSize.
     isPopUpMenu      := self isPopUpView.
 
@@ -3243,7 +3269,7 @@
         (self hasScrollerAt:#PREV) ifTrue:[
             prvBound := self scrollerBoundsAt:#PREV.
 
-            self verticalLayout ifTrue:[
+            self hasVerticalLayout ifTrue:[
                 (mustDrawLeft := (prvBound bottom > y)) ifTrue:[
                     y0 := prvBound bottom.
                 ].
@@ -3257,7 +3283,7 @@
         (self hasScrollerAt:#NEXT) ifTrue:[
             nxtBound := self scrollerBoundsAt:#NEXT.
 
-            self verticalLayout ifTrue:[
+            self hasVerticalLayout ifTrue:[
                 (mustDrawRight := (nxtBound top < y1)) ifTrue:[
                     y1 := nxtBound top.
                 ]
@@ -3559,7 +3585,7 @@
 	].
 	layouts add:layout.
     ].
-    isVertical  := self verticalLayout.
+    isVertical  := self hasVerticalLayout.
     scrollBound := self scrollerBoundsAt:#NEXT.
 
     self rearrangeItems.
@@ -4004,7 +4030,7 @@
 	^ self
     ].
 
-    isVrt := self verticalLayout.
+    isVrt := self hasVerticalLayout.
 
     selection isNil ifTrue:[
 	(isVrt and:[aKey == #CursorDown]) ifTrue:[
@@ -4027,7 +4053,7 @@
      or:[(isVrt not and:[aKey == #CursorRight or:[aKey == #CursorLeft]])]
     ) ifTrue:[
 	selection isNil ifTrue:[
-	    (superMenu notNil and:[superMenu verticalLayout == isVrt]) ifTrue:[
+	    (superMenu notNil and:[superMenu hasVerticalLayout == isVrt]) ifTrue:[
 		^ superMenu handleCursorKey:aKey
 	    ].
 	    idx := 0.
@@ -4103,7 +4129,7 @@
 	superMenu isNil ifTrue:[
 	    self accept:nil
 	] ifFalse:[
-	    superMenu verticalLayout ~~ isVrt ifTrue:[
+	    superMenu hasVerticalLayout ~~ isVrt ifTrue:[
 		superMenu handleCursorKey:aKey
 	    ] ifFalse:[
 		superMenu selection hideSubmenu
@@ -4115,7 +4141,7 @@
     selection isNil ifTrue:[
 	superMenu isNil ifTrue:[^ self accept:nil].
 
-	superMenu verticalLayout ~~ isVrt ifTrue:[
+	superMenu hasVerticalLayout ~~ isVrt ifTrue:[
 	    superMenu handleCursorKey:aKey
 	] ifFalse:[
 	    (item := items findFirst:[:el| el canSelect]) notNil ifTrue:[
@@ -4133,7 +4159,7 @@
 	]
     ] ifFalse:[
 	superMenu notNil ifTrue:[
-	    superMenu verticalLayout ~~ isVrt ifTrue:[
+	    superMenu hasVerticalLayout ~~ isVrt ifTrue:[
 		superMenu handleCursorKey:aKey
 	    ]
 	] ifFalse:[
@@ -4678,7 +4704,7 @@
     ] ifFalse:[
         self hasExplicitExtent ifTrue:[
             (self width) == (superView width) ifTrue:[
-                self verticalLayout:false
+                self hasVerticalLayout:false
             ]
         ]
     ]
@@ -5436,7 +5462,7 @@
             item   := items detect:[:each|(each layout notNil and:[each isVisible])] ifNone:[^ false ].
             layout := item layout.
 
-          ^ self verticalLayout ifTrue:[ layout top  < margin]
+          ^ self hasVerticalLayout ifTrue:[ layout top  < margin]
                                ifFalse:[ layout left < margin]
         ].
         aDirection == #NEXT ifTrue:[
@@ -5444,7 +5470,7 @@
             item   := items detectLast:[:each|(each layout notNil and:[each isVisible])] ifNone:[^ false ].
             layout := item layout.
 
-          ^ self verticalLayout ifTrue:[ layout bottom > (height - margin)]
+          ^ self hasVerticalLayout ifTrue:[ layout bottom > (height - margin)]
                                ifFalse:[ layout right  > (width  - margin)]
         ].
     ].
@@ -5458,7 +5484,7 @@
 
     (mustRearrange or:[items size <= 1]) ifTrue:[^ false].
 
-    isVert := self verticalLayout.
+    isVert := self hasVerticalLayout.
 
     superView notNil ifTrue:[
 	((first := items first layout) isNil
@@ -5482,7 +5508,7 @@
     "answer the index of the first item shown (scrolling) or 0"
     items size == 0 ifTrue:[^ 0].
 
-    self verticalLayout ifTrue:[
+    self hasVerticalLayout ifTrue:[
         ^ items findFirst:[:each|(each layout notNil and:[each layout top >= 0 and:[each isVisible]])].
     ].
     ^ items findFirst:[:each|(each layout notNil and:[each layout left >= 0 and:[each isVisible]])].
@@ -5498,7 +5524,7 @@
     self hasScrollers ifFalse:[ ^ 0 ].
     bounds := self scrollerBoundsAt:aDirection.
 
-    self verticalLayout ifTrue:[
+    self hasVerticalLayout ifTrue:[
         min := bounds top.
         max := bounds bottom.
 
@@ -5533,7 +5559,7 @@
 
     items size == 0 ifTrue:[^ 0].
 
-    self verticalLayout ifTrue:[
+    self hasVerticalLayout ifTrue:[
         ^ items findLast:[:each|(each layout notNil and:[each layout bottom <= height and:[each isVisible]])].
     ].
     ^ items findLast:[:each|(each layout notNil and:[each layout right <= width and:[each isVisible]])].
@@ -5556,7 +5582,7 @@
     boundsPREV := self scrollerBoundsAt:#PREV.
     boundsNEXT := self scrollerBoundsAt:#NEXT.
 
-    isVertical := self verticalLayout.
+    isVertical := self hasVerticalLayout.
 
     isVertical ifTrue:[
 	boundsMin := boundsPREV bottom.
@@ -5668,7 +5694,7 @@
     index := self indexOfLastItemShown.
     index == 0 ifTrue:[^ self].
     
-    isVertical := self verticalLayout.
+    isVertical := self hasVerticalLayout.
     delta := isVertical ifTrue:[self height] ifFalse:[self width].
     delta := delta - 15. "/ bounds
 
@@ -5697,7 +5723,7 @@
     index := self indexOfFirstItemShown.
     index == 0 ifTrue:[^ self].
     
-    isVertical := self verticalLayout.
+    isVertical := self hasVerticalLayout.
     delta := isVertical ifTrue:[self height] ifFalse:[self width].
     delta := delta - 15. "/ bounds
 
@@ -5800,7 +5826,7 @@
     w := 15.
     h := 15.
 
-    self verticalLayout ifTrue:[
+    self hasVerticalLayout ifTrue:[
         aDirection == #NEXT ifTrue:[
             y := height - h.
         ].
@@ -6010,7 +6036,7 @@
 isVerticalLayout
     "returns true if vertical layout otherwise false( horizontal layout )"
 
-    ^ self verticalLayout
+    ^ self hasVerticalLayout
 !
 
 isViewWrapper
@@ -6079,7 +6105,7 @@
     ].
 
     delayedOpenSeconds := self delayInSecondsBeforeOpeningSubmenu.
-    "/ self verticalLayout ifFalse:[ delayedOpenSeconds := 0.1 ].
+    "/ self hasVerticalLayout ifFalse:[ delayedOpenSeconds := 0.1 ].
 
     oldSelect := selection.
     selection := nil.
@@ -6764,7 +6790,7 @@
 	subMenu superMenu:menuPanel.
 
 	menuItem horizontalLayout == true ifTrue:[
-	    subMenu verticalLayout:false
+	    subMenu hasVerticalLayout:false
 	].
 	subMenu menu:aSubMenu.
     ] ifFalse:[
@@ -6784,7 +6810,7 @@
 	    subMenu := widget.
 
 	    menuItem horizontalLayout == true ifTrue:[
-		subMenu verticalLayout:false
+		subMenu hasVerticalLayout:false
 	    ].
 	] ifFalse:[
 	    subMenu := MenuPanel new.
@@ -7089,7 +7115,7 @@
     x := x * 2.
     y := y * 2.
 
-    isVertical := menuPanel verticalLayout.
+    isVertical := menuPanel hasVerticalLayout.
 
     self isSeparator ifTrue:[
         s := self class separatorSize.
@@ -7462,7 +7488,7 @@
     "
     layout isNil ifTrue:[menuPanel rearrangeItems].
 
-    isVertical := menuPanel verticalLayout.
+    isVertical := menuPanel hasVerticalLayout.
 
     p := isVertical ifTrue:[layout topRight - 2] ifFalse:[layout bottomLeft].
     menuPanel isPopUpView ifTrue:[
@@ -8157,7 +8183,7 @@
     r := layout right.
     b := layout bottom.
 
-    menuPanel verticalLayout ifTrue:[
+    menuPanel hasVerticalLayout ifTrue:[
         lfSep ifTrue:[menuPanel displayLineFromX:l y:t-1 toX:r y:t-1].
         rtSep ifTrue:[menuPanel displayLineFromX:l y:b-1 toX:r y:b-1].
 
@@ -8200,7 +8226,7 @@
     left := layout left.
     top := layout top.
 
-    menuPanel verticalLayout ifTrue:[
+    menuPanel hasVerticalLayout ifTrue:[
         x0 := left  + HorizontalInset.
         x1 := layout right - HorizontalInset.
         y0 := top   - 1 + (layout height // 2).
@@ -9253,10 +9279,10 @@
     menusDevice := aMenu device.
 
     aDirection == #PREV ifTrue:[
-        aMenu verticalLayout ifTrue:[index := 3]    "/ 3 - 1 * 90  180
+        aMenu hasVerticalLayout ifTrue:[index := 3]    "/ 3 - 1 * 90  180
                             ifFalse:[index := 2]    "/ 2 - 1 * 90  90
     ] ifFalse:[
-        aMenu verticalLayout ifTrue:[index := 1]    "/ 1 - 1 * 90  0
+        aMenu hasVerticalLayout ifTrue:[index := 1]    "/ 1 - 1 * 90  0
                             ifFalse:[index := 4]    "/ 4 - 1 * 90  270
     ].