123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- Smalltalk current createPackage: 'Helios' properties: #{}!
- Widget subclass: #HLBrowser
- instanceVariableNames: ''
- package: 'Helios'!
- Widget subclass: #HLDebugger
- instanceVariableNames: ''
- package: 'Helios'!
- Widget subclass: #HLInspector
- instanceVariableNames: ''
- package: 'Helios'!
- Widget subclass: #HLSUnit
- instanceVariableNames: ''
- package: 'Helios'!
- Object subclass: #HLTab
- instanceVariableNames: 'widget label'
- package: 'Helios'!
- !HLTab methodsFor: 'accessing'!
- activate
- self manager activate: self
- !
- add
- self manager addTab: self
- !
- label
- ^ label ifNil: [ '' ]
- !
- label: aString
- label := aString
- !
- manager
- ^ HLTabManager current
- !
- widget
- ^ widget
- !
- widget: aWidget
- widget := aWidget
- ! !
- !HLTab methodsFor: 'testing'!
- isActive
- ^ self manager activeTab = self
- ! !
- !HLTab class methodsFor: 'instance creation'!
- on: aWidget labelled: aString
- ^ self new
- widget: aWidget;
- label: aString;
- yourself
- ! !
- Widget subclass: #HLTabManager
- instanceVariableNames: 'tabs activeTab'
- package: 'Helios'!
- !HLTabManager methodsFor: 'accessing'!
- activate: aTab
- activeTab := aTab.
- self
- refresh;
- show: aTab
- !
- activeTab
- ^ activeTab
- !
- addTab: aTab
- self tabs add: aTab.
- self refresh
- !
- removeTab: aTab
- "Todo: activate the previously activated tab. Keep a history of tabs selection"
- (self tabs includes: aTab) ifFalse: [ ^ self ].
- self tabs remove: aTab.
- self refresh
- !
- tabs
- ^ tabs ifNil: [ tabs := OrderedCollection new ]
- ! !
- !HLTabManager methodsFor: 'rendering'!
- refresh
- (window jQuery: '.navbar') remove.
- (window jQuery: '#container') remove.
- self appendToJQuery: 'body' asJQuery
- !
- renderOn: html
- html div
- class: 'navbar navbar-fixed-top';
- with: [ html div
- class: 'navbar-inner';
- with: [ self renderTabsOn: html ] ].
- html div id: 'container'
- !
- renderTabsOn: html
- html ul
- class: 'nav';
- with: [ self tabs do: [ :each |
- html li
- class: (each isActive ifTrue: [ 'active' ] ifFalse: [ 'inactive' ]);
- with: [
- html a
- with: each label;
- onClick: [ each activate ] ] ] ]
- !
- show: aTab
- (window jQuery: '#container') empty.
- aTab widget appendToJQuery: '#container' asJQuery
- ! !
- HLTabManager class instanceVariableNames: 'current'!
- !HLTabManager class methodsFor: 'accessing'!
- current
- ^ current ifNil: [ current := self basicNew initialize ]
- ! !
- !HLTabManager class methodsFor: 'initialization'!
- initialize
- self current appendToJQuery: 'body' asJQuery
- ! !
- !HLTabManager class methodsFor: 'instance creation'!
- new
- "Use current instead"
- self shouldNotImplement
- ! !
- Widget subclass: #HLTranscript
- instanceVariableNames: ''
- package: 'Helios'!
- Widget subclass: #HLWorkspace
- instanceVariableNames: ''
- package: 'Helios'!
|