|
Class: TabItem
Object
|
+--Model
|
+--TabItem
- Package:
- stx:libwidg2
- Category:
- Views-Support
- Version:
- rev:
1.54
date: 2023/11/07 16:29:10
- user: cg
- file: TabItem.st directory: libwidg2
- module: stx stc-classLibrary: libwidg2
describes one tab entry; could be used for tabs instead of a string. Whenever
a value changed, a change notification is raised
copyrightCOPYRIGHT (c) 1997 by eXept Software AG
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
instance creation
-
label: aLabel
-
accessing
-
accessCharacterPosition
-
get the index of the access character in the label text or string, or 0 if none
-
accessCharacterPosition: anIndex
-
set the index of the access character in the label
-
argument
-
returns a user defined argument or nil
-
argument: anArgument
-
set a user defined argument
-
createNewBuilder
-
returns true if a new builder is used to create the canvas;
the default is true
-
createNewBuilder: aBool
-
set/clear the flag which controls if a new ui-builder is used to create the canvas;
the default is true. This affects if the bindings will be shared or not between tabs.
-
destroyTabAction
-
if non-nil, this tab has its own private destroyButton.
This can be used for individual tabs; for an overall tab-destroy capability,
change the destroyTab: action of my owning tabView
-
destroyTabAction: aBlock
-
if non-nil, this tab has its own private destroyButton.
This can be used for individual tabs; for an overall tab-destroy capability,
change the destroyTab: action of my owning tabView
-
enabled
-
get the enabled state of the tab
-
enabled: aBoolean
-
set the enabled state of the tab
-
hasView
-
-
label
-
get the label or selector to access a label/bitmap.
To get the label to be shown use: #rawLabel
-
label: aLabel
-
set the label or selector to access the label/bitmap
-
nameKey
-
an additional (untranslated) key (do not use the label to identify tabs)
-
nameKey: aStringOrSymbol
-
an additional (untranslated) key (do not use the label to identify tabs)
-
printableLabel
-
-
shortcutKey
-
get the key to press to select the tab item from the keyboard; a symbol or nil
-
shortcutKey: aKeyOrNil
-
set the key to press to select the tab item from the keyboard; a symbol or nil
-
view
-
-
view: aView
-
accessing-canvas
-
canvas
-
returns the application or view. Creates one if not already present
Usage example(s):
canvasClass := Smalltalk resolveName:classNameKey inClass:self class.
|
-
canvasApplication
-
returns the application the canvas is running
-
canvasOrNil
-
returns the application or nil - does NOT create one
-
canvasView
-
returns the view the canvas is running in or nil if no canvas
specified or not yet created
-
destroyCanvas
-
-
majorKey
-
-
majorKey: aMajorKey
-
-
minorKey
-
-
minorKey: aMinorKey
-
-
setupCanvasView: aView
-
not horizontal scrollable - always set x to scrolled view x
accessing-color & font
-
foregroundColor
-
get the label color or nil
-
foregroundColor: aColor
-
set the label color or nil
-
labelForegroundColor
-
get the label color or nil
-
labelForegroundColor: aColor
-
set the label color or nil
accessing-scrollbars
-
autoHideScrollBars
-
-
autoHideScrollBars: aBoolOrNil
-
-
hasHorizontalScrollBar
-
-
hasHorizontalScrollBar: aBool
-
-
hasVerticalScrollBar
-
-
hasVerticalScrollBar: aBool
-
-
miniScrollerHorizontal
-
-
miniScrollerHorizontal: aBool
-
-
miniScrollerVertical
-
-
miniScrollerVertical: aBool
-
building
-
applicationProvidesLabel
-
returns true if the label is acquired from the application
-
applicationProvidesLabel: aBool
-
set/clear the flag which controls if the label is provided by the application
-
editAgument
-
used by TabItemEditor to get the argument
-
editAgument: anArgument
-
used by TabItemEditor to set the argument
-
rawLabel
-
returns the label to be shown
-
setAttributesFromClass: aClass
-
setup attributes from aClass
Ugly: used only with the tabListEditor.
-
setAttributesWithBuilder: aBuilder
-
setup attributes dependent on the builder
-
translateLabel
-
returns true if the label derives from the application
-
translateLabel: aBool
-
set/clear the flag which controls if the label is translated to a national language
via the application's resources
converting
-
skippedInLiteralEncoding
-
define the inst-slots which are skipped when generating a literalArrayEncoding;
(to skip the ones with default values.)
displaying
-
displayOn: aGC x: x y: y
-
(comment from inherited method)
display the receiver in a graphicsContext - this method allows
for any object to be displayed in a ListView (or any view) - for example.
-
heightOn: aGC
-
(comment from inherited method)
return the height of the receiver, if it is to be displayed on aGC
-
widthOn: aGC
-
(comment from inherited method)
return the width of the receiver, if it is to be displayed on aGC
help
-
activeHelpKey
-
the key used to ask the application for the tooltip text (via helpTextFor:)
-
activeHelpKey: aSymbolicKey
-
the key used to ask the application for the tooltip text (via helpTextFor:)
-
activeHelpText
-
-
activeHelpText: aString
-
queries
-
isCanvasApplicationModel
-
returns true if the canvas is an application model
-
isEnabled
-
labels derived from item
|top tab|
top := StandardSystemView new label:'tabs at top'; extent:250@100.
tab := TabView origin:0.0 @ 0.0 corner:1.0 @ 0.5 in:top.
tab direction:#top.
tab list:(#( 'Foo' 'Bar' 'Baz' ) collect:[:l| TabItem label:l ]).
tab action:[:aName|Transcript showCR:aName].
top open.
|
|top tab list item|
top := StandardSystemView new label:'tabs at top'; extent:400@400.
tab := NoteBookView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
tab direction:#top.
list := #( 'Foo' 'Bar' 'Baz' ) collect:[:l| TabItem label:l ].
item := list at:1.
item majorKey:ClockView.
item := list at:2.
item majorKey:CodingExamples_GUI::GUIDemoNoteBook.
item := list at:3.
item majorKey:CodingExamples_GUI::GUIDemoMenu.
tab list:list.
top open.
|
testing tab configuration and change notifications
|top tab list idx label|
top := StandardSystemView new label:'tabs at top'; extent:250@100.
tab := TabView origin:0.0 @ 0.0 corner:1.0 @ 0.5 in:top.
tab direction:#top.
list := (#( 'Foo' 'Bar' 'Baz' ) collect:[:l| TabItem label:l ]).
tab list:list.
tab action:[:aName|Transcript showCR:aName].
top openAndWaitUntilVisible.
[
idx := 0.
label := LabelAndIcon icon:(Image fromFile:('xpmBitmaps/document_images/tiny_yellow_dir.xpm' ))
string:'Test Tab'.
[top shown] whileTrue:[
|aTab lbl|
(idx := idx + 1) > list size ifTrue:[idx := 1].
aTab := list at:idx.
lbl := aTab label.
Delay waitForSeconds:0.5. aTab label:label.
Delay waitForSeconds:0.5. aTab enabled:false.
Delay waitForSeconds:0.5. aTab enabled:true.
Delay waitForSeconds:0.5. aTab foregroundColor:(Color red).
Delay waitForSeconds:0.5. aTab foregroundColor:nil.
aTab label:lbl.
]
] forkAt:1.
|
|