Skip to content

Commit

Permalink
a menu selection is removed when it is leaved.
Browse files Browse the repository at this point in the history
fixed menu right hand side image color in dark theme
  • Loading branch information
plantec committed Dec 29, 2024
1 parent 7f65043 commit e0de827
Show file tree
Hide file tree
Showing 14 changed files with 108 additions and 31 deletions.
2 changes: 1 addition & 1 deletion src/Toplo-Widget-Button/ToGeneralButton.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ ToGeneralButton >> initialize [

super initialize.
self addEventHandler: ToClickableFocusEventHandler new.
self applySkinInstallerOnFirstRequest: true.
self applySkinInstallerOnFirstRequest: false.
takeFocusOnClick := true
]

Expand Down
26 changes: 13 additions & 13 deletions src/Toplo-Widget-Image/ToImage.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -54,21 +54,21 @@ ToImage >> defaultInnerImage [
yourself
]

{ #category : #'form accessing' }
{ #category : #'inner accessing' }
ToImage >> errorInnerFormNotFound [
"Raise a NotFound exception."

NotFound signalFor: self
]

{ #category : #'form accessing' }
{ #category : #'inner accessing' }
ToImage >> errorInnerSvgElementNotFound [
"Raise a NotFound exception."

NotFound signalFor: self
]

{ #category : #'form accessing' }
{ #category : #'inner accessing' }
ToImage >> formColor: aColor [

self
Expand Down Expand Up @@ -101,22 +101,22 @@ ToImage >> initialize [
self preventChildrenMouseEvents
]

{ #category : #'form accessing' }
{ #category : #'inner accessing' }
ToImage >> innerForm [
"Convenience method that returns nil if the request makes no sense or if there is no form."

self deprecated: 'Use #innerFormImage' transformWith: '`@recvr innerForm'->'`@recvr innerFormImage'.
^ self innerFormImage
]

{ #category : #'form accessing' }
{ #category : #'inner accessing' }
ToImage >> innerFormImage [
"Convenience method that returns nil if the request makes no sense or if there is no form."

^ self innerImage background formImage
]

{ #category : #'form accessing' }
{ #category : #'inner accessing' }
ToImage >> innerFormImageColor: aColor [

self
Expand Down Expand Up @@ -149,14 +149,14 @@ ToImage >> innerImage: anImage [
c vertical matchParent ] ] ]
]

{ #category : #'form accessing' }
{ #category : #'inner accessing' }
ToImage >> innerImageColor: aColor [

self innerSvgImage ifNotNil: [ ^ self innerSvgImageColor: aColor ].
self innerFormImage ifNotNil: [ ^ self innerFormImageColor: aColor ]
]

{ #category : #'form accessing' }
{ #category : #'inner accessing' }
ToImage >> innerSvgImage [
"Convenience method that returns nil if the request makes no sense or if there is no svg image."

Expand All @@ -165,7 +165,7 @@ ToImage >> innerSvgImage [
ifFalse: [ ]
]

{ #category : #'form accessing' }
{ #category : #'inner accessing' }
ToImage >> innerSvgImageColor: aColor [

self
Expand Down Expand Up @@ -195,15 +195,15 @@ ToImage >> unknownInnerImageId [
^ self class unknownInnerImageId
]

{ #category : #'form accessing' }
{ #category : #'inner accessing' }
ToImage >> withInnerFormDo: aBlock [
" aBlock is evaluated with the form as arguments
if the result of #innerForm is not nil "

self withInnerFormDo: aBlock ifNone: [ self errorInnerFormNotFound ]
]

{ #category : #'form accessing' }
{ #category : #'inner accessing' }
ToImage >> withInnerFormDo: aBlock ifNone: aNoneBlock [
" aBlock is evaluated with the form as arguments
if the result of #innerForm is not nil, else, aNoneBlock is evaluated "
Expand All @@ -213,7 +213,7 @@ ToImage >> withInnerFormDo: aBlock ifNone: aNoneBlock [
ifNotNil: [ :f | aBlock value: f ]
]

{ #category : #'form accessing' }
{ #category : #'inner accessing' }
ToImage >> withInnerSvgElementDo: aBlock [
" aBlock is evaluated with the svg element as arguments
if the result of #innerForm is not nil "
Expand All @@ -223,7 +223,7 @@ ToImage >> withInnerSvgElementDo: aBlock [
ifNone: [ self errorInnerSvgElementNotFound ]
]

{ #category : #'form accessing' }
{ #category : #'inner accessing' }
ToImage >> withInnerSvgElementDo: aBlock ifNone: aNoneBlock [
" aBlock is evaluated with the svg element as arguments
if the result of #innerSvgImage is not nil, else, aNoneBlock is evaluated "
Expand Down
23 changes: 21 additions & 2 deletions src/Toplo-Widget-Menu/ToInlineMenuWindowElement.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Class {
#superclass : #ToCustomMenuItem,
#traits : 'TToAnchoredWindowElement + TToMenuWindowModel',
#classTraits : 'TToAnchoredWindowElement classTrait + TToMenuWindowModel classTrait',
#category : #'Toplo-Widget-Menu-Basic'
#category : #'Toplo-Widget-Menu-Inline'
}

{ #category : #'t - menu window model' }
Expand Down Expand Up @@ -32,6 +32,13 @@ ToInlineMenuWindowElement >> includes: anElement [
^ false
]

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

super initialize.
self addEventHandler: ToMenuWindowEventHandler new
]

{ #category : #'t - menu window model' }
ToInlineMenuWindowElement >> isInline [

Expand All @@ -56,6 +63,12 @@ ToInlineMenuWindowElement >> itemContainer [
^ self element
]

{ #category : #accessing }
ToInlineMenuWindowElement >> itemList [

^ self element itemList
]

{ #category : #accessing }
ToInlineMenuWindowElement >> items [

Expand All @@ -68,12 +81,18 @@ ToInlineMenuWindowElement >> menuWindow [
^ self
]

{ #category : #'instance creation' }
{ #category : #skin }
ToInlineMenuWindowElement >> newRawSkin [

^ ToInlineMenuWindowSkin new
]

{ #category : #'t - inline window element - accessing' }
ToInlineMenuWindowElement >> root [

^ self
]

{ #category : #'api - displaying' }
ToInlineMenuWindowElement >> toThemeInstalled [

Expand Down
6 changes: 2 additions & 4 deletions src/Toplo-Widget-Menu/ToInlineMenuWindowSkin.class.st
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
Class {
#name : #ToInlineMenuWindowSkin,
#superclass : #ToRawSkin,
#category : #'Toplo-Widget-Menu-Basic'
#category : #'Toplo-Widget-Menu-Inline'
}

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

super installSkinEvent: anEvent.
anEvent elementDo: [ :e |
"e background: (Color veryLightGray alpha: 0.2)."
"e margin:
(BlInsets left: (e valueOfTokenNamed: #'menu-item-start-alignment'))" ]
e background: (Color veryLightGray alpha: 0.1) ]
]

{ #category : #'event handling' }
Expand Down
6 changes: 6 additions & 0 deletions src/Toplo-Widget-Menu/ToMenu.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@ ToMenu >> menuWindow [
^ self windowManager currentWindow
]

{ #category : #'event handling' }
ToMenu >> mouseLeaveEvent: anEvent [

self itemList secondarySelecter deselectAll
]

{ #category : #'event handling' }
ToMenu >> mouseOverEvent: anEvent [

Expand Down
2 changes: 1 addition & 1 deletion src/Toplo-Widget-Menu/ToMenuInlineWindowMode.class.st
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Class {
#name : #ToMenuInlineWindowMode,
#superclass : #ToInlineWindowMode,
#category : #'Toplo-Widget-Menu-Basic'
#category : #'Toplo-Widget-Menu-Inline'
}

{ #category : #'window handling' }
Expand Down
2 changes: 1 addition & 1 deletion src/Toplo-Widget-Menu/ToMenuItemEventHandler.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ToMenuItemEventHandler >> closeOnEvent: anEvent [
and finally can decide to not close the menu window"
(target isInInlineWindow or: [ target isInline ]) ifTrue: [ ^ self ].
target rootMenuDo: [ :rm |
rm windowManager checkAutoCloseWindowOnMouseUp: anEvent ]
rm manager checkAutoCloseWindowOnMouseUp: anEvent ]
]

{ #category : #'api - accessing' }
Expand Down
13 changes: 13 additions & 0 deletions src/Toplo-Widget-Menu/ToMenuWindow.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,25 @@ ToMenuWindow >> includes: anElement [
^ false
]

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

super initialize.
self addEventHandler: ToMenuWindowEventHandler new
]

{ #category : #accessing }
ToMenuWindow >> itemContainer [

^ self element
]

{ #category : #accessing }
ToMenuWindow >> itemList [

^ self element itemList
]

{ #category : #accessing }
ToMenuWindow >> items [

Expand Down
17 changes: 17 additions & 0 deletions src/Toplo-Widget-Menu/ToMenuWindowEventHandler.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Class {
#name : #ToMenuWindowEventHandler,
#superclass : #BlCustomEventHandler,
#category : #'Toplo-Widget-Menu-Basic'
}

{ #category : #'api - accessing' }
ToMenuWindowEventHandler >> eventsToHandle [
^ { BlMouseLeaveEvent }
]

{ #category : #'event handling' }
ToMenuWindowEventHandler >> mouseLeaveEvent: anEvent [

anEvent currentTarget isOpened ifFalse: [ ^ self ].
anEvent currentTarget itemList secondarySelecter deselectAll
]
5 changes: 1 addition & 4 deletions src/Toplo-Widget-Menu/ToMenuWindowManager.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ ToMenuWindowManager >> mouseEnterEvent: anEvent [
{ #category : #'event handling' }
ToMenuWindowManager >> mouseLeaveEvent: anEvent [

element itemList secondarySelecter deselectAll
]

{ #category : #'window handling' }
Expand Down Expand Up @@ -89,7 +88,5 @@ ToMenuWindowManager >> popupNewWindowEvent: anEvent [
{ #category : #accessing }
ToMenuWindowManager >> popupWindowClass [

^ self isInline
ifTrue: [ ToInlineMenuWindowElement ]
ifFalse: [ ToMenuWindow ]
^ ToMenuWindow
]
2 changes: 1 addition & 1 deletion src/Toplo/TToAnchoredWindowElement.trait.st
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ TToAnchoredWindowElement >> preventPickOutsideClosing [
{ #category : #'t - inline window element - accessing' }
TToAnchoredWindowElement >> root [

^ self
^ self explicitRequirement
]

{ #category : #'t - inline window element - displaying' }
Expand Down
6 changes: 6 additions & 0 deletions src/Toplo/ToAnchoredWindow.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ ToAnchoredWindow >> dispatchOpenedEvent [
self element dispatchEvent: self newOpenedEvent
]

{ #category : #'t - inline window element - accessing' }
ToAnchoredWindow >> root [

^ super root
]

{ #category : #'api - displaying' }
ToAnchoredWindow >> toThemeInstalled [

Expand Down
20 changes: 19 additions & 1 deletion src/Toplo/ToRawDarkTheme.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,27 @@ Class {
ToRawDarkTheme class >> defaultTokenProperties [

^ super defaultTokenProperties , {
(ToTokenProperty
(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
9 changes: 6 additions & 3 deletions src/Toplo/ToTheme.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,21 @@ ToTheme class >> defaultTokenProperties [
(ToTokenProperty name: #'background-color' value: Color white).
(ToTokenProperty name: #'submenu-arrow-right' value: [
(ToMaterialDesignIconProvider iconNamed:
'outlined_keyboardarrowright') yourself
'outlined_keyboardarrowright')
size: 18 asPoint;
innerImageColor: Color gray;
yourself ]).
(ToTokenProperty name: #'submenu-arrow-down' value: [
(ToMaterialDesignIconProvider iconNamed:
'outlined_keyboardarrowdown') yourself
'outlined_keyboardarrowdown')
size: 18 asPoint;
innerImageColor: Color gray;
yourself ]).
(ToTokenProperty name: #'submenu-arrow-up' value: [
(ToMaterialDesignIconProvider iconNamed:
'outlined_keyboardarrowup') yourself
'outlined_keyboardarrowup')
size: 18 asPoint;
innerImageColor: Color gray;
yourself ]).
(ToTokenProperty name: #'border-radius' value: 4).
(ToTokenProperty name: #'border-radius-LG' value: 8).
Expand Down

0 comments on commit e0de827

Please sign in to comment.