TextSweep

Hex Artifact Content
Login

Artifact d5baadd4d5ddaf85e56eb8b9a31d7d0b02ce6dde:


0000: 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  # --------------
0010: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0020: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0030: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0040: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23  --------------.#
0050: 20 20 73 63 72 6f 6c 6c 66 72 61 6d 65 2e 74 63    scrollframe.tc
0060: 6c 0a 23 20 20 54 68 69 73 20 66 69 6c 65 20 69  l.#  This file i
0070: 73 20 70 61 72 74 20 6f 66 20 55 6e 69 66 69 78  s part of Unifix
0080: 20 42 57 69 64 67 65 74 20 54 6f 6f 6c 6b 69 74   BWidget Toolkit
0090: 0a 23 20 20 24 49 64 3a 20 73 63 72 6f 6c 6c 66  .#  $Id: scrollf
00a0: 72 61 6d 65 2e 74 63 6c 2c 76 20 31 2e 31 31 20  rame.tcl,v 1.11 
00b0: 32 30 30 39 2f 30 37 2f 31 37 20 31 35 3a 32 39  2009/07/17 15:29
00c0: 3a 35 31 20 6f 65 68 68 61 72 20 45 78 70 20 24  :51 oehhar Exp $
00d0: 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  .# -------------
00e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
00f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0100: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0110: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a  ---------------.
0120: 23 20 20 49 6e 64 65 78 20 6f 66 20 63 6f 6d 6d  #  Index of comm
0130: 61 6e 64 73 3a 0a 23 20 20 20 20 20 2d 20 53 63  ands:.#     - Sc
0140: 72 6f 6c 6c 61 62 6c 65 46 72 61 6d 65 3a 3a 63  rollableFrame::c
0150: 72 65 61 74 65 0a 23 20 20 20 20 20 2d 20 53 63  reate.#     - Sc
0160: 72 6f 6c 6c 61 62 6c 65 46 72 61 6d 65 3a 3a 63  rollableFrame::c
0170: 6f 6e 66 69 67 75 72 65 0a 23 20 20 20 20 20 2d  onfigure.#     -
0180: 20 53 63 72 6f 6c 6c 61 62 6c 65 46 72 61 6d 65   ScrollableFrame
0190: 3a 3a 63 67 65 74 0a 23 20 20 20 20 20 2d 20 53  ::cget.#     - S
01a0: 63 72 6f 6c 6c 61 62 6c 65 46 72 61 6d 65 3a 3a  crollableFrame::
01b0: 67 65 74 66 72 61 6d 65 0a 23 20 20 20 20 20 2d  getframe.#     -
01c0: 20 53 63 72 6f 6c 6c 61 62 6c 65 46 72 61 6d 65   ScrollableFrame
01d0: 3a 3a 73 65 65 0a 23 20 20 20 20 20 2d 20 53 63  ::see.#     - Sc
01e0: 72 6f 6c 6c 61 62 6c 65 46 72 61 6d 65 3a 3a 78  rollableFrame::x
01f0: 76 69 65 77 0a 23 20 20 20 20 20 2d 20 53 63 72  view.#     - Scr
0200: 6f 6c 6c 61 62 6c 65 46 72 61 6d 65 3a 3a 79 76  ollableFrame::yv
0210: 69 65 77 0a 23 20 20 20 20 20 2d 20 53 63 72 6f  iew.#     - Scro
0220: 6c 6c 61 62 6c 65 46 72 61 6d 65 3a 3a 5f 72 65  llableFrame::_re
0230: 73 69 7a 65 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d  size.# ---------
0240: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0250: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0260: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0270: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0280: 2d 2d 2d 0a 0a 6e 61 6d 65 73 70 61 63 65 20 65  ---..namespace e
0290: 76 61 6c 20 53 63 72 6f 6c 6c 61 62 6c 65 46 72  val ScrollableFr
02a0: 61 6d 65 20 7b 0a 20 20 20 20 57 69 64 67 65 74  ame {.    Widget
02b0: 3a 3a 64 65 66 69 6e 65 20 53 63 72 6f 6c 6c 61  ::define Scrolla
02c0: 62 6c 65 46 72 61 6d 65 20 73 63 72 6f 6c 6c 66  bleFrame scrollf
02d0: 72 61 6d 65 0a 0a 20 20 20 20 23 20 49 66 20 74  rame..    # If t
02e0: 68 65 6d 65 64 2c 20 74 68 65 72 65 20 69 73 20  hemed, there is 
02f0: 6e 6f 20 62 61 63 6b 67 72 6f 75 6e 64 20 61 6e  no background an
0300: 64 20 2d 62 67 20 6f 70 74 69 6f 6e 0a 20 20 20  d -bg option.   
0310: 20 69 66 20 7b 5b 57 69 64 67 65 74 3a 3a 74 68   if {[Widget::th
0320: 65 6d 65 5d 7d 20 7b 0a 20 20 20 20 20 20 20 20  eme]} {.        
0330: 57 69 64 67 65 74 3a 3a 64 65 63 6c 61 72 65 20  Widget::declare 
0340: 53 63 72 6f 6c 6c 61 62 6c 65 46 72 61 6d 65 20  ScrollableFrame 
0350: 7b 0a 20 20 20 20 20 20 20 20 20 20 20 20 7b 2d  {.            {-
0360: 77 69 64 74 68 20 20 20 20 20 20 20 20 20 20 20  width           
0370: 20 20 49 6e 74 20 20 20 20 20 20 20 20 30 20 20    Int        0  
0380: 30 20 7b 7d 7d 0a 20 20 20 20 20 20 20 20 20 20  0 {}}.          
0390: 20 20 7b 2d 68 65 69 67 68 74 20 20 20 20 20 20    {-height      
03a0: 20 20 20 20 20 20 49 6e 74 20 20 20 20 20 20 20        Int       
03b0: 20 30 20 20 30 20 7b 7d 7d 0a 20 20 20 20 20 20   0  0 {}}.      
03c0: 20 20 20 20 20 20 7b 2d 61 72 65 61 77 69 64 74        {-areawidt
03d0: 68 20 20 20 20 20 20 20 20 20 49 6e 74 20 20 20  h         Int   
03e0: 20 20 20 20 20 30 20 20 30 20 7b 7d 7d 0a 20 20       0  0 {}}.  
03f0: 20 20 20 20 20 20 20 20 20 20 7b 2d 61 72 65 61            {-area
0400: 68 65 69 67 68 74 20 20 20 20 20 20 20 20 49 6e  height        In
0410: 74 20 20 20 20 20 20 20 20 30 20 20 30 20 7b 7d  t        0  0 {}
0420: 7d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7b 2d  }.            {-
0430: 63 6f 6e 73 74 72 61 69 6e 65 64 77 69 64 74 68  constrainedwidth
0440: 20 20 42 6f 6f 6c 65 61 6e 20 20 20 20 30 20 30    Boolean    0 0
0450: 7d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7b 2d  }.            {-
0460: 63 6f 6e 73 74 72 61 69 6e 65 64 68 65 69 67 68  constrainedheigh
0470: 74 20 42 6f 6f 6c 65 61 6e 20 20 20 20 30 20 30  t Boolean    0 0
0480: 7d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7b 2d  }.            {-
0490: 78 73 63 72 6f 6c 6c 63 6f 6d 6d 61 6e 64 20 20  xscrollcommand  
04a0: 20 20 54 6b 52 65 73 6f 75 72 63 65 20 22 22 20    TkResource "" 
04b0: 30 20 63 61 6e 76 61 73 7d 0a 20 20 20 20 20 20  0 canvas}.      
04c0: 20 20 20 20 20 20 7b 2d 79 73 63 72 6f 6c 6c 63        {-yscrollc
04d0: 6f 6d 6d 61 6e 64 20 20 20 20 54 6b 52 65 73 6f  ommand    TkReso
04e0: 75 72 63 65 20 22 22 20 30 20 63 61 6e 76 61 73  urce "" 0 canvas
04f0: 7d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7b 2d  }.            {-
0500: 78 73 63 72 6f 6c 6c 69 6e 63 72 65 6d 65 6e 74  xscrollincrement
0510: 20 20 54 6b 52 65 73 6f 75 72 63 65 20 22 22 20    TkResource "" 
0520: 30 20 63 61 6e 76 61 73 7d 0a 20 20 20 20 20 20  0 canvas}.      
0530: 20 20 20 20 20 20 7b 2d 79 73 63 72 6f 6c 6c 69        {-yscrolli
0540: 6e 63 72 65 6d 65 6e 74 20 20 54 6b 52 65 73 6f  ncrement  TkReso
0550: 75 72 63 65 20 22 22 20 30 20 63 61 6e 76 61 73  urce "" 0 canvas
0560: 7d 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20  }.        }.    
0570: 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 20  } else {.       
0580: 20 57 69 64 67 65 74 3a 3a 64 65 63 6c 61 72 65   Widget::declare
0590: 20 53 63 72 6f 6c 6c 61 62 6c 65 46 72 61 6d 65   ScrollableFrame
05a0: 20 7b 0a 20 20 20 20 20 20 20 20 20 20 20 20 7b   {.            {
05b0: 2d 62 61 63 6b 67 72 6f 75 6e 64 20 20 20 20 20  -background     
05c0: 20 20 20 54 6b 52 65 73 6f 75 72 63 65 20 22 22     TkResource ""
05d0: 20 30 20 66 72 61 6d 65 7d 0a 20 20 20 20 20 20   0 frame}.      
05e0: 20 20 20 20 20 20 7b 2d 77 69 64 74 68 20 20 20        {-width   
05f0: 20 20 20 20 20 20 20 20 20 20 49 6e 74 20 20 20            Int   
0600: 20 20 20 20 20 30 20 20 30 20 7b 7d 7d 0a 20 20       0  0 {}}.  
0610: 20 20 20 20 20 20 20 20 20 20 7b 2d 68 65 69 67            {-heig
0620: 68 74 20 20 20 20 20 20 20 20 20 20 20 20 49 6e  ht            In
0630: 74 20 20 20 20 20 20 20 20 30 20 20 30 20 7b 7d  t        0  0 {}
0640: 7d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7b 2d  }.            {-
0650: 61 72 65 61 77 69 64 74 68 20 20 20 20 20 20 20  areawidth       
0660: 20 20 49 6e 74 20 20 20 20 20 20 20 20 30 20 20    Int        0  
0670: 30 20 7b 7d 7d 0a 20 20 20 20 20 20 20 20 20 20  0 {}}.          
0680: 20 20 7b 2d 61 72 65 61 68 65 69 67 68 74 20 20    {-areaheight  
0690: 20 20 20 20 20 20 49 6e 74 20 20 20 20 20 20 20        Int       
06a0: 20 30 20 20 30 20 7b 7d 7d 0a 20 20 20 20 20 20   0  0 {}}.      
06b0: 20 20 20 20 20 20 7b 2d 63 6f 6e 73 74 72 61 69        {-constrai
06c0: 6e 65 64 77 69 64 74 68 20 20 42 6f 6f 6c 65 61  nedwidth  Boolea
06d0: 6e 20 20 20 20 30 20 30 7d 0a 20 20 20 20 20 20  n    0 0}.      
06e0: 20 20 20 20 20 20 7b 2d 63 6f 6e 73 74 72 61 69        {-constrai
06f0: 6e 65 64 68 65 69 67 68 74 20 42 6f 6f 6c 65 61  nedheight Boolea
0700: 6e 20 20 20 20 30 20 30 7d 0a 20 20 20 20 20 20  n    0 0}.      
0710: 20 20 20 20 20 20 7b 2d 78 73 63 72 6f 6c 6c 63        {-xscrollc
0720: 6f 6d 6d 61 6e 64 20 20 20 20 54 6b 52 65 73 6f  ommand    TkReso
0730: 75 72 63 65 20 22 22 20 30 20 63 61 6e 76 61 73  urce "" 0 canvas
0740: 7d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7b 2d  }.            {-
0750: 79 73 63 72 6f 6c 6c 63 6f 6d 6d 61 6e 64 20 20  yscrollcommand  
0760: 20 20 54 6b 52 65 73 6f 75 72 63 65 20 22 22 20    TkResource "" 
0770: 30 20 63 61 6e 76 61 73 7d 0a 20 20 20 20 20 20  0 canvas}.      
0780: 20 20 20 20 20 20 7b 2d 78 73 63 72 6f 6c 6c 69        {-xscrolli
0790: 6e 63 72 65 6d 65 6e 74 20 20 54 6b 52 65 73 6f  ncrement  TkReso
07a0: 75 72 63 65 20 22 22 20 30 20 63 61 6e 76 61 73  urce "" 0 canvas
07b0: 7d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7b 2d  }.            {-
07c0: 79 73 63 72 6f 6c 6c 69 6e 63 72 65 6d 65 6e 74  yscrollincrement
07d0: 20 20 54 6b 52 65 73 6f 75 72 63 65 20 22 22 20    TkResource "" 
07e0: 30 20 63 61 6e 76 61 73 7d 0a 20 20 20 20 20 20  0 canvas}.      
07f0: 20 20 20 20 20 20 7b 2d 62 67 20 20 20 20 20 20        {-bg      
0800: 20 20 20 20 20 20 20 20 20 20 53 79 6e 6f 6e 79            Synony
0810: 6d 20 20 20 20 2d 62 61 63 6b 67 72 6f 75 6e 64  m    -background
0820: 7d 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20  }.        }.    
0830: 7d 0a 0a 20 20 20 20 57 69 64 67 65 74 3a 3a 61  }..    Widget::a
0840: 64 64 6d 61 70 20 53 63 72 6f 6c 6c 61 62 6c 65  ddmap Scrollable
0850: 46 72 61 6d 65 20 22 22 20 3a 63 6d 64 20 7b 0a  Frame "" :cmd {.
0860: 20 20 20 20 20 20 20 20 2d 77 69 64 74 68 20 7b          -width {
0870: 7d 20 2d 68 65 69 67 68 74 20 7b 7d 20 0a 20 20  } -height {} .  
0880: 20 20 20 20 20 20 2d 78 73 63 72 6f 6c 6c 63 6f        -xscrollco
0890: 6d 6d 61 6e 64 20 7b 7d 20 2d 79 73 63 72 6f 6c  mmand {} -yscrol
08a0: 6c 63 6f 6d 6d 61 6e 64 20 7b 7d 0a 20 20 20 20  lcommand {}.    
08b0: 20 20 20 20 2d 78 73 63 72 6f 6c 6c 69 6e 63 72      -xscrollincr
08c0: 65 6d 65 6e 74 20 7b 7d 20 2d 79 73 63 72 6f 6c  ement {} -yscrol
08d0: 6c 69 6e 63 72 65 6d 65 6e 74 20 7b 7d 0a 20 20  lincrement {}.  
08e0: 20 20 7d 0a 20 20 20 20 69 66 20 7b 20 21 20 5b    }.    if { ! [
08f0: 57 69 64 67 65 74 3a 3a 74 68 65 6d 65 5d 7d 20  Widget::theme]} 
0900: 7b 0a 20 20 20 20 20 20 20 20 57 69 64 67 65 74  {.        Widget
0910: 3a 3a 61 64 64 6d 61 70 20 53 63 72 6f 6c 6c 61  ::addmap Scrolla
0920: 62 6c 65 46 72 61 6d 65 20 22 22 20 2e 66 72 61  bleFrame "" .fra
0930: 6d 65 20 7b 2d 62 61 63 6b 67 72 6f 75 6e 64 20  me {-background 
0940: 7b 7d 7d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 76  {}}.    }..    v
0950: 61 72 69 61 62 6c 65 20 5f 77 69 64 67 65 74 0a  ariable _widget.
0960: 0a 20 20 20 20 62 69 6e 64 20 42 77 53 63 72 6f  .    bind BwScro
0970: 6c 6c 61 62 6c 65 46 72 61 6d 65 20 3c 43 6f 6e  llableFrame <Con
0980: 66 69 67 75 72 65 3e 20 5b 6c 69 73 74 20 53 63  figure> [list Sc
0990: 72 6f 6c 6c 61 62 6c 65 46 72 61 6d 65 3a 3a 5f  rollableFrame::_
09a0: 72 65 73 69 7a 65 20 25 57 5d 0a 20 20 20 20 62  resize %W].    b
09b0: 69 6e 64 20 42 77 53 63 72 6f 6c 6c 61 62 6c 65  ind BwScrollable
09c0: 46 72 61 6d 65 20 3c 44 65 73 74 72 6f 79 3e 20  Frame <Destroy> 
09d0: 20 20 5b 6c 69 73 74 20 57 69 64 67 65 74 3a 3a    [list Widget::
09e0: 64 65 73 74 72 6f 79 20 25 57 5d 0a 7d 0a 0a 0a  destroy %W].}...
09f0: 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  # --------------
0a00: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0a10: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0a20: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0a30: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23  --------------.#
0a40: 20 20 43 6f 6d 6d 61 6e 64 20 53 63 72 6f 6c 6c    Command Scroll
0a50: 61 62 6c 65 46 72 61 6d 65 3a 3a 63 72 65 61 74  ableFrame::creat
0a60: 65 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  e.# ------------
0a70: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0a80: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0a90: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0aa0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0ab0: 0a 70 72 6f 63 20 53 63 72 6f 6c 6c 61 62 6c 65  .proc Scrollable
0ac0: 46 72 61 6d 65 3a 3a 63 72 65 61 74 65 20 7b 20  Frame::create { 
0ad0: 70 61 74 68 20 61 72 67 73 20 7d 20 7b 0a 20 20  path args } {.  
0ae0: 20 20 57 69 64 67 65 74 3a 3a 69 6e 69 74 20 53    Widget::init S
0af0: 63 72 6f 6c 6c 61 62 6c 65 46 72 61 6d 65 20 24  crollableFrame $
0b00: 70 61 74 68 20 24 61 72 67 73 0a 0a 20 20 20 20  path $args..    
0b10: 73 65 74 20 63 61 6e 76 61 73 20 5b 65 76 61 6c  set canvas [eval
0b20: 20 5b 6c 69 73 74 20 63 61 6e 76 61 73 20 24 70   [list canvas $p
0b30: 61 74 68 5d 20 5b 57 69 64 67 65 74 3a 3a 73 75  ath] [Widget::su
0b40: 62 63 67 65 74 20 24 70 61 74 68 20 3a 63 6d 64  bcget $path :cmd
0b50: 5d 20 5c 0a 20 20 20 20 20 20 20 20 20 20 20 20  ] \.            
0b60: 20 20 20 20 20 20 20 20 2d 68 69 67 68 6c 69 67          -highlig
0b70: 68 74 74 68 69 63 6b 6e 65 73 73 20 30 20 2d 62  htthickness 0 -b
0b80: 6f 72 64 65 72 77 69 64 74 68 20 30 20 2d 72 65  orderwidth 0 -re
0b90: 6c 69 65 66 20 66 6c 61 74 5d 0a 0a 20 20 20 20  lief flat]..    
0ba0: 69 66 20 7b 5b 57 69 64 67 65 74 3a 3a 74 68 65  if {[Widget::the
0bb0: 6d 65 5d 7d 20 7b 0a 09 73 65 74 20 66 72 61 6d  me]} {..set fram
0bc0: 65 20 5b 65 76 61 6c 20 5b 6c 69 73 74 20 74 74  e [eval [list tt
0bd0: 6b 3a 3a 66 72 61 6d 65 20 24 70 61 74 68 2e 66  k::frame $path.f
0be0: 72 61 6d 65 5d 20 5c 0a 09 09 20 20 20 20 20 20  rame] \...      
0bf0: 20 5b 57 69 64 67 65 74 3a 3a 73 75 62 63 67 65   [Widget::subcge
0c00: 74 20 24 70 61 74 68 20 2e 66 72 61 6d 65 5d 5d  t $path .frame]]
0c10: 0a 09 73 65 74 20 62 67 20 5b 74 74 6b 3a 3a 73  ..set bg [ttk::s
0c20: 74 79 6c 65 20 6c 6f 6f 6b 75 70 20 54 46 72 61  tyle lookup TFra
0c30: 6d 65 20 2d 62 61 63 6b 67 72 6f 75 6e 64 5d 0a  me -background].
0c40: 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 09 73 65      } else {..se
0c50: 74 20 66 72 61 6d 65 20 5b 65 76 61 6c 20 5b 6c  t frame [eval [l
0c60: 69 73 74 20 66 72 61 6d 65 20 24 70 61 74 68 2e  ist frame $path.
0c70: 66 72 61 6d 65 5d 20 5c 0a 09 09 20 20 20 20 20  frame] \...     
0c80: 20 20 5b 57 69 64 67 65 74 3a 3a 73 75 62 63 67    [Widget::subcg
0c90: 65 74 20 24 70 61 74 68 20 2e 66 72 61 6d 65 5d  et $path .frame]
0ca0: 20 5c 0a 09 09 20 20 20 20 20 20 20 2d 68 69 67   \...       -hig
0cb0: 68 6c 69 67 68 74 74 68 69 63 6b 6e 65 73 73 20  hlightthickness 
0cc0: 30 20 2d 62 6f 72 64 65 72 77 69 64 74 68 20 30  0 -borderwidth 0
0cd0: 20 2d 72 65 6c 69 65 66 20 66 6c 61 74 5d 0a 09   -relief flat]..
0ce0: 73 65 74 20 62 67 20 5b 24 66 72 61 6d 65 20 63  set bg [$frame c
0cf0: 67 65 74 20 2d 62 61 63 6b 67 72 6f 75 6e 64 5d  get -background]
0d00: 0a 20 20 20 20 7d 0a 20 20 20 20 23 20 47 69 76  .    }.    # Giv
0d10: 65 20 63 61 6e 76 61 73 20 66 72 61 6d 65 20 28  e canvas frame (
0d20: 6f 72 20 74 68 65 6d 65 29 20 62 61 63 6b 67 72  or theme) backgr
0d30: 6f 75 6e 64 0a 20 20 20 20 24 63 61 6e 76 61 73  ound.    $canvas
0d40: 20 63 6f 6e 66 69 67 75 72 65 20 2d 62 61 63 6b   configure -back
0d50: 67 72 6f 75 6e 64 20 24 62 67 0a 0a 20 20 20 20  ground $bg..    
0d60: 24 63 61 6e 76 61 73 20 63 72 65 61 74 65 20 77  $canvas create w
0d70: 69 6e 64 6f 77 20 30 20 30 20 2d 61 6e 63 68 6f  indow 0 0 -ancho
0d80: 72 20 6e 77 20 2d 77 69 6e 64 6f 77 20 24 66 72  r nw -window $fr
0d90: 61 6d 65 20 2d 74 61 67 73 20 77 69 6e 20 5c 0a  ame -tags win \.
0da0: 20 20 20 20 20 20 20 20 2d 77 69 64 74 68 20 20          -width  
0db0: 5b 57 69 64 67 65 74 3a 3a 63 67 65 74 20 24 70  [Widget::cget $p
0dc0: 61 74 68 20 2d 61 72 65 61 77 69 64 74 68 5d 20  ath -areawidth] 
0dd0: 5c 0a 20 20 20 20 20 20 20 20 2d 68 65 69 67 68  \.        -heigh
0de0: 74 20 5b 57 69 64 67 65 74 3a 3a 63 67 65 74 20  t [Widget::cget 
0df0: 24 70 61 74 68 20 2d 61 72 65 61 68 65 69 67 68  $path -areaheigh
0e00: 74 5d 0a 0a 20 20 20 20 62 69 6e 64 20 24 66 72  t]..    bind $fr
0e10: 61 6d 65 20 3c 43 6f 6e 66 69 67 75 72 65 3e 20  ame <Configure> 
0e20: 5c 0a 20 20 20 20 20 20 20 20 5b 6c 69 73 74 20  \.        [list 
0e30: 53 63 72 6f 6c 6c 61 62 6c 65 46 72 61 6d 65 3a  ScrollableFrame:
0e40: 3a 5f 66 72 61 6d 65 43 6f 6e 66 69 67 75 72 65  :_frameConfigure
0e50: 20 24 63 61 6e 76 61 73 5d 0a 20 20 20 20 23 20   $canvas].    # 
0e60: 61 64 64 20 3c 75 6e 6d 61 70 3e 20 62 69 6e 64  add <unmap> bind
0e70: 69 6e 67 3a 20 3c 63 6f 6e 66 69 67 75 72 65 3e  ing: <configure>
0e80: 20 69 73 20 6e 6f 74 20 63 61 6c 6c 65 64 20 77   is not called w
0e90: 68 65 6e 20 66 72 61 6d 65 0a 20 20 20 20 23 20  hen frame.    # 
0ea0: 62 65 63 6f 6d 65 73 20 73 6f 20 73 6d 61 6c 6c  becomes so small
0eb0: 20 74 68 61 74 20 69 74 20 73 75 64 64 65 6e 6c   that it suddenl
0ec0: 79 20 66 61 6c 6c 73 20 6f 75 74 73 69 64 65 20  y falls outside 
0ed0: 6f 66 20 63 75 72 72 65 6e 74 6c 79 20 76 69 73  of currently vis
0ee0: 69 62 6c 65 20 61 72 65 61 2e 0a 20 20 20 20 23  ible area..    #
0ef0: 20 62 75 74 20 6e 6f 77 20 77 65 20 6e 65 65 64   but now we need
0f00: 20 74 6f 20 61 64 64 20 61 20 3c 6d 61 70 3e 20   to add a <map> 
0f10: 62 69 6e 64 69 6e 67 20 74 6f 6f 0a 20 20 20 20  binding too.    
0f20: 62 69 6e 64 20 24 66 72 61 6d 65 20 3c 4d 61 70  bind $frame <Map
0f30: 3e 20 5c 0a 20 20 20 20 20 20 20 20 5b 6c 69 73  > \.        [lis
0f40: 74 20 53 63 72 6f 6c 6c 61 62 6c 65 46 72 61 6d  t ScrollableFram
0f50: 65 3a 3a 5f 66 72 61 6d 65 43 6f 6e 66 69 67 75  e::_frameConfigu
0f60: 72 65 20 24 63 61 6e 76 61 73 5d 0a 20 20 20 20  re $canvas].    
0f70: 62 69 6e 64 20 24 66 72 61 6d 65 20 3c 55 6e 6d  bind $frame <Unm
0f80: 61 70 3e 20 5c 0a 20 20 20 20 20 20 20 20 5b 6c  ap> \.        [l
0f90: 69 73 74 20 53 63 72 6f 6c 6c 61 62 6c 65 46 72  ist ScrollableFr
0fa0: 61 6d 65 3a 3a 5f 66 72 61 6d 65 43 6f 6e 66 69  ame::_frameConfi
0fb0: 67 75 72 65 20 24 63 61 6e 76 61 73 20 31 5d 0a  gure $canvas 1].
0fc0: 0a 20 20 20 20 62 69 6e 64 74 61 67 73 20 24 70  .    bindtags $p
0fd0: 61 74 68 20 5b 6c 69 73 74 20 24 70 61 74 68 20  ath [list $path 
0fe0: 42 77 53 63 72 6f 6c 6c 61 62 6c 65 46 72 61 6d  BwScrollableFram
0ff0: 65 20 5b 77 69 6e 66 6f 20 74 6f 70 6c 65 76 65  e [winfo topleve
1000: 6c 20 24 70 61 74 68 5d 20 61 6c 6c 5d 0a 0a 20  l $path] all].. 
1010: 20 20 20 72 65 74 75 72 6e 20 5b 57 69 64 67 65     return [Widge
1020: 74 3a 3a 63 72 65 61 74 65 20 53 63 72 6f 6c 6c  t::create Scroll
1030: 61 62 6c 65 46 72 61 6d 65 20 24 70 61 74 68 5d  ableFrame $path]
1040: 0a 7d 0a 0a 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d  .}...# ---------
1050: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1060: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1070: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1080: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1090: 2d 2d 2d 0a 23 20 20 43 6f 6d 6d 61 6e 64 20 53  ---.#  Command S
10a0: 63 72 6f 6c 6c 61 62 6c 65 46 72 61 6d 65 3a 3a  crollableFrame::
10b0: 63 6f 6e 66 69 67 75 72 65 0a 23 20 2d 2d 2d 2d  configure.# ----
10c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
10d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
10e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
10f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1100: 2d 2d 2d 2d 2d 2d 2d 2d 0a 70 72 6f 63 20 53 63  --------.proc Sc
1110: 72 6f 6c 6c 61 62 6c 65 46 72 61 6d 65 3a 3a 63  rollableFrame::c
1120: 6f 6e 66 69 67 75 72 65 20 7b 20 70 61 74 68 20  onfigure { path 
1130: 61 72 67 73 20 7d 20 7b 0a 20 20 20 20 73 65 74  args } {.    set
1140: 20 72 65 73 20 5b 57 69 64 67 65 74 3a 3a 63 6f   res [Widget::co
1150: 6e 66 69 67 75 72 65 20 24 70 61 74 68 20 24 61  nfigure $path $a
1160: 72 67 73 5d 0a 20 20 20 20 73 65 74 20 75 70 64  rgs].    set upd
1170: 20 30 0a 0a 20 20 20 20 73 65 74 20 6d 6f 64 63   0..    set modc
1180: 77 20 5b 57 69 64 67 65 74 3a 3a 68 61 73 43 68  w [Widget::hasCh
1190: 61 6e 67 65 64 20 24 70 61 74 68 20 2d 63 6f 6e  anged $path -con
11a0: 73 74 72 61 69 6e 65 64 77 69 64 74 68 20 63 77  strainedwidth cw
11b0: 5d 0a 20 20 20 20 73 65 74 20 6d 6f 64 77 20 20  ].    set modw  
11c0: 5b 57 69 64 67 65 74 3a 3a 68 61 73 43 68 61 6e  [Widget::hasChan
11d0: 67 65 64 20 24 70 61 74 68 20 2d 61 72 65 61 77  ged $path -areaw
11e0: 69 64 74 68 20 77 5d 0a 20 20 20 20 69 66 20 7b  idth w].    if {
11f0: 20 24 6d 6f 64 63 77 20 7c 7c 20 28 21 24 63 77   $modcw || (!$cw
1200: 20 26 26 20 24 6d 6f 64 77 29 20 7d 20 7b 0a 20   && $modw) } {. 
1210: 20 20 20 20 20 20 20 73 65 74 20 75 70 64 20 31         set upd 1
1220: 0a 20 20 20 20 7d 0a 20 20 20 20 69 66 20 7b 20  .    }.    if { 
1230: 24 63 77 20 7d 20 7b 0a 20 20 20 20 20 20 20 20  $cw } {.        
1240: 73 65 74 20 77 20 5b 77 69 6e 66 6f 20 77 69 64  set w [winfo wid
1250: 74 68 20 24 70 61 74 68 5d 0a 20 20 20 20 7d 0a  th $path].    }.
1260: 0a 20 20 20 20 73 65 74 20 6d 6f 64 63 68 20 5b  .    set modch [
1270: 57 69 64 67 65 74 3a 3a 68 61 73 43 68 61 6e 67  Widget::hasChang
1280: 65 64 20 24 70 61 74 68 20 2d 63 6f 6e 73 74 72  ed $path -constr
1290: 61 69 6e 65 64 68 65 69 67 68 74 20 63 68 5d 0a  ainedheight ch].
12a0: 20 20 20 20 73 65 74 20 6d 6f 64 68 20 20 5b 57      set modh  [W
12b0: 69 64 67 65 74 3a 3a 68 61 73 43 68 61 6e 67 65  idget::hasChange
12c0: 64 20 24 70 61 74 68 20 2d 61 72 65 61 68 65 69  d $path -areahei
12d0: 67 68 74 20 68 5d 0a 20 20 20 20 69 66 20 7b 20  ght h].    if { 
12e0: 24 6d 6f 64 63 68 20 7c 7c 20 28 21 24 63 68 20  $modch || (!$ch 
12f0: 26 26 20 24 6d 6f 64 68 29 20 7d 20 7b 0a 20 20  && $modh) } {.  
1300: 20 20 20 20 20 20 73 65 74 20 75 70 64 20 31 0a        set upd 1.
1310: 20 20 20 20 7d 0a 20 20 20 20 69 66 20 7b 20 24      }.    if { $
1320: 63 68 20 7d 20 7b 0a 20 20 20 20 20 20 20 20 73  ch } {.        s
1330: 65 74 20 68 20 5b 77 69 6e 66 6f 20 68 65 69 67  et h [winfo heig
1340: 68 74 20 24 70 61 74 68 5d 0a 20 20 20 20 7d 0a  ht $path].    }.
1350: 0a 20 20 20 20 69 66 20 7b 20 24 75 70 64 20 7d  .    if { $upd }
1360: 20 7b 0a 20 20 20 20 20 20 20 20 24 70 61 74 68   {.        $path
1370: 3a 63 6d 64 20 69 74 65 6d 63 6f 6e 66 69 67 75  :cmd itemconfigu
1380: 72 65 20 77 69 6e 20 2d 77 69 64 74 68 20 24 77  re win -width $w
1390: 20 2d 68 65 69 67 68 74 20 24 68 0a 20 20 20 20   -height $h.    
13a0: 7d 0a 20 20 20 20 72 65 74 75 72 6e 20 24 72 65  }.    return $re
13b0: 73 0a 7d 0a 0a 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d  s.}...# --------
13c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
13d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
13e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
13f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1400: 2d 2d 2d 2d 0a 23 20 20 43 6f 6d 6d 61 6e 64 20  ----.#  Command 
1410: 53 63 72 6f 6c 6c 61 62 6c 65 46 72 61 6d 65 3a  ScrollableFrame:
1420: 3a 63 67 65 74 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d  :cget.# --------
1430: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1440: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1450: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1460: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1470: 2d 2d 2d 2d 0a 70 72 6f 63 20 53 63 72 6f 6c 6c  ----.proc Scroll
1480: 61 62 6c 65 46 72 61 6d 65 3a 3a 63 67 65 74 20  ableFrame::cget 
1490: 7b 20 70 61 74 68 20 6f 70 74 69 6f 6e 20 7d 20  { path option } 
14a0: 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 5b 57 69  {.    return [Wi
14b0: 64 67 65 74 3a 3a 63 67 65 74 20 24 70 61 74 68  dget::cget $path
14c0: 20 24 6f 70 74 69 6f 6e 5d 0a 7d 0a 0a 0a 23 20   $option].}...# 
14d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
14e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
14f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1500: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1510: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 20 20  ------------.#  
1520: 43 6f 6d 6d 61 6e 64 20 53 63 72 6f 6c 6c 61 62  Command Scrollab
1530: 6c 65 46 72 61 6d 65 3a 3a 67 65 74 66 72 61 6d  leFrame::getfram
1540: 65 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  e.# ------------
1550: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1560: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1570: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1580: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1590: 0a 70 72 6f 63 20 53 63 72 6f 6c 6c 61 62 6c 65  .proc Scrollable
15a0: 46 72 61 6d 65 3a 3a 67 65 74 66 72 61 6d 65 20  Frame::getframe 
15b0: 7b 20 70 61 74 68 20 7d 20 7b 0a 20 20 20 20 72  { path } {.    r
15c0: 65 74 75 72 6e 20 24 70 61 74 68 2e 66 72 61 6d  eturn $path.fram
15d0: 65 0a 7d 0a 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d  e.}..# ---------
15e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
15f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1600: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1610: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1620: 2d 2d 2d 0a 23 20 20 43 6f 6d 6d 61 6e 64 20 53  ---.#  Command S
1630: 63 72 6f 6c 6c 61 62 6c 65 46 72 61 6d 65 3a 3a  crollableFrame::
1640: 73 65 65 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  see.# ----------
1650: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1660: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1670: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1680: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1690: 2d 2d 0a 70 72 6f 63 20 53 63 72 6f 6c 6c 61 62  --.proc Scrollab
16a0: 6c 65 46 72 61 6d 65 3a 3a 73 65 65 20 7b 20 70  leFrame::see { p
16b0: 61 74 68 20 77 69 64 67 65 74 20 7b 76 65 72 74  ath widget {vert
16c0: 20 74 6f 70 7d 20 7b 68 6f 72 7a 20 6c 65 66 74   top} {horz left
16d0: 7d 20 7b 78 4f 66 66 73 65 74 20 30 7d 20 7b 79  } {xOffset 0} {y
16e0: 4f 66 66 73 65 74 20 30 7d 7d 20 7b 0a 20 20 20  Offset 0}} {.   
16f0: 20 73 65 74 20 78 30 20 20 5b 77 69 6e 66 6f 20   set x0  [winfo 
1700: 78 20 24 77 69 64 67 65 74 5d 0a 20 20 20 20 73  x $widget].    s
1710: 65 74 20 79 30 20 20 5b 77 69 6e 66 6f 20 79 20  et y0  [winfo y 
1720: 24 77 69 64 67 65 74 5d 0a 20 20 20 20 73 65 74  $widget].    set
1730: 20 78 31 20 20 5b 65 78 70 72 20 7b 24 78 30 2b   x1  [expr {$x0+
1740: 5b 77 69 6e 66 6f 20 77 69 64 74 68 20 20 24 77  [winfo width  $w
1750: 69 64 67 65 74 5d 7d 5d 0a 20 20 20 20 73 65 74  idget]}].    set
1760: 20 79 31 20 20 5b 65 78 70 72 20 7b 24 79 30 2b   y1  [expr {$y0+
1770: 5b 77 69 6e 66 6f 20 68 65 69 67 68 74 20 24 77  [winfo height $w
1780: 69 64 67 65 74 5d 7d 5d 0a 20 20 20 20 73 65 74  idget]}].    set
1790: 20 78 62 30 20 5b 24 70 61 74 68 3a 63 6d 64 20   xb0 [$path:cmd 
17a0: 63 61 6e 76 61 73 78 20 30 5d 0a 20 20 20 20 73  canvasx 0].    s
17b0: 65 74 20 79 62 30 20 5b 24 70 61 74 68 3a 63 6d  et yb0 [$path:cm
17c0: 64 20 63 61 6e 76 61 73 79 20 30 5d 0a 20 20 20  d canvasy 0].   
17d0: 20 73 65 74 20 78 62 31 20 5b 24 70 61 74 68 3a   set xb1 [$path:
17e0: 63 6d 64 20 63 61 6e 76 61 73 78 20 5b 77 69 6e  cmd canvasx [win
17f0: 66 6f 20 77 69 64 74 68 20 20 24 70 61 74 68 5d  fo width  $path]
1800: 5d 0a 20 20 20 20 73 65 74 20 79 62 31 20 5b 24  ].    set yb1 [$
1810: 70 61 74 68 3a 63 6d 64 20 63 61 6e 76 61 73 79  path:cmd canvasy
1820: 20 5b 77 69 6e 66 6f 20 68 65 69 67 68 74 20 24   [winfo height $
1830: 70 61 74 68 5d 5d 0a 20 20 20 20 73 65 74 20 64  path]].    set d
1840: 78 20 20 30 0a 20 20 20 20 73 65 74 20 64 79 20  x  0.    set dy 
1850: 20 30 0a 20 20 20 20 0a 20 20 20 20 69 66 20 7b   0.    .    if {
1860: 20 5b 73 74 72 69 6e 67 20 65 71 75 61 6c 20 24   [string equal $
1870: 68 6f 72 7a 20 22 6c 65 66 74 22 5d 20 7d 20 7b  horz "left"] } {
1880: 0a 09 69 66 20 7b 20 24 78 31 20 3e 20 24 78 62  ..if { $x1 > $xb
1890: 31 20 7d 20 7b 0a 09 20 20 20 20 73 65 74 20 64  1 } {..    set d
18a0: 78 20 5b 65 78 70 72 20 7b 24 78 31 2d 24 78 62  x [expr {$x1-$xb
18b0: 31 7d 5d 0a 09 7d 0a 09 69 66 20 7b 20 24 78 30  1}]..}..if { $x0
18c0: 20 3c 20 24 78 62 30 2b 24 64 78 20 7d 20 7b 0a   < $xb0+$dx } {.
18d0: 09 20 20 20 20 73 65 74 20 64 78 20 5b 65 78 70  .    set dx [exp
18e0: 72 20 7b 24 78 30 2d 24 78 62 30 7d 5d 0a 09 7d  r {$x0-$xb0}]..}
18f0: 0a 20 20 20 20 7d 20 65 6c 73 65 69 66 20 7b 20  .    } elseif { 
1900: 5b 73 74 72 69 6e 67 20 65 71 75 61 6c 20 24 68  [string equal $h
1910: 6f 72 7a 20 22 72 69 67 68 74 22 5d 20 7d 20 7b  orz "right"] } {
1920: 0a 09 69 66 20 7b 20 24 78 30 20 3c 20 24 78 62  ..if { $x0 < $xb
1930: 30 20 7d 20 7b 0a 09 20 20 20 20 73 65 74 20 64  0 } {..    set d
1940: 78 20 5b 65 78 70 72 20 7b 24 78 30 2d 24 78 62  x [expr {$x0-$xb
1950: 30 7d 5d 0a 09 7d 0a 09 69 66 20 7b 20 24 78 31  0}]..}..if { $x1
1960: 20 3e 20 24 78 62 31 2b 24 64 78 20 7d 20 7b 0a   > $xb1+$dx } {.
1970: 09 20 20 20 20 73 65 74 20 64 78 20 5b 65 78 70  .    set dx [exp
1980: 72 20 7b 24 78 31 2d 24 78 62 31 7d 5d 0a 09 7d  r {$x1-$xb1}]..}
1990: 0a 20 20 20 20 7d 0a 0a 20 20 20 20 69 66 20 7b  .    }..    if {
19a0: 20 5b 73 74 72 69 6e 67 20 65 71 75 61 6c 20 24   [string equal $
19b0: 76 65 72 74 20 22 74 6f 70 22 5d 20 7d 20 7b 0a  vert "top"] } {.
19c0: 09 69 66 20 7b 20 24 79 31 20 3e 20 24 79 62 31  .if { $y1 > $yb1
19d0: 20 7d 20 7b 0a 09 20 20 20 20 73 65 74 20 64 79   } {..    set dy
19e0: 20 5b 65 78 70 72 20 7b 24 79 31 2d 24 79 62 31   [expr {$y1-$yb1
19f0: 7d 5d 0a 09 7d 0a 09 69 66 20 7b 20 24 79 30 20  }]..}..if { $y0 
1a00: 3c 20 24 79 62 30 2b 24 64 79 20 7d 20 7b 0a 09  < $yb0+$dy } {..
1a10: 20 20 20 20 73 65 74 20 64 79 20 5b 65 78 70 72      set dy [expr
1a20: 20 7b 24 79 30 2d 24 79 62 30 7d 5d 0a 09 7d 0a   {$y0-$yb0}]..}.
1a30: 20 20 20 20 7d 20 65 6c 73 65 69 66 20 7b 20 5b      } elseif { [
1a40: 73 74 72 69 6e 67 20 65 71 75 61 6c 20 24 76 65  string equal $ve
1a50: 72 74 20 22 62 6f 74 74 6f 6d 22 5d 20 7d 20 7b  rt "bottom"] } {
1a60: 0a 09 69 66 20 7b 20 24 79 30 20 3c 20 24 79 62  ..if { $y0 < $yb
1a70: 30 20 7d 20 7b 0a 09 20 20 20 20 73 65 74 20 64  0 } {..    set d
1a80: 79 20 5b 65 78 70 72 20 7b 24 79 30 2d 24 79 62  y [expr {$y0-$yb
1a90: 30 7d 5d 0a 09 7d 0a 09 69 66 20 7b 20 24 79 31  0}]..}..if { $y1
1aa0: 20 3e 20 24 79 62 31 2b 24 64 79 20 7d 20 7b 0a   > $yb1+$dy } {.
1ab0: 09 20 20 20 20 73 65 74 20 64 79 20 5b 65 78 70  .    set dy [exp
1ac0: 72 20 7b 24 79 31 2d 24 79 62 31 7d 5d 0a 09 7d  r {$y1-$yb1}]..}
1ad0: 0a 20 20 20 20 7d 0a 0a 20 20 20 20 69 66 20 7b  .    }..    if {
1ae0: 28 24 64 78 20 2b 20 24 78 4f 66 66 73 65 74 29  ($dx + $xOffset)
1af0: 20 21 3d 20 30 7d 20 7b 0a 09 73 65 74 20 78 20   != 0} {..set x 
1b00: 5b 65 78 70 72 20 7b 28 24 78 62 30 2b 24 64 78  [expr {($xb0+$dx
1b10: 2b 24 78 4f 66 66 73 65 74 29 2f 5b 77 69 6e 66  +$xOffset)/[winf
1b20: 6f 20 77 69 64 74 68 20 24 70 61 74 68 2e 66 72  o width $path.fr
1b30: 61 6d 65 5d 7d 5d 0a 09 24 70 61 74 68 3a 63 6d  ame]}]..$path:cm
1b40: 64 20 78 76 69 65 77 20 6d 6f 76 65 74 6f 20 24  d xview moveto $
1b50: 78 0a 20 20 20 20 7d 0a 20 20 20 20 69 66 20 7b  x.    }.    if {
1b60: 28 24 64 79 20 2b 20 24 79 4f 66 66 73 65 74 29  ($dy + $yOffset)
1b70: 20 21 3d 20 30 7d 20 7b 0a 09 73 65 74 20 79 20   != 0} {..set y 
1b80: 5b 65 78 70 72 20 7b 28 24 79 62 30 2b 24 64 79  [expr {($yb0+$dy
1b90: 2b 24 79 4f 66 66 73 65 74 29 2f 5b 77 69 6e 66  +$yOffset)/[winf
1ba0: 6f 20 68 65 69 67 68 74 20 24 70 61 74 68 2e 66  o height $path.f
1bb0: 72 61 6d 65 5d 7d 5d 0a 09 24 70 61 74 68 3a 63  rame]}]..$path:c
1bc0: 6d 64 20 79 76 69 65 77 20 6d 6f 76 65 74 6f 20  md yview moveto 
1bd0: 24 79 0a 20 20 20 20 7d 0a 7d 0a 0a 0a 23 20 2d  $y.    }.}...# -
1be0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1bf0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1c00: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1c10: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1c20: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 20 20 43  -----------.#  C
1c30: 6f 6d 6d 61 6e 64 20 53 63 72 6f 6c 6c 61 62 6c  ommand Scrollabl
1c40: 65 46 72 61 6d 65 3a 3a 78 76 69 65 77 0a 23 20  eFrame::xview.# 
1c50: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1c60: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1c70: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1c80: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1c90: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 70 72 6f  ------------.pro
1ca0: 63 20 53 63 72 6f 6c 6c 61 62 6c 65 46 72 61 6d  c ScrollableFram
1cb0: 65 3a 3a 78 76 69 65 77 20 7b 20 70 61 74 68 20  e::xview { path 
1cc0: 61 72 67 73 20 7d 20 7b 0a 20 20 20 20 72 65 74  args } {.    ret
1cd0: 75 72 6e 20 5b 65 76 61 6c 20 5b 6c 69 73 74 20  urn [eval [list 
1ce0: 24 70 61 74 68 3a 63 6d 64 20 78 76 69 65 77 5d  $path:cmd xview]
1cf0: 20 24 61 72 67 73 5d 0a 7d 0a 0a 0a 23 20 2d 2d   $args].}...# --
1d00: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1d10: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1d20: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1d30: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1d40: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 20 20 43 6f  ----------.#  Co
1d50: 6d 6d 61 6e 64 20 53 63 72 6f 6c 6c 61 62 6c 65  mmand Scrollable
1d60: 46 72 61 6d 65 3a 3a 79 76 69 65 77 0a 23 20 2d  Frame::yview.# -
1d70: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1d80: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1d90: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1da0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1db0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 70 72 6f 63  -----------.proc
1dc0: 20 53 63 72 6f 6c 6c 61 62 6c 65 46 72 61 6d 65   ScrollableFrame
1dd0: 3a 3a 79 76 69 65 77 20 7b 20 70 61 74 68 20 61  ::yview { path a
1de0: 72 67 73 20 7d 20 7b 0a 20 20 20 20 72 65 74 75  rgs } {.    retu
1df0: 72 6e 20 5b 65 76 61 6c 20 5b 6c 69 73 74 20 24  rn [eval [list $
1e00: 70 61 74 68 3a 63 6d 64 20 79 76 69 65 77 5d 20  path:cmd yview] 
1e10: 24 61 72 67 73 5d 0a 7d 0a 0a 0a 23 20 2d 2d 2d  $args].}...# ---
1e20: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1e30: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1e40: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1e50: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1e60: 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 20 20 43 6f 6d  ---------.#  Com
1e70: 6d 61 6e 64 20 53 63 72 6f 6c 6c 61 62 6c 65 46  mand ScrollableF
1e80: 72 61 6d 65 3a 3a 5f 72 65 73 69 7a 65 0a 23 20  rame::_resize.# 
1e90: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1ea0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1eb0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1ec0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1ed0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 70 72 6f  ------------.pro
1ee0: 63 20 53 63 72 6f 6c 6c 61 62 6c 65 46 72 61 6d  c ScrollableFram
1ef0: 65 3a 3a 5f 72 65 73 69 7a 65 20 7b 20 70 61 74  e::_resize { pat
1f00: 68 20 7d 20 7b 0a 20 20 20 20 69 66 20 7b 20 5b  h } {.    if { [
1f10: 57 69 64 67 65 74 3a 3a 67 65 74 6f 70 74 69 6f  Widget::getoptio
1f20: 6e 20 24 70 61 74 68 20 2d 63 6f 6e 73 74 72 61  n $path -constra
1f30: 69 6e 65 64 77 69 64 74 68 5d 20 7d 20 7b 0a 20  inedwidth] } {. 
1f40: 20 20 20 20 20 20 20 24 70 61 74 68 3a 63 6d 64         $path:cmd
1f50: 20 69 74 65 6d 63 6f 6e 66 69 67 75 72 65 20 77   itemconfigure w
1f60: 69 6e 20 2d 77 69 64 74 68 20 5b 77 69 6e 66 6f  in -width [winfo
1f70: 20 77 69 64 74 68 20 24 70 61 74 68 5d 0a 20 20   width $path].  
1f80: 20 20 7d 0a 20 20 20 20 69 66 20 7b 20 5b 57 69    }.    if { [Wi
1f90: 64 67 65 74 3a 3a 67 65 74 6f 70 74 69 6f 6e 20  dget::getoption 
1fa0: 24 70 61 74 68 20 2d 63 6f 6e 73 74 72 61 69 6e  $path -constrain
1fb0: 65 64 68 65 69 67 68 74 5d 20 7d 20 7b 0a 20 20  edheight] } {.  
1fc0: 20 20 20 20 20 20 24 70 61 74 68 3a 63 6d 64 20        $path:cmd 
1fd0: 69 74 65 6d 63 6f 6e 66 69 67 75 72 65 20 77 69  itemconfigure wi
1fe0: 6e 20 2d 68 65 69 67 68 74 20 5b 77 69 6e 66 6f  n -height [winfo
1ff0: 20 68 65 69 67 68 74 20 24 70 61 74 68 5d 0a 20   height $path]. 
2000: 20 20 20 7d 0a 20 20 20 20 23 20 73 63 6f 6c 6c     }.    # scoll
2010: 72 65 67 69 6f 6e 20 6d 75 73 74 20 61 6c 73 6f  region must also
2020: 20 62 65 20 72 65 73 65 74 20 77 68 65 6e 20 63   be reset when c
2030: 61 6e 76 61 73 20 73 69 7a 65 20 63 68 61 6e 67  anvas size chang
2040: 65 73 0a 20 20 20 20 5f 66 72 61 6d 65 43 6f 6e  es.    _frameCon
2050: 66 69 67 75 72 65 20 24 70 61 74 68 0a 7d 0a 0a  figure $path.}..
2060: 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  .# -------------
2070: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2080: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2090: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
20a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a  ---------------.
20b0: 23 20 20 43 6f 6d 6d 61 6e 64 20 53 63 72 6f 6c  #  Command Scrol
20c0: 6c 61 62 6c 65 46 72 61 6d 65 3a 3a 5f 66 72 61  lableFrame::_fra
20d0: 6d 65 43 6f 6e 66 69 67 75 72 65 0a 23 20 2d 2d  meConfigure.# --
20e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
20f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2100: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2110: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2120: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 70 72 6f 63 20  ----------.proc 
2130: 53 63 72 6f 6c 6c 61 62 6c 65 46 72 61 6d 65 3a  ScrollableFrame:
2140: 3a 5f 6d 61 78 20 7b 61 20 62 7d 20 7b 72 65 74  :_max {a b} {ret
2150: 75 72 6e 20 5b 65 78 70 72 20 7b 24 61 20 3c 3d  urn [expr {$a <=
2160: 20 24 62 20 3f 20 24 62 20 3a 20 24 61 7d 5d 7d   $b ? $b : $a}]}
2170: 0a 70 72 6f 63 20 53 63 72 6f 6c 6c 61 62 6c 65  .proc Scrollable
2180: 46 72 61 6d 65 3a 3a 5f 66 72 61 6d 65 43 6f 6e  Frame::_frameCon
2190: 66 69 67 75 72 65 20 7b 63 61 6e 76 61 73 20 7b  figure {canvas {
21a0: 75 6e 6d 61 70 20 30 7d 7d 20 7b 0a 20 20 20 20  unmap 0}} {.    
21b0: 23 20 54 68 69 73 20 65 6e 73 75 72 65 73 20 74  # This ensures t
21c0: 68 61 74 20 77 65 20 64 6f 6e 27 74 20 67 65 74  hat we don't get
21d0: 20 66 75 6e 6e 79 20 73 63 72 6f 6c 6c 61 62 69   funny scrollabi
21e0: 6c 69 74 79 20 69 6e 20 74 68 65 20 66 72 61 6d  lity in the fram
21f0: 65 0a 20 20 20 20 23 20 77 68 65 6e 20 69 74 20  e.    # when it 
2200: 69 73 20 73 6d 61 6c 6c 65 72 20 74 68 61 6e 20  is smaller than 
2210: 74 68 65 20 63 61 6e 76 61 73 20 73 70 61 63 65  the canvas space
2220: 0a 20 20 20 20 23 20 75 73 65 20 5b 77 69 6e 66  .    # use [winf
2230: 6f 5d 20 74 6f 20 67 65 74 20 68 65 69 67 68 74  o] to get height
2240: 20 26 20 77 69 64 74 68 20 6f 66 20 66 72 61 6d   & width of fram
2250: 65 0a 0a 20 20 20 20 23 20 5b 77 69 6e 66 6f 5d  e..    # [winfo]
2260: 20 64 6f 65 73 6e 27 74 20 77 6f 72 6b 20 66 6f   doesn't work fo
2270: 72 20 75 6e 6d 61 70 70 65 64 20 66 72 61 6d 65  r unmapped frame
2280: 0a 20 20 20 20 73 65 74 20 66 72 61 6d 65 68 20  .    set frameh 
2290: 5b 65 78 70 72 20 7b 24 75 6e 6d 61 70 20 3f 20  [expr {$unmap ? 
22a0: 30 20 3a 20 5b 77 69 6e 66 6f 20 68 65 69 67 68  0 : [winfo heigh
22b0: 74 20 24 63 61 6e 76 61 73 2e 66 72 61 6d 65 5d  t $canvas.frame]
22c0: 7d 5d 0a 20 20 20 20 73 65 74 20 66 72 61 6d 65  }].    set frame
22d0: 77 20 5b 65 78 70 72 20 7b 24 75 6e 6d 61 70 20  w [expr {$unmap 
22e0: 3f 20 30 20 3a 20 5b 77 69 6e 66 6f 20 77 69 64  ? 0 : [winfo wid
22f0: 74 68 20 20 24 63 61 6e 76 61 73 2e 66 72 61 6d  th  $canvas.fram
2300: 65 5d 7d 5d 0a 0a 20 20 20 20 73 65 74 20 68 65  e]}]..    set he
2310: 69 67 68 74 20 5b 5f 6d 61 78 20 24 66 72 61 6d  ight [_max $fram
2320: 65 68 20 5b 77 69 6e 66 6f 20 68 65 69 67 68 74  eh [winfo height
2330: 20 24 63 61 6e 76 61 73 5d 5d 0a 20 20 20 20 73   $canvas]].    s
2340: 65 74 20 77 69 64 74 68 20 20 5b 5f 6d 61 78 20  et width  [_max 
2350: 24 66 72 61 6d 65 77 20 5b 77 69 6e 66 6f 20 77  $framew [winfo w
2360: 69 64 74 68 20 20 24 63 61 6e 76 61 73 5d 5d 0a  idth  $canvas]].
2370: 0a 20 20 20 20 24 63 61 6e 76 61 73 3a 63 6d 64  .    $canvas:cmd
2380: 20 63 6f 6e 66 69 67 75 72 65 20 2d 73 63 72 6f   configure -scro
2390: 6c 6c 72 65 67 69 6f 6e 20 5b 6c 69 73 74 20 30  llregion [list 0
23a0: 20 30 20 24 77 69 64 74 68 20 24 68 65 69 67 68   0 $width $heigh
23b0: 74 5d 0a 7d 0a                                   t].}.