SystemOrganization addCategory: #'OB-Tabs-Core'! SystemOrganization addCategory: #'OB-Tabs-Morphic'! !OBMorphBuilder methodsFor: '*ob-tabs' stamp: 'lr 5/14/2009 19:51'! tabGroup: aModel with: aBlock | morph | morph := OBTabGroupMorph model: aModel. current isNil ifFalse: [ current addMorph: morph frame: (0 @ 0 corner: 1 @ 1) ]. ^ self current: morph do: aBlock! ! !OBMorphBuilder methodsFor: '*ob-tabs' stamp: 'lr 5/14/2009 20:18'! tabSheet: aModel with: aBlock | morph | morph := OBTabSheetMorph model: aModel. self current: morph do: aBlock. current isNil ifTrue: [ ^ morph ]. current addPage: morph label: aModel labelString. ^ morph! ! OBGroupingMorph subclass: #OBTabSheetMorph instanceVariableNames: 'model' classVariableNames: '' poolDictionaries: '' category: 'OB-Tabs-Morphic'! !OBTabSheetMorph class methodsFor: 'instance-creation' stamp: 'lr 5/14/2009 20:11'! model: aModel ^ self basicNew initializeModel: aModel! ! !OBTabSheetMorph methodsFor: 'initialization' stamp: 'lr 5/14/2009 20:12'! initialize super initialize. self layoutPolicy: TableLayout new. self vResizing: #spaceFill; hResizing: #spaceFill! ! !OBTabSheetMorph methodsFor: 'initialization' stamp: 'lr 5/14/2009 20:15'! initializeModel: aModel model := aModel. model addDependent: self. self initialize! ! !OBTabSheetMorph methodsFor: 'accessing' stamp: 'lr 1/22/2008 19:40'! model ^ model! ! !OBTabSheetMorph methodsFor: 'accessing' stamp: 'lr 5/11/2009 17:11'! tabMorph ^ self owner owner tabSelectorMorph tabs detect: [ :each | each model = self ]! ! TabSelectorMorph subclass: #OBTabSelectorMorph instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tabs-Morphic'! !OBTabSelectorMorph class methodsFor: 'instance creation' stamp: 'lr 5/14/2009 20:26'! model: aModel ^ self basicNew initializeModel: aModel! ! !OBTabSelectorMorph methodsFor: 'actions' stamp: 'lr 5/14/2009 21:20'! closeOther! ! !OBTabSelectorMorph methodsFor: 'actions' stamp: 'lr 5/14/2009 21:22'! closeTab self changed: #remove: with: self model! ! !OBTabSelectorMorph methodsFor: 'initialization' stamp: 'lr 5/14/2009 20:29'! initializeModel: aModel model := aModel. model addDependent: self. self initialize. self hResizing: #spaceFill. self height: Preferences standardButtonFont height * 2! ! !OBTabSelectorMorph methodsFor: 'events' stamp: 'lr 5/14/2009 21:18'! menuClicked: anEvent with: aMorph | menu | menu := self theme newMenuIn: aMorph for: self. menu add: 'New Tab' action: #newTab. menu add: 'Close Tab' action: #closeTab. menu add: 'Close Other' action: #closeOther. menu popUpEvent: anEvent in: self world! ! !OBTabSelectorMorph methodsFor: 'creational' stamp: 'lr 5/14/2009 21:05'! newLabelMorph: aStringOrMorph | label morph | label := aStringOrMorph isMorph ifTrue: [ aStringOrMorph lock ] ifFalse: [ LabelMorph new contents: aStringOrMorph; font: self font; vResizing: #shrinkWrap; hResizing: #shrinkWrap; lock ]. morph := OBTabLabelMorph model: self model. morph roundedCorners: #(1 4); cornerStyle: self cornerStyle; changeTableLayout; listCentering: #center; layoutInset: (self theme tabLabelInsetFor: self); hResizing: #shrinkWrap; vResizing: #spaceFill; addMorph: label. morph on: #mouseDown send: #tabClicked:with: to: self. ^ morph! ! !OBTabSelectorMorph methodsFor: 'actions' stamp: 'lr 5/14/2009 21:20'! newTab ! ! !OBTabSelectorMorph methodsFor: 'events' stamp: 'lr 5/14/2009 21:14'! tabClicked: anEvent with: aMorph | index | index := self tabs indexOf: aMorph. self selectedIndex = index ifTrue: [ self menuClicked: anEvent with: aMorph ] ifFalse: [ self selectedIndex: index ]! ! TabLabelMorph subclass: #OBTabLabelMorph instanceVariableNames: 'model' classVariableNames: '' poolDictionaries: '' category: 'OB-Tabs-Morphic'! !OBTabLabelMorph class methodsFor: 'instance creation' stamp: 'lr 5/14/2009 20:14'! model: aModel ^ self basicNew initializeModel: aModel! ! !OBTabLabelMorph methodsFor: 'configuration' stamp: 'lr 5/14/2009 20:02'! defaultColor ^ self model defaultBackgroundColor! ! !OBTabLabelMorph methodsFor: 'initialization' stamp: 'lr 5/14/2009 21:04'! initializeModel: aModel model := aModel. model addDependent: self. self initialize. self cellInset: 5! ! !OBTabLabelMorph methodsFor: 'accessing' stamp: 'lr 5/14/2009 20:01'! model ^ model! ! !OBTabLabelMorph methodsFor: 'updating' stamp: 'lr 5/14/2009 20:42'! update: aSymbol super update: aSymbol. Transcript show: aSymbol; cr. aSymbol = #relabel ifTrue: [ self halt ]! ! OBMorphicPlatform subclass: #OBTabPlatform instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tabs-Core'! !OBTabPlatform class methodsFor: 'initialization' stamp: 'lr 5/11/2009 11:35'! initialize self current: self default! ! !OBTabPlatform class methodsFor: 'initialization' stamp: 'lr 5/11/2009 11:35'! unload self current: OBMorphicPlatform default! ! !OBTabPlatform methodsFor: 'interaction' stamp: 'lr 5/27/2009 18:27'! handleBrowseRequest: aRequest | window | (Sensor shiftPressed or: [ aRequest browser class = OBTabBrowser ]) ifTrue: [ ^ super handleBrowseRequest: aRequest ]. window := SystemWindow topWindow. (window isNil or: [ window model class ~= OBTabBrowser ]) ifTrue: [ window := OBTabBrowser open ]. window model add: aRequest browser; activate: aRequest browser. ^ window! ! TabGroupMorph subclass: #OBTabGroupMorph instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tabs-Morphic'! !OBTabGroupMorph class methodsFor: 'instance-creation' stamp: 'lr 5/14/2009 20:19'! model: aModel ^ self basicNew initializeModel: aModel! ! !OBTabGroupMorph methodsFor: 'actions' stamp: 'lr 5/11/2009 16:45'! activate: aBrowser | index | index := self pages findFirst: [ :each | each model = aBrowser ]. self selectedPageIndex: index! ! !OBTabGroupMorph methodsFor: 'actions' stamp: 'lr 8/27/2010 11:23'! add: aBrowser | builder | builder := OBMorphBuilder new. builder current: self do: [ builder tabSheet: aBrowser with: [ aBrowser buildGroup: aBrowser panels on: builder ] ]! ! !OBTabGroupMorph methodsFor: 'initialization' stamp: 'lr 5/14/2009 20:34'! initializeModel: aModel model := aModel. model addDependent: self. super initialize. self addMorphBack: (BorderedMorph new color: self tabSelectorMorph color; hResizing: #spaceFill; borderWidth: 0; height: 3; yourself)! ! !OBTabGroupMorph methodsFor: 'creation' stamp: 'lr 5/14/2009 20:27'! newTabSelectorMorph ^ OBTabSelectorMorph model: self model! ! !OBTabGroupMorph methodsFor: 'actions' stamp: 'lr 5/14/2009 21:32'! remove: aBrowser self tabSelectorMorph removeMorph: (self tabSelectorMorph submorphs detect: [ :each | each model = aBrowser ]). self pages removeMorph: (self pages detect: [ :each | each model = aBrowser ]). self pages submorphs isEmpty ifTrue: [ OBCloseRequest signal: self model ]! ! !OBTabGroupMorph methodsFor: 'events' stamp: 'lr 1/22/2008 18:44'! update: aSymbol with: aBrowser ^ self perform: aSymbol with: aBrowser! ! Object subclass: #OBTabBrowser instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tabs-Core'! !OBTabBrowser class methodsFor: 'instance creation' stamp: 'lr 1/22/2008 18:04'! new ^ self basicNew initialize! ! !OBTabBrowser class methodsFor: 'instance creation' stamp: 'lr 1/22/2008 18:04'! open ^ self new open! ! !OBTabBrowser methodsFor: 'actions' stamp: 'lr 1/22/2008 18:45'! activate: aBrowser self changed: #activate: with: aBrowser! ! !OBTabBrowser methodsFor: 'actions' stamp: 'lr 1/22/2008 19:00'! add: aBrowser self changed: #add: with: aBrowser! ! !OBTabBrowser methodsFor: 'building' stamp: 'lr 5/14/2009 17:52'! buildOn: aBuilder ^ aBuilder window: self with: [ aBuilder tabGroup: self with: [ ] ]! ! !OBTabBrowser methodsFor: 'opening' stamp: 'lr 1/22/2008 17:50'! close ^ OBCloseRequest signal: self! ! !OBTabBrowser methodsFor: 'configuration' stamp: 'lr 1/22/2008 18:06'! defaultLabel ^ 'Tab Browser'! ! !OBTabBrowser methodsFor: 'configuration' stamp: 'lr 5/11/2009 11:33'! labelString ^ self defaultLabel! ! !OBTabBrowser methodsFor: 'opening' stamp: 'lr 1/22/2008 17:50'! open ^ OBBrowseRequest signal: self! ! !OBTabBrowser methodsFor: 'actions' stamp: 'lr 1/22/2008 18:45'! remove: aBrowser self changed: #remove: with: aBrowser! ! OBTabPlatform initialize!