From 8b4e98e730d3ebed6b33a3b4b5757c0f619b76ac Mon Sep 17 00:00:00 2001 From: Alain Plantec Date: Fri, 21 Jul 2023 10:10:18 +0200 Subject: [PATCH] workin on skin installation, uninstallation --- src/Toplo/BlElement.extension.st | 3 +- src/Toplo/TToLabeledIcon.trait.st | 1 - src/Toplo/TToSkinable.trait.st | 1 + src/Toplo/ToButtonImageSkin.class.st | 2 +- src/Toplo/ToButtonLabelSkin.class.st | 3 +- src/Toplo/ToButtonMenuItem.class.st | 6 +++ src/Toplo/ToButtonSkin.class.st | 8 +++- src/Toplo/ToCheckableSkin.class.st | 3 +- src/Toplo/ToCheckboxImageSkin.class.st | 3 +- src/Toplo/ToImage.class.st | 3 +- src/Toplo/ToRadioImageSkin.class.st | 3 +- src/Toplo/ToSandBox.class.st | 49 +++++++++++-------- src/Toplo/ToToggleSkin.class.st | 59 +---------------------- src/Toplo/ToToggleTrackSkin.class.st | 4 +- src/Toplo/ToToogleTrackLook.class.st | 48 +++++++++++++++++-- src/Toplo/ToWidgetSkin.class.st | 66 ++++++++++++++++++-------- 16 files changed, 149 insertions(+), 113 deletions(-) diff --git a/src/Toplo/BlElement.extension.st b/src/Toplo/BlElement.extension.st index 4f5cbb85..d7e1fb3f 100644 --- a/src/Toplo/BlElement.extension.st +++ b/src/Toplo/BlElement.extension.st @@ -19,7 +19,8 @@ BlElement >> dispatchLookEvent: anEvent [ BlElement >> dispatchSkinChangedEvent [ self dispatchEvent: ToElementSkinChangedEvent new. - self childrenDo: [ :child | child dispatchSkinChangedEvent ] + self childrenDo: [ :child | child dispatchSkinChangedEvent ]. + ] diff --git a/src/Toplo/TToLabeledIcon.trait.st b/src/Toplo/TToLabeledIcon.trait.st index 5ed6518b..e9cbefa1 100644 --- a/src/Toplo/TToLabeledIcon.trait.st +++ b/src/Toplo/TToLabeledIcon.trait.st @@ -69,7 +69,6 @@ TToLabeledIcon >> labelFirst: aBoolean [ { #category : #'t - labeled icon' } TToLabeledIcon >> labelText: aText [ - self label ifNotNil: [ :lab | ^ lab text: aText ]. self label: (ToLabel text: aText) ] diff --git a/src/Toplo/TToSkinable.trait.st b/src/Toplo/TToSkinable.trait.st index 1dcb554a..e77fd1f5 100644 --- a/src/Toplo/TToSkinable.trait.st +++ b/src/Toplo/TToSkinable.trait.st @@ -46,6 +46,7 @@ TToSkinable >> withSkin: aSkin [ Toplo useLookAndFeel ifTrue: [ ^ self ]. privateSkin ifNotNil: [ self addEventHandler: privateSkin. + self requestLayout. self dispatchSkinChangedEvent ] ] diff --git a/src/Toplo/ToButtonImageSkin.class.st b/src/Toplo/ToButtonImageSkin.class.st index b825ad2e..6b96fd2a 100644 --- a/src/Toplo/ToButtonImageSkin.class.st +++ b/src/Toplo/ToButtonImageSkin.class.st @@ -23,8 +23,8 @@ ToButtonImageSkin >> buttonType: aButtonType [ ToButtonImageSkin >> onSkinInstalledIn: anElement [ | iconLook | + super onSkinInstalledIn: anElement. iconLook := self buttonType iconLookIn: anElement. self addLook: iconLook. - super onSkinInstalledIn: anElement ] diff --git a/src/Toplo/ToButtonLabelSkin.class.st b/src/Toplo/ToButtonLabelSkin.class.st index 5514e871..80110953 100644 --- a/src/Toplo/ToButtonLabelSkin.class.st +++ b/src/Toplo/ToButtonLabelSkin.class.st @@ -24,12 +24,13 @@ ToButtonLabelSkin >> onSkinInstalledIn: anElement [ | labelLook attrBuilder | + super onSkinInstalledIn: anElement. attrBuilder := self textAttributesBuilderFromElement: anElement. labelLook := self buttonType labelLookIn: anElement. labelLook attrBuilder: attrBuilder. self addLook: labelLook. - super onSkinInstalledIn: anElement + ] diff --git a/src/Toplo/ToButtonMenuItem.class.st b/src/Toplo/ToButtonMenuItem.class.st index e13b077c..41a458ad 100644 --- a/src/Toplo/ToButtonMenuItem.class.st +++ b/src/Toplo/ToButtonMenuItem.class.st @@ -21,6 +21,12 @@ ToButtonMenuItem >> defaultDresser [ ^ ToBasicMenuItemDresser next: (ToButtonMenuItemDresser new) ] +{ #category : #'t - skin accessing' } +ToButtonMenuItem >> defaultSkin [ + + ^ ToButtonSkin new +] + { #category : #initialization } ToButtonMenuItem >> initialize [ diff --git a/src/Toplo/ToButtonSkin.class.st b/src/Toplo/ToButtonSkin.class.st index c3df217a..39bfaebb 100644 --- a/src/Toplo/ToButtonSkin.class.st +++ b/src/Toplo/ToButtonSkin.class.st @@ -7,6 +7,12 @@ Class { #category : #'Toplo-Widget-Button-Skins' } +{ #category : #'accessing - structure variables' } +ToButtonSkin class >> type: aButtonType [ + + ^ self new type: aButtonType +] + { #category : #'api - install/uninstall hook' } ToButtonSkin >> buttonIconChanged: anEvent [ @@ -56,8 +62,8 @@ ToButtonSkin >> eventsToHandle [ ToButtonSkin >> onSkinInstalledIn: anElement [ " must send to super ** after ** the look is initialize from type " + super onSkinInstalledIn: anElement. self type onSkinInstalled: self in: anElement. - super onSkinInstalledIn: anElement ] diff --git a/src/Toplo/ToCheckableSkin.class.st b/src/Toplo/ToCheckableSkin.class.st index 2d975d98..50ad394f 100644 --- a/src/Toplo/ToCheckableSkin.class.st +++ b/src/Toplo/ToCheckableSkin.class.st @@ -25,6 +25,7 @@ ToCheckableSkin >> indeterminateImageIn: anElement [ { #category : #'api - install/uninstall hook' } ToCheckableSkin >> onSkinInstalledIn: anElement [ + super onSkinInstalledIn: anElement. anElement spacingWidth: anElement toTheme paddingContentHorizontal / 2. anElement icon: (ToImage inner: (anElement isChecked ifTrue: [ self checkedImageIn: anElement ] @@ -35,7 +36,7 @@ ToCheckableSkin >> onSkinInstalledIn: anElement [ uncheckedImage: (self uncheckedImageIn: anElement); indeterminateImage: (self indeterminateImageIn: anElement); yourself). - super onSkinInstalledIn: anElement + ] { #category : #accessing } diff --git a/src/Toplo/ToCheckboxImageSkin.class.st b/src/Toplo/ToCheckboxImageSkin.class.st index 8c2c74d9..0976442f 100644 --- a/src/Toplo/ToCheckboxImageSkin.class.st +++ b/src/Toplo/ToCheckboxImageSkin.class.st @@ -9,6 +9,7 @@ ToCheckboxImageSkin >> onSkinInstalledIn: anElement [ | borderLook | + super onSkinInstalledIn: anElement. anElement geometry: (BlRoundedRectangleGeometry cornerRadius: 3). borderLook := ToBorderLook new initialPaint: anElement toTheme colorBorder; @@ -17,6 +18,6 @@ ToCheckboxImageSkin >> onSkinInstalledIn: anElement [ width: 1. self addLook: borderLook. - super onSkinInstalledIn: anElement + ] diff --git a/src/Toplo/ToImage.class.st b/src/Toplo/ToImage.class.st index 93b872b9..272c72ec 100644 --- a/src/Toplo/ToImage.class.st +++ b/src/Toplo/ToImage.class.st @@ -43,7 +43,8 @@ ToImage >> initialize [ super initialize. self fitContent. - self innerImage: self defaultInnerImage. + innerImage := self defaultInnerImage. + self addChild: innerImage. " I ** must be ** considered as a leaf of a UI element tree. Otherwise, click may not work on me. This is why my children are not allowed to manage mouse events. Related to https://github.com/plantec/Toplo/issues/41" self preventChildrenMouseEvents. self whenInnerImageChangedDo: [ :new :prev | diff --git a/src/Toplo/ToRadioImageSkin.class.st b/src/Toplo/ToRadioImageSkin.class.st index 75ffd13c..d6680486 100644 --- a/src/Toplo/ToRadioImageSkin.class.st +++ b/src/Toplo/ToRadioImageSkin.class.st @@ -9,6 +9,7 @@ ToRadioImageSkin >> onSkinInstalledIn: anElement [ | borderLook | + super onSkinInstalledIn: anElement. anElement geometry: (BlCircleGeometry new). borderLook := ToBorderLook new initialPaint: anElement toTheme colorBorder; @@ -17,6 +18,6 @@ ToRadioImageSkin >> onSkinInstalledIn: anElement [ width: 1. self addLook: borderLook. - super onSkinInstalledIn: anElement + ] diff --git a/src/Toplo/ToSandBox.class.st b/src/Toplo/ToSandBox.class.st index 8da09c20..66ac414e 100644 --- a/src/Toplo/ToSandBox.class.st +++ b/src/Toplo/ToSandBox.class.st @@ -1059,7 +1059,7 @@ ToSandBox class >> example_ToButtonWithDashedSkin [ space root addChild: button1. button1 labelText: 'Dashed button **'. - + space show. ^space @@ -1080,6 +1080,7 @@ ToSandBox class >> example_ToButtonWithDefaultDangerSkin [ space root when: BlElementAddedToSceneGraphEvent do: [ button1 labelText: 'Default danger button 3'. button1 iconImage: (ToThemeIcons iconSearchOutlined16x16) ]. + "button1 inspect." space show. ] @@ -1087,25 +1088,37 @@ ToSandBox class >> example_ToButtonWithDefaultDangerSkin [ ToSandBox class >> example_ToButtonWithDefaultSkin [ - | space button1 themeSwitcher | + | space button1 themeSwitcher skinSwitcher pane | space := BlSpace new. + pane := ToPane horizontal. + pane layout cellSpacing: 10. space root layout: (BlLinearLayout vertical cellSpacing: 10). - themeSwitcher := ToChoiceBox new. - themeSwitcher data addAll: { ToThemeLight. ToThemeDark }. - - themeSwitcher whenSelectedIndexChangedDo: [ space toTheme: themeSwitcher selectedData new ]. - themeSwitcher selectData: space toTheme class. - - space root addChild: themeSwitcher. - + button1 := ToButton new. button1 label: (ToLabel text: 'Primary button'). button1 icon: (ToImage new innerImage: (ToThemeIcons iconSearchOutlined16x16)). - space root addChild: button1. space root when: BlElementAddedToSceneGraphEvent do: [ button1 labelText: 'Primary button 3'. button1 iconImage: (ToThemeIcons iconSearchOutlined16x16) ]. + + skinSwitcher := ToChoiceBox new. + skinSwitcher data addAll: { ToButtonDefaultType. ToButtonLinkType. ToButtonPrimaryType. ToButtonTextType }. + + skinSwitcher whenSelectedIndexChangedDo: [ button1 withSkin: (ToButtonSkin type: skinSwitcher selectedData new) ]. + skinSwitcher selectData: button1 privateSkin type class. + + themeSwitcher := ToChoiceBox new. + themeSwitcher data addAll: { ToThemeLight. ToThemeDark }. + + themeSwitcher whenSelectedIndexChangedDo: [ space toTheme: themeSwitcher selectedData new ]. + themeSwitcher selectData: space toTheme class. + + pane addChild: themeSwitcher. + pane addChild: skinSwitcher. + space root addChild: pane. + space root addChild: button1. + space show. ] @@ -2206,9 +2219,6 @@ ToSandBox class >> example_toButtonOrientationChanger [ | but space iconImage count | but := ToButton new. - but layout cellSpacing: 4. - but padding: (BlInsets all: 3). - but border: (BlBorder paint: Color lightGray). but label: (ToLabel text:'Button' asRopedText bold). iconImage := BlElement new size: 20 @ 20; @@ -2227,9 +2237,6 @@ ToSandBox class >> example_toButtonOrientationChanger3 [ | but space iconImage count | but := ToButton new. - but columnWidth: 100. - but padding: (BlInsets all: 3). - but border: (BlBorder paint: Color lightGray). but label: (ToLabel text:'Button' asRopedText bold). iconImage := BlElement new size: 20 @ 20; @@ -2290,7 +2297,7 @@ ToSandBox class >> example_toButtonWithIconOnly [ ToSandBox class >> example_toButtonWithTextAndIconHorizontal [ | but space count | - but := ToButton new "cellSpacing: 2; padding: (BlInsets all: 4)". + but := ToButton new. but label: (ToLabel text: 'Button'). but iconImage: (BlElement new size: 60 @ 20; @@ -2300,9 +2307,10 @@ ToSandBox class >> example_toButtonWithTextAndIconHorizontal [ but layout cellSpacing: 10. count := 0. but when: BlClickEvent do: [ :event | count := count + 1. count traceCr ]. - "but whenClickedDo: [ :ann | but icon background: Color random ]." + but whenClickedDo: [ :ann | but icon background: Color random ]. space := BlSpace new. space root addChild: but. + but inspect. space show ] @@ -2310,7 +2318,7 @@ ToSandBox class >> example_toButtonWithTextAndIconHorizontal [ ToSandBox class >> example_toButtonWithTextAndIconHorizontal2 [ | but count | - but := ToButton new "cellSpacing: 2; padding: (BlInsets all: 4)". + but := ToButton new. but label: (ToLabel text: 'Button'). but iconImage: (BlElement new size: 60 @ 20; @@ -2320,7 +2328,6 @@ ToSandBox class >> example_toButtonWithTextAndIconHorizontal2 [ but layout cellSpacing: 10. count := 0. but when: BlClickEvent do: [ :event | count := count + 1. count traceCr ]. - "but whenClickedDo: [ :ann | but icon background: Color random ]." but openInInnerWindow ] diff --git a/src/Toplo/ToToggleSkin.class.st b/src/Toplo/ToToggleSkin.class.st index 1c07b2cd..a40775fe 100644 --- a/src/Toplo/ToToggleSkin.class.st +++ b/src/Toplo/ToToggleSkin.class.st @@ -4,71 +4,16 @@ Class { #category : #'Toplo-Widget-Button-Toggle-Skins' } -{ #category : #'api - install/uninstall hook' } -ToToggleSkin >> barWidthFromTrack: aToggleTrack [ - - | but onw offw bw | - - onw := 0. - offw := 0. - but := aToggleTrack switchButton. - bw := but width + but margin left + but margin right. - aToggleTrack switchBarOnElement ifNotNil: [ :o | onw := o width ]. - aToggleTrack switchBarOffElement ifNotNil: [ :o | offw := o width ]. - ^ bw + (onw max: offw) max: bw * 1.6 -] - -{ #category : #'api - install/uninstall hook' } -ToToggleSkin >> buttonIconChanged: anEvent [ - - anEvent currentTarget icon ifNil: [ ^ self ]. - -] - -{ #category : #'api - install/uninstall hook' } -ToToggleSkin >> buttonLabelChanged: anEvent [ - - anEvent currentTarget label ifNil: [ ^ self ]. - -] - { #category : #'api - install/uninstall hook' } ToToggleSkin >> onSkinInstalledIn: anElement [ + super onSkinInstalledIn: anElement. anElement spacingWidth: anElement toTheme paddingContentHorizontal / 2. - anElement geometry: (BlRoundedRectangleGeometry cornerRadius: (self trackBorderRadiusIn: anElement)). anElement padding: (BlInsets top: anElement toTheme paddingXS / 2 left: anElement toTheme paddingContentHorizontal bottom: anElement toTheme paddingXS / 2 right: anElement toTheme paddingContentHorizontal). - self setupTrackElementIn: anElement. - super onSkinInstalledIn: anElement -] - -{ #category : #'api - install/uninstall hook' } -ToToggleSkin >> setupTrackElementIn: anElement [ - " setup the track " - anElement switchButton size: (self switchButtonSizeIn: anElement). - anElement switchButton background: Color white. - anElement switchButton margin: (BlInsets top: 1 left: 3 bottom: 1 right: 3). - anElement track geometry: (BlRoundedRectangleGeometry cornerRadius: (self trackBorderRadiusIn: anElement)). - anElement track padding: (BlInsets all: 1). - anElement track withSkin: (ToToggleTrackSkin new toggleButton: anElement). - anElement whenLayoutedDoOnce: [ - anElement track width: (self barWidthFromTrack: anElement track)]. - -] - -{ #category : #accessing } -ToToggleSkin >> switchButtonSizeIn: anElement [ - - ^ 14 asPoint -] - -{ #category : #accessing } -ToToggleSkin >> trackBorderRadiusIn: anElement [ - - ^ 26 + anElement track withSkin: (ToToggleTrackSkin new toggleButton: anElement) ] diff --git a/src/Toplo/ToToggleTrackSkin.class.st b/src/Toplo/ToToggleTrackSkin.class.st index 1949a90b..1f92635e 100644 --- a/src/Toplo/ToToggleTrackSkin.class.st +++ b/src/Toplo/ToToggleTrackSkin.class.st @@ -10,7 +10,7 @@ Class { { #category : #'api - install/uninstall hook' } ToToggleTrackSkin >> onSkinInstalledIn: anElement [ - toggleButton := anElement parent. + super onSkinInstalledIn: anElement. self addLook: (ToBackgroundLook new initialBg: [ :e | toggleButton isChecked @@ -29,7 +29,7 @@ ToToggleTrackSkin >> onSkinInstalledIn: anElement [ animate: true; toggleButton: toggleButton; yourself). - super onSkinInstalledIn: anElement + ] { #category : #accessing } diff --git a/src/Toplo/ToToogleTrackLook.class.st b/src/Toplo/ToToogleTrackLook.class.st index 457021c0..8f3e6943 100644 --- a/src/Toplo/ToToogleTrackLook.class.st +++ b/src/Toplo/ToToogleTrackLook.class.st @@ -31,7 +31,21 @@ ToToogleTrackLook >> animationDeltaIn: anElement [ { #category : #accessing } ToToogleTrackLook >> animationDuration [ - ^ 250 milliSeconds + ^ 150 milliSeconds +] + +{ #category : #'event handling' } +ToToogleTrackLook >> barWidthFromTrack: aToggleTrack [ + + | but onw offw bw | + + onw := 0. + offw := 0. + but := aToggleTrack switchButton. + bw := but width + but margin left + but margin right. + aToggleTrack switchBarOnElement ifNotNil: [ :o | onw := o width ]. + aToggleTrack switchBarOffElement ifNotNil: [ :o | offw := o width ]. + ^ bw + (onw max: offw) max: bw * 1.6 ] { #category : #'event handling' } @@ -51,20 +65,32 @@ ToToogleTrackLook >> initialize [ { #category : #'event handling' } ToToogleTrackLook >> installAppearanceIn: anElement [ - toggleButton track slideToLeft. - self withoutAnimationWhile: [ self syncAppearanceIn: anElement ] + self withoutAnimationWhile: [ + anElement slideToLeft. + self syncAppearanceIn: anElement ] ] { #category : #'event handling' } ToToogleTrackLook >> installLookEvent: anEvent [ + self flag: 'The mutiple #whenLayoutedDoOnce: sends demonstrate that we need a skin specific space phase that will occur after layout phase'. + super installLookEvent: anEvent. installed ifTrue: [ ^ self ]. installed := true. anEvent elementDo: [ :e | - " Have to wait for the next layout to install the appearance " - toggleButton whenLayoutedDoOnce: [ self installAppearanceIn: e ] ] + e whenLayoutedDoOnce: [ + e switchButton size: (self switchButtonSizeIn: e). + e switchButton background: Color white. + e switchButton margin: (BlInsets top: 1 left: 3 bottom: 1 right: 3). + e geometry: (BlRoundedRectangleGeometry cornerRadius: (self trackBorderRadiusIn: e)). + e padding: (BlInsets all: 1). + + " Have to wait for the next layout to install the appearance " + e whenLayoutedDoOnce: [ + e width: (self barWidthFromTrack: e). + e whenLayoutedDoOnce: [ self installAppearanceIn: e ] ] ] ] ] { #category : #sliding } @@ -91,6 +117,12 @@ ToToogleTrackLook >> slideToRightWithAnimationIn: anElement [ anElement switchBar addAnimation: anim ] +{ #category : #'event handling' } +ToToogleTrackLook >> switchButtonSizeIn: anElement [ + + ^ 14 asPoint +] + { #category : #sliding } ToToogleTrackLook >> switchOffIn: anElement [ @@ -121,6 +153,12 @@ ToToogleTrackLook >> toggleButton: aToggleButton [ toggleButton := aToggleButton ] +{ #category : #'event handling' } +ToToogleTrackLook >> trackBorderRadiusIn: anElement [ + + ^ 26 +] + { #category : #'event handling' } ToToogleTrackLook >> withoutAnimationWhile: aBlock [ diff --git a/src/Toplo/ToWidgetSkin.class.st b/src/Toplo/ToWidgetSkin.class.st index 3814bd95..948b1136 100644 --- a/src/Toplo/ToWidgetSkin.class.st +++ b/src/Toplo/ToWidgetSkin.class.st @@ -2,7 +2,8 @@ Class { #name : #ToWidgetSkin, #superclass : #BlCustomEventHandler, #instVars : [ - 'look' + 'look', + 'installed' ], #category : #'Toplo-Core-Theme' } @@ -33,16 +34,49 @@ ToWidgetSkin >> elementRemovedFromSceneGraphEvent: anEvent [ self whenRemovedFromSpace: anEvent in: anEvent currentTarget ] -{ #category : #'event handling' } +{ #category : #'api - install/uninstall hook' } ToWidgetSkin >> elementSkinChangedEvent: anEvent [ - + self launchSkinUninstallationIn: anEvent target. + self launchSkinInstallationIn: anEvent target ] { #category : #'api - accessing' } ToWidgetSkin >> eventsToHandle [ - ^ { ToThemeChangedEvent. BlElementAddedToSceneGraphEvent. BlElementRemovedFromSceneGraphEvent . ToElementLookEvent } + ^ { ToThemeChangedEvent. ToElementSkinChangedEvent. BlElementAddedToSceneGraphEvent. BlElementRemovedFromSceneGraphEvent . ToElementLookEvent } +] + +{ #category : #initialization } +ToWidgetSkin >> initialize [ + + super initialize. + installed := false. + self privateLook: ToNullElementLook new. + +] + +{ #category : #'api - install/uninstall hook' } +ToWidgetSkin >> launchSkinInstallationIn: anElement [ + + installed ifTrue: [ ^ self ]. + installed := true. + self privateLook: ToNullElementLook new. + self onSkinInstalledIn: anElement. + + anElement whenLayoutedDoOnce: [ anElement dispatchLookEvent: ToInstallLookEvent new. anElement switchToState: ToInitialState new ]. + anElement requestLayout +] + +{ #category : #'api - install/uninstall hook' } +ToWidgetSkin >> launchSkinUninstallationIn: anElement [ + + installed ifFalse: [ ^ self ]. + anElement dispatchLookEvent: ToUninstallLookEvent new. + self onSkinUninstalledIn: anElement. + self privateLook: ToNullElementLook new. + installed := false. + ] { #category : #accessing } @@ -54,16 +88,14 @@ ToWidgetSkin >> look [ { #category : #'api - install/uninstall hook' } ToWidgetSkin >> onInstalledIn: anElement [ - super onInstalledIn: anElement. - self privateLook: ToNullElementLook new. - - + super onInstalledIn: anElement ] { #category : #'api - install/uninstall hook' } ToWidgetSkin >> onSkinInstalledIn: anElement [ + ] { #category : #'api - install/uninstall hook' } @@ -75,8 +107,8 @@ ToWidgetSkin >> onSkinUninstalledIn: anElement [ { #category : #'api - install/uninstall hook' } ToWidgetSkin >> onUninstalledIn: anElement [ - look := nil. - super onUninstalledIn: anElement + super onUninstalledIn: anElement. + look := nil ] { #category : #'private - accessing' } @@ -96,24 +128,20 @@ ToWidgetSkin >> removeLook: aLook [ { #category : #'event handling' } ToWidgetSkin >> themeChangedEvent: anEvent [ - self onSkinUninstalledIn: anEvent currentTarget. - self onSkinInstalledIn: anEvent currentTarget. - anEvent currentTarget dispatchLookEvent: ToInstallLookEvent new. - anEvent currentTarget whenLayoutedDoOnce: [ anEvent currentTarget switchToState: ToInitialState new ] + self launchSkinUninstallationIn: anEvent currentTarget. + self launchSkinInstallationIn: anEvent currentTarget ] { #category : #'api - install/uninstall hook' } ToWidgetSkin >> whenAddedToSpace: anEvent in: anElement [ - self onSkinInstalledIn: anElement. - anElement dispatchLookEvent: ToInstallLookEvent new. - anElement whenLayoutedDoOnce: [ anElement switchToState: ToInitialState new ] + self launchSkinInstallationIn: anElement + ] { #category : #'api - install/uninstall hook' } ToWidgetSkin >> whenRemovedFromSpace: anEvent in: anElement [ - anElement dispatchLookEvent: ToUninstallLookEvent new. - self onSkinUninstalledIn: anElement. + self launchSkinUninstallationIn: anElement ]