-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Working on a first cleaned version of ToAccordionElement (not ready t…
…o be used but cleaned enough)
- Loading branch information
Showing
10 changed files
with
215 additions
and
394 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
107 changes: 107 additions & 0 deletions
107
src/Toplo-Widget-Accordion/ToAccordionHeaderElement.class.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
Class { | ||
#name : #ToAccordionHeaderElement, | ||
#superclass : #ToElement, | ||
#traits : 'TToClickable', | ||
#classTraits : 'TToClickable classTrait', | ||
#instVars : [ | ||
'builder', | ||
'clickHandler', | ||
'clickEventClass', | ||
'isCollapsed', | ||
'iconContainer', | ||
'content' | ||
], | ||
#category : #'Toplo-Widget-Accordion-Core' | ||
} | ||
|
||
{ #category : #examples } | ||
ToAccordionHeaderElement class >> exampleWithLabel [ | ||
|
||
<script> | ||
| inst | | ||
inst := self new. | ||
inst builder: [ :header | header addChild: (ToLabel text: 'header') ]. | ||
inst openInSpace. | ||
^ inst | ||
] | ||
|
||
{ #category : #'as yet unclassified' } | ||
ToAccordionHeaderElement >> builder: aValuable [ | ||
"With an header as argument" | ||
|
||
aValuable value: content | ||
] | ||
|
||
{ #category : #'as yet unclassified' } | ||
ToAccordionHeaderElement >> clickHandler [ | ||
|
||
^ clickHandler | ||
] | ||
|
||
{ #category : #'as yet unclassified' } | ||
ToAccordionHeaderElement >> clickHandler: anHandler [ | ||
|
||
clickHandler := anHandler | ||
] | ||
|
||
{ #category : #accessing } | ||
ToAccordionHeaderElement >> content [ | ||
|
||
^ content | ||
] | ||
|
||
{ #category : #'as yet unclassified' } | ||
ToAccordionHeaderElement >> icon: aToImage [ | ||
|
||
iconContainer removeChildren. | ||
iconContainer addChild: aToImage | ||
] | ||
|
||
{ #category : #initialization } | ||
ToAccordionHeaderElement >> initialize [ | ||
|
||
super initialize. | ||
isCollapsed := true. | ||
self layout: BlLinearLayout horizontal. | ||
self hMatchParent. | ||
self vFitContent. | ||
content := ToElement new. | ||
content layout: BlLinearLayout horizontal. | ||
content hMatchParent. | ||
content vFitContent. | ||
|
||
iconContainer := ToElement new. | ||
iconContainer fitContent. | ||
self addChild: iconContainer. | ||
self addChild: content | ||
] | ||
|
||
{ #category : #'as yet unclassified' } | ||
ToAccordionHeaderElement >> isCollapsed [ | ||
|
||
^ isCollapsed | ||
] | ||
|
||
{ #category : #'as yet unclassified' } | ||
ToAccordionHeaderElement >> isCollapsed: aBoolean [ | ||
|
||
isCollapsed := aBoolean | ||
] | ||
|
||
{ #category : #skin } | ||
ToAccordionHeaderElement >> newRawSkin [ | ||
|
||
^ ToAccordionHeaderElementSkin new | ||
] | ||
|
||
{ #category : #'as yet unclassified' } | ||
ToAccordionHeaderElement >> rawClickEventClass [ | ||
|
||
^ clickEventClass | ||
] | ||
|
||
{ #category : #'as yet unclassified' } | ||
ToAccordionHeaderElement >> rawClickEventClass: aClass [ | ||
|
||
clickEventClass := aClass | ||
] |
29 changes: 29 additions & 0 deletions
29
src/Toplo-Widget-Accordion/ToAccordionHeaderElementSkin.class.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
Class { | ||
#name : #ToAccordionHeaderElementSkin, | ||
#superclass : #ToRawSkin, | ||
#category : #'Toplo-Widget-Accordion-Core' | ||
} | ||
|
||
{ #category : #'as yet unclassified' } | ||
ToAccordionHeaderElementSkin >> clickedSkinEvent: anEvent [ | ||
|
||
super clickedSkinEvent: anEvent. | ||
anEvent elementDo: [ :e | | ||
| arrowTk | | ||
arrowTk := e isCollapsed | ||
ifTrue: [ #'submenu-arrow-up' ] | ||
ifFalse: [ #'submenu-arrow-down' ]. | ||
e icon: (e valueOfTokenNamed: arrowTk) value ] | ||
] | ||
|
||
{ #category : #'event handling' } | ||
ToAccordionHeaderElementSkin >> installSkinEvent: anEvent [ | ||
|
||
super installSkinEvent: anEvent. | ||
anEvent elementDo: [ :e | | ||
| arrowTk | | ||
arrowTk := e isCollapsed | ||
ifTrue: [ #'submenu-arrow-up' ] | ||
ifFalse: [ #'submenu-arrow-down' ]. | ||
e icon: (e valueOfTokenNamed: arrowTk) value ] | ||
] |
Oops, something went wrong.