1118 |
1118 |
1119 |i newSubMenus| |
1119 |i newSubMenus| |
1120 |
1120 |
1121 i := self indexOf:indexOrName. |
1121 i := self indexOf:indexOrName. |
1122 i == 0 ifTrue:[^ nil]. |
1122 i == 0 ifTrue:[^ nil]. |
|
1123 |
1123 subMenus size < i ifTrue:[ |
1124 subMenus size < i ifTrue:[ |
1124 newSubMenus := Array new:(list size max:i). |
1125 newSubMenus := Array new:(list size max:i). |
1125 subMenus notNil ifTrue:[ |
1126 subMenus notNil ifTrue:[ |
1126 newSubMenus replaceFrom:1 with:subMenus. |
1127 newSubMenus replaceFrom:1 with:subMenus. |
1127 ]. |
1128 ]. |
1128 subMenus := newSubMenus. |
1129 subMenus := newSubMenus. |
1129 shown ifTrue:[ |
1130 shown ifTrue:[ |
1130 self resize |
1131 self resize |
1131 ] ifFalse:[ |
1132 ] ifFalse:[ |
1132 needResize := true |
1133 needResize := true |
1133 ] |
1134 ] |
1134 ]. |
1135 ]. |
1135 subMenus at:i put:aPopUpMenu |
1136 subMenus at:i put:aPopUpMenu. |
|
1137 |
|
1138 (receiver notNil and:[aPopUpMenu receiver isNil]) ifTrue:[ |
|
1139 aPopUpMenu receiver:receiver |
|
1140 ]. |
|
1141 |
|
1142 "Modified: 8.3.1996 / 14:42:51 / cg" |
1136 ! |
1143 ! |
1137 |
1144 |
1138 subMenuShown |
1145 subMenuShown |
1139 "return the currently visible submenu - or nil if there is none" |
1146 "return the currently visible submenu - or nil if there is none" |
1140 |
1147 |
1874 |
1888 |
1875 (x < 0 |
1889 (x < 0 |
1876 or:[x >= width |
1890 or:[x >= width |
1877 or:[y < 0 |
1891 or:[y < 0 |
1878 or:[y >= height]]]) ifTrue:[ |
1892 or:[y >= height]]]) ifTrue:[ |
1879 " |
1893 " |
1880 moved outside submenu, but not within self |
1894 moved outside submenu, but not within self |
1881 " |
1895 " |
1882 subMenuShown notNil ifTrue:[ |
1896 subMenuShown notNil ifTrue:[ |
1883 ^ self |
1897 ^ self |
1884 ]. |
1898 ]. |
1885 superMenu notNil ifTrue:[ |
1899 superMenu notNil ifTrue:[ |
1886 superMenu regainControl |
1900 superMenu regainControl |
1887 ]. |
1901 ]. |
1888 ]. |
1902 ]. |
1889 |
1903 |
1890 newSelection := self positionToSelectionX:x y:y. |
1904 newSelection := self positionToSelectionX:x y:y. |
1891 newSelection ~= selection ifTrue:[ |
1905 newSelection ~= selection ifTrue:[ |
1892 newSelection notNil ifTrue:[ |
1906 newSelection notNil ifTrue:[ |
1893 (enableFlags at:newSelection) ifFalse:[ |
1907 (enableFlags at:newSelection) ifFalse:[ |
1894 newSelection := nil |
1908 newSelection := nil |
1895 ] |
1909 ] |
1896 ]. |
1910 ]. |
1897 |
1911 |
1898 self selection:newSelection. |
1912 subMenuShown notNil ifTrue:[ |
1899 |
1913 self hideSubmenu. |
1900 subMenuShown notNil ifTrue:[ |
1914 ]. |
1901 self hideSubmenu. |
1915 |
1902 ]. |
1916 self selection:newSelection. |
1903 ]. |
1917 ]. |
1904 |
1918 |
1905 subMenu := nil. |
1919 subMenu := nil. |
1906 selection notNil ifTrue:[ |
1920 selection notNil ifTrue:[ |
1907 subMenus notNil ifTrue:[ |
1921 subMenus notNil ifTrue:[ |
1908 x > (width // 2) ifTrue:[ |
1922 x > (width // 2) ifTrue:[ |
1909 subMenu := (subMenus at:selection) |
1923 subMenu := (subMenus at:selection) |
1910 ] |
1924 ] |
1911 ] |
1925 ] |
1912 ]. |
1926 ]. |
1913 subMenu notNil ifTrue:[ |
1927 subMenu notNil ifTrue:[ |
1914 self showSubmenu:selection. |
1928 self showSubmenu:selection. |
1915 ] ifFalse:[ |
1929 ] ifFalse:[ |
1916 subMenuShown notNil ifTrue:[ |
1930 subMenuShown notNil ifTrue:[ |
1917 self hideSubmenu. |
1931 self hideSubmenu. |
1918 ]. |
1932 ]. |
1919 subMenuShown := nil |
1933 subMenuShown := nil |
1920 ] |
1934 ] |
|
1935 |
|
1936 "Modified: 8.3.1996 / 14:20:59 / cg" |
1921 ! |
1937 ! |
1922 |
1938 |
1923 showSubmenu:index |
1939 showSubmenu:index |
1924 "show subMenu at index" |
1940 "show subMenu at index" |
1925 |
1941 |