[squeak-dev] The Trunk: Morphic-kb.242.mcz
commits at source.squeak.org
commits at source.squeak.org
Sat Nov 21 03:13:21 UTC 2009
Andreas Raab uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-kb.242.mcz
==================== Summary ====================
Name: Morphic-kb.242
Author: kb
Time: 20 November 2009, 2:30:38 am
UUID: 75fcbe2b-bc23-8f4c-8dcb-ba69f6848820
Ancestors: Morphic-kb.241
- Refactored updating menus:
- Removed subMenuUpdater from MenuItemMorph
- Hijacked UpdatingMenuMorph
- Added #updateMenu to MenuMorph with an empty body
- Added updateMenu call to activation methods:
- UpdatingMenuMorph >> activate:
- DockingBarMorph >> activeSubmenu:
- MenuMorph >> activeSubmenu:
- Changed MenuItemMorph updating submenu mechanism
- Poked with Windows menu
=============== Diff against Morphic-kb.241 ===============
Item was added:
+ ----- Method: MenuItemMorph>>addUpdatingSubMenu: (in category 'accessing') -----
+ addUpdatingSubMenu: aBlock
+
+ subMenu := UpdatingMenuMorph new.
+ subMenu updater: aBlock updateSelector: #value:.
+ self changed.
+ !
Item was changed:
StringMorph subclass: #MenuItemMorph
+ instanceVariableNames: 'isEnabled subMenu isSelected target selector arguments icon lastMousePosition'
- instanceVariableNames: 'isEnabled subMenu isSelected target selector arguments icon lastMousePosition subMenuUpdater'
classVariableNames: 'SubMenuMarker'
poolDictionaries: ''
category: 'Morphic-Menus'!
!MenuItemMorph commentStamp: '<historical>' prior: 0!
I represent an item in a menu.
Instance variables:
isEnabled <Boolean> True if the menu item can be executed.
subMenu <MenuMorph | nil> The submenu to activate automatically when the user mouses over the item.
isSelected <Boolean> True if the item is currently selected.
target <Object> The target of the associated action.
selector <Symbol> The associated action.
arguments <Array> The arguments for the associated action.
icon <Form | nil> An optional icon form to be displayed to my left.
If I have a dynamic marker, created by strings like <yes> or <no> in my contents, it will be installed as a submorph.!
Item was changed:
----- Method: TheWorldMainDockingBar>>windowMenuFor:on: (in category 'submenu - windows') -----
windowMenuFor: window on: menu
menu
addItem: [ :item |
item
contents: 'Close';
action: [ window delete ] ];
addItem: [ :item |
item
+ contents: 'Toggle Full Screen';
+ action: [ window expandBoxHit ] ]!
- contents: 'Full Screen';
- action: [ window fullScreen ] ]!
Item was added:
+ ----- Method: UpdatingMenuMorph>>activate: (in category 'as yet unclassified') -----
+ activate: evt
+ "Receiver should be activated; e.g., so that control passes correctly."
+
+ self updateMenu.
+ evt hand newMouseFocus: self.!
Item was changed:
----- Method: MenuItemMorph>>select: (in category 'selecting') -----
select: evt
self isSelected: true.
- self updateSubMenu.
owner activeSubmenu: subMenu.
subMenu ifNotNil: [
subMenu delete.
subMenu
popUpAdjacentTo: self adjacentTo
forHand: evt hand
from: self.
subMenu selectItem: nil event: evt].!
Item was changed:
----- Method: TheWorldMainDockingBar>>jumpToProjectMenuItemOn: (in category 'submenu - projects') -----
jumpToProjectMenuItemOn: menu
menu addItem: [ :item |
item
contents: 'Jump To Project' translated;
icon: MenuIcons smallForwardIcon;
+ addUpdatingSubMenu: [ :subMenu |
- subMenuUpdater: [ :subMenu |
subMenu defaultTarget: Project.
Project buildJumpToMenu: subMenu ] ]!
Item was changed:
----- Method: MenuMorph>>activeSubmenu: (in category 'control') -----
activeSubmenu: aSubmenu
+ activeSubMenu ifNotNil: [
+ activeSubMenu delete ].
- activeSubMenu
- ifNotNil: [activeSubMenu delete].
activeSubMenu := aSubmenu.
+ activeSubMenu ifNotNil: [
+ activeSubMenu updateMenu.
+ activeSubMenu activatedFromDockingBar: nil. ]!
- aSubmenu
- ifNotNil: [
- activeSubMenu activatedFromDockingBar: nil.
- ]!
Item was added:
+ ----- Method: MenuMorph>>updateMenu (in category 'update') -----
+ updateMenu
+ " Do nothing "!
Item was changed:
----- Method: TheWorldMainDockingBar>>windowsMenuOn: (in category 'construction') -----
windowsMenuOn: aDockingBar
aDockingBar addItem: [ :item |
item
contents: 'Windows' translated;
+ addUpdatingSubMenu: [ :menu |
- subMenuUpdater: [ :menu |
self listWindowsOn: menu ] ]
!
Item was changed:
----- Method: DockingBarMorph>>activeSubmenu: (in category 'control') -----
activeSubmenu: aSubmenu
activeSubMenu isNil
ifFalse: [activeSubMenu delete].
activeSubMenu := aSubmenu.
aSubmenu isNil
ifTrue: [^ self].
+ activeSubMenu updateMenu.
- ""
activeSubMenu selectItem: nil event: nil.
MenuIcons decorateMenu: activeSubMenu.
activeSubMenu activatedFromDockingBar: self.
activeSubMenu borderColor: self borderColor.
activeSubMenu beSticky.
activeSubMenu resistsRemoval: true.
activeSubMenu removeMatchString.!
Item was changed:
----- Method: TheWorldMainDockingBar>>listWindowsOn: (in category 'submenu - windows') -----
listWindowsOn: menu
| expanded |
expanded := SystemWindow windowsIn: World satisfying: [ :w | w isCollapsed not ].
expanded ifEmpty: [
menu addItem: [ :item |
item
contents: 'No open Windows' translated;
isEnabled: false;
action: [ ] ] ].
expanded do: [ :each |
menu addItem: [ :item |
item
contents: each label;
icon: (self colorIcon: each paneColor);
+ addUpdatingSubMenu: [ :subMenu | self windowMenuFor: each on: subMenu ];
- subMenuUpdater: [ :subMenu | self windowMenuFor: each on: subMenu ];
action: [ each activateAndForceLabelToShow ] ] ].!
Item was removed:
- ----- Method: MenuItemMorph>>subMenuUpdater: (in category 'accessing') -----
- subMenuUpdater: aBlock
-
- subMenuUpdater := aBlock.
- self updateSubMenu.
- self changed.
- !
Item was removed:
- ----- Method: MenuItemMorph>>updateSubMenu (in category 'selecting') -----
- updateSubMenu
-
- | menu |
- subMenuUpdater ifNil: [^self ].
- menu := MenuMorph new.
- subMenuUpdater value: menu.
- self subMenu: menu!
More information about the Squeak-dev
mailing list
|