Skip to content

Commit

Permalink
Some functions added
Browse files Browse the repository at this point in the history
  • Loading branch information
Lasse Steffen committed Jun 4, 2018
1 parent 40ce4f6 commit b72c92f
Show file tree
Hide file tree
Showing 19 changed files with 92 additions and 27 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
default properties
defaultWidth

^ 320
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
construction
add: aString target: aTarget selector: aSymbol arguments: aArgList

| item |
item := MDMenuItem new
text: aString;
target: aTarget;
actionSelector: aSymbol;
arguments: aArgList.
self addMorphBack: item.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
construction
add: aString target: aTarget selector: aSymbol arguments: aArgList position: aPosition

| item |
item := MDMenuItem new
text: aString;
target: aTarget;
actionSelector: aSymbol;
arguments: aArgList.
self addMorphBack: item.
item width: self width.
item bounds: (item bounds origin x @ (item bounds origin y + ((aPosition - 1) * item height)) corner:
item bounds corner x @ (item bounds corner y + ((aPosition - 1) * item height)))
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
construction
addLine

self flag: #refactor
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
initialization
addMenuItem: aPosition

| item |
item := MDMenuItem new.
item width: self width.
self addMorphBack: item.
item bounds: (item bounds origin x @ (item bounds origin y + ((aPosition - 1) * item height)) corner:
item bounds corner x @ (item bounds corner y + ((aPosition - 1) * item height)))
construction
addMenuItem: aMDMenuItemMorph
self addMorphBack: aMDMenuItemMorph

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
event handling
handlesMouseDown: evt

^ true
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
accessing
hasItems
"Answer if the receiver has menu items"
^ submorphs
anySatisfy: [:each | each isKindOf: MDMenuItem]
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ initialize
super initialize.
self updateBounds.
self hasADropShadow: true.
1 to: 5 do: [:x | self addMenuItem: x]
self initializeExample
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
initialization
initializeExample

1 to: 5 do: [:x | self add: 'Hey'
target: 'key'
selector: 'e'
arguments: 'e'
position: x.].

4 changes: 4 additions & 0 deletions packages/Material-Core.package/MDMenu.class/instance/items.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
items

^ submorphs select: [:m | m isKindOf: MDMenuItem ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
accessing
lastItem

submorphs reverseDo: [ :each |
(each isKindOf: MDMenuItem) ifTrue: [ ^each ] ].
^submorphs last
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
event handling
mouseDown: evt

(self fullContainsPoint: evt position)
ifFalse: [self delete]
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
numItems

^ self items size
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
accessing
updateBounds

self bounds: (self bounds origin extent: (self width @ self height))
self bounds: (self bounds origin extent: (self class defaultWidth @ self height))
4 changes: 0 additions & 4 deletions packages/Material-Core.package/MDMenu.class/instance/width.st

This file was deleted.

19 changes: 14 additions & 5 deletions packages/Material-Core.package/MDMenu.class/methodProperties.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,20 @@
"class" : {
"defaultBackgroundColor" : "LS 6/3/2018 16:57",
"defaultBorderRadius" : "LS 6/3/2018 17:08",
"defaultWidth" : "LS 6/3/2018 18:03",
"paddingY" : "LS 6/3/2018 17:11" },
"instance" : {
"addMenuItem" : "LS 6/3/2018 17:00",
"addMenuItem:" : "LS 6/3/2018 17:06",
"add:target:selector:arguments:" : "LS 6/3/2018 18:09",
"add:target:selector:arguments:position:" : "LS 6/4/2018 08:29",
"addLine" : "LS 6/4/2018 08:23",
"addMenuItem:" : "LS 6/3/2018 18:22",
"handlesMouseDown:" : "LS 6/3/2018 18:16",
"hasItems" : "LS 6/4/2018 08:24",
"height" : "LS 6/3/2018 16:58",
"initialize" : "LS 6/3/2018 17:55",
"updateBounds" : "LS 6/3/2018 16:57",
"width" : "LS 6/3/2018 16:59" } }
"initialize" : "LS 6/4/2018 08:27",
"initializeExample" : "LS 6/4/2018 08:28",
"items" : "LS 6/4/2018 08:24",
"lastItem" : "LS 6/4/2018 08:25",
"mouseDown:" : "LS 6/3/2018 18:17",
"numItems" : "LS 6/4/2018 08:30",
"updateBounds" : "LS 6/3/2018 18:03" } }
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
defaultBorderRadius

^ 0
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"class" : {
"defaultBorderRadius" : "LS 6/3/2018 18:04",
"defaultHeight" : "LS 6/3/2018 17:12",
"defaultText" : "LS 6/3/2018 17:22",
"defaultTextColor" : "LS 6/3/2018 17:09" },
Expand Down

0 comments on commit b72c92f

Please sign in to comment.