Model Railroad System  2.2.1
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
ScrollTabNotebook Class Reference

Tabbed Notebook with scrollable tabs. More...

Public Member Functions

 ScrollTabNotebook (name,...)
 Constructor: create a ScrollTabNotebook. More...
 
 compute_size ()
 (Re-)compute the size of the widget. More...
 
 add (window,...)
 Add a window to the end of the page list. More...
 
 insert (pos, window,...)
 Insert a window at the specified position. More...
 
 tab (tabid,...)
 Updates the tab options for tabid. More...
 
 tabs ()
 Return all tabs. More...
 
 forget (tabid)
 Removes the tab specified by tabid, unmaps and unmanages the associated window. More...
 
 select (tabid="")
 Selects the specified tab. More...
 
 see (tabid)
 Make the specified tabid visible. More...
 
 index (tabid)
 Returns the numeric index of the tab specified by tabid, or the total number of tabs if tabid is the string "end". More...
 

Private Member Functions

 _test_page (page)
 Test to see if page is managed. More...
 
 _compute_width ()
 Recompute tab width. More...
 
 _compute_height ()
 Recompute tab height. More...
 
 _get_x_page (pos)
 Get X position of the page at pos. More...
 
 _xview (inc)
 Shift the tabs to the left or right. More...
 
 _highlight (flag, page)
 Turn highlighting on or off for the specified tab. More...
 
 _select (page)
 Make the specified page the selected page. More...
 
 _redraw ()
 Redraw the tabs and all. More...
 
 _draw_page (page, create)
 Draw a tab for the specified page, creating a new tab if asked or moving an old one otherwise. More...
 
 _draw_arrows ()
 Draw the arrow buttons if needed. More...
 
 _resize ()
 Resize the widget. More...
 
 _themeChanged_ ()
 Theme Changed method. More...
 

Static Private Member Functions

static _themeChanged (w)
 Theme Changed typemethod. More...
 
static _Configure (widget, width, height)
 Configure typemethod. More...
 
static get3dcolor (path, bgcolor)
 Compute 3D colors. More...
 

Private Attributes

 tabrow
 Row containing the tabs. More...
 
 left
 Left arrow button. More...
 
 tabs
 Scrolling tab frame (canvas). More...
 
 right
 Right arrow button. More...
 
 select
 The currently selected page. More...
 
 _clientRow
 Grid row for client pages (1 is bottom). More...
 
 _tabrow
 Grid row for tabs (0 is top). More...
 
 _hpage
 Height of tabrow. More...
 
 _wpage
 Width of tabrow. More...
 
 _textid
 Scratch text id. More...
 
 realized
 Flag to indicate if the widget is realized. More...
 
 pages
 The list of available pages. More...
 
 pages_opts
 The options for the available pages. More...
 
 base
 Leftmost visible tab. More...
 
 dbg
 Darker tab background. More...
 
 lbg
 Lighter tab background. More...
 

Static Private Attributes

static _tabsides
 Tabside type checker. More...
 
static _radiustype
 Tab radius and bevelsize type checker. More...
 
static _paddingtype
 Tab padding type checker. More...
 
static _warrow
 Width of an arrow button. More...
 
static _left
 Bitmap for the left button. More...
 
static _right
 Bitmap for the right button. More...
 

Detailed Description

Tabbed Notebook with scrollable tabs.

This is a Tabbed Notebook widget, with scrollable tabs. It implements left and right arrows, as needed, to shift the tab row to the left or right to allow for more tabs than will fit in the available space.

Options:

Constructor & Destructor Documentation

◆ ScrollTabNotebook()

ScrollTabNotebook::ScrollTabNotebook ( name  ,
  ... 
)

Constructor: create a ScrollTabNotebook.

Parameters
namePathname of the widget.
...Options:
  • -style Widget style.
  • -width The width of the widget.
  • -height The height of the widget.
  • -cursor The cursor to use.
  • -takefocus Can the widget take focus?

Member Function Documentation

◆ _compute_height()

ScrollTabNotebook::_compute_height ( )
private

Recompute tab height.

◆ _compute_width()

ScrollTabNotebook::_compute_width ( )
private

Recompute tab width.

◆ _Configure()

static ScrollTabNotebook::_Configure ( widget  ,
width  ,
height   
)
staticprivate

Configure typemethod.

Parameters
widgetThe widget the Configure event happened for.
widthThe new width.
heightThe new height.

◆ _draw_arrows()

ScrollTabNotebook::_draw_arrows ( )
private

Draw the arrow buttons if needed.

◆ _draw_page()

ScrollTabNotebook::_draw_page ( page  ,
create   
)
private

Draw a tab for the specified page, creating a new tab if asked or moving an old one otherwise.

Parameters
pageThe page whose tab we will draw.
createFlag indicating if the tab needs to be created.

◆ _get_x_page()

ScrollTabNotebook::_get_x_page ( pos  )
private

Get X position of the page at pos.

Parameters
posThe page position.
Returns
The x position of the tab.

◆ _highlight()

ScrollTabNotebook::_highlight ( flag  ,
page   
)
private

Turn highlighting on or off for the specified tab.

Parameters
flagFlag to indicate turning highlighting on or off.
pageThe page whose tab to turn highlighting on or off.

◆ _redraw()

ScrollTabNotebook::_redraw ( )
private

Redraw the tabs and all.

◆ _resize()

ScrollTabNotebook::_resize ( )
private

Resize the widget.

◆ _select()

ScrollTabNotebook::_select ( page  )
private

Make the specified page the selected page.

Parameters
pageThe page to select.

◆ _test_page()

ScrollTabNotebook::_test_page ( page  )
private

Test to see if page is managed.

Parameters
pageThe page to test.
Returns
The position of the page.

◆ _themeChanged()

static ScrollTabNotebook::_themeChanged ( )
staticprivate

Theme Changed typemethod.

Parameters
wThe widget the theme changed for.

◆ _themeChanged_()

ScrollTabNotebook::_themeChanged_ ( )
private

Theme Changed method.

◆ _xview()

ScrollTabNotebook::_xview ( inc  )
private

Shift the tabs to the left or right.

Parameters
incThe shift increment, negative to the left, positive to the right.

◆ add()

ScrollTabNotebook::add ( window  ,
  ... 
)

Add a window to the end of the page list.

Adds a new window (page) to the list of managed pages.

Parameters
windowThe window to add.
...Tab options:
  • -state The state of the tab (NOT IMPLEMENTED - state is always normal).
  • -sticky The stickyness (as in grid configure ... -sticky).
  • -padding The padding (as in grid configure ... -padx and -pady).
  • -text The text of the tab.
  • -image The image of the tab.
  • -compound The compound of the tab (see the -compound option of labels and buttons).
  • -underline The underline of the tab label (NOT IMPLEMENTED, the -underline option is ignored).

◆ compute_size()

ScrollTabNotebook::compute_size ( )

(Re-)compute the size of the widget.

◆ forget()

ScrollTabNotebook::forget ( tabid  )

Removes the tab specified by tabid, unmaps and unmanages the associated window.

Parameters
tabidThe tab to remove.

◆ get3dcolor()

static ScrollTabNotebook::get3dcolor ( path  ,
bgcolor   
)
staticprivate

Compute 3D colors.

Parameters
pathWindow path.
bgcolorBackground color to use as a base.
Returns
Two RGB colors, one darker, one lighter.

◆ index()

ScrollTabNotebook::index ( tabid  )

Returns the numeric index of the tab specified by tabid, or the total number of tabs if tabid is the string "end".

Parameters
tabidThe tabid to get the index of.
Returns
The numeric index of the tab specified by tabid.

◆ insert()

ScrollTabNotebook::insert ( pos  ,
window  ,
  ... 
)

Insert a window at the specified position.

Inserts a new window (page) to the list of managed pages at the specified position.

Parameters
posThe insert position.
windowThe window to insert.
...Tab options:
  • -state The state of the tab (NOT IMPLEMENTED - state is always normal).
  • -sticky The stickyness (as in grid configure ... -sticky).
  • -padding The padding (as in grid configure ... -padx and -pady).
  • -text The text of the tab.
  • -image The image of the tab.
  • -compound The compound of the tab (see the -compound option of labels and buttons).
  • -underline The underline of the tab label (NOT IMPLEMENTED, the -underline option is ignored).

◆ see()

ScrollTabNotebook::see ( tabid  )

Make the specified tabid visible.

Parameters
tabidThe tabid to make visible.

◆ select()

ScrollTabNotebook::select ( tabid  = "")

Selects the specified tab.

The associated slave window will be displayed, and the previously-selected window (if different) is unmapped. If tabid is omitted, returns the widget name of the currently selected pane.

Parameters
tabidThe tab to select.
Returns
If tabid is ommited, return the currently selected pane.

◆ tab()

ScrollTabNotebook::tab ( tabid  ,
  ... 
)

Updates the tab options for tabid.

Parameters
tabidThe tab index.
...Tab options:
  • -state The state of the tab (NOT IMPLEMENTED - state is always normal).
  • -sticky The stickyness (as in grid configure ... -sticky).
  • -padding The padding (as in grid configure ... -padx and -pady).
  • -text The text of the tab.
  • -image The image of the tab.
  • -compound The compound of the tab (see the -compound option of labels and buttons).
  • -underline The underline of the tab label (NOT IMPLEMENTED, the -underline option is ignored).

◆ tabs()

ScrollTabNotebook::tabs ( )

Return all tabs.

Returns
All managed windows

Member Data Documentation

◆ _clientRow

ScrollTabNotebook::_clientRow
private

Grid row for client pages (1 is bottom).

◆ _hpage

ScrollTabNotebook::_hpage
private

Height of tabrow.

◆ _left

ScrollTabNotebook::_left
staticprivate

Bitmap for the left button.

◆ _paddingtype

ScrollTabNotebook::_paddingtype
staticprivate

Tab padding type checker.

◆ _radiustype

ScrollTabNotebook::_radiustype
staticprivate

Tab radius and bevelsize type checker.

◆ _right

ScrollTabNotebook::_right
staticprivate

Bitmap for the right button.

◆ _tabrow

ScrollTabNotebook::_tabrow
private

Grid row for tabs (0 is top).

◆ _tabsides

ScrollTabNotebook::_tabsides
staticprivate

Tabside type checker.

◆ _textid

ScrollTabNotebook::_textid
private

Scratch text id.

◆ _warrow

ScrollTabNotebook::_warrow
staticprivate

Width of an arrow button.

◆ _wpage

ScrollTabNotebook::_wpage
private

Width of tabrow.

◆ base

ScrollTabNotebook::base
private

Leftmost visible tab.

◆ dbg

ScrollTabNotebook::dbg
private

Darker tab background.

◆ lbg

ScrollTabNotebook::lbg
private

Lighter tab background.

◆ left

ScrollTabNotebook::left
private

Left arrow button.

◆ pages

ScrollTabNotebook::pages
private

The list of available pages.

◆ pages_opts

ScrollTabNotebook::pages_opts
private

The options for the available pages.

◆ realized

ScrollTabNotebook::realized
private

Flag to indicate if the widget is realized.

◆ right

ScrollTabNotebook::right
private

Right arrow button.

◆ select

ScrollTabNotebook::select
private

The currently selected page.

◆ tabrow

ScrollTabNotebook::tabrow
private

Row containing the tabs.


◆ tabs

ScrollTabNotebook::tabs
private

Scrolling tab frame (canvas).