Skip to content

Commit

Permalink
+ ToImportedIconProvider>>innerImageNamed: changed ToTheme>>defaultTo…
Browse files Browse the repository at this point in the history
…kenProperties to use #innerImageNamed: instead of #iconNamed:
  • Loading branch information
plantec committed Feb 9, 2025
1 parent e82f6b3 commit 66014d9
Show file tree
Hide file tree
Showing 12 changed files with 162 additions and 61 deletions.
37 changes: 37 additions & 0 deletions src/Toplo-Examples/ToSandBox.class.st

Large diffs are not rendered by default.

24 changes: 18 additions & 6 deletions src/Toplo-Widget-Accordion/ToAccordionHeaderElementSkin.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@ ToAccordionHeaderElementSkin >> checkedSkinEvent: anEvent [
{ #category : #'event handling' }
ToAccordionHeaderElementSkin >> collapseHeader: anHeader [

| arrowTk |
| arrowTk arrowIm |
arrowTk := #'submenu-arrow-right'.
anHeader icon: (anHeader valueOfTokenNamed: arrowTk) value
arrowIm := ToImage inner: (anHeader valueOfTokenNamed: arrowTk).
arrowIm
size: 18 asPoint;
innerImageColor: (anHeader valueOfTokenNamed: #'color-text').
anHeader icon: arrowIm
]

{ #category : #'event handling' }
Expand All @@ -30,17 +34,21 @@ ToAccordionHeaderElementSkin >> deselectedSkinEvent: anEvent [
{ #category : #'event handling' }
ToAccordionHeaderElementSkin >> expandHeader: anHeader [

| arrowTk |
| arrowTk arrowIm |
arrowTk := #'submenu-arrow-down'.
anHeader icon: (anHeader valueOfTokenNamed: arrowTk) value
arrowIm := ToImage inner: (anHeader valueOfTokenNamed: arrowTk).
arrowIm
size: 18 asPoint;
innerImageColor: (anHeader valueOfTokenNamed: #'color-text').
anHeader icon: arrowIm
]

{ #category : #'event handling' }
ToAccordionHeaderElementSkin >> installSkinEvent: anEvent [

super installSkinEvent: anEvent.
anEvent elementDo: [ :e |
| arrowTk |
| arrowTk arrowIm |
e padding: (BlInsets
horizontal: (e valueOfTokenNamed: #'padding-content-HS')
vertical: (e valueOfTokenNamed: #'padding-content-V')).
Expand All @@ -49,7 +57,11 @@ ToAccordionHeaderElementSkin >> installSkinEvent: anEvent [
arrowTk := e isExpanded
ifTrue: [ #'submenu-arrow-down' ]
ifFalse: [ #'submenu-arrow-right' ].
e icon: (e valueOfTokenNamed: arrowTk) value.
arrowIm := ToImage inner: (e valueOfTokenNamed: arrowTk).
arrowIm
size: 18 asPoint;
innerImageColor: (e valueOfTokenNamed: #'color-text').
e icon: arrowIm.
(e parent hasStamp: #ghost) ifFalse: [
e background: (e valueOfTokenNamed: #'color-secondary-selection') ] ]
]
Expand Down
6 changes: 6 additions & 0 deletions src/Toplo-Widget-Empty/ToEmpty.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ ToEmpty >> defaultLayout [
^ BlLinearLayout vertical
]

{ #category : #accessing }
ToEmpty >> image [

^ image
]

{ #category : #initialization }
ToEmpty >> initialize [

Expand Down
5 changes: 4 additions & 1 deletion src/Toplo-Widget-Empty/ToEmptySkin.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,8 @@ ToEmptySkin >> installSkinEvent: anEvent [
anEvent elementDo: [ :e |
e layout alignCenter.
(e hasStamp: #box) ifTrue: [
e installInnerImage: (e valueOfTokenNamed: #empty_box) value ] ]
e installInnerImage: (e valueOfTokenNamed: #empty_box).
e image
size: 50 asPoint;
innerImageColor: Color lightGray ] ]
]
18 changes: 11 additions & 7 deletions src/Toplo-Widget-Image/ToImage.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ ToImage >> formInnerImageId [
ToImage >> fromUrl: anUrl [

self terminateLoader.
self innerImage: ToMiscellaneousIcons filled_pending_work.
loader := [
| timesRetry contents |
timesRetry := 0.
Expand All @@ -104,13 +105,16 @@ ToImage >> fromUrl: anUrl [
do: [ ]) isNil and: [ timesRetry < 5 ] ]
whileTrue: [ timesRetry := timesRetry + 1 ].
loader := nil.
contents ifNotNil: [
| source |
source := contents isString
ifTrue: [ contents ]
ifFalse: [
Form fromBinaryStream: contents readStream ].
self innerImage: source ] ] newProcess.
contents
ifNil: [
self innerImage: ToMiscellaneousIcons round_close ]
ifNotNil: [
| source |
source := contents isString
ifTrue: [ contents ]
ifFalse: [
Form fromBinaryStream: contents readStream ].
self innerImage: source ] ] newProcess.
loader priority: Processor userBackgroundPriority.
loader name: 'ToImage loader'.
loader resume
Expand Down
9 changes: 7 additions & 2 deletions src/Toplo-Widget-Menu/ToMenuSkin.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ ToMenuSkin >> installSkinEvent: anEvent [
anEvent elementDo: [ :e |
e isSubmenu
ifTrue: [
| arrowTk |
| arrowTk arrowIm |
e endFlexible: true.
e endInterspace:
(e valueOfTokenNamed: #'menu-item-start-alignment').
Expand All @@ -21,7 +21,12 @@ ToMenuSkin >> installSkinEvent: anEvent [
ifTrue: [ #'submenu-arrow-up' ]
ifFalse: [ #'submenu-arrow-down' ] ]
ifFalse: [ #'submenu-arrow-right' ].
e endElement addChild: (e valueOfTokenNamed: arrowTk) value ]

arrowIm := ToImage inner: (e valueOfTokenNamed: arrowTk).
arrowIm
size: 18 asPoint;
innerImageColor: (e valueOfTokenNamed: #'color-text').
e endElement addChild: arrowIm ]
ifFalse: [
(e hasIcon and: [ e hasLabel ])
ifTrue: [
Expand Down
6 changes: 5 additions & 1 deletion src/Toplo-Widget-Select/ToSelectIconContainerSkin.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ ToSelectIconContainerSkin >> installSkinEvent: anEvent [
super installSkinEvent: anEvent.
anEvent elementDo: [ :e |
e middleContainer padding: (BlInsets horizontal: 5).
e icon ifNil: [ e icon: (e valueOfTokenNamed: #'submenu-arrow-down') value ] ]
e icon ifNil: [ | image |
image := ToImage inner: (e valueOfTokenNamed: #'submenu-arrow-down').
image size: 18 asPoint.
image innerImageColor: (e valueOfTokenNamed: #'color-text').
e icon: image ] ]
]

{ #category : #'event handling' }
Expand Down
12 changes: 12 additions & 0 deletions src/Toplo/ToIconStyle.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ ToIconStyle class >> iconNamed: anIconName inProvider: anIconProvider [
(self prefix , '_', anIconName) asSymbol
]

{ #category : #accessing }
ToIconStyle class >> innerImageNamed: anIconName inProvider: anIconProvider [

^ anIconProvider innerImageNamed:
(self prefix , '_', anIconName) asSymbol
]

{ #category : #'instance creation' }
ToIconStyle class >> outlined [

Expand All @@ -40,6 +47,11 @@ ToIconStyle >> iconNamed: anIconName inProvider: anIconProvider [
^ self class iconNamed: anIconName inProvider: anIconProvider
]

{ #category : #accessing }
ToIconStyle >> innerImageNamed: anIconName inProvider: anIconProvider [
^ self class innerImageNamed: anIconName inProvider: anIconProvider
]

{ #category : #accessing }
ToIconStyle >> prefix [

Expand Down
30 changes: 29 additions & 1 deletion src/Toplo/ToImportedIconProvider.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,20 @@ ToImportedIconProvider class >> iconNamed: aName ifAbsent: aBlock [
do: [ :err | aBlock value ]
]

{ #category : #accessing }
ToImportedIconProvider class >> innerImageNamed: aName [

^ self innerImageNamed: aName ifAbsent: [ ]
]

{ #category : #accessing }
ToImportedIconProvider class >> innerImageNamed: aName ifAbsent: aBlock [

^ [ self perform: aName asSymbol ]
on: Error
do: [ :err | aBlock value ]
]

{ #category : #'_private - utilities' }
ToImportedIconProvider class >> listElementWithAllIcons [
"
Expand Down Expand Up @@ -110,11 +124,25 @@ ToImportedIconProvider class >> listElementWithAllIcons [
]

{ #category : #accessing }
ToImportedIconProvider >> iconNamed: aName [
ToImportedIconProvider >> iconNamed: aName [

^ self class iconNamed: aName
]

{ #category : #accessing }
ToImportedIconProvider >> iconNamed: aName ifAbsent: aBlock [

^ self class iconNamed: aName ifAbsent: aBlock
]

{ #category : #accessing }
ToImportedIconProvider >> innerImageNamed: aName [

^ self class innerImageNamed: aName
]

{ #category : #accessing }
ToImportedIconProvider >> innerImageNamed: aName ifAbsent: aBlock [

^ self class innerImageNamed: aName ifAbsent: aBlock
]
22 changes: 21 additions & 1 deletion src/Toplo/ToMiscellaneousIcons.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,27 @@ Class {

{ #category : #accessing }
ToMiscellaneousIcons class >> filled_emptyBox [
"icon from https://uxwing.com/empty-box-icon/ (see https://uxwing.com/license/) "
"icon from https://uxwing.com/empty-box-icon/
License: All icons on this site can be used in personal, commercial, and client projects without any attribution or credit
(see https://uxwing.com/license/) "

^ '<?xml version="1.0" encoding="utf-8"?><svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 122.88 117.85" style="enable-background:new 0 0 122.88 117.85" xml:space="preserve"><g><path d="M60.05,68.41L18.02,46.33L6.2,60.47c14.91,7.88,29.82,15.76,44.74,23.65L60.05,68.41L60.05,68.41z M63.3,23.47L21.12,44.39 L62.24,66l41.2-21.65L79.81,31.99L63.3,23.47L63.3,23.47z M15.89,43.95L0.39,29.27c-0.57-0.65-0.51-1.65,0.15-2.23 c0.09-0.08,0.2-0.15,0.3-0.21L47.95,0.18c0.75-0.4,1.68-0.12,2.1,0.61l13.23,18.22L72.1,2.49c0.41-0.77,1.36-1.07,2.13-0.66 l47.8,25.27c0.14,0.08,0.27,0.17,0.39,0.29c0.61,0.62,0.6,1.62-0.02,2.23l-14.16,13.91l13.71,16.41c0.56,0.67,0.47,1.67-0.2,2.22 c-0.1,0.08-0.21,0.15-0.32,0.21l-12.31,6.51v24.4c0,0.66-0.4,1.22-0.98,1.46l-44.51,22.59c-0.29,0.32-0.71,0.52-1.17,0.52 c-0.62,0-1.15-0.35-1.41-0.87l-44.59-22.3c-0.55-0.28-0.87-0.83-0.87-1.41L15.59,69L3.05,62.37c-0.11-0.06-0.22-0.13-0.32-0.21 c-0.67-0.56-0.76-1.56-0.2-2.22L15.89,43.95L15.89,43.95z M60.84,21.06L48.11,3.67L4.07,28.7L18.46,42.1L60.84,21.06L60.84,21.06z M65.75,21.08l14.75,7.72l25.08,12.93l13.07-12.84L74.15,5.35L65.75,21.08L65.75,21.08z M106.47,46.33L64.44,68.41l9.11,15.7 l44.74-23.65L106.47,46.33L106.47,46.33z"/></g></svg>'
]

{ #category : #accessing }
ToMiscellaneousIcons class >> filled_pending_work [
"icon from https://uxwing.com/pending_work_icon
License: All icons on this site can be used in personal, commercial, and client projects without any attribution or credit
(see https://uxwing.com/license/) "

^ '<?xml version="1.0" encoding="utf-8"?><svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 122.88 122.77" xml:space="preserve"><g><path class="st0" d="M92.45,8.98c-1.35-0.94-2.88-1.35-4.44-1.04c-1.56,0.31-2.88,1.15-3.82,2.46l-5.27,7.43 c-1.87-0.83-3.82-1.46-5.9-1.98s-4.03-0.94-6.11-1.25l-1.67-9.72C64.94,3.21,64.09,2,62.89,1.06c-1.35-0.94-2.78-1.25-4.44-0.94 L46.26,2.31c-1.56,0.31-2.78,1.04-3.82,2.39c-0.94,1.35-1.35,2.78-1.04,4.44l1.56,8.88c-1.98,0.83-3.82,1.77-5.59,2.88 c-1.77,1.04-3.5,2.29-5.07,3.5l-8.26-5.69c-1.35-0.94-2.78-1.35-4.34-1.04c-1.56,0.31-2.88,1.15-3.82,2.5L8.85,30.22 c-0.94,1.35-1.35,2.88-1.04,4.44c0.31,1.67,1.15,2.88,2.5,3.82l7.43,5.27c-0.83,1.87-1.46,3.82-1.98,5.9 c-0.52,2.08-0.94,4.03-1.25,6.11L4.8,57.42c-8.24,1.55-3.58,13.36-2.57,18.98c0.31,1.56,1.04,2.78,2.36,3.82 c1.35,0.94,2.78,1.35,4.44,1.04l8.88-1.56c0.83,1.98,1.77,3.82,2.88,5.59c1.04,1.77,2.29,3.5,3.5,5.17l-5.69,8.16 c-0.94,1.35-1.35,2.78-1.04,4.34c0.31,1.56,1.14,2.88,2.46,3.82l10.13,7.11c1.35,0.94,2.88,1.25,4.44,0.94 c1.56-0.31,2.88-1.04,3.92-2.36l5.28-7.53c1.87,0.83,3.82,1.46,5.9,1.98c2.08,0.52,4.02,0.94,6.11,1.25l1.67,9.72 c0.31,1.67,1.15,2.88,2.36,3.82c1.35,0.94,2.78,1.25,4.44,0.94l12.18-2.19c1.56-0.31,2.78-1.04,3.82-2.36 c0.94-1.35,1.35-2.78,1.04-4.44l-1.56-8.88c1.98-0.83,3.82-1.77,5.59-2.88c1.77-1.04,3.51-2.26,5.17-3.5l8.16,5.69 c1.35,0.94,2.78,1.35,4.44,1.04c1.67-0.31,2.88-1.15,3.82-2.46l7.11-10.14c0.94-1.35,1.25-2.88,0.94-4.44s-1.04-2.88-2.39-3.92 L105.05,79c0.83-1.87,1.46-3.82,1.98-5.9c0.52-2.08,0.94-4.03,1.25-6.11l9.72-1.67c1.67-0.31,2.88-1.15,3.82-2.39 c0.94-1.35,1.25-2.78,0.94-4.44l-2.19-12.18c-0.31-1.56-1.04-2.78-2.36-3.82c-1.35-0.94-2.78-1.35-4.44-1.04l-8.88,1.56 c-0.83-1.87-1.77-3.71-2.88-5.59c-1.04-1.87-2.29-3.5-3.5-5.07l5.69-8.26c0.94-1.35,1.35-2.78,1.04-4.34 c-0.31-1.56-1.15-2.88-2.46-3.82L92.73,8.87L92.45,8.98L92.45,8.98L92.45,8.98L92.45,8.98z M53.18,69.19h16.34 C65.97,60.85,56.73,60.85,53.18,69.19L53.18,69.19z M43.34,78.99v-3.07h4.63c0.11-6.15,3.1-13,9.04-15.57 c-5.92-2.56-8.91-9.39-9.04-15.54h-4.63v-3.07h36.2v3.07l-4.8,0c-0.12,6.14-3.11,12.98-9.04,15.54c5.93,2.56,8.92,9.41,9.04,15.57 h4.8v3.07H43.34L43.34,78.99z M70.92,45.47H51.78C52.39,61.7,70.31,61.72,70.92,45.47L70.92,45.47z M55.41,28.79 c4.39-0.72,8.84-0.72,13.23,0.29c4.25,1,8.12,2.72,11.65,5.11c3.39,2.44,6.4,5.54,8.84,9.26c2.44,3.68,3.97,7.84,4.68,12.23 c0.72,4.39,0.72,8.84-0.29,13.23c-1,4.25-2.72,8.12-5.11,11.65c-2.44,3.39-5.54,6.4-9.27,8.84c-3.68,2.44-7.84,3.97-12.23,4.68 c-4.39,0.72-8.84,0.72-13.23-0.29c-4.25-1-8.12-2.72-11.65-5.11c-3.39-2.44-6.4-5.54-8.84-9.26c-2.44-3.68-3.97-7.84-4.68-12.23 c-0.72-4.39-0.72-8.84,0.29-13.23c1-4.25,2.72-8.12,5.11-11.65c2.44-3.39,5.54-6.4,9.27-8.84C46.91,31.08,51.01,29.5,55.41,28.79 L55.41,28.79L55.41,28.79L55.41,28.79z"/></g></svg>'
]

{ #category : #accessing }
ToMiscellaneousIcons class >> round_close [
"icon from https://uxwing.com/close-round-icon/
License: All icons on this site can be used in personal, commercial, and client projects without any attribution or credit
(see https://uxwing.com/license/) "

^ '<?xml version="1.0" encoding="utf-8"?><svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="122.881px" height="122.88px" viewBox="0 0 122.881 122.88" enable-background="new 0 0 122.881 122.88" xml:space="preserve"><g><path fill-rule="evenodd" clip-rule="evenodd" d="M61.44,0c33.933,0,61.441,27.507,61.441,61.439 c0,33.933-27.508,61.44-61.441,61.44C27.508,122.88,0,95.372,0,61.439C0,27.507,27.508,0,61.44,0L61.44,0z M81.719,36.226 c1.363-1.363,3.572-1.363,4.936,0c1.363,1.363,1.363,3.573,0,4.936L66.375,61.439l20.279,20.278c1.363,1.363,1.363,3.573,0,4.937 c-1.363,1.362-3.572,1.362-4.936,0L61.44,66.376L41.162,86.654c-1.362,1.362-3.573,1.362-4.936,0c-1.363-1.363-1.363-3.573,0-4.937 l20.278-20.278L36.226,41.162c-1.363-1.363-1.363-3.573,0-4.936c1.363-1.363,3.573-1.363,4.936,0L61.44,56.504L81.719,36.226 L81.719,36.226z"/></g></svg>'
]
18 changes: 0 additions & 18 deletions src/Toplo/ToRawDarkTheme.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,6 @@ ToRawDarkTheme class >> defaultTokenProperties [
(ToTokenProperty
name: #'sh-style-table'
value: SHRBTextStyler darkStyleTable).
(ToTokenProperty name: #'submenu-arrow-right' value: [
(ToMaterialDesignIconProvider iconNamed:
'outlined_keyboardarrowright')
size: 18 asPoint;
innerImageColor: (Color r: 255 g: 255 b: 255);
yourself ]).
(ToTokenProperty name: #'submenu-arrow-down' value: [
(ToMaterialDesignIconProvider iconNamed:
'outlined_keyboardarrowdown')
size: 18 asPoint;
innerImageColor: (Color r: 255 g: 255 b: 255);
yourself ]).
(ToTokenProperty name: #'submenu-arrow-up' value: [
(ToMaterialDesignIconProvider iconNamed:
'outlined_keyboardarrowup')
size: 18 asPoint;
innerImageColor: (Color r: 255 g: 255 b: 255);
yourself ]).
(ToTokenProperty
name: #'background-color'
value: (Color fromHexString: '#313339')).
Expand Down
36 changes: 12 additions & 24 deletions src/Toplo/ToTheme.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -55,30 +55,18 @@ ToTheme class >> defaultTokenProperties [
name: #'sh-style-table'
value: SHRBTextStyler defaultStyleTable).
(ToTokenProperty name: #'background-color' value: Color white).
(ToTokenProperty name: #'empty_box' value: [
(ToMiscellaneousIcons iconNamed:
'filled_emptyBox')
size: 50 asPoint;
innerImageColor: Color lightGray;
yourself ]).
(ToTokenProperty name: #'submenu-arrow-right' value: [
(ToMaterialDesignIconProvider iconNamed:
'outlined_keyboardarrowright')
size: 18 asPoint;
innerImageColor: Color gray;
yourself ]).
(ToTokenProperty name: #'submenu-arrow-down' value: [
(ToMaterialDesignIconProvider iconNamed:
'outlined_keyboardarrowdown')
size: 18 asPoint;
innerImageColor: Color gray;
yourself ]).
(ToTokenProperty name: #'submenu-arrow-up' value: [
(ToMaterialDesignIconProvider iconNamed:
'outlined_keyboardarrowup')
size: 18 asPoint;
innerImageColor: Color gray;
yourself ]).
(ToTokenProperty
name: #empty_box
value: (ToMiscellaneousIcons innerImageNamed: 'filled_emptyBox')).
(ToTokenProperty name: #'submenu-arrow-right' value:
(ToMaterialDesignIconProvider innerImageNamed:
'outlined_keyboardarrowright')).
(ToTokenProperty name: #'submenu-arrow-down' value:
(ToMaterialDesignIconProvider innerImageNamed:
'outlined_keyboardarrowdown')).
(ToTokenProperty name: #'submenu-arrow-up' value:
(ToMaterialDesignIconProvider innerImageNamed:
'outlined_keyboardarrowup')).
(ToTokenProperty name: #'border-radius' value: 4).
(ToTokenProperty name: #'border-radius-LG' value: 8).
(ToTokenProperty name: #'border-radius-SM' value: 4).
Expand Down

0 comments on commit 66014d9

Please sign in to comment.