The Inbox: Morphic-ct.1774.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.1774.mcz

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

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

Name: Morphic-ct.1774
Author: ct
Time: 15 June 2021, 6:50:38.559902 pm
UUID: f5614a67-386a-ee4c-9683-44b338df60dd
Ancestors: Morphic-mt.1773

Allows models to honor the currently hovered column position in a PluggableMultiColumnListMorph for mouse actions such as tool-tips or double-click events.

Usage examples:

        multiColumnList getHelpSelector: #helpAtRow:atColumn:.
        multiColumnList doubleClickSelector: #doubleClickColumn:.

=============== Diff against Morphic-mt.1773 ===============

Item was changed:
  PluggableListMorph subclass: #PluggableMultiColumnListMorph
+ instanceVariableNames: 'listMorphs hoverColumn'
- instanceVariableNames: 'listMorphs'
  classVariableNames: ''
  poolDictionaries: ''
  category: 'Morphic-Pluggable Widgets'!
 
  !PluggableMultiColumnListMorph commentStamp: '<historical>' prior: 0!
  This morph can be used to show a list having multiple columns,  The columns are self width sized to make the largest entry in each list fit.  In some cases the pane may then be too narrow.
 
  Use it like a regular PluggableListMorph except pass in an array of lists instead of a single list.
 
  There are base assumptions made here that each list in the array of lists is the same size.
 
  Also, the highlight color for the selection is easy to modify in the #highlightSelection method.  I used blue
  when testing just to see it work.!

Item was added:
+ ----- Method: PluggableMultiColumnListMorph>>balloonText (in category 'accessing') -----
+ balloonText
+
+ | columnIndex modelIndex selector |
+ selector := self getHelpSelector ifNil: [^ super balloonText].
+ (self model respondsTo: selector) ifFalse: [^ nil].
+
+ modelIndex := self modelIndexFor: self hoverRow.
+ modelIndex > 0 ifFalse: [^ nil].
+ columnIndex := self hoverColumn.
+ columnIndex > 0 ifFalse: [^ nil].
+ ^ self model perform: selector withEnoughArguments: {modelIndex. columnIndex}!

Item was added:
+ ----- Method: PluggableMultiColumnListMorph>>columnAtLocation: (in category 'accessing - items') -----
+ columnAtLocation: aPoint
+ "Return the index of the column at the given point or 0 if outside"
+
+ | pointInListMorphCoords |
+ pointInListMorphCoords := (self scroller transformFrom: self) transform: aPoint.
+
+ ^ listMorphs findFirst: [:listMorph |
+ pointInListMorphCoords x between: listMorph left and: listMorph right]!

Item was added:
+ ----- Method: PluggableMultiColumnListMorph>>doubleClick: (in category 'event handling') -----
+ doubleClick: event
+
+ | rowIndex columnIndex |
+ doubleClickSelector ifNil: [^ super doubleClick: event].
+
+ rowIndex := self rowAtLocation: event position.
+ rowIndex = 0 ifTrue: [^ super doubleClick: event].
+ columnIndex := self columnAtLocation: event position.
+ "selectedMorph ifNil: [self setSelectedMorph: aMorph]."
+ ^ self model perform: doubleClickSelector withEnoughArguments: {columnIndex}!

Item was added:
+ ----- Method: PluggableMultiColumnListMorph>>handleMouseMove: (in category 'events-processing') -----
+ handleMouseMove: anEvent
+
+ anEvent wasHandled ifTrue: [^ self].
+
+ super handleMouseMove: anEvent.
+
+ self hoverColumn: (self columnAtLocation: anEvent position).!

Item was added:
+ ----- Method: PluggableMultiColumnListMorph>>hoverColumn (in category 'accessing') -----
+ hoverColumn
+
+ ^ hoverColumn ifNil: [0]!

Item was added:
+ ----- Method: PluggableMultiColumnListMorph>>hoverColumn: (in category 'accessing') -----
+ hoverColumn: viewIndex
+
+ hoverColumn := viewIndex.
+
+ self wantsBalloon ifTrue: [
+ self activeHand
+ removePendingBalloonFor: self;
+ triggerBalloonFor: self after: self balloonHelpDelayTime].!

Item was changed:
  ----- Method: PluggableMultiColumnListMorph>>hoverRow: (in category 'accessing') -----
  hoverRow: viewIndex
 
  hoverRow = viewIndex ifTrue: [^ self].
+ hoverRow = 0 ifTrue: [self hoverColumn: 0].
  listMorphs do: [:listMorph |
  listMorph rowChanged: hoverRow with: viewIndex].
  super hoverRow: viewIndex.!