eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'NoteBookView':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: NoteBookView


Inheritance:

   Object
   |
   +--GraphicsMedium
      |
      +--DisplaySurface
         |
         +--SimpleView
            |
            +--View
               |
               +--NoteBookView
                  |
                  +--TabView

Package:
stx:libwidg2
Category:
Views-Layout
Version:
rev: 1.233 date: 2019/07/09 18:53:39
user: cg
file: NoteBookView.st directory: libwidg2
module: stx stc-classLibrary: libwidg2
Author:
Claus Atzkern

Description:


implements the noteBook.


Related information:

    TabView

Class protocol:

defaults
o  defaultFont

o  updateStyleCache
extract values from the styleSheet and cache them in class variables

usage example(s):

     self updateStyleCache

image specs
o  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


Instance protocol:

accepting-items
o  tabAtIndex: tabIndex

o  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

accessing
o  canvas
returns the canvas; the containter view

o  canvas: newCanvas
change the canvas; the container view

o  hierarchicalIndexOfChild: aView

o  lastUserSelection

o  lastUserSelection: something

o  list
return the list of Tabs or Labels

o  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?

o  listIndexOf: something
convert something to an index into the list;
returns the index or nil if not found

o  numberOfLines
assume one line at least

o  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

o  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

o  useIndex
use index instead of tab name

o  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
o  accessTabMenuAction
callback to retrieve the menu for a specific tab.
the argument to the block is the index of the tab

o  accessTabMenuAction: aOneArgAction
callback to retrieve the menu for a specific tab.
the argument to the block is the index of the tab

o  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.

o  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
o  destroyTabAction

o  destroyTabAction: aOneArgBlockOrNil
Modified (format): / 05-07-2011 / 15:35:07 / cg

o  disableDestroyButtonOfInactiveTabs

o  enabled
returns true if tabs are enabled

o  enabled: aBooleanOrNil
set the enabled state of tabs

o  isEnabled
returns the enabled state

o  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.

o  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.

o  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.

o  showDestroyButtonOfInactiveTabs

o  translateLabel
true if labels are translated

o  translateLabel: aBoolean
set to true if labels should be translated

o  translateToDisplayLabel: aString
translate the label

accessing-color & font
o  activeBackgroundColor
returns the bg color used when drawing the active tabs label

o  activeBackgroundColor: aColor
set the bg color used when drawing the active tabs label

o  activeForegroundColor
returns the color used when drawing the active tab's label

o  activeForegroundColor: aColor
set the color used when drawing the active tab's label

o  activeTabMarkerColor
win-XP style marker

o  activeTabMarkerColor: aColor

o  activeTabMarkerFgColor
win-XP style marker

o  backgroundColor
return the backgroundColor of the notebook view

o  destroyTabForegroundColor
returns the color used to draw the destroy button

o  disabledDestroyTabForegroundColor
returns the color used to draw a disabled destroy button

o  disabledForegroundColor
returns the color used when drawing disabled tab labels

o  drawLightColor
get the color to be used for lighted edges;
bug fix caused by common drawEdge

o  foregroundColor
return the color used for drawing text

o  foregroundColor: aColor
set the color to be used for drawing text

o  halfLightColor

o  halfShadowColor

o  viewBackground: aColor

accessing-dimension
o  activeTabMarkerHeight

o  computePreferredExtent
compute max extent x/y based on one line

o  destroyButtonFrameForTab: aTab

o  destroyButtonHeight

o  destroyButtonSepX
separating space between tabs right and the destroyButton

o  destroyButtonSepY
separating space between tabs top and the destroyButton

o  destroyButtonUsedWidth
returns the additional width used for a destroy button

o  destroyButtonWidth

o  preferredExtentForTab: aTab
returns the preferred extent of a specific tab

accessing-mvc
o  canvasHolder
get the model, which keeps the canvas, a kind of SimpleView

o  canvasHolder: aValueHolder
set the model, which keeps the canvas, a kind of SimpleView

o  listHolder
get the model, which keeps the list of Tabs or Labels

o  listHolder: aValueHolder
set the model, which keeps the list of Tabs or Labels

o  model: aValueHolder
set the model, which keeps the selection

accessing-style
o  addTabAction: aBlockOrNil
if not nil, an add-tab button is shown beside the tab list,
which calls aBlock

o  canvasInset
inset of the canvas relative to my frame
tabLevel + canvasInset == origin of canvas

o  canvasInset: anInset
inset of the canvas relative to my frame
tabLevel + canvasInset == origin of canvas

o  direction
returns the direction of tabs as symbol. On 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

o  direction: aDirection
change the direction of tabs. On 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

o  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.

o  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.

o  hasScrollButtons

o  hasScrollButtons: aBoolean
realized ifTrue:[

o  isHorizontal
returns true in case of direction is #top or #bottom

o  minimumTabWidth
answer the minimum required width of a tab or nil (use extent of tab only)

o  minimumTabWidth: aWidthOrNil
set the minimum required width of a tab or nil (use extent of tab only)

o  showDestroyTabButton
if true, a close-tab icon is shown

o  showDestroyTabButton: aBoolean
if true, a close-tab icon is shown

o  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

o  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

o  tabBottomMargin
returns the margin between the tabs and the canvas

o  tabBottomMargin: aMargin
set the margin between the tabs and the canvas

o  tabLabelInset
inset (a point) of the label relative to its frame
preferredExtent of Tab: label extent + tabLabelInset

o  tabLabelInset: aPoint
inset (a point) of the label relative to its frame
preferredExtent of Tab: label extent + tabLabelInset

o  tabLeftMargin
margin to the first visible tab or scroller button

o  tabLeftMargin: aMargin
margin to the first visible tab or scroller button

o  tabLevel
the level of the tabs and noteBook frame

o  tabLevel: aLevel
the level of the tabs and noteBook frame

o  tabRightMargin
margin from the last visible tab or scroller button to the view

o  tabRightMargin: aMargin
margin from the last visible tab or scroller button to the view

o  tabTopMargin
returns the margin between the tabs and the widget (not canvas)

o  tabTopMargin: aMargin
set the margin between the tabs and the widget (not canvas)

change & update
o  styleChanged
called if the tab style changed;
list must be recomputed

o  update: something with: aParameter from: changedObject
one of my models changed its value

drawing
o  computeDrawingClipX: x y: y width: w height: h

o  drawActiveTabMarker: aTab
draw a tabs focus-rectangle

o  drawAddTabButton
redraw the add-tab button

o  drawBorderEdges
test whether TabView and not NoteBookView

o  drawDestroyButtonForTab: aTab
redraw a tab's destroy button

o  drawTabEdgesFor: aTab
}

o  drawTabFocus: aTab
draw a tabs focus-rectangle

o  invalidateSelectedTab

o  invalidateTab: aTab
invalidate a tab (i.e. force it to be redrawn)

o  redrawTab: aTab
redraw a tab

o  redrawX: x y: y width: w height: h
a region must be redrawn

event handling
o  buttonMotion: buttonState x: x y: y
if we have to show a different icon while over the tab...

o  buttonPress: button x: x y: y
a button is pressed; find tab under point and set the selection

o  buttonRelease: button x: x y: y
a button is released; see if it's the destroyTab button

o  keyPress: aKey x: x y: y
selection might change; look for corresponding list entry

o  pointerLeave: state

o  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

o  processCursorKey: aKey x: x y: y
selection might change; look for corresponding list entry

o  processShortcutKey: aKey
if there is a short-key for that character, process it
and return true. Otherwise, return false.

o  processShortcutKeyEvent: event

o  sizeChanged: how
size of my view changed

focus handling
o  canTab
if the list of tabLabels is empty, we do not need the focus
by tabing - give the focus to my included subviews.

o  showFocus: explicit
got the keyboard focus

o  showNoFocus: explicit
lost the keyboard focus

o  supportsFocusOnTab
return true if the keyboard focus can ever be on the tab area

o  updateFocusIdOnSelectedTab
update the lastFocusId for the current selected tab

o  updateFocusView
called when updating the focusView within my canvas

o  wantsFocusWithButtonPress
never wants the focus by button press

help
o  helpText
return the helpText for the currently selected item (empty if none)

o  helpTextAt: srcPoint
return the helpText for aPoint (i.e. when mouse-pointer is moved over an item).

o  helpTextForItemAt: anIndex

o  helpTextForTab: aTab

initialization & release
o  destroy
remove dependencies

o  initStyle
setup style attributes

o  initialize
must init first - these values might be overwritten by initStyle

o  mapped

o  postRealize
automatically set the initially selected notebook tab;
unless it has been set already (by setup code)

o  realize
canvas notNil ASK CA

layout
o  computeBorderLayout
returns the layout of the frame araound the canvas

o  computeLayoutForTab: aTab
calculate the effective bounds of a tab.
This includes any size changes for the active tab (overlap etc.).

o  frameForAddTabButton
bottom

o  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

o  recomputeList
recompute list

o  recomputeListHorizontal
compute layouts for all tabs

o  recomputeListVertical
compute layouts for all tabs

o  resizeCanvas

obsolete
o  canvasFrameLevel
ignored

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  canvasFrameLevel: anInteger
ignored

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  labels
return the list of labels

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  labels: aListOfLabels
set the list of labels


** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  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) **

o  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
o  horizontalMarginForAddTabButton
should be changed to be style specific;
some (win8) prefer an additional, empty short tab

o  indexOfTab: aTab

o  showingDestroyButton

o  tabContainingPointX: x y: y

o  verticalMarginForAddTabButton
should be changed to be style specific;
some (win8) prefer an additional, empty short tab

private-buttons
o  buttonLayoutUpdate

o  buttonWidth
returns the button extent x or y dependent on the layout

o  hideButton: aButton

o  makeVisible: aTab
setup transformation to make the selection visible;
returns true if the transformation has changed otherwise false.

o  makeVisibleHorizontal: aTab
setup transformation to make the horizontal selection visible

o  makeVisibleVertical: aTab
setup transformation to make the vertical selection visible

o  scrollButtonPressed: whichButton

queries
o  hasTabSelected: aTab

o  isDestroyTabButtonShownFor: aTab
returns true if the destroyButton for a tab is shown

o  isFirstTabInLine: aTab
returns true if the tab is the first tab in the line
used by drawing

o  isLastTabInLine: aTab
returns true if the tab is the last tab in the line
used by drawing

selection
o  isSelectable: anIndex
returns true if tab at an index is selectable

o  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.

o  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.

o  selectTab: aTab
select aTab - which may be a tab label or a TabItem

o  selectedTab
returns the selected tab or nil

o  selection
return the selection or nil/o; caring for the useIndex setting.

o  selection: anIndexOrNil
change the selection to index or nil. The model and/or actionBlock is notified

o  selectionChanged
selection has changed; update the model and evaluate change action

usage example(s):

due to selectionChanged -> model value -> model changes again -> selectionChanged...

o  setSelection: anIndexOrNil
change the selection to anIndexOrNil. No notifications are raised

o  userSelection: anIndexOrNil
user changed the selection to index or nil. The model and/or actionBlock is notified

o  validateVisibleCanvas
tabItem minorKey notNil ifTrue:[


Private classes:

    Tab

Examples:


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 direction:#top.
  tab1 list:#( 'Foo' 'Bagr' 'Baz' 'Bgar' 'Baqz'  ).

  tab2 := NoteBookView origin:0.0 @ 0.5 corner:1.0 @ 1.0 in:top.
  tab2 direction:#bottom.
  tab2 list:#( 'Foo' 'Bagr' 'Baz' 'Bgar' 'Baqz'  ).
  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 direction:#left.
  tab1 list:#( 'Foo' 'Bagr' 'Baz' 'Bgar' 'Baqz'  ).

  tab2 := NoteBookView origin:0.5 @ 0.0 corner:1.0 @ 1.0 in:top.
  tab2 direction:#right.
  tab2 list:#( 'Foo' 'Bagr' 'Baz' 'Bgar' 'Baqz'  ).
  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 direction:#top.
  tab1 list:#( 'Foo' 'Bagr' 'Baz' 'Bgar' 'Baqz'  ).

  tab2 := NoteBookView origin:0.0 @ 0.5 corner:1.0 @ 1.0 in:top.
  tab2 addTabAction:[ self halt ].
  tab2 direction:#bottom.
  tab2 list:#( 'Foo' 'Bagr' 'Baz' 'Bgar' 'Baqz'  ).
  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 direction:#left.
  tab1 list:#( 'Foo' 'Bagr' 'Baz' 'Bgar' 'Baqz'  ).

  tab2 := NoteBookView origin:0.5 @ 0.0 corner:1.0 @ 1.0 in:top.
  tab2 addTabAction:[ self halt ].
  tab2 direction:#right.
  tab2 list:#( 'Foo' 'Bagr' 'Baz' 'Bgar' 'Baqz'  ).
  top open.


ST/X 7.2.0.0; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Sat, 20 Apr 2024 02:38:12 GMT