From a3bcbf2afc7e656826099162dd7aa3ebd8daf4d5 Mon Sep 17 00:00:00 2001 From: Alain Plantec Date: Fri, 21 Jul 2023 00:28:05 +0200 Subject: [PATCH] plugged ToThemeChangedEvent --- src/Toplo/ToSandBox.class.st | 12 ++++++++++-- src/Toplo/ToWidgetSkin.class.st | 6 +++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/Toplo/ToSandBox.class.st b/src/Toplo/ToSandBox.class.st index 827cc419..8da09c20 100644 --- a/src/Toplo/ToSandBox.class.st +++ b/src/Toplo/ToSandBox.class.st @@ -1087,10 +1087,18 @@ ToSandBox class >> example_ToButtonWithDefaultDangerSkin [ ToSandBox class >> example_ToButtonWithDefaultSkin [ - | space button1 | + | space button1 themeSwitcher | space := BlSpace new. - + 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)). diff --git a/src/Toplo/ToWidgetSkin.class.st b/src/Toplo/ToWidgetSkin.class.st index 8004a4a2..3814bd95 100644 --- a/src/Toplo/ToWidgetSkin.class.st +++ b/src/Toplo/ToWidgetSkin.class.st @@ -15,7 +15,7 @@ ToWidgetSkin >> addLook: aLook [ self privateLook: aLook ] -{ #category : #'as yet unclassified' } +{ #category : #'event handling' } ToWidgetSkin >> elementAddedToSceneGraphEvent: anEvent [ self whenAddedToSpace: anEvent in: anEvent currentTarget @@ -27,7 +27,7 @@ ToWidgetSkin >> elementLookEvent: anEvent [ anEvent sendTo: self look ] -{ #category : #'as yet unclassified' } +{ #category : #'event handling' } ToWidgetSkin >> elementRemovedFromSceneGraphEvent: anEvent [ self whenRemovedFromSpace: anEvent in: anEvent currentTarget @@ -42,7 +42,7 @@ ToWidgetSkin >> elementSkinChangedEvent: anEvent [ { #category : #'api - accessing' } ToWidgetSkin >> eventsToHandle [ - ^ { BlElementAddedToSceneGraphEvent. BlElementRemovedFromSceneGraphEvent . ToElementLookEvent } + ^ { ToThemeChangedEvent. BlElementAddedToSceneGraphEvent. BlElementRemovedFromSceneGraphEvent . ToElementLookEvent } ] { #category : #accessing }