Bwidget Source Code
Check-in [5afb5e2005]
Not logged in
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Implemented the new configuration option -side, which allows the selection of the side for the notebook tabs. Possible values are "top" and "bottom".
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 5afb5e20058d257b30cd2db60bc92ada86ad1b3f
User & Date: sven 1999-09-21 01:50:17
Context
1999-09-21
17:22
* buttonbox.tcl: Fixed ButtonBox::add input list, as the change I made to allow tagging was not backwards compatible. Now tags are specified with -tags $tags, and all is well. check-in: 420c4a35b6 user: ericm tags: trunk
01:50
Implemented the new configuration option -side, which allows the selection of the side for the notebook tabs. Possible values are "top" and "bottom". check-in: 5afb5e2005 user: sven tags: trunk
1999-09-19
22:40
* mainframe.tcl: Fixed _destroy to unset ALL state variables, so that when a new MainFrame of the same name as an old one is created, it doesn't pick up residual state from the old one. check-in: 027986893f user: ericm tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to notebook.tcl.

1
2
3
4
5
6
7
8
9
10
11
...
193
194
195
196
197
198
199



200
201
202
203
204
205
206
...
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
...
632
633
634
635
636
637
638











639
640
641
642
643
644
645
646
647
648
649



650
651
652
653




654


655
656
657
658
659
660
661
662
663
664
665




666


667
668
669
670
671
672
673
...
675
676
677
678
679
680
681

682
683
684
685
686
687

688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712








713

714
715
716
717
718
719

720
721
722

723
724
725
726
727
728
729
...
752
753
754
755
756
757
758








759


760

761
762
763
764
765
766
767
768
769
770
771

772
773
774
775
776
777

778
779
780
781
782
783
784
785
786
787
788

789
790
791
792
793
794
795
...
799
800
801
802
803
804
805
806


807
808
809


810
811




812
813
814
815
816
817
818
819
820
821
822
823

824















825
826
827
828
829
830

831
832
833
834
835
836
837
838
839
840
841

842
843
844
845
846
847
848
849
850
851
852
853
854
855
856






857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
...
887
888
889
890
891
892
893
894
895

896
897
# ------------------------------------------------------------------------------
#  notebook.tcl
#  This file is part of Unifix BWidget Toolkit
#  $Id: notebook.tcl,v 1.2 1999/09/16 15:36:22 ericm Exp $
# ------------------------------------------------------------------------------
#  Index of commands:
#     - NoteBook::create
#     - NoteBook::configure
#     - NoteBook::cget
#     - NoteBook::compute_size
#     - NoteBook::insert
................................................................................
    foreach page $data(pages) {
        set w    [winfo reqwidth  $path.f$page]
        set h    [winfo reqheight $path.f$page]
        set wmax [expr {$w>$wmax ? $w : $wmax}]
        set hmax [expr {$h>$hmax ? $h : $hmax}]
    }
    configure $path -width $wmax -height $hmax



}


# ------------------------------------------------------------------------------
#  Command NoteBook::insert
# ------------------------------------------------------------------------------
proc NoteBook::insert { path index page args } {
................................................................................
    }

    foreach page $data(pages) {
        _draw_page $path $page 0
    }
    _draw_area   $path
    _draw_arrows $path
    # ericm
    set foo [lindex [split [winfo geometry $path] +] 0]
    foreach {w h} [split $foo x] {
	break
    }
#    $path:cmd scale all 0 0 1.0 -1.0
#    $path:cmd itemconfigure window -anchor sw
#    $path:cmd move all 0 $h
    # ericm
}


# -----------------------------------------------------------------------------
#  Command NoteBook::_draw_page
# -----------------------------------------------------------------------------
proc NoteBook::_draw_page { path page create } {
................................................................................

    # --- calcul des coordonnees et des couleurs de l'onglet ---------------------------------
    set pos [lsearch $data(pages) $page]
    set bg  [Widget::getoption $path -background]
    set h   $data(hpage)
    set xd  [_get_x_page $path $pos]
    set xf  [expr {$xd + $data($page,width)}]











    set lt  [list $xd $h $xd 4 [expr {$xd+3}] 1 $xf 1]
    set lb  [list $xf 1 [expr {$xf+3}] 4 [expr {$xf+3}] [expr {$h-3}] [expr {$xf+6}] $h]
    # ericm
#    set nbh [expr {[winfo height $path]-1} - $data(hpage)]
#    set nlt {}
#    set nlb {}
#    foreach {x y} $lt { lappend nlt $x [expr $y + $nbh] }
#    foreach {x y} $lb { lappend nlb $x [expr $y + $nbh] }
#    set lb $nlb
#    set lt $nlt
    # ericm



    set img [Widget::getoption $path.f$page -image]
    if { $data(select) == $page } {
        set fgt   $data(lbg)
        set fgb   $data(dbg)




        set ytext [expr {$h/2-1}]


        if { $img == "" } {
            set xtext [expr {$xd+9}]
        } else {
            set ximg  [expr {$xd+9}]
            set xtext [expr {$ximg+[image width $img]+4}]
        }
        set bd    [Widget::getoption $path -borderwidth]
        set fg    [Widget::getoption $path -foreground]
    } else {
        set fgt   $data(dbg)
        set fgb   $fgt




        set ytext [expr {$h/2}]


        if { $img == "" } {
            set xtext [expr {$xd+10}]
        } else {
            set ximg  [expr {$xd+10}]
            set xtext [expr {$ximg+[image width $img]+4}]
        }
        set bd    1
................................................................................
            set fg [Widget::getoption $path -foreground]
        } else {
            set fg [Widget::getoption $path -disabledforeground]
        }
    }

    # --- creation ou modification de l'onglet -----------------------------------------------

    if { $create } {
        eval $path:cmd create polygon [concat $lt $lb] \
            -tag     {"page p:$page $page:poly"} \
            -outline $bg \
            -fill    $bg
        eval $path:cmd create line $lt -tags {"page p:$page $page:top top"} -fill $fgt -width $bd

        eval $path:cmd create line $lb -tags {"page p:$page $page:bot bot"} -fill $fgb -width $bd
        $path:cmd create text $xtext $ytext           \
            -text   [Widget::getoption $path.f$page -text] \
            -font   [Widget::getoption $path -font]        \
            -fill   $fg                               \
            -anchor w                                 \
            -tags   "page p:$page $page:text"

        $path:cmd bind p:$page <ButtonPress-1> "NoteBook::_select $path $page"
        $path:cmd bind p:$page <Enter>         "NoteBook::_highlight on  $path $page"
        $path:cmd bind p:$page <Leave>         "NoteBook::_highlight off $path $page"
    } else {
        eval $path:cmd coords "$page:poly" [concat $lt $lb]
        eval $path:cmd coords "$page:top"  $lt
        eval $path:cmd coords "$page:bot"  $lb
        $path:cmd coords "$page:text" $xtext $ytext

        $path:cmd itemconfigure "$page:poly" -fill $bg  -outline $bg
        $path:cmd itemconfigure "$page:top"  -fill $fgt -width $bd
        $path:cmd itemconfigure "$page:bot"  -fill $fgb -width $bd
        $path:cmd itemconfigure "$page:text"    \
            -text [Widget::getoption $path.f$page -text]     \
            -font [Widget::getoption $path -font]    \
            -fill $fg
    }








    if { $img != "" } {

        if { [set id [$path:cmd find withtag $page:img]] == "" } {
            $path:cmd create image $ximg $ytext \
                -image  $img \
                -anchor w    \
                -tags   "page p:$page $page:img"
        } else {

            $path:cmd coords $id $ximg $ytext
            $path:cmd itemconfigure $id -image $img
        }

    } else {
        $path:cmd delete $page:img
    }

    if { $data(select) == $page } {
        $path:cmd raise p:$page
    } elseif { $pos == 0 } {
................................................................................
    upvar 0  $path data

    set w       [expr {[winfo width $path]-1}]
    set h       [expr {$data(hpage)-1}]
    set nbpages [llength $data(pages)]
    set xl      0
    set xr      [expr {$w-$_warrow+1}]











    if { $data(base) > 0 } {

        if { ![llength [$path:cmd find withtag "leftarrow"]] } {
            $path:cmd create window $xl 1 \
                -width  $_warrow          \
                -height $h                \
                -anchor nw                \
                -window $path.fg          \
                -tags   "leftarrow"
        } else {
            $path:cmd coords "leftarrow" $xl 1
            $path:cmd itemconfigure "leftarrow" -width $_warrow -height $h
        }

    } else {
        $path:cmd delete "leftarrow"
    }

    if { $data(base) < $nbpages-1 &&
         $data(wpage) + [_get_x_page $path 0] + 6 > $w } {

        if { ![llength [$path:cmd find withtag "rightarrow"]] } {
            $path:cmd create window $xr 1 \
                -width  $_warrow          \
                -height $h                \
                -window $path.fd          \
                -anchor nw                \
                -tags   "rightarrow"
        } else {
            $path:cmd coords "rightarrow" $xr 1
            $path:cmd itemconfigure "rightarrow" -width $_warrow -height $h
        }

    } else {
        $path:cmd delete "rightarrow"
    }
}


# ------------------------------------------------------------------------------
................................................................................
    variable $path
    upvar 0  $path data

    set w   [expr {[winfo width  $path]-1}]
    set h   [expr {[winfo height $path]-1}]
    set bd  [Widget::getoption $path -borderwidth]
    set x0  [expr {$bd-1}]
    set y0  $data(hpage)


    set y1  $h
    # ericm
#    set y0 [expr $y0 - $data(hpage)]


#    set y1 [expr $y1 - $data(hpage)]
    # ericm




    set dbg $data(dbg)
    set sel $data(select)
    if {  $sel == "" } {
        set xd  [expr {$w/2}]
        set xf  $xd
        set lbg $data(dbg)
    } else {
        set xd [_get_x_page $path [lsearch $data(pages) $data(select)]]
        set xf [expr {$xd + $data($sel,width)+6}]
        set lbg $data(lbg)
    }


    if { [llength [$path:cmd find withtag rect]] } {















        $path:cmd coords "toprect1" $xd $y0 $x0 $y0 $x0 $h
        $path:cmd coords "toprect2" $w $y0 $xf $y0
        $path:cmd coords "botrect"  $x0 $h $w $h $w $y0
        $path:cmd itemconfigure "toprect1" -fill $lbg -width $bd
        $path:cmd itemconfigure "toprect2" -fill $lbg -width $bd
        $path:cmd itemconfigure "botrect"  -width $bd

        $path:cmd raise "rect"
    } else {
        $path:cmd create line $xd $y0 $x0 $y0 $x0 $y1 \
            -tags "rect toprect1" -fill $lbg -width $bd
        $path:cmd create line $w $y0 $xf $y0 \
            -tags "rect toprect2" -fill $lbg -width $bd
        $path:cmd create line 1 $h $w $h $w $y0 \
            -tags "rect botrect"  -fill $dbg -width $bd
    }

    if { $sel != "" } {

        if { [llength [$path:cmd find withtag "window"]] } {
            $path:cmd coords "window" 2 [expr {$y0+1}]
            $path:cmd itemconfigure "window"    \
                -width  [expr {$w-3}]        \
                -height [expr {$h-$y0-3}]    \
                -window $path.f$sel
        } else {
            set y0 $data(hpage)
            $path:cmd create window 2 [expr {$y0+1}] \
                -width  [expr {$w-3}]           \
                -height [expr {$h-$y0-3}]       \
                -anchor nw                      \
                -tags   "window"                \
                -window $path.f$sel
        }






    } else {
        $path:cmd delete "window"
    }
}


# ------------------------------------------------------------------------------
#  Command NoteBook::_resize
# ------------------------------------------------------------------------------
proc NoteBook::_resize { path } {
    _draw_area   $path
    _draw_arrows $path
    # ericm
    set foo [lindex [split [winfo geometry $path] +] 0]
    foreach {w h} [split $foo x] {
	break
    }
#    $path:cmd scale all 0 0 1.0 -1.0
#    $path:cmd itemconfigure window -anchor sw
#    $path:cmd move all 0 $h
    # ericm
}


# ------------------------------------------------------------------------------
#  Command NoteBook::_realize
# ------------------------------------------------------------------------------
proc NoteBook::_realize { path } {
................................................................................

    if { [set width  [Widget::getoption $path -width]]  == 0 ||
         [set height [Widget::getoption $path -height]] == 0 } {
        compute_size $path
    }

    set data(realized) 1
    _draw_area $path
    _draw_arrows $path

    bind $path <Configure> "NoteBook::_resize $path"
}


|







 







>
>
>







 







<
<
<
<
<
<
<
<
<







 







>
>
>
>
>
>
>
>
>
>
>
|
|
<
<
<
<
<
<
<
<
<
>
>
>




>
>
>
>
|
>
>











>
>
>
>
|
>
>







 







>


|
<
|
|
>
|











<
<
<


<
<
<





>
>
>
>
>
>
>
>

>

|
<

|
<
>
|
|
<
>







 







>
>
>
>
>
>
>
>
|
>
>

>

|
|
|
|
|


|


>






>

|
|
|
|
|


|


>







 







|
>
>
|
<
|
>
>
|
<
>
>
>
>












>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|




|
>
|
<
|
<
<
<
<
<
|
<

>
|
<
<
<
<
<
<
<


|




>
>
>
>
>
>










|
|
|
<
<
<
<
<
<
<
<







 







|
|
>


1
2
3
4
5
6
7
8
9
10
11
...
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
...
610
611
612
613
614
615
616









617
618
619
620
621
622
623
...
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645









646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
...
686
687
688
689
690
691
692
693
694
695
696

697
698
699
700
701
702
703
704
705
706
707
708
709
710
711



712
713



714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730

731
732

733
734
735

736
737
738
739
740
741
742
743
...
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
...
827
828
829
830
831
832
833
834
835
836
837

838
839
840
841

842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882

883





884

885
886
887







888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913








914
915
916
917
918
919
920
...
923
924
925
926
927
928
929
930
931
932
933
934
# ------------------------------------------------------------------------------
#  notebook.tcl
#  This file is part of Unifix BWidget Toolkit
#  $Id: notebook.tcl,v 1.3 1999/09/21 01:50:17 sven Exp $
# ------------------------------------------------------------------------------
#  Index of commands:
#     - NoteBook::create
#     - NoteBook::configure
#     - NoteBook::cget
#     - NoteBook::compute_size
#     - NoteBook::insert
................................................................................
    foreach page $data(pages) {
        set w    [winfo reqwidth  $path.f$page]
        set h    [winfo reqheight $path.f$page]
        set wmax [expr {$w>$wmax ? $w : $wmax}]
        set hmax [expr {$h>$hmax ? $h : $hmax}]
    }
    configure $path -width $wmax -height $hmax
    # Sven... well ok so this is called twice in some cases...
    NoteBook::_redraw $path
    # Sven end
}


# ------------------------------------------------------------------------------
#  Command NoteBook::insert
# ------------------------------------------------------------------------------
proc NoteBook::insert { path index page args } {
................................................................................
    }

    foreach page $data(pages) {
        _draw_page $path $page 0
    }
    _draw_area   $path
    _draw_arrows $path









}


# -----------------------------------------------------------------------------
#  Command NoteBook::_draw_page
# -----------------------------------------------------------------------------
proc NoteBook::_draw_page { path page create } {
................................................................................

    # --- calcul des coordonnees et des couleurs de l'onglet ---------------------------------
    set pos [lsearch $data(pages) $page]
    set bg  [Widget::getoption $path -background]
    set h   $data(hpage)
    set xd  [_get_x_page $path $pos]
    set xf  [expr {$xd + $data($page,width)}]
    # Sven
    set side [Widget::getoption $path -side]
    set h1 [expr {[winfo height $path]}]
    set bd [Widget::getoption $path -borderwidth]
    if {"$side" == "bottom"} {
        set lt  [list $xd [expr {$h1-$h-1}] $xd [expr {$h1-4}] \
            [expr {$xd+3}] [expr {$h1-1}]]
        set lb  [list [expr {$xd+3}] [expr {$h1-1}] $xf [expr {$h1-1}] \
            [expr {$xf+3}] [expr {$h1-4}] [expr {$xf+3}] [expr {$h1-$h+3}] \
            [expr {$xf+6}] [expr {$h1-$h-1}]]
    } else {
        set lt  [list $xd $h $xd 4 [expr {$xd+3}] 1 $xf 1]
        set lb  [list $xf 1 [expr {$xf+3}] 4 [expr {$xf+3}] [expr {$h-3}] \









            [expr {$xf+6}] $h]
    }
    # Sven end
    set img [Widget::getoption $path.f$page -image]
    if { $data(select) == $page } {
        set fgt   $data(lbg)
        set fgb   $data(dbg)
        # Sven
        if {"$side" == "bottom"} {
            set ytext [expr {($h1 - ($h/2))}]
        } else {
            set ytext [expr {$h/2-1}]
        }
        # Sven end
        if { $img == "" } {
            set xtext [expr {$xd+9}]
        } else {
            set ximg  [expr {$xd+9}]
            set xtext [expr {$ximg+[image width $img]+4}]
        }
        set bd    [Widget::getoption $path -borderwidth]
        set fg    [Widget::getoption $path -foreground]
    } else {
        set fgt   $data(dbg)
        set fgb   $fgt
        # Sven
        if {"$side" == "bottom"} {
            set ytext [expr {$h1 - ($h/2) - 1}]
        } else {
            set ytext [expr {$h/2}]
        }
        # Sven end
        if { $img == "" } {
            set xtext [expr {$xd+10}]
        } else {
            set ximg  [expr {$xd+10}]
            set xtext [expr {$ximg+[image width $img]+4}]
        }
        set bd    1
................................................................................
            set fg [Widget::getoption $path -foreground]
        } else {
            set fg [Widget::getoption $path -disabledforeground]
        }
    }

    # --- creation ou modification de l'onglet -----------------------------------------------
    # Sven
    if { $create } {
        eval $path:cmd create polygon [concat $lt $lb] \
            -tag     {"page p:$page $page:poly"}

        eval $path:cmd create line $lt \
            -tags {"page p:$page $page:top top"}
        eval $path:cmd create line $lb \
            -tags {"page p:$page $page:bot bot"}
        $path:cmd create text $xtext $ytext           \
            -text   [Widget::getoption $path.f$page -text] \
            -font   [Widget::getoption $path -font]        \
            -fill   $fg                               \
            -anchor w                                 \
            -tags   "page p:$page $page:text"

        $path:cmd bind p:$page <ButtonPress-1> "NoteBook::_select $path $page"
        $path:cmd bind p:$page <Enter>         "NoteBook::_highlight on  $path $page"
        $path:cmd bind p:$page <Leave>         "NoteBook::_highlight off $path $page"
    } else {



        $path:cmd coords "$page:text" $xtext $ytext




        $path:cmd itemconfigure "$page:text"    \
            -text [Widget::getoption $path.f$page -text]     \
            -font [Widget::getoption $path -font]    \
            -fill $fg
    }
    $path:cmd itemconfigure "$page:poly" -fill $bg  -outline $bg
    $path:cmd itemconfigure "$page:top"  -fill $fgt -width $bd
    $path:cmd itemconfigure "$page:bot"  -fill $fgb -width $bd
    eval $path:cmd coords "$page:poly" [concat $lt $lb]
    eval $path:cmd coords "$page:top"  $lt
    eval $path:cmd coords "$page:bot"  $lb
    # Sven end
        
    if { $img != "" } {
        # Sven
        if { [set id [$path:cmd find withtag $page:img]] == "" } {
            set id [$path:cmd create image $ximg $ytext \

                -anchor w    \
                -tags   "page p:$page $page:img"]

        }
        $path:cmd coords $id $ximg $ytext
        $path:cmd itemconfigure $id -image $img

        # Sven end
    } else {
        $path:cmd delete $page:img
    }

    if { $data(select) == $page } {
        $path:cmd raise p:$page
    } elseif { $pos == 0 } {
................................................................................
    upvar 0  $path data

    set w       [expr {[winfo width $path]-1}]
    set h       [expr {$data(hpage)-1}]
    set nbpages [llength $data(pages)]
    set xl      0
    set xr      [expr {$w-$_warrow+1}]
    # Sven
    set side [Widget::getoption $path -side]
    if {"$side" == "bottom"} {
        set h1 [expr {[winfo height $path]-1}]
        set bd [Widget::getoption $path -borderwidth]
        set y0 [expr {$h1 - $data(hpage) + $bd}]
    } else {
        set y0 1
    }
    # Sven end (all y positions where replaced with $y0 later)

    if { $data(base) > 0 } {
        # Sven 
        if { ![llength [$path:cmd find withtag "leftarrow"]] } {
            $path:cmd create window $xl $y0 \
                -width  $_warrow            \
                -height $h                  \
                -anchor nw                  \
                -window $path.fg            \
                -tags   "leftarrow"
        } else {
            $path:cmd coords "leftarrow" $xl $y0
            $path:cmd itemconfigure "leftarrow" -width $_warrow -height $h
        }
        # Sven end
    } else {
        $path:cmd delete "leftarrow"
    }

    if { $data(base) < $nbpages-1 &&
         $data(wpage) + [_get_x_page $path 0] + 6 > $w } {
        # Sven
        if { ![llength [$path:cmd find withtag "rightarrow"]] } {
            $path:cmd create window $xr $y0 \
                -width  $_warrow            \
                -height $h                  \
                -window $path.fd            \
                -anchor nw                  \
                -tags   "rightarrow"
        } else {
            $path:cmd coords "rightarrow" $xr $y0
            $path:cmd itemconfigure "rightarrow" -width $_warrow -height $h
        }
        # Sven end
    } else {
        $path:cmd delete "rightarrow"
    }
}


# ------------------------------------------------------------------------------
................................................................................
    variable $path
    upvar 0  $path data

    set w   [expr {[winfo width  $path]-1}]
    set h   [expr {[winfo height $path]-1}]
    set bd  [Widget::getoption $path -borderwidth]
    set x0  [expr {$bd-1}]
    # Sven
    set side [Widget::getoption $path -side]
    if {"$side" == "bottom"} {
        set y0 0

        set y1 [expr {$h - $data(hpage)}]
        set yo $y1
    } else {
        set y0 $data(hpage)

        set y1 $h
        set yo [expr {$h-$y0}]
    }
    # Sven end
    set dbg $data(dbg)
    set sel $data(select)
    if {  $sel == "" } {
        set xd  [expr {$w/2}]
        set xf  $xd
        set lbg $data(dbg)
    } else {
        set xd [_get_x_page $path [lsearch $data(pages) $data(select)]]
        set xf [expr {$xd + $data($sel,width)+6}]
        set lbg $data(lbg)
    }

    # Sven
    if { [llength [$path:cmd find withtag rect]] == 0} {
        $path:cmd create line $xd $y0 $x0 $y0 $x0 $y1 \
            -tags "rect toprect1" 
        $path:cmd create line $w $y0 $xf $y0 \
            -tags "rect toprect2"
        $path:cmd create line 1 $h $w $h $w $y0 \
            -tags "rect botrect"
    }
    if {"$side" == "bottom"} {
        $path:cmd coords "toprect1" $w $y0 $x0 $y0 $x0 $y1
        $path:cmd coords "toprect2" $x0 $y1 $xd $y1
        $path:cmd coords "botrect"  $xf $y1 $w $y1 $w $y0
        $path:cmd itemconfigure "toprect1" -fill $lbg -width $bd
        $path:cmd itemconfigure "toprect2" -fill $dbg -width $bd
        $path:cmd itemconfigure "botrect" -fill $dbg -width $bd
    } else {
        $path:cmd coords "toprect1" $xd $y0 $x0 $y0 $x0 $y1
        $path:cmd coords "toprect2" $w $y0 $xf $y0
        $path:cmd coords "botrect"  $x0 $h $w $h $w $y0
        $path:cmd itemconfigure "toprect1" -fill $lbg -width $bd
        $path:cmd itemconfigure "toprect2" -fill $lbg -width $bd
        $path:cmd itemconfigure "botrect" -fill $dbg -width $bd
    }
    $path:cmd raise "rect"

    # Sven end







    if { $sel != "" } {
        # Sven
        if { [llength [$path:cmd find withtag "window"]] == 0 } {







            $path:cmd create window 2 [expr {$y0+1}] \
                -width  [expr {$w-3}]           \
                -height [expr {$yo-3}]          \
                -anchor nw                      \
                -tags   "window"                \
                -window $path.f$sel
        }
        $path:cmd coords "window" 2 [expr {$y0+1}]
        $path:cmd itemconfigure "window"    \
            -width  [expr {$w-3}]           \
            -height [expr {$yo-3}]          \
            -window $path.f$sel
        # Sven end
    } else {
        $path:cmd delete "window"
    }
}


# ------------------------------------------------------------------------------
#  Command NoteBook::_resize
# ------------------------------------------------------------------------------
proc NoteBook::_resize { path } {
    # Sven
    NoteBook::_redraw $path
    # Sven








}


# ------------------------------------------------------------------------------
#  Command NoteBook::_realize
# ------------------------------------------------------------------------------
proc NoteBook::_realize { path } {
................................................................................

    if { [set width  [Widget::getoption $path -width]]  == 0 ||
         [set height [Widget::getoption $path -height]] == 0 } {
        compute_size $path
    }

    set data(realized) 1
    # Sven
    NoteBook::_redraw $path
    # Sven
    bind $path <Configure> "NoteBook::_resize $path"
}