Grafoscopio/src/Grafoscopio/SpSquareButton.class.st

53 lines
1.0 KiB
Smalltalk

Class {
#name : #SpSquareButton,
#superclass : #SpPresenter,
#instVars : [
'button',
'parent'
],
#category : #'Grafoscopio-New-UI'
}
{ #category : #specs }
SpSquareButton class >> defaultSpec [
^ SpBoxLayout newVertical
add: (SpBoxLayout newHorizontal add: #button width: 50; yourself) height: 50;
yourself
]
{ #category : #initialization }
SpSquareButton >> action: anAction [
button
action: [ :state |
state
ifTrue: [ parent buttons
reject: [ :b | b = self ]
thenDo: [ :b | b toggleOff ].
anAction cull: state ]
ifFalse: [ ] ]
]
{ #category : #initialization }
SpSquareButton >> icon: icon [
button icon: icon
]
{ #category : #initialization }
SpSquareButton >> initializeWidgets [
super initializeWidgets.
button := self newToggleButton
extent: 90 @ 50;
color: Color transparent;
yourself
]
{ #category : #'as yet unclassified' }
SpSquareButton >> parent: aSpSidebar [
parent := aSpSidebar
]
{ #category : #initialization }
SpSquareButton >> toggleOff [
button state: false.
]