'From Small-Land 3.8-5976-0266 of 29 August 2004 [latest update: #5976] on 31 August 2004 at 4:40:12 pm'! "Change Set: WantsToBeTopmost-Refactor-dgd Date: 31 August 2004 Author: Diego Gomez Deck Generalization of the already implemented mechanism to promote flaps to topmost objects. This new method will allow other type of morphs but flaps to benefit and become topmost citizens. For instance, a DockingBarMorph like http://swiki.agro.uba.ar/small_land/uploads/234/menubar.png can share the benefit. " ! !Morph methodsFor: 'accessing' stamp: 'dgd 8/31/2004 16:21'! wantsToBeTopmost "Answer if the receiver want to be one of the topmost objects in its owner" ^ self isFlapOrTab! ! !Morph methodsFor: 'geometry' stamp: 'dgd 8/31/2004 16:22'! shiftSubmorphsBy: delta self shiftSubmorphsOtherThan: (submorphs select: [:m | m wantsToBeTopmost]) by: delta! ! !FlapTab methodsFor: 'show & hide' stamp: 'dgd 8/31/2004 16:25'! showFlap "Open the flap up" | thicknessToUse flapOwner | "19 sept 2000 - going for all paste ups <- raa note" flapOwner _ self pasteUpMorph. self referentThickness <= 0 ifTrue: [thicknessToUse _ lastReferentThickness ifNil: [100]. self orientation == #horizontal ifTrue: [referent height: thicknessToUse] ifFalse: [referent width: thicknessToUse]]. inboard ifTrue: [self stickOntoReferent]. "makes referent my owner, and positions me accordingly" referent pasteUpMorph == flapOwner ifFalse: [flapOwner accommodateFlap: self. "Make room if needed" flapOwner addMorphFront: referent. flapOwner startSteppingSubmorphsOf: referent. self positionReferent. referent adaptToWorld: flapOwner]. inboard ifFalse: [self adjustPositionVisAVisFlap]. flapShowing _ true. self pasteUpMorph hideFlapsOtherThan: self ifClingingTo: edgeToAdhereTo. flapOwner bringTopmostsToFront! ! !PasteUpMorph methodsFor: 'WiW support' stamp: 'dgd 8/31/2004 16:25'! addMorphInLayer: aMorph super addMorphInLayer: aMorph. aMorph wantsToBeTopmost ifFalse:[self bringTopmostsToFront].! ! !PasteUpMorph methodsFor: 'flaps' stamp: 'dgd 8/31/2004 16:27'! bringFlapTabsToFront self deprecated: 'Replaced by #bringTopmostsToFront'. (submorphs select:[:m| m wantsToBeTopmost]) do:[:m| self addMorphInLayer: m].! ! !PasteUpMorph methodsFor: 'flaps' stamp: 'dgd 8/31/2004 16:25'! bringTopmostsToFront (submorphs select:[:m| m wantsToBeTopmost]) do:[:m| self addMorphInLayer: m].! ! !PasteUpMorph methodsFor: 'flaps' stamp: 'dgd 8/31/2004 16:23'! deleteAllFlapArtifacts "self currentWorld deleteAllFlapArtifacts" self submorphs do:[:m | m wantsToBeTopmost ifTrue:[m delete]]! ! !PasteUpMorph methodsFor: 'misc' stamp: 'dgd 8/31/2004 16:23'! roundUpStrays self submorphsDo: [:m | (m wantsToBeTopmost) ifFalse: [m goHome. m isPlayfieldLike ifTrue: [m roundUpStrays]]]! ! !PasteUpMorph methodsFor: 'world menu' stamp: 'dgd 8/31/2004 16:25'! putUpWorldMenu: evt "Put up a menu in response to a click on the desktop, triggered by evt." | menu | self bringTopmostsToFront. evt isMouse ifTrue: [evt yellowButtonPressed ifTrue: [^ self yellowButtonClickOnDesktopWithEvent: evt]. evt shiftPressed ifTrue:[^ self findWindow: evt]]. "put up screen menu" menu _ self buildWorldMenu: evt. menu addTitle: Preferences desktopMenuTitle translated. menu popUpEvent: evt in: self. ^ menu! ! !PasteUpMorph methodsFor: 'world state' stamp: 'dgd 8/31/2004 16:23'! allNonFlapRelatedSubmorphs "Answer all non-window submorphs that are not flap-related" ^submorphs select: [:m | (m isSystemWindow) not and: [m wantsToBeTopmost not]]! ! !PasteUpMorph methodsFor: 'world state' stamp: 'dgd 8/31/2004 16:25'! installFlaps "Get flaps installed within the bounds of the receiver" Project current assureFlapIntegrity. self addGlobalFlaps. self localFlapTabs do: [:aFlapTab | aFlapTab adaptToWorld]. self assureFlapTabsFitOnScreen. self bringTopmostsToFront! ! !PasteUpMorph methodsFor: 'world state' stamp: 'dgd 8/31/2004 16:25'! restoreFlapsDisplay "Restore the display of flaps" (Flaps sharedFlapsAllowed and: [CurrentProjectRefactoring currentFlapsSuppressed not]) ifTrue: [Flaps globalFlapTabs do: [:aFlapTab | aFlapTab adaptToWorld]]. self localFlapTabs do: [:aFlapTab | aFlapTab adaptToWorld]. self assureFlapTabsFitOnScreen. self bringTopmostsToFront! !