|
Class: NoteBookView
Object
|
+--GraphicsMedium
|
+--DisplaySurface
|
+--SimpleView
|
+--View
|
+--NoteBookView
|
+--TabView
- Package:
- stx:libwidg2
- Category:
- Views-Layout
- Version:
- rev:
1.261
date: 2023/12/11 13:34:10
- user: stefan
- file: NoteBookView.st directory: libwidg2
- module: stx stc-classLibrary: libwidg2
implements the noteBook.
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.
defaults
-
defaultFont
-
-
updateStyleCache
-
extract values from the styleSheet and cache them in class variables
Usage example(s):
image specs
-
tabBackgroundVista
-
This resource specification was automatically generated
by the ImageEditor of ST/X.
Usage example(s):
self tabBackgroundVista inspect
ImageEditor openOnClass:self andSelector:#tabBackgroundVista
Icon flushCachedIcons
|
accepting-items
-
tabAtIndex: tabIndex
-
-
tabAtIndex: tabIndex put: newLabelOrTabItem
-
called when the contents of a tab changed;
test whether the old layout can be reused;
otherwise we must recompute the whole list
-
tabForWhich: checkBlock
-
-
tabList
-
accessing
-
canvas
-
returns the canvas; the containter view
-
canvas: newCanvas
-
change the canvas; the container view
-
hierarchicalIndexOfChild: aView
-
-
lastUserSelection
-
-
lastUserSelection: something
-
-
list
-
return the list of Tabs or Labels
-
list: newTabItemListOrNil
-
set the tab-list.
warning: transforms the given list to a list of tabItems,
where each holds on to a corresponding list element.
When a new list comes in, the list elements are compared for identity.
This may make problems, when strings come in.
Q: should we compare for equality here?
-
listIndexOf: indexOrString
-
convert something to an index into the tab list;
returns the index or nil if not found
-
numberOfLines
-
assume one line at least
-
suppressAccessCharacters
-
sr: bugfix: https://expeccoalm.exept.de/D237051
do not convert labels like 'Drag&Drop' into 'DragDrop' 2nd D with underline,
and do not offer the &D as access character
-
suppressAccessCharacters: something
-
sr: bugfix: https://expeccoalm.exept.de/D237051
do not convert labels like 'Drag&Drop' into 'DragDrop' 2nd D with underline,
and do not offer the &D as access character
-
useIndex
-
use index instead of tab name
-
useIndex: aBoolean
-
set/clear the useIndex flag. If set, both actionBlock and change-messages
are passed the index(indices) of the selection as argument.
If clear, the value(s) (i.e. the selected string) is passed.
Default is false.
accessing-actions
-
accessTabMenuAction
-
callback to retrieve the menu for a specific tab.
the argument to the block is the index of the tab
-
accessTabMenuAction: aOneArgAction
-
callback to retrieve the menu for a specific tab.
the argument to the block is the index of the tab
-
action
-
get the action block to be performed on select; the argument to
the block is the selected index or nil in case of no selection.
-
action: oneArgBlock
-
set the action block to be performed on select; the argument to
the block is the selected index or nil in case of no selection.
accessing-behavior
-
destroyTabAction
-
-
destroyTabAction: aOneArgBlockOrNil
-
Modified (format): / 05-07-2011 / 15:35:07 / cg
-
disableDestroyButtonOfInactiveTabs
-
-
enabled
-
returns true if tabs are enabled
-
enabled: aBooleanOrNil
-
set the enabled state of tabs
-
isEnabled
-
returns the enabled state
-
keepCanvas: aBoolean
-
if false (the default), the previous canvas is destroyed, whenever
a new canvas is set.
if true, it is unmapped and kept.
Set this flag, if the application changes the canvas but wants
them to be kept for fast switching.
-
selectConditionBlock
-
get the conditionBlock; this block is evaluated before a selection
change is performed; the change will not be done, if the evaluation
returns false. The argument to the block is the selection index.
-
selectConditionBlock: aOneArgBlock
-
get the conditionBlock; this block is evaluated before a selection
change is performed; the change will not be done, if the evaluation
returns false. The argument to the block is the selection index.
-
showDestroyButtonOfInactiveTabs
-
-
translateLabel
-
true if labels are translated
-
translateLabel: aBoolean
-
set/clear the flag which controls if labels are translated to a national language
via the application's resources
-
translateToDisplayLabel: aString
-
translate the label
accessing-color & font
-
activeBackgroundColor
-
returns the bg color used when drawing the active tabs label
-
activeBackgroundColor: aColor
-
set the bg color used when drawing the active tabs label
-
activeForegroundColor
-
returns the color used when drawing the active tab's label
-
activeForegroundColor: aColor
-
set the color used when drawing the active tab's label
-
activeTabMarkerColor
-
win-XP style marker
-
activeTabMarkerColor: aColor
-
-
activeTabMarkerFgColor
-
win-XP style marker
-
backgroundColor
-
return the backgroundColor of the notebook view
-
destroyTabForegroundColor
-
returns the color used to draw the destroy button
-
disabledDestroyTabForegroundColor
-
returns the color used to draw a disabled destroy button
-
disabledForegroundColor
-
returns the color used when drawing disabled tab labels
-
drawLightColor
-
get the color to be used for lighted edges;
bug fix caused by common drawEdge
-
foregroundColor
-
return the color used for drawing text
-
foregroundColor: aColor
-
set the color to be used for drawing text
-
halfLightColor
-
-
halfShadowColor
-
-
viewBackground: aColor
-
(comment from inherited method)
set the viewBackground to something, a color, image or form.
If it's a color and we run on a color display, also set shadow and light
colors - this means, that a red view will get light-red and dark-red
edges.
accessing-dimension
-
activeTabMarkerHeight
-
-
computePreferredExtent
-
compute max extent x/y based on one line
-
destroyButtonFrameForTab: aTab
-
-
destroyButtonHeight
-
-
destroyButtonSepX
-
separating space between tabs right and the destroyButton
-
destroyButtonSepY
-
separating space between tabs top and the destroyButton
-
destroyButtonUsedWidth
-
returns the additional width used for a destroy button
-
destroyButtonWidth
-
-
preferredExtentForTab: aTab
-
returns the preferred extent of a specific tab
accessing-mvc
-
canvasHolder
-
get the model, which keeps the canvas, a kind of SimpleView
-
canvasHolder: aValueHolder
-
set the model, which keeps the canvas, a kind of SimpleView
-
listHolder
-
get the model, which keeps the list of Tabs or Labels
-
listHolder: aValueHolder
-
set the model, which keeps the list of Tabs or Labels
-
model: aValueHolder
-
set the model, which keeps the selection
accessing-style
-
addTabAction: aBlockOrNil
-
if not nil, an add-tab button is shown beside the tab list,
which calls aBlock
-
canvasInset
-
inset of the canvas relative to my frame
tabLevel + canvasInset == origin of canvas
-
canvasInset: anInset
-
inset of the canvas relative to my frame
tabLevel + canvasInset == origin of canvas
-
direction
-
returns the position of the tabs as symbol.
By default the value is set to #top.
Valid symbols are:
#top arrange tabs to be on top of a view
#bottom arrange tabs to be on bottom of a view
#left arrange tabs to be on left of a view
#right arrange tabs to be on right of a view
-
direction: aDirection
-
change the position of the tabs.
By default the value is set to #top.
Valid symbols are:
#top arrange tabs to be on top of a view
#bottom arrange tabs to be on bottom of a view
#left arrange tabs to be on left of a view
#right arrange tabs to be on right of a view
-
fitLastRow
-
in case of true, the last row is expanded to the view size like all
other rows. In case of false all the tabs in the last row keep their
preferred extent (x or y) depending on the direction.
-
fitLastRow: aBool
-
in case of true, the last row is expanded to the view size like all
other rows. In case of false all the tabs in the last row keep their
preferred extent (x or y) depending on the direction.
-
hasScrollButtons
-
-
hasScrollButtons: aBoolean
-
realized ifTrue:[
-
isHorizontal
-
returns true in case of direction is #top or #bottom
-
minimumTabWidth
-
answer the minimum required width of a tab or nil (use extent of tab only)
-
minimumTabWidth: aWidthOrNil
-
set the minimum required width of a tab or nil (use extent of tab only)
-
showDestroyTabButton
-
if true, a close-tab icon is shown
-
showDestroyTabButton: aBoolean
-
if true, a close-tab icon is shown
-
showDestroyTabButtonOnSingleTab
-
if true, AND showDestroyTabButton is true,
a close-tab icon is shown even for a single tab.
Otherwise, it is hidden if there is only one tab-item left
-
showDestroyTabButtonOnSingleTab: aBoolean
-
if true, AND showDestroyTabButton is true,
a close-tab icon is shown even for a single tab.
Otherwise, it is hidden if there is only one tab-item left
-
tabBottomMargin
-
returns the margin between the tabs and the canvas
-
tabBottomMargin: aMargin
-
set the margin between the tabs and the canvas
-
tabLabelInset
-
inset (a point) of the label relative to its frame
preferredExtent of Tab: label extent + tabLabelInset
-
tabLabelInset: aPoint
-
inset (a point) of the label relative to its frame
preferredExtent of Tab: label extent + tabLabelInset
-
tabLeftMargin
-
margin to the first visible tab or scroller button
-
tabLeftMargin: aMargin
-
margin to the first visible tab or scroller button
-
tabLevel
-
the level of the tabs and noteBook frame
-
tabLevel: aLevel
-
the level of the tabs and noteBook frame
-
tabRightMargin
-
margin from the last visible tab or scroller button to the view
-
tabRightMargin: aMargin
-
margin from the last visible tab or scroller button to the view
-
tabTopMargin
-
returns the margin between the tabs and the widget (not canvas)
-
tabTopMargin: aMargin
-
set the margin between the tabs and the widget (not canvas)
-
tabsPosition
-
returns the position of the tabs as symbol.
By default, the value is set to #top.
Valid symbols are:
#top arrange tabs to be on top of a view
#bottom arrange tabs to be on bottom of a view
#left arrange tabs to be on left of a view
#right arrange tabs to be on right of a view
-
tabsPosition: aDirectionSymbol
-
change the position of tabs.
By default the value is set to #top.
Valid symbols are:
#top arrange tabs to be on top of a view
#bottom arrange tabs to be on bottom of a view
#left arrange tabs to be on left of a view
#right arrange tabs to be on right of a view
change & update
-
styleChanged
-
called if the tab style changed;
list must be recomputed
-
update: something with: aParameter from: changedObject
-
one of my models changed its value
drawing
-
computeDrawingClipX: x y: y width: w height: h
-
-
drawActiveTabMarker: aTab
-
draw a tabs focus-rectangle
-
drawAddTabButton
-
redraw the add-tab button
-
drawBorderEdges
-
test whether TabView and not NoteBookView
-
drawDestroyButtonForTab: aTab
-
redraw a tab's destroy button
-
drawTabEdgesFor: aTab
-
}
-
drawTabFocus: aTab
-
draw a tabs focus-rectangle
-
invalidate
-
(comment from inherited method)
add a damage to redraw the receiver to its input event queue.
This is preferable to calling redraw directly, in that the drawing is done by
the view's process itself, and there is a possibilty to merge
multiple damage rectangles into single redraws.
However, be aware, that the redrawing may be delayed for some time,
until the receiver's windowGroupProcess gets rescheduled.
-
invalidateSelectedTab
-
-
invalidateTab: aTab
-
invalidate a tab (i.e. force it to be redrawn)
-
redrawTab: aTab
-
redraw a tab
-
redrawX: x y: y width: w height: h
-
a region must be redrawn
event handling
-
buttonMotion: buttonState x: x y: y
-
if we have to show a different icon while over the tab...
-
buttonPress: button x: x y: y
-
a button is pressed; find tab under point and set the selection
-
buttonRelease: button x: x y: y
-
a button is released; see if it's the destroyTab button
-
keyPress: aKey x: x y: y
-
selection might change; look for corresponding list entry
-
pointerLeave: state
-
(comment from inherited method)
mouse pointer left
-
processAccessCharacter: aKey
-
a character is pressed; check for tab identified by the character
select the tab and return true or if no tab detected return false
-
processCursorKey: aKey x: x y: y
-
selection might change; look for corresponding list entry
-
processShortcutKey: aKey
-
if there is a short-key for that character, process it
and return true. Otherwise, return false.
-
processShortcutKeyEvent: event
-
-
sizeChanged: how from: oldExtentOrNil
-
size of my view changed
focus handling
-
canTab
-
if the list of tabLabels is empty, we do not need the focus
by tabing - give the focus to my included subviews.
-
showFocus: explicit
-
got the keyboard focus
-
showNoFocus: explicit
-
lost the keyboard focus
-
supportsFocusOnTab
-
return true if the keyboard focus can ever be on the tab area
-
updateFocusIdOnSelectedTab
-
update the lastFocusId for the current selected tab
-
updateFocusView
-
called when updating the focusView within my canvas
-
wantsFocusWithButtonPress
-
never wants the focus by button press
help
-
helpText
-
return the helpText for the currently selected item (empty if none)
Usage example(s):
^ self helpTextForItemAt:selection
|
-
helpTextAt: srcPoint
-
return the helpText for aPoint (i.e. when mouse-pointer is moved over an item).
-
helpTextForItemAt: anIndex
-
-
helpTextForTab: aTab
-
initialization & release
-
destroy
-
remove dependencies
-
initStyle
-
setup style attributes
-
initialize
-
must init first - these values might be overwritten by initStyle
-
mapped
-
(comment from inherited method)
the view has been mapped (by some outside
action - i.e. window manager de-iconified me)
-
postRealize
-
automatically set the initially selected notebook tab;
unless it has been set already (by setup code)
-
realize
-
canvas notNil ASK CA
layout
-
computeBorderLayout
-
returns the layout of the frame araound the canvas
-
computeLayoutForTab: aTab
-
calculate the effective bounds of a tab.
This includes any size changes for the active tab (overlap etc.).
-
frameForAddTabButton
-
SmallInteger}
-
makeToBaseLine: aLnNr
-
rotate lines to make the line #aLnNr be the new base line (i.e.
subtract (aLnNr-1) from all lines and take modulu the number of lines
-
recomputeList
-
recompute list
-
recomputeListHorizontal
-
compute layouts for all tabs
-
recomputeListVertical
-
compute layouts for all tabs
-
resizeCanvas
-
obsolete
-
canvasFrameLevel
-
ignored
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
canvasFrameLevel: anInteger
-
ignored
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
labels
-
return the list of labels
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
labels: aListOfLabels
-
set the list of labels
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
labelsHolder
-
get the model, which keeps the list of Tabs or Labels
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
labelsHolder: aValueHolder
-
set the model, which keeps the list of Tabs or Labels
** This is an obsolete interface - do not use it (it may vanish in future versions) **
private
-
horizontalMarginForAddTabButton
-
should be changed to be style specific;
some (win8) prefer an additional, empty short tab
-
indexOfTab: aTab
-
-
showingDestroyButton
-
-
tabContainingPointX: x y: y
-
-
verticalMarginForAddTabButton
-
should be changed to be style specific;
some (win8) prefer an additional, empty short tab
private-buttons
-
buttonLayoutUpdate
-
-
buttonWidth
-
returns the button extent x or y dependent on the layout
-
hideButton: aButton
-
-
makeVisible: aTab
-
setup transformation to make the selection visible;
returns true if the transformation has changed otherwise false.
-
makeVisibleHorizontal: aTab
-
setup transformation to make the horizontal selection visible
-
makeVisibleVertical: aTab
-
setup transformation to make the vertical selection visible
-
scrollButtonPressed: whichButton
-
queries
-
hasTabSelected: aTab
-
-
isDestroyTabButtonShownFor: aTab
-
returns true if the destroyButton for a tab is shown
-
isFirstTabInLine: aTab
-
returns true if the tab is the first tab in the line
used by drawing
-
isLastTabInLine: aTab
-
returns true if the tab is the last tab in the line
used by drawing
selection
-
indexOfTabNamed: aTabLabel
-
-
isSelectable: anIndex
-
returns true if tab at an index is selectable
-
nextSelectableAfter: anIndex wrapAtEnd: wrapAtEnd
-
return the index of the next selectable entry after the index;
wrap at end if the wrapAtEnd flag is set to true.
-
previousSelectableBefore: anIndex wrapAtBegin: wrapAtBegin
-
return the index of the previous selectable entry before the index;
wrap at begin if the wrapAtBegin flag is set to true.
-
selectTab: aTab
-
select aTab - which may be a tab label or a TabItem
-
selectedTab
-
returns the selected tab or nil
-
selection
-
return the selection or nil/o; caring for the useIndex setting.
-
selection: anIndexOrNil
-
change the selection to index or nil. The model and/or actionBlock is notified
-
selectionChanged
-
selection has changed; update the model and evaluate change action
Usage example(s):
due to selectionChanged -> model value -> model changes again -> selectionChanged...
|
-
setSelection: anIndexOrNil
-
change the selection to anIndexOrNil. No notifications are raised
-
userSelection: anIndexOrNil
-
user changed the selection to index or nil. The model and/or actionBlock is notified
-
validateVisibleCanvas
-
tabItem minorKey notNil ifTrue:[
Tab
tabs at top & bottom
|top tab1 tab2|
top := StandardSystemView extent:300@100.
tab1 := NoteBookView origin:0.0 @ 0.0 corner:1.0 @ 0.5 in:top.
tab1 tabsPosition:#top.
tab1 list:#( 'Foo' 'Bar' 'Baz' 'Bla' 'BlaBla' ).
tab2 := NoteBookView origin:0.0 @ 0.5 corner:1.0 @ 1.0 in:top.
tab2 tabsPosition:#bottom.
tab2 list:#( 'Foo' 'Bar' 'Baz' 'Bla' 'BlaBla' ).
top open.
|
tabs at left & right
|top tab1 tab2|
top := StandardSystemView extent:100@300.
tab1 := NoteBookView origin:0.0 @ 0.0 corner:0.5 @ 01.0 in:top.
tab1 tabsPosition:#left.
tab1 list:#( 'Foo' 'Bar' 'Baz' 'Bla' 'BlaBla' ).
tab2 := NoteBookView origin:0.5 @ 0.0 corner:1.0 @ 1.0 in:top.
tab2 tabsPosition:#right.
tab2 list:#( 'Foo' 'Bar' 'Baz' 'Bla' 'BlaBla' ).
top open.
|
tabs at top & bottom, with add-tab button
|top tab1 tab2|
top := StandardSystemView extent:300@100.
tab1 := NoteBookView origin:0.0 @ 0.0 corner:1.0 @ 0.5 in:top.
tab1 addTabAction:[ self halt ].
tab1 tabsPosition:#top.
tab1 list:#( 'Foo' 'Bar' 'Baz' 'Bla' 'BlaBla' ).
tab2 := NoteBookView origin:0.0 @ 0.5 corner:1.0 @ 1.0 in:top.
tab2 addTabAction:[ self halt ].
tab2 tabsPosition:#bottom.
tab2 list:#( 'Foo' 'Bar' 'Baz' 'Bla' 'BlaBla' ).
top open.
|
tabs at left & right, with add-tab button
|top tab1 tab2|
top := StandardSystemView extent:100@300.
tab1 := NoteBookView origin:0.0 @ 0.0 corner:0.5 @ 01.0 in:top.
tab1 addTabAction:[ self halt ].
tab1 tabsPosition:#left.
tab1 list:#( 'Foo' 'Bar' 'Baz' 'Bla' 'BlaBla' ).
tab2 := NoteBookView origin:0.5 @ 0.0 corner:1.0 @ 1.0 in:top.
tab2 addTabAction:[ self halt ].
tab2 tabsPosition:#right.
tab2 list:#( 'Foo' 'Bar' 'Baz' 'Bla' 'BlaBla' ).
top open.
|
|