-
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.
+ ToImage>>rotateBy: + ToTabPane examples with vertical labels in ToTab
- Loading branch information
Showing
14 changed files
with
684 additions
and
632 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
Class { | ||
#name : 'ToTabNew', | ||
#superclass : 'Object', | ||
#classTraits : 'TToCheckable classTrait', | ||
#instVars : [ | ||
'data', | ||
'preserveOnSelect', | ||
'closable', | ||
'pageBuilder', | ||
'buttonBuilder' | ||
], | ||
#category : 'Toplo-Incubator', | ||
#package : 'Toplo-Incubator' | ||
} | ||
|
||
{ #category : 'accessing' } | ||
ToTabNew >> buttonBuilder [ | ||
|
||
^ buttonBuilder | ||
] | ||
|
||
{ #category : 'accessing' } | ||
ToTabNew >> buttonBuilder: aValuable2Args [ | ||
|
||
buttonBuilder := aValuable2Args | ||
] | ||
|
||
{ #category : 'accessing' } | ||
ToTabNew >> closable: aBoolean [ | ||
|
||
closable := aBoolean. | ||
aBoolean | ||
ifTrue: [ | ||
| but | | ||
but := ToButton new. | ||
but defaultSkin: ToTabInnerCloseButtonSkin new. | ||
but icon: (ToImage inner: (Smalltalk ui icons iconNamed: #windowClose)). | ||
but constraintsDo: [ :c | c linear vertical alignCenter ]. | ||
but when: BlClickEvent do: [ :event | event currentTarget removeFromParent ]. | ||
but id: #innerCloseButton. ] | ||
ifFalse: [ | ||
self removeChildNamed: #innerCloseButton ] | ||
] | ||
|
||
{ #category : 'accessing' } | ||
ToTabNew >> data [ | ||
|
||
^ data | ||
] | ||
|
||
{ #category : 'accessing' } | ||
ToTabNew >> data: anObject [ | ||
|
||
data := anObject | ||
] | ||
|
||
{ #category : 'initialization' } | ||
ToTabNew >> defaultButtonBuilder [ | ||
|
||
^ [ :node :holder | | ||
| but | | ||
but := ToLabeledIcon new labelText: self data asString. | ||
node addChild: but. | ||
node fitContent ] | ||
] | ||
|
||
{ #category : 'initialization' } | ||
ToTabNew >> initialize [ | ||
|
||
super initialize. | ||
closable := false. | ||
pageBuilder := [ :arg1 :arg2 | ]. | ||
buttonBuilder := self defaultButtonBuilder | ||
] | ||
|
||
{ #category : 'testing' } | ||
ToTabNew >> isClosable [ | ||
|
||
^ closable | ||
] | ||
|
||
{ #category : 'accessing' } | ||
ToTabNew >> pageBuilder [ | ||
|
||
^ pageBuilder | ||
] | ||
|
||
{ #category : 'accessing' } | ||
ToTabNew >> pageBuilder: aValuable2Args [ | ||
"Establish what is my body. When a tab is selected in a notebook, it will send `#value:value:` to this factory, | ||
with the page pane and the notebook as arguments" | ||
|
||
pageBuilder := aValuable2Args | ||
] | ||
|
||
{ #category : 'accessing' } | ||
ToTabNew >> preserveOnSelect [ | ||
|
||
^ preserveOnSelect | ||
] | ||
|
||
{ #category : 'accessing' } | ||
ToTabNew >> preserveOnSelect: aBoolean [ | ||
|
||
preserveOnSelect := aBoolean | ||
] |
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,158 @@ | ||
Class { | ||
#name : 'ToTabPaneHeaderNew', | ||
#superclass : 'ToPane', | ||
#classTraits : 'TToOrientable classTrait', | ||
#instVars : [ | ||
'tabs', | ||
'tabRow', | ||
'tabRowContainer', | ||
'startContainer', | ||
'endContainer', | ||
'vertical', | ||
'sharedDistributor' | ||
], | ||
#category : 'Toplo-Incubator', | ||
#package : 'Toplo-Incubator' | ||
} | ||
|
||
{ #category : 'orientation' } | ||
ToTabPaneHeaderNew >> beHorizontal [ | ||
|
||
self tabs beHorizontal | ||
] | ||
|
||
{ #category : 'orientation' } | ||
ToTabPaneHeaderNew >> beVertical [ | ||
|
||
self tabs beVertical | ||
] | ||
|
||
{ #category : 'tabs selection' } | ||
ToTabPaneHeaderNew >> dataEmptinessChangeEvent: anEvent [ | ||
|
||
self tabs selectionIndexes ifEmpty: [ self selectIndex: 1 ] | ||
] | ||
|
||
{ #category : 'initialization' } | ||
ToTabPaneHeaderNew >> defaultTabRowNodeBuilder [ | ||
|
||
^ [ :node :holder | | ||
| tabModel | | ||
tabModel := holder data. | ||
tabModel buttonBuilder value: node value: holder ] | ||
] | ||
|
||
{ #category : 'accessing' } | ||
ToTabPaneHeaderNew >> endContainer [ | ||
|
||
^ endContainer | ||
] | ||
|
||
{ #category : 'orientation' } | ||
ToTabPaneHeaderNew >> horizontal [ | ||
|
||
^ self vertical not | ||
] | ||
|
||
{ #category : 'orientation' } | ||
ToTabPaneHeaderNew >> horizontal: aBoolean [ | ||
|
||
self vertical: aBoolean not | ||
] | ||
|
||
{ #category : 'initialization' } | ||
ToTabPaneHeaderNew >> initialize [ | ||
|
||
super initialize. | ||
tabRowContainer := ToPane new fitContent; yourself. | ||
tabs := ToList new nodeBuilder: self defaultTabRowNodeBuilder; yourself. | ||
tabs nodeClass: ToTabNode. | ||
tabs matchParent. | ||
tabs infinite matchParent. | ||
tabRowContainer addChild: tabs. | ||
tabRowContainer matchParent. | ||
startContainer := ToPane new fitContent; yourself. | ||
endContainer := ToPane new fitContent; yourself. | ||
self addChild: startContainer. | ||
self addChild: tabRowContainer. | ||
self addChild: endContainer. | ||
self initializeEventHandler. | ||
self when: ToInfiniteSelectionChangedEvent do: [ :evt | self tabsSelectionChangedEvent: evt ]. | ||
tabs data when: ToDataEmptinessChangeEvent do: [ :evt | self dataEmptinessChangeEvent: evt ] | ||
] | ||
|
||
{ #category : 'initialization' } | ||
ToTabPaneHeaderNew >> initializeEventHandler [ | ||
|
||
sharedDistributor := BlSharedEventDistributor new shareEvents: | ||
self sharedEvents yourself. | ||
self addEventHandler: sharedDistributor. | ||
self tabs addEventHandler: sharedDistributor. | ||
|
||
] | ||
|
||
{ #category : 'orientation' } | ||
ToTabPaneHeaderNew >> orientationChanged [ | ||
|
||
self vertical | ||
ifTrue: [ self beVertical ] | ||
ifFalse: [ self beHorizontal ] | ||
] | ||
|
||
{ #category : 'tabs selection' } | ||
ToTabPaneHeaderNew >> selectIndex: anInteger [ | ||
|
||
self tabs selectIndex: anInteger | ||
] | ||
|
||
{ #category : 'initialization' } | ||
ToTabPaneHeaderNew >> sharedEvents [ | ||
|
||
^ { ToInfiniteSelectionChangedEvent. } | ||
] | ||
|
||
{ #category : 'accessing' } | ||
ToTabPaneHeaderNew >> startContainer [ | ||
|
||
^ startContainer | ||
] | ||
|
||
{ #category : 'accessing' } | ||
ToTabPaneHeaderNew >> tabRow [ | ||
|
||
^ tabRow | ||
] | ||
|
||
{ #category : 'accessing' } | ||
ToTabPaneHeaderNew >> tabRowContainer [ | ||
|
||
^ tabRowContainer | ||
] | ||
|
||
{ #category : 'accessing' } | ||
ToTabPaneHeaderNew >> tabs [ | ||
|
||
^ tabs | ||
] | ||
|
||
{ #category : 'tabs selection' } | ||
ToTabPaneHeaderNew >> tabsSelectionChangedEvent: anEvent [ | ||
|
||
anEvent oldSelectedIndexes trace. ' -> ' trace. | ||
anEvent newSelectedIndexes traceCr. | ||
] | ||
|
||
{ #category : 'orientation' } | ||
ToTabPaneHeaderNew >> vertical [ | ||
|
||
^ vertical | ||
] | ||
|
||
{ #category : 'orientation' } | ||
ToTabPaneHeaderNew >> vertical: aBoolean [ | ||
|
||
vertical = aBoolean ifTrue: [ ^ self ]. | ||
vertical := aBoolean. | ||
self orientationChanged | ||
|
||
] |
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,23 @@ | ||
Class { | ||
#name : 'ToTabPaneHeaderNewExamples', | ||
#superclass : 'Object', | ||
#category : 'Toplo-Incubator', | ||
#package : 'Toplo-Incubator' | ||
} | ||
|
||
{ #category : 'header' } | ||
ToTabPaneHeaderNewExamples >> example_headerFourTab [ | ||
|
||
| header | | ||
header := ToTabPaneHeaderNew new. | ||
header tabs data add: (ToTabNew new data: 'Tab 1'). | ||
header tabs data add: (ToTabNew new data: 'Tab 2'). | ||
header tabs data add: (ToTabNew new data: 'Tab 3'). | ||
header tabs data add: (ToTabNew new data: 'Tab 4'). | ||
header background: Color yellow. | ||
header matchParent. | ||
header beVertical. | ||
header openInSpace. | ||
header inspect. | ||
^ header | ||
] |
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
Oops, something went wrong.