[Cuis-dev] Menu item icons adjustment

Mariano Montone marianomontone at gmail.com
Mon Feb 1 11:29:28 PST 2021


This just adds a 3px space between the menu item icon and the menu item
label, in MenuMorphs.

I think menus look better like this; there's not enough space in between
currently.

Cheers,

Mariano
-------------- next part --------------
'From Cuis 5.0 [latest update: #4528] on 1 February 2021 at 12:45:25 pm'!

!MenuItemMorph methodsFor: 'drawing' stamp: 'MM 2/1/2021 12:45:05'!
drawOn: aCanvas 
	| stringColor leftEdge magnifiedIcon |

	stringColor _ color.
	isSelected & isEnabled
		ifTrue: [
			aCanvas fillRectangle: self morphLocalBounds color: Theme current menuHighlight].
	leftEdge _ 0.

	self hasMarker ifTrue: [
		leftEdge _ leftEdge + submorphs first morphWidth + 8 ].

	icon ifNotNil: [
		magnifiedIcon _ self magnifiedIcon.
		aCanvas image: magnifiedIcon at: leftEdge+1 @ (magnifiedIcon height *1//10).
		leftEdge _ magnifiedIcon width *12//10 + leftEdge + 3].

	aCanvas
		drawString: contents
		at: leftEdge @ 1
		font: self fontToUse
		color: stringColor.
	subMenu ifNotNil: [
		aCanvas
			image: self class subMenuMarker
			at: extent x - 8 @ (extent y - self class subMenuMarker height // 2) ]! !


More information about the Cuis-dev mailing list