The Inbox: Morphic-ct.1682.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: Morphic-ct.1682.mcz

commits-2
A new version of Morphic was added to project The Inbox:
http://source.squeak.org/inbox/Morphic-ct.1682.mcz

==================== Summary ====================

Name: Morphic-ct.1682
Author: ct
Time: 17 September 2020, 5:20:17.764813 pm
UUID: ae7e7e33-c789-ea41-a0d2-b81efd35d2da
Ancestors: Morphic-dtl.1681

Adds new #repositionOnExpand flag to CollapsedMorph. If set, the wrapped morph is repositioned using RealEstateAgent when uncollapsed. Also adds some world-agnostic (someone knowing a good Descartes joke for this?) instantiation methods with examples.

Will be used for Objectland.

=============== Diff against Morphic-dtl.1681 ===============

Item was added:
+ ----- Method: CollapsedMorph class>>createReplacementFor: (in category 'instance creation') -----
+ createReplacementFor: aMorph
+ "Create an instance of the receiver that encapsulates aMorph.
+
+ Usage:
+ (CollapsedMorph createReplacementFor: Morph new) openInHand
+ "
+
+ ^ self new
+ basicBeReplacementFor: aMorph;
+ setProperty: #repositionOnExpand toValue: true;
+ yourself!

Item was changed:
  ----- Method: CollapsedMorph class>>createReplacementFor:in: (in category 'instance creation') -----
  createReplacementFor: aMorph in: anOwner
+ "Create an instance of the receiver that encapsulates aMorph and is opened in anOwner.
+
+ Usage:
+ (CollapsedMorph createReplacementFor: Morph new in: World) centerWithWrappees: 100 @ 100
+ "
 
  ^ self new
  beReplacementFor: aMorph in: anOwner;
  yourself!

Item was added:
+ ----- Method: CollapsedMorph>>basicBeReplacementFor: (in category 'collapse/expand') -----
+ basicBeReplacementFor: aMorph
+ "Encapsulate aMorph into the receiver."
+
+ uncollapsedMorph := aMorph.
+
+ self setLabel: aMorph externalName.
+ self refreshWindowColor.
+ self collapseOrExpand.!

Item was changed:
  ----- Method: CollapsedMorph>>collapseOrExpand (in category 'resize/collapse') -----
  collapseOrExpand
  "Toggle the expand/collapsd state of the receiver.  If expanding, copy the window title back to the name of the expanded morph"
 
  | aWorld |
+ isCollapsed ifFalse: [^ super collapseOrExpand].
+
+ aWorld := self currentWorld.
+ uncollapsedMorph setProperty: #collapsedPosition toValue: self position.
+ self repositionOnExpand ifTrue: [
+ uncollapsedMorph bounds: (RealEstateAgent
+ initialFrameFor: uncollapsedMorph
+ initialExtent: uncollapsedMorph extent
+ world: aWorld)].
+ labelString ifNotNil: [uncollapsedMorph setNameTo: labelString].
+
+ mustNotClose := false. "We're not closing but expanding"
+ self delete.
+
+ aWorld
+ addMorphFront: uncollapsedMorph;
+ startSteppingSubmorphsOf: uncollapsedMorph.!
- isCollapsed
- ifTrue:
- [uncollapsedMorph setProperty: #collapsedPosition toValue: self position.
- labelString ifNotNil: [uncollapsedMorph setNameTo: labelString].
- mustNotClose := false. "We're not closing but expanding"
- self delete.
- (aWorld := self currentWorld) addMorphFront: uncollapsedMorph.
- aWorld startSteppingSubmorphsOf: uncollapsedMorph]
- ifFalse:
- [super collapseOrExpand]!

Item was added:
+ ----- Method: CollapsedMorph>>repositionOnExpand (in category 'accessing') -----
+ repositionOnExpand
+ "If true, the wrapped morph will be repositioned using RealEstateAgent when expanded the next time; otherwise, the former position will be kept (default). See #collapseOrExpand."
+
+ ^ self valueOfProperty: #repositionOnExpand ifAbsent: [false]!

Item was added:
+ ----- Method: CollapsedMorph>>repositionOnExpand: (in category 'accessing') -----
+ repositionOnExpand: aBoolean
+ "If true, the wrapped morph will be repositioned using RealEstateAgent when expanded the next time; otherwise, the former position will be kept (default). See #collapseOrExpand."
+
+ self setProperty: #repositionOnExpand toValue: aBoolean.!