-
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.
- Loading branch information
Showing
12 changed files
with
433 additions
and
185 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
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 was deleted.
Oops, something went wrong.
71 changes: 71 additions & 0 deletions
71
src/Toplo-Widget-Accordion/ToAccordionItemBodyElement.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,71 @@ | ||
Class { | ||
#name : #ToAccordionItemBodyElement, | ||
#superclass : #ToElement, | ||
#instVars : [ | ||
'builder', | ||
'content', | ||
'preservedContent', | ||
'isBuilt' | ||
], | ||
#category : #'Toplo-Widget-Accordion-Core' | ||
} | ||
|
||
{ #category : #accessing } | ||
ToAccordionItemBodyElement >> builder: aValuable [ | ||
"With content as argument" | ||
|
||
isBuilt := false. | ||
builder := aValuable | ||
] | ||
|
||
{ #category : #accessing } | ||
ToAccordionItemBodyElement >> content [ | ||
|
||
^ content | ||
] | ||
|
||
{ #category : #initialization } | ||
ToAccordionItemBodyElement >> initialize [ | ||
|
||
super initialize. | ||
isBuilt := false. | ||
preservedContent := true. | ||
self initializeContent | ||
] | ||
|
||
{ #category : #initialization } | ||
ToAccordionItemBodyElement >> initializeContent [ | ||
|
||
content := ToElement new | ||
withNullSkin; | ||
background: BlBackground transparent; | ||
layout: BlLinearLayout vertical; | ||
constraintsDo: [ :c | | ||
c vertical fitContent. | ||
c horizontal matchParent ]; | ||
yourself. | ||
self addChild: content | ||
] | ||
|
||
{ #category : #accessing } | ||
ToAccordionItemBodyElement >> preservedContent: aBoolean [ | ||
|
||
preservedContent := aBoolean | ||
] | ||
|
||
{ #category : #'expanding-collapsing' } | ||
ToAccordionItemBodyElement >> switchCollapsed [ | ||
|
||
preservedContent ifFalse: [ content removeChildren ]. | ||
content visibility: BlVisibility gone | ||
] | ||
|
||
{ #category : #'expanding-collapsing' } | ||
ToAccordionItemBodyElement >> switchExpanded [ | ||
|
||
(isBuilt and: [ preservedContent ]) ifFalse: [ | ||
content removeChildren. | ||
builder ifNotNil: [ builder value: content ]. | ||
isBuilt := true ]. | ||
content visibility: BlVisibility visible | ||
] |
Oops, something went wrong.