Skip to content

Commit

Permalink
toolbar height takes into account display mode
Browse files Browse the repository at this point in the history
  • Loading branch information
estebanlm committed Dec 31, 2018
1 parent 576b7ca commit 8686964
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 29 deletions.
2 changes: 1 addition & 1 deletion src/Spec-Core/ToolBarPresenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ ToolBarPresenter >> isDisplayModeBoth [
{ #category : #testing }
ToolBarPresenter >> isDisplayModeIcons [

^ self displayMode = ToolBarDisplayMode modeIcon.
^ self displayMode = ToolBarDisplayMode modeIcon
]

{ #category : #testing }
Expand Down
3 changes: 3 additions & 0 deletions src/Spec-MorphicAdapters/MorphicToolBarAdapter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ Class {
MorphicToolBarAdapter >> addModelTo: toolBarMorph [

toolBarMorph displayMode: self model displayMode.
toolBarMorph height: self model displayMode height.

self model items
at: ToolBarItemPosition left
ifPresent: [ :items |
Expand All @@ -19,6 +21,7 @@ MorphicToolBarAdapter >> addModelTo: toolBarMorph [
configureItem: each
morph: each buildWithSpec
toolBar: toolBarMorph) ] ].

self model items
at: ToolBarItemPosition right
ifPresent: [ :items |
Expand Down
7 changes: 7 additions & 0 deletions src/Spec-PolyWidgets/ToolBarDisplayMode.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,12 @@ ToolBarDisplayMode >> extent [

{ #category : #accessing }
ToolBarDisplayMode >> height [

^ self extent y
]

{ #category : #accessing }
ToolBarDisplayMode >> width [

^ self extent x
]
3 changes: 2 additions & 1 deletion src/Spec-PolyWidgets/ToolBarDisplayModeIcon.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ ToolBarDisplayModeIcon >> configureButton: aButton item: aToolbarItem [

{ #category : #accessing }
ToolBarDisplayModeIcon >> extent [
^ 25@25

^ 30@30
]
38 changes: 11 additions & 27 deletions src/Spec-PolyWidgets/ToolBarMorph.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,25 @@ Class {

{ #category : #accessing }
ToolBarMorph class >> defaultHeight [

^ self defaultMode height
]

{ #category : #accessing }
ToolBarMorph class >> defaultItemSeparation [

^ 0
]

{ #category : #accessing }
ToolBarMorph class >> defaultItemSize [

^ 50
]

{ #category : #accessing }
ToolBarMorph class >> defaultMode [

^ ToolBarDisplayMode default
]

Expand Down Expand Up @@ -72,11 +76,13 @@ ToolBarMorph >> addItemRight: aMorph [

{ #category : #'as yet unclassified' }
ToolBarMorph >> addItemsFromContext: aContext [
| menu |

self flag: #TODO.
"| menu |
menu := CmdMenu activatedBy: ITToolbarActivation.
menu buildInContext: aContext.
menu buildToolbarOn: self
menu buildToolbarOn: self"

]

Expand Down Expand Up @@ -159,33 +165,10 @@ ToolBarMorph >> newToolbarItemFont [
pointSize: buttonFont pointSize - 3
]

{ #category : #accessing }
ToolBarMorph >> rebuildLeftPanel [

self halt.
"self leftPanel removeAllMorphs.
leftItems do: [ :each |
leftPanel addMorphBack: ((each buildMorphOnToolbar: self)
vResizing: #spaceFill;
yourself) ]"
]

{ #category : #accessing }
ToolBarMorph >> rebuildRightPanel [

self halt.
"self rightPanel removeAllMorphs.
rightItems do: [ :each |
rightPanel addMorphBack: ((each buildMorphOnToolbar: self)
vResizing: #spaceFill;
yourself) ]"
]

{ #category : #accessing }
ToolBarMorph >> refresh [

self rebuildLeftPanel.
self rebuildRightPanel.
self flag: #TODO. "Maybe remove?"
]

{ #category : #'private accessing' }
Expand All @@ -210,5 +193,6 @@ ToolBarMorph >> toolbarItemFont: anObject [

{ #category : #accessing }
ToolBarMorph >> toolbarItemSize [
^ self class defaultItemSize

^ self displayMode height
]

0 comments on commit 8686964

Please sign in to comment.