Bwidget Source Code
Hex Artifact Content
Not logged in
Bounty program for improvements to Tcl and certain Tcl packages.

Artifact 262d986c39e32b000b7613844b526225ab4c6dde:


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 64 69 61 6c 6f 67 2e 74 63 6c 0a 23 20 20    dialog.tcl.#  
0060: 54 68 69 73 20 66 69 6c 65 20 69 73 20 70 61 72  This file is par
0070: 74 20 6f 66 20 55 6e 69 66 69 78 20 42 57 69 64  t of Unifix BWid
0080: 67 65 74 20 54 6f 6f 6c 6b 69 74 0a 23 20 20 24  get Toolkit.#  $
0090: 49 64 3a 20 64 69 61 6c 6f 67 2e 74 63 6c 2c 76  Id: dialog.tcl,v
00a0: 20 31 2e 31 37 20 32 30 30 39 2f 31 30 2f 32 35   1.17 2009/10/25
00b0: 20 32 30 3a 35 34 3a 35 34 20 6f 62 65 72 64 6f   20:54:54 oberdo
00c0: 72 66 65 72 20 45 78 70 20 24 0a 23 20 2d 2d 2d  rfer Exp $.# ---
00d0: 2d 2d 2d 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 0a 23 20 20 49 6e 64  ---------.#  Ind
0120: 65 78 20 6f 66 20 63 6f 6d 6d 61 6e 64 73 3a 0a  ex of commands:.
0130: 23 20 20 20 20 20 2d 20 44 69 61 6c 6f 67 3a 3a  #     - Dialog::
0140: 63 72 65 61 74 65 0a 23 20 20 20 20 20 2d 20 44  create.#     - D
0150: 69 61 6c 6f 67 3a 3a 63 6f 6e 66 69 67 75 72 65  ialog::configure
0160: 0a 23 20 20 20 20 20 2d 20 44 69 61 6c 6f 67 3a  .#     - Dialog:
0170: 3a 63 67 65 74 0a 23 20 20 20 20 20 2d 20 44 69  :cget.#     - Di
0180: 61 6c 6f 67 3a 3a 67 65 74 66 72 61 6d 65 0a 23  alog::getframe.#
0190: 20 20 20 20 20 2d 20 44 69 61 6c 6f 67 3a 3a 61       - Dialog::a
01a0: 64 64 0a 23 20 20 20 20 20 2d 20 44 69 61 6c 6f  dd.#     - Dialo
01b0: 67 3a 3a 69 74 65 6d 63 6f 6e 66 69 67 75 72 65  g::itemconfigure
01c0: 0a 23 20 20 20 20 20 2d 20 44 69 61 6c 6f 67 3a  .#     - Dialog:
01d0: 3a 69 74 65 6d 63 67 65 74 0a 23 20 20 20 20 20  :itemcget.#     
01e0: 2d 20 44 69 61 6c 6f 67 3a 3a 69 6e 76 6f 6b 65  - Dialog::invoke
01f0: 0a 23 20 20 20 20 20 2d 20 44 69 61 6c 6f 67 3a  .#     - Dialog:
0200: 3a 73 65 74 66 6f 63 75 73 0a 23 20 20 20 20 20  :setfocus.#     
0210: 2d 20 44 69 61 6c 6f 67 3a 3a 65 6e 64 64 69 61  - Dialog::enddia
0220: 6c 6f 67 0a 23 20 20 20 20 20 2d 20 44 69 61 6c  log.#     - Dial
0230: 6f 67 3a 3a 64 72 61 77 0a 23 20 20 20 20 20 2d  og::draw.#     -
0240: 20 44 69 61 6c 6f 67 3a 3a 77 69 74 68 64 72 61   Dialog::withdra
0250: 77 0a 23 20 20 20 20 20 2d 20 44 69 61 6c 6f 67  w.#     - Dialog
0260: 3a 3a 5f 64 65 73 74 72 6f 79 0a 23 20 2d 2d 2d  ::_destroy.# ---
0270: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0280: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0290: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
02a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
02b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 23 20 4a 44 43  ---------..# JDC
02c0: 3a 20 61 64 64 65 64 20 2d 74 72 61 6e 73 69 65  : added -transie
02d0: 6e 74 20 61 6e 64 20 2d 70 6c 61 63 65 20 66 6c  nt and -place fl
02e0: 61 67 0a 0a 6e 61 6d 65 73 70 61 63 65 20 65 76  ag..namespace ev
02f0: 61 6c 20 44 69 61 6c 6f 67 20 7b 0a 20 20 20 20  al Dialog {.    
0300: 57 69 64 67 65 74 3a 3a 64 65 66 69 6e 65 20 44  Widget::define D
0310: 69 61 6c 6f 67 20 64 69 61 6c 6f 67 20 42 75 74  ialog dialog But
0320: 74 6f 6e 42 6f 78 0a 0a 20 20 20 20 57 69 64 67  tonBox..    Widg
0330: 65 74 3a 3a 62 77 69 6e 63 6c 75 64 65 20 44 69  et::bwinclude Di
0340: 61 6c 6f 67 20 42 75 74 74 6f 6e 42 6f 78 20 2e  alog ButtonBox .
0350: 62 62 6f 78 20 5c 0a 09 72 65 6d 6f 76 65 09 20  bbox \..remove. 
0360: 20 20 7b 2d 6f 72 69 65 6e 74 7d 20 5c 0a 09 69    {-orient} \..i
0370: 6e 69 74 69 61 6c 69 7a 65 20 7b 2d 73 70 61 63  nitialize {-spac
0380: 69 6e 67 20 31 30 20 2d 70 61 64 78 20 31 30 7d  ing 10 -padx 10}
0390: 0a 0a 20 20 20 20 57 69 64 67 65 74 3a 3a 64 65  ..    Widget::de
03a0: 63 6c 61 72 65 20 44 69 61 6c 6f 67 20 7b 0a 20  clare Dialog {. 
03b0: 20 20 20 20 20 20 20 7b 2d 62 61 63 6b 67 72 6f         {-backgro
03c0: 75 6e 64 20 20 43 6f 6c 6f 72 20 20 20 20 20 22  und  Color     "
03d0: 53 79 73 74 65 6d 57 69 6e 64 6f 77 46 72 61 6d  SystemWindowFram
03e0: 65 22 20 30 7d 0a 09 7b 2d 74 69 74 6c 65 09 20  e" 0}..{-title. 
03f0: 20 20 20 20 20 53 74 72 69 6e 67 09 20 22 22 09       String. "".
0400: 20 20 30 7d 0a 09 7b 2d 67 65 6f 6d 65 74 72 79    0}..{-geometry
0410: 20 20 20 20 53 74 72 69 6e 67 09 20 22 22 09 20      String. "". 
0420: 20 30 7d 0a 09 7b 2d 6d 6f 64 61 6c 09 20 20 20   0}..{-modal.   
0430: 20 20 20 45 6e 75 6d 09 20 6c 6f 63 61 6c 09 20     Enum. local. 
0440: 20 30 20 7b 6e 6f 6e 65 20 6c 6f 63 61 6c 20 67   0 {none local g
0450: 6c 6f 62 61 6c 7d 7d 0a 09 7b 2d 62 69 74 6d 61  lobal}}..{-bitma
0460: 70 20 20 20 20 20 20 54 6b 52 65 73 6f 75 72 63  p      TkResourc
0470: 65 20 22 22 09 20 20 31 20 6c 61 62 65 6c 7d 0a  e "".  1 label}.
0480: 09 7b 2d 69 6d 61 67 65 09 20 20 20 20 20 20 54  .{-image.      T
0490: 6b 52 65 73 6f 75 72 63 65 20 22 22 09 20 20 31  kResource "".  1
04a0: 20 6c 61 62 65 6c 7d 0a 09 7b 2d 73 65 70 61 72   label}..{-separ
04b0: 61 74 6f 72 20 20 20 42 6f 6f 6c 65 61 6e 09 20  ator   Boolean. 
04c0: 30 09 20 20 31 7d 0a 09 7b 2d 63 61 6e 63 65 6c  0.  1}..{-cancel
04d0: 20 20 20 20 20 20 49 6e 74 09 20 2d 31 09 20 20        Int. -1.  
04e0: 30 20 22 25 64 20 3e 3d 20 2d 31 22 7d 0a 09 7b  0 "%d >= -1"}..{
04f0: 2d 70 61 72 65 6e 74 20 20 20 20 20 20 53 74 72  -parent      Str
0500: 69 6e 67 09 20 22 22 09 20 20 30 7d 0a 09 7b 2d  ing. "".  0}..{-
0510: 73 69 64 65 09 20 20 20 20 20 20 45 6e 75 6d 09  side.      Enum.
0520: 20 62 6f 74 74 6f 6d 09 20 20 31 20 7b 62 6f 74   bottom.  1 {bot
0530: 74 6f 6d 20 6c 65 66 74 20 74 6f 70 20 72 69 67  tom left top rig
0540: 68 74 7d 7d 0a 09 7b 2d 61 6e 63 68 6f 72 20 20  ht}}..{-anchor  
0550: 20 20 20 20 45 6e 75 6d 09 20 63 09 20 20 31 20      Enum. c.  1 
0560: 7b 6e 20 65 20 77 20 73 20 63 7d 7d 0a 09 7b 2d  {n e w s c}}..{-
0570: 63 6c 61 73 73 09 20 20 20 20 20 20 53 74 72 69  class.      Stri
0580: 6e 67 09 20 44 69 61 6c 6f 67 09 20 20 31 7d 0a  ng. Dialog.  1}.
0590: 09 7b 2d 74 72 61 6e 73 69 65 6e 74 20 20 20 42  .{-transient   B
05a0: 6f 6f 6c 65 61 6e 09 20 31 09 20 20 31 7d 0a 09  oolean. 1.  1}..
05b0: 7b 2d 70 6c 61 63 65 09 20 20 20 20 20 20 45 6e  {-place.      En
05c0: 75 6d 09 20 63 65 6e 74 65 72 09 20 20 30 20 7b  um. center.  0 {
05d0: 6e 6f 6e 65 20 63 65 6e 74 65 72 20 6c 65 66 74  none center left
05e0: 20 72 69 67 68 74 20 61 62 6f 76 65 20 62 65 6c   right above bel
05f0: 6f 77 7d 7d 0a 20 20 20 20 7d 0a 0a 20 20 20 20  ow}}.    }..    
0600: 69 66 20 7b 20 21 5b 42 57 69 64 67 65 74 3a 3a  if { ![BWidget::
0610: 75 73 69 6e 67 20 74 74 6b 5d 20 7d 20 7b 0a 20  using ttk] } {. 
0620: 20 20 20 20 20 20 57 69 64 67 65 74 3a 3a 61 64        Widget::ad
0630: 64 6d 61 70 20 44 69 61 6c 6f 67 20 22 22 20 3a  dmap Dialog "" :
0640: 63 6d 64 20 20 20 7b 2d 62 61 63 6b 67 72 6f 75  cmd   {-backgrou
0650: 6e 64 20 7b 7d 7d 0a 20 20 20 20 20 20 20 57 69  nd {}}.       Wi
0660: 64 67 65 74 3a 3a 61 64 64 6d 61 70 20 44 69 61  dget::addmap Dia
0670: 6c 6f 67 20 22 22 20 2e 66 72 61 6d 65 20 7b 2d  log "" .frame {-
0680: 62 61 63 6b 67 72 6f 75 6e 64 20 7b 7d 7d 0a 20  background {}}. 
0690: 20 20 20 7d 0a 0a 20 20 20 20 62 69 6e 64 20 42     }..    bind B
06a0: 77 44 69 61 6c 6f 67 20 3c 44 65 73 74 72 6f 79  wDialog <Destroy
06b0: 3e 20 5b 6c 69 73 74 20 44 69 61 6c 6f 67 3a 3a  > [list Dialog::
06c0: 5f 64 65 73 74 72 6f 79 20 25 57 5d 0a 0a 20 20  _destroy %W]..  
06d0: 20 20 76 61 72 69 61 62 6c 65 20 5f 77 69 64 67    variable _widg
06e0: 65 74 0a 7d 0a 0a 0a 23 20 2d 2d 2d 2d 2d 2d 2d  et.}...# -------
06f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0700: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0710: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0720: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0730: 2d 2d 2d 2d 2d 0a 23 20 20 43 6f 6d 6d 61 6e 64  -----.#  Command
0740: 20 44 69 61 6c 6f 67 3a 3a 63 72 65 61 74 65 0a   Dialog::create.
0750: 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  # --------------
0760: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0770: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0780: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0790: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 70  --------------.p
07a0: 72 6f 63 20 44 69 61 6c 6f 67 3a 3a 63 72 65 61  roc Dialog::crea
07b0: 74 65 20 7b 20 70 61 74 68 20 61 72 67 73 20 7d  te { path args }
07c0: 20 7b 0a 20 20 20 20 67 6c 6f 62 61 6c 20 20 20   {.    global   
07d0: 74 63 6c 5f 70 6c 61 74 66 6f 72 6d 0a 20 20 20  tcl_platform.   
07e0: 20 76 61 72 69 61 62 6c 65 20 5f 77 69 64 67 65   variable _widge
07f0: 74 0a 0a 20 20 20 20 61 72 72 61 79 20 73 65 74  t..    array set
0800: 20 6d 61 70 73 20 5b 6c 69 73 74 20 44 69 61 6c   maps [list Dial
0810: 6f 67 20 7b 7d 20 2e 62 62 6f 78 20 7b 7d 5d 0a  og {} .bbox {}].
0820: 20 20 20 20 61 72 72 61 79 20 73 65 74 20 6d 61      array set ma
0830: 70 73 20 5b 57 69 64 67 65 74 3a 3a 70 61 72 73  ps [Widget::pars
0840: 65 41 72 67 73 20 44 69 61 6c 6f 67 20 24 61 72  eArgs Dialog $ar
0850: 67 73 5d 0a 0a 20 20 20 20 23 20 43 68 65 63 6b  gs]..    # Check
0860: 20 74 6f 20 73 65 65 20 69 66 20 74 68 65 20 2d   to see if the -
0870: 63 6c 61 73 73 20 66 6c 61 67 20 77 61 73 20 73  class flag was s
0880: 70 65 63 69 66 69 65 64 0a 20 20 20 20 73 65 74  pecified.    set
0890: 20 64 69 61 6c 6f 67 43 6c 61 73 73 20 22 44 69   dialogClass "Di
08a0: 61 6c 6f 67 22 0a 20 20 20 20 61 72 72 61 79 20  alog".    array 
08b0: 73 65 74 20 64 69 61 6c 6f 67 41 72 67 73 20 24  set dialogArgs $
08c0: 6d 61 70 73 28 44 69 61 6c 6f 67 29 0a 20 20 20  maps(Dialog).   
08d0: 20 69 66 20 7b 20 5b 69 6e 66 6f 20 65 78 69 73   if { [info exis
08e0: 74 73 20 64 69 61 6c 6f 67 41 72 67 73 28 2d 63  ts dialogArgs(-c
08f0: 6c 61 73 73 29 5d 20 7d 20 7b 0a 09 73 65 74 20  lass)] } {..set 
0900: 64 69 61 6c 6f 67 43 6c 61 73 73 20 24 64 69 61  dialogClass $dia
0910: 6c 6f 67 41 72 67 73 28 2d 63 6c 61 73 73 29 0a  logArgs(-class).
0920: 20 20 20 20 7d 0a 0a 20 20 20 20 69 66 20 7b 20      }..    if { 
0930: 5b 73 74 72 69 6e 67 20 65 71 75 61 6c 20 24 74  [string equal $t
0940: 63 6c 5f 70 6c 61 74 66 6f 72 6d 28 70 6c 61 74  cl_platform(plat
0950: 66 6f 72 6d 29 20 22 75 6e 69 78 22 5d 20 7d 20  form) "unix"] } 
0960: 7b 0a 09 73 65 74 20 72 65 20 72 61 69 73 65 64  {..set re raised
0970: 0a 09 73 65 74 20 62 64 20 31 0a 20 20 20 20 7d  ..set bd 1.    }
0980: 20 65 6c 73 65 20 7b 0a 09 73 65 74 20 72 65 20   else {..set re 
0990: 66 6c 61 74 0a 09 73 65 74 20 62 64 20 30 0a 20  flat..set bd 0. 
09a0: 20 20 20 7d 0a 20 20 20 20 74 6f 70 6c 65 76 65     }.    topleve
09b0: 6c 20 24 70 61 74 68 20 5c 0a 20 20 20 20 20 20  l $path \.      
09c0: 2d 72 65 6c 69 65 66 20 24 72 65 20 2d 62 6f 72  -relief $re -bor
09d0: 64 65 72 77 69 64 74 68 20 24 62 64 20 2d 63 6c  derwidth $bd -cl
09e0: 61 73 73 20 24 64 69 61 6c 6f 67 43 6c 61 73 73  ass $dialogClass
09f0: 20 5c 0a 20 20 20 20 20 20 2d 62 61 63 6b 67 72   \.      -backgr
0a00: 6f 75 6e 64 20 24 3a 3a 42 57 69 64 67 65 74 3a  ound $::BWidget:
0a10: 3a 63 6f 6c 6f 72 73 28 53 79 73 74 65 6d 57 69  :colors(SystemWi
0a20: 6e 64 6f 77 46 72 61 6d 65 29 0a 20 20 20 20 77  ndowFrame).    w
0a30: 6d 20 77 69 74 68 64 72 61 77 20 24 70 61 74 68  m withdraw $path
0a40: 0a 0a 20 20 20 20 57 69 64 67 65 74 3a 3a 69 6e  ..    Widget::in
0a50: 69 74 46 72 6f 6d 4f 44 42 20 44 69 61 6c 6f 67  itFromODB Dialog
0a60: 20 24 70 61 74 68 20 24 6d 61 70 73 28 44 69 61   $path $maps(Dia
0a70: 6c 6f 67 29 0a 0a 20 20 20 20 62 69 6e 64 74 61  log)..    bindta
0a80: 67 73 20 24 70 61 74 68 20 5b 6c 69 73 74 20 24  gs $path [list $
0a90: 70 61 74 68 20 42 77 44 69 61 6c 6f 67 20 61 6c  path BwDialog al
0aa0: 6c 5d 0a 20 0a 20 20 20 20 77 6d 20 6f 76 65 72  l]. .    wm over
0ab0: 72 69 64 65 72 65 64 69 72 65 63 74 20 24 70 61  rideredirect $pa
0ac0: 74 68 20 31 0a 20 20 20 20 77 6d 20 74 69 74 6c  th 1.    wm titl
0ad0: 65 20 24 70 61 74 68 20 5b 57 69 64 67 65 74 3a  e $path [Widget:
0ae0: 3a 63 67 65 74 20 24 70 61 74 68 20 2d 74 69 74  :cget $path -tit
0af0: 6c 65 5d 0a 20 20 20 20 73 65 74 20 70 61 72 65  le].    set pare
0b00: 6e 74 20 5b 57 69 64 67 65 74 3a 3a 63 67 65 74  nt [Widget::cget
0b10: 20 24 70 61 74 68 20 2d 70 61 72 65 6e 74 5d 0a   $path -parent].
0b20: 20 20 20 20 69 66 20 7b 20 21 5b 77 69 6e 66 6f      if { ![winfo
0b30: 20 65 78 69 73 74 73 20 24 70 61 72 65 6e 74 5d   exists $parent]
0b40: 20 7d 20 7b 0a 20 20 20 20 20 20 20 20 73 65 74   } {.        set
0b50: 20 70 61 72 65 6e 74 20 5b 77 69 6e 66 6f 20 70   parent [winfo p
0b60: 61 72 65 6e 74 20 24 70 61 74 68 5d 0a 20 20 20  arent $path].   
0b70: 20 7d 0a 20 20 20 20 23 20 4a 44 43 3a 20 6d 61   }.    # JDC: ma
0b80: 64 65 20 74 72 61 6e 73 69 65 6e 74 20 6f 70 74  de transient opt
0b90: 69 6f 6e 61 6c 0a 20 20 20 20 69 66 20 7b 20 5b  ional.    if { [
0ba0: 57 69 64 67 65 74 3a 3a 67 65 74 6f 70 74 69 6f  Widget::getoptio
0bb0: 6e 20 24 70 61 74 68 20 2d 74 72 61 6e 73 69 65  n $path -transie
0bc0: 6e 74 5d 20 7d 20 7b 0a 09 77 6d 20 74 72 61 6e  nt] } {..wm tran
0bd0: 73 69 65 6e 74 20 24 70 61 74 68 20 5b 77 69 6e  sient $path [win
0be0: 66 6f 20 74 6f 70 6c 65 76 65 6c 20 24 70 61 72  fo toplevel $par
0bf0: 65 6e 74 5d 0a 20 20 20 20 7d 0a 0a 20 20 20 20  ent].    }..    
0c00: 73 65 74 20 73 69 64 65 20 5b 57 69 64 67 65 74  set side [Widget
0c10: 3a 3a 63 67 65 74 20 24 70 61 74 68 20 2d 73 69  ::cget $path -si
0c20: 64 65 5d 0a 20 20 20 20 69 66 20 7b 20 5b 73 74  de].    if { [st
0c30: 72 69 6e 67 20 65 71 75 61 6c 20 24 73 69 64 65  ring equal $side
0c40: 20 22 6c 65 66 74 22 5d 20 7c 7c 20 5b 73 74 72   "left"] || [str
0c50: 69 6e 67 20 65 71 75 61 6c 20 24 73 69 64 65 20  ing equal $side 
0c60: 22 72 69 67 68 74 22 5d 20 7d 20 7b 0a 20 20 20  "right"] } {.   
0c70: 20 20 20 20 20 73 65 74 20 6f 72 69 65 6e 74 20       set orient 
0c80: 76 65 72 74 69 63 61 6c 0a 20 20 20 20 7d 20 65  vertical.    } e
0c90: 6c 73 65 20 7b 0a 20 20 20 20 20 20 20 20 73 65  lse {.        se
0ca0: 74 20 6f 72 69 65 6e 74 20 68 6f 72 69 7a 6f 6e  t orient horizon
0cb0: 74 61 6c 0a 20 20 20 20 7d 0a 0a 20 20 20 20 73  tal.    }..    s
0cc0: 65 74 20 62 62 6f 78 20 20 5b 65 76 61 6c 20 5b  et bbox  [eval [
0cd0: 6c 69 73 74 20 42 75 74 74 6f 6e 42 6f 78 3a 3a  list ButtonBox::
0ce0: 63 72 65 61 74 65 20 24 70 61 74 68 2e 62 62 6f  create $path.bbo
0cf0: 78 5d 20 24 6d 61 70 73 28 2e 62 62 6f 78 29 20  x] $maps(.bbox) 
0d00: 5c 0a 09 09 20 20 20 2d 6f 72 69 65 6e 74 20 24  \...   -orient $
0d10: 6f 72 69 65 6e 74 5d 0a 0a 20 20 20 20 73 65 74  orient]..    set
0d20: 20 62 67 20 5b 57 69 64 67 65 74 3a 3a 63 67 65   bg [Widget::cge
0d30: 74 20 24 70 61 74 68 20 2d 62 61 63 6b 67 72 6f  t $path -backgro
0d40: 75 6e 64 5d 0a 20 20 20 20 24 70 61 74 68 20 63  und].    $path c
0d50: 6f 6e 66 69 67 75 72 65 20 2d 62 61 63 6b 67 72  onfigure -backgr
0d60: 6f 75 6e 64 20 24 62 67 0a 0a 20 20 20 20 69 66  ound $bg..    if
0d70: 20 7b 20 5b 42 57 69 64 67 65 74 3a 3a 75 73 69   { [BWidget::usi
0d80: 6e 67 20 74 74 6b 5d 20 7d 20 7b 0a 20 20 20 20  ng ttk] } {.    
0d90: 20 20 20 20 20 73 65 74 20 66 72 61 6d 65 20 5b       set frame [
0da0: 74 74 6b 3a 3a 66 72 61 6d 65 20 24 70 61 74 68  ttk::frame $path
0db0: 2e 66 72 61 6d 65 20 2d 72 65 6c 69 65 66 20 66  .frame -relief f
0dc0: 6c 61 74 5d 0a 20 20 20 20 7d 20 65 6c 73 65 20  lat].    } else 
0dd0: 7b 0a 20 20 20 20 20 20 20 20 20 73 65 74 20 66  {.         set f
0de0: 72 61 6d 65 20 5b 66 72 61 6d 65 20 24 70 61 74  rame [frame $pat
0df0: 68 2e 66 72 61 6d 65 20 2d 72 65 6c 69 65 66 20  h.frame -relief 
0e00: 66 6c 61 74 20 2d 62 6f 72 64 65 72 77 69 64 74  flat -borderwidt
0e10: 68 20 30 20 2d 62 61 63 6b 67 72 6f 75 6e 64 20  h 0 -background 
0e20: 24 62 67 5d 0a 20 20 20 20 7d 0a 0a 20 20 20 20  $bg].    }..    
0e30: 69 66 20 7b 20 5b 73 65 74 20 62 69 74 6d 61 70  if { [set bitmap
0e40: 20 5b 57 69 64 67 65 74 3a 3a 67 65 74 6f 70 74   [Widget::getopt
0e50: 69 6f 6e 20 24 70 61 74 68 20 2d 69 6d 61 67 65  ion $path -image
0e60: 5d 5d 20 21 3d 20 22 22 20 7d 20 7b 0a 20 20 20  ]] != "" } {.   
0e70: 20 20 20 20 20 73 65 74 20 6c 61 62 65 6c 20 5b       set label [
0e80: 6c 61 62 65 6c 20 24 70 61 74 68 2e 6c 61 62 65  label $path.labe
0e90: 6c 20 2d 69 6d 61 67 65 20 24 62 69 74 6d 61 70  l -image $bitmap
0ea0: 20 2d 62 61 63 6b 67 72 6f 75 6e 64 20 24 62 67   -background $bg
0eb0: 5d 0a 20 20 20 20 7d 20 65 6c 73 65 69 66 20 7b  ].    } elseif {
0ec0: 20 5b 73 65 74 20 62 69 74 6d 61 70 20 5b 57 69   [set bitmap [Wi
0ed0: 64 67 65 74 3a 3a 67 65 74 6f 70 74 69 6f 6e 20  dget::getoption 
0ee0: 24 70 61 74 68 20 2d 62 69 74 6d 61 70 5d 5d 20  $path -bitmap]] 
0ef0: 21 3d 20 22 22 20 7d 20 7b 0a 20 20 20 20 20 20  != "" } {.      
0f00: 20 20 73 65 74 20 6c 61 62 65 6c 20 5b 6c 61 62    set label [lab
0f10: 65 6c 20 24 70 61 74 68 2e 6c 61 62 65 6c 20 2d  el $path.label -
0f20: 62 69 74 6d 61 70 20 24 62 69 74 6d 61 70 20 2d  bitmap $bitmap -
0f30: 62 61 63 6b 67 72 6f 75 6e 64 20 24 62 67 5d 0a  background $bg].
0f40: 20 20 20 20 7d 0a 20 20 20 20 69 66 20 7b 20 5b      }.    if { [
0f50: 57 69 64 67 65 74 3a 3a 67 65 74 6f 70 74 69 6f  Widget::getoptio
0f60: 6e 20 24 70 61 74 68 20 2d 73 65 70 61 72 61 74  n $path -separat
0f70: 6f 72 5d 20 7d 20 7b 0a 09 53 65 70 61 72 61 74  or] } {..Separat
0f80: 6f 72 3a 3a 63 72 65 61 74 65 20 24 70 61 74 68  or::create $path
0f90: 2e 73 65 70 20 2d 6f 72 69 65 6e 74 20 24 6f 72  .sep -orient $or
0fa0: 69 65 6e 74 20 2d 62 61 63 6b 67 72 6f 75 6e 64  ient -background
0fb0: 20 24 62 67 0a 20 20 20 20 7d 0a 20 20 20 20 73   $bg.    }.    s
0fc0: 65 74 20 5f 77 69 64 67 65 74 28 24 70 61 74 68  et _widget($path
0fd0: 2c 72 65 61 6c 69 7a 65 64 29 20 30 0a 20 20 20  ,realized) 0.   
0fe0: 20 73 65 74 20 5f 77 69 64 67 65 74 28 24 70 61   set _widget($pa
0ff0: 74 68 2c 6e 62 75 74 29 20 20 20 20 20 30 0a 0a  th,nbut)     0..
1000: 20 20 20 20 62 69 6e 64 20 24 70 61 74 68 20 3c      bind $path <
1010: 45 73 63 61 70 65 3e 20 20 5b 6c 69 73 74 20 42  Escape>  [list B
1020: 75 74 74 6f 6e 42 6f 78 3a 3a 69 6e 76 6f 6b 65  uttonBox::invoke
1030: 20 24 70 61 74 68 2e 62 62 6f 78 20 5b 57 69 64   $path.bbox [Wid
1040: 67 65 74 3a 3a 67 65 74 6f 70 74 69 6f 6e 20 24  get::getoption $
1050: 70 61 74 68 20 2d 63 61 6e 63 65 6c 5d 5d 0a 20  path -cancel]]. 
1060: 20 20 20 62 69 6e 64 20 24 70 61 74 68 20 3c 52     bind $path <R
1070: 65 74 75 72 6e 3e 20 20 5b 6c 69 73 74 20 42 75  eturn>  [list Bu
1080: 74 74 6f 6e 42 6f 78 3a 3a 69 6e 76 6f 6b 65 20  ttonBox::invoke 
1090: 24 70 61 74 68 2e 62 62 6f 78 20 64 65 66 61 75  $path.bbox defau
10a0: 6c 74 5d 0a 0a 20 20 20 20 72 65 74 75 72 6e 20  lt]..    return 
10b0: 5b 57 69 64 67 65 74 3a 3a 63 72 65 61 74 65 20  [Widget::create 
10c0: 44 69 61 6c 6f 67 20 24 70 61 74 68 5d 0a 7d 0a  Dialog $path].}.
10d0: 0a 0a 23 20 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 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1110: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1120: 0a 23 20 20 43 6f 6d 6d 61 6e 64 20 44 69 61 6c  .#  Command Dial
1130: 6f 67 3a 3a 63 6f 6e 66 69 67 75 72 65 0a 23 20  og::configure.# 
1140: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1150: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1160: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1170: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1180: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 70 72 6f  ------------.pro
1190: 63 20 44 69 61 6c 6f 67 3a 3a 63 6f 6e 66 69 67  c Dialog::config
11a0: 75 72 65 20 7b 20 70 61 74 68 20 61 72 67 73 20  ure { path args 
11b0: 7d 20 7b 0a 20 20 20 20 73 65 74 20 72 65 73 20  } {.    set res 
11c0: 5b 57 69 64 67 65 74 3a 3a 63 6f 6e 66 69 67 75  [Widget::configu
11d0: 72 65 20 24 70 61 74 68 20 24 61 72 67 73 5d 0a  re $path $args].
11e0: 0a 20 20 20 20 69 66 20 7b 20 5b 57 69 64 67 65  .    if { [Widge
11f0: 74 3a 3a 68 61 73 43 68 61 6e 67 65 64 20 24 70  t::hasChanged $p
1200: 61 74 68 20 2d 74 69 74 6c 65 20 74 69 74 6c 65  ath -title title
1210: 5d 20 7d 20 7b 0a 20 20 20 20 20 20 20 20 77 6d  ] } {.        wm
1220: 20 74 69 74 6c 65 20 24 70 61 74 68 20 24 74 69   title $path $ti
1230: 74 6c 65 0a 20 20 20 20 7d 0a 20 20 20 20 69 66  tle.    }.    if
1240: 20 7b 20 5b 57 69 64 67 65 74 3a 3a 68 61 73 43   { [Widget::hasC
1250: 68 61 6e 67 65 64 20 24 70 61 74 68 20 2d 62 61  hanged $path -ba
1260: 63 6b 67 72 6f 75 6e 64 20 62 67 5d 20 7d 20 7b  ckground bg] } {
1270: 0a 20 20 20 20 20 20 20 20 69 66 20 7b 20 5b 77  .        if { [w
1280: 69 6e 66 6f 20 65 78 69 73 74 73 20 24 70 61 74  info exists $pat
1290: 68 2e 6c 61 62 65 6c 5d 20 7d 20 7b 0a 20 20 20  h.label] } {.   
12a0: 20 20 20 20 20 20 20 20 20 24 70 61 74 68 2e 6c           $path.l
12b0: 61 62 65 6c 20 63 6f 6e 66 69 67 75 72 65 20 2d  abel configure -
12c0: 62 61 63 6b 67 72 6f 75 6e 64 20 24 62 67 0a 20  background $bg. 
12d0: 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 20         }.       
12e0: 20 69 66 20 7b 20 5b 77 69 6e 66 6f 20 65 78 69   if { [winfo exi
12f0: 73 74 73 20 24 70 61 74 68 2e 73 65 70 5d 20 7d  sts $path.sep] }
1300: 20 7b 0a 20 20 20 20 20 20 20 20 20 20 20 20 53   {.            S
1310: 65 70 61 72 61 74 6f 72 3a 3a 63 6f 6e 66 69 67  eparator::config
1320: 75 72 65 20 24 70 61 74 68 2e 73 65 70 20 2d 62  ure $path.sep -b
1330: 61 63 6b 67 72 6f 75 6e 64 20 24 62 67 0a 20 20  ackground $bg.  
1340: 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 0a 20 20        }.    }.  
1350: 20 20 72 65 74 75 72 6e 20 24 72 65 73 0a 7d 0a    return $res.}.
1360: 0a 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ..# ------------
1370: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1380: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1390: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
13a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
13b0: 0a 23 20 20 43 6f 6d 6d 61 6e 64 20 44 69 61 6c  .#  Command Dial
13c0: 6f 67 3a 3a 63 67 65 74 0a 23 20 2d 2d 2d 2d 2d  og::cget.# -----
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 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1410: 2d 2d 2d 2d 2d 2d 2d 0a 70 72 6f 63 20 44 69 61  -------.proc Dia
1420: 6c 6f 67 3a 3a 63 67 65 74 20 7b 20 70 61 74 68  log::cget { path
1430: 20 6f 70 74 69 6f 6e 20 7d 20 7b 0a 20 20 20 20   option } {.    
1440: 72 65 74 75 72 6e 20 5b 57 69 64 67 65 74 3a 3a  return [Widget::
1450: 63 67 65 74 20 24 70 61 74 68 20 24 6f 70 74 69  cget $path $opti
1460: 6f 6e 5d 0a 7d 0a 0a 0a 23 20 2d 2d 2d 2d 2d 2d  on].}...# ------
1470: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1480: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1490: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
14a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
14b0: 2d 2d 2d 2d 2d 2d 0a 23 20 20 43 6f 6d 6d 61 6e  ------.#  Comman
14c0: 64 20 44 69 61 6c 6f 67 3a 3a 67 65 74 66 72 61  d Dialog::getfra
14d0: 6d 65 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  me.# -----------
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 2d 2d 2d 2d  ----------------
1520: 2d 0a 70 72 6f 63 20 44 69 61 6c 6f 67 3a 3a 67  -.proc Dialog::g
1530: 65 74 66 72 61 6d 65 20 7b 20 70 61 74 68 20 7d  etframe { path }
1540: 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 24 70   {.    return $p
1550: 61 74 68 2e 66 72 61 6d 65 0a 7d 0a 0a 0a 23 20  ath.frame.}...# 
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: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
15a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 20 20  ------------.#  
15b0: 43 6f 6d 6d 61 6e 64 20 44 69 61 6c 6f 67 3a 3a  Command Dialog::
15c0: 61 64 64 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  add.# ----------
15d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
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 0a 70 72 6f 63 20 44 69 61 6c 6f 67 3a 3a  --.proc Dialog::
1620: 61 64 64 20 7b 20 70 61 74 68 20 61 72 67 73 20  add { path args 
1630: 7d 20 7b 0a 20 20 20 20 76 61 72 69 61 62 6c 65  } {.    variable
1640: 20 5f 77 69 64 67 65 74 0a 0a 20 20 20 20 69 66   _widget..    if
1650: 20 7b 5b 73 74 72 69 6e 67 20 65 71 75 61 6c 20   {[string equal 
1660: 24 3a 3a 74 63 6c 5f 70 6c 61 74 66 6f 72 6d 28  $::tcl_platform(
1670: 70 6c 61 74 66 6f 72 6d 29 20 22 77 69 6e 64 6f  platform) "windo
1680: 77 73 22 5d 0a 09 26 26 20 24 3a 3a 74 6b 5f 76  ws"]..&& $::tk_v
1690: 65 72 73 69 6f 6e 20 3e 3d 20 38 2e 34 7d 20 7b  ersion >= 8.4} {
16a0: 0a 09 73 65 74 20 77 69 64 74 68 20 2d 31 31 0a  ..set width -11.
16b0: 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 09 73 65      } else {..se
16c0: 74 20 77 69 64 74 68 20 38 0a 20 20 20 20 7d 0a  t width 8.    }.
16d0: 20 20 20 20 73 65 74 20 63 6d 64 20 5b 6c 69 73      set cmd [lis
16e0: 74 20 42 75 74 74 6f 6e 42 6f 78 3a 3a 61 64 64  t ButtonBox::add
16f0: 20 24 70 61 74 68 2e 62 62 6f 78 20 2d 77 69 64   $path.bbox -wid
1700: 74 68 20 24 77 69 64 74 68 20 5c 0a 09 09 20 2d  th $width \... -
1710: 63 6f 6d 6d 61 6e 64 20 5b 6c 69 73 74 20 44 69  command [list Di
1720: 61 6c 6f 67 3a 3a 65 6e 64 64 69 61 6c 6f 67 20  alog::enddialog 
1730: 24 70 61 74 68 20 24 5f 77 69 64 67 65 74 28 24  $path $_widget($
1740: 70 61 74 68 2c 6e 62 75 74 29 5d 5d 0a 0a 20 20  path,nbut)]]..  
1750: 20 20 73 65 74 20 72 65 73 20 5b 65 76 61 6c 20    set res [eval 
1760: 24 63 6d 64 20 24 61 72 67 73 5d 0a 0a 20 20 20  $cmd $args]..   
1770: 20 23 20 61 20 62 75 74 74 6f 6e 20 62 6f 78 20   # a button box 
1780: 62 75 74 74 6f 6e 20 62 79 20 64 65 66 61 75 6c  button by defaul
1790: 74 20 69 73 20 66 6c 61 74 2c 20 74 68 69 73 20  t is flat, this 
17a0: 69 73 6e 27 74 20 77 68 61 74 20 77 65 20 77 61  isn't what we wa
17b0: 6e 74 0a 20 20 20 20 23 20 68 65 72 65 20 66 6f  nt.    # here fo
17c0: 72 20 6e 6f 72 6d 61 6c 20 64 69 61 6c 6f 67 20  r normal dialog 
17d0: 62 6f 78 20 61 63 74 69 6f 6e 20 62 75 74 74 6f  box action butto
17e0: 6e 73 2c 20 73 6f 20 77 65 20 6e 65 65 64 20 74  ns, so we need t
17f0: 6f 0a 20 20 20 20 23 20 6f 76 65 72 72 69 64 65  o.    # override
1800: 20 74 68 65 20 64 65 66 61 75 6c 74 3a 0a 0a 20   the default:.. 
1810: 20 20 20 69 66 20 7b 20 5b 42 57 69 64 67 65 74     if { [BWidget
1820: 3a 3a 75 73 69 6e 67 20 74 74 6b 5d 20 7d 20 7b  ::using ttk] } {
1830: 0a 20 20 20 20 20 20 20 20 24 72 65 73 20 63 6f  .        $res co
1840: 6e 66 69 67 75 72 65 20 2d 73 74 79 6c 65 20 22  nfigure -style "
1850: 54 42 75 74 74 6f 6e 22 0a 20 20 20 20 7d 0a 0a  TButton".    }..
1860: 20 20 20 20 69 6e 63 72 20 5f 77 69 64 67 65 74      incr _widget
1870: 28 24 70 61 74 68 2c 6e 62 75 74 29 0a 20 20 20  ($path,nbut).   
1880: 20 72 65 74 75 72 6e 20 24 72 65 73 0a 7d 0a 0a   return $res.}..
1890: 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  .# -------------
18a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
18b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
18c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
18d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a  ---------------.
18e0: 23 20 20 43 6f 6d 6d 61 6e 64 20 44 69 61 6c 6f  #  Command Dialo
18f0: 67 3a 3a 69 74 65 6d 63 6f 6e 66 69 67 75 72 65  g::itemconfigure
1900: 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  .# -------------
1910: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1920: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1930: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1940: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a  ---------------.
1950: 70 72 6f 63 20 44 69 61 6c 6f 67 3a 3a 69 74 65  proc Dialog::ite
1960: 6d 63 6f 6e 66 69 67 75 72 65 20 7b 20 70 61 74  mconfigure { pat
1970: 68 20 69 6e 64 65 78 20 61 72 67 73 20 7d 20 7b  h index args } {
1980: 0a 20 20 20 20 72 65 74 75 72 6e 20 5b 65 76 61  .    return [eva
1990: 6c 20 5b 6c 69 73 74 20 42 75 74 74 6f 6e 42 6f  l [list ButtonBo
19a0: 78 3a 3a 69 74 65 6d 63 6f 6e 66 69 67 75 72 65  x::itemconfigure
19b0: 20 24 70 61 74 68 2e 62 62 6f 78 20 24 69 6e 64   $path.bbox $ind
19c0: 65 78 5d 20 24 61 72 67 73 5d 0a 7d 0a 0a 0a 23  ex] $args].}...#
19d0: 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d   ---------------
19e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
19f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1a00: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1a10: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 20  -------------.# 
1a20: 20 43 6f 6d 6d 61 6e 64 20 44 69 61 6c 6f 67 3a   Command Dialog:
1a30: 3a 69 74 65 6d 63 67 65 74 0a 23 20 2d 2d 2d 2d  :itemcget.# ----
1a40: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1a50: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1a60: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1a70: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1a80: 2d 2d 2d 2d 2d 2d 2d 2d 0a 70 72 6f 63 20 44 69  --------.proc Di
1a90: 61 6c 6f 67 3a 3a 69 74 65 6d 63 67 65 74 20 7b  alog::itemcget {
1aa0: 20 70 61 74 68 20 69 6e 64 65 78 20 6f 70 74 69   path index opti
1ab0: 6f 6e 20 7d 20 7b 0a 20 20 20 20 72 65 74 75 72  on } {.    retur
1ac0: 6e 20 5b 42 75 74 74 6f 6e 42 6f 78 3a 3a 69 74  n [ButtonBox::it
1ad0: 65 6d 63 67 65 74 20 24 70 61 74 68 2e 62 62 6f  emcget $path.bbo
1ae0: 78 20 24 69 6e 64 65 78 20 24 6f 70 74 69 6f 6e  x $index $option
1af0: 5d 0a 7d 0a 0a 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d  ].}...# --------
1b00: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1b10: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1b20: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1b30: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1b40: 2d 2d 2d 2d 0a 23 20 20 43 6f 6d 6d 61 6e 64 20  ----.#  Command 
1b50: 44 69 61 6c 6f 67 3a 3a 69 6e 76 6f 6b 65 0a 23  Dialog::invoke.#
1b60: 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d   ---------------
1b70: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1b80: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1b90: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1ba0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 70 72  -------------.pr
1bb0: 6f 63 20 44 69 61 6c 6f 67 3a 3a 69 6e 76 6f 6b  oc Dialog::invok
1bc0: 65 20 7b 20 70 61 74 68 20 69 6e 64 65 78 20 7d  e { path index }
1bd0: 20 7b 0a 20 20 20 20 42 75 74 74 6f 6e 42 6f 78   {.    ButtonBox
1be0: 3a 3a 69 6e 76 6f 6b 65 20 24 70 61 74 68 2e 62  ::invoke $path.b
1bf0: 62 6f 78 20 24 69 6e 64 65 78 0a 7d 0a 0a 0a 23  box $index.}...#
1c00: 20 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 2d 2d 2d 2d 2d  ----------------
1c30: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1c40: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 20  -------------.# 
1c50: 20 43 6f 6d 6d 61 6e 64 20 44 69 61 6c 6f 67 3a   Command Dialog:
1c60: 3a 73 65 74 66 6f 63 75 73 0a 23 20 2d 2d 2d 2d  :setfocus.# ----
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 2d 2d 2d 2d  ----------------
1ca0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1cb0: 2d 2d 2d 2d 2d 2d 2d 2d 0a 70 72 6f 63 20 44 69  --------.proc Di
1cc0: 61 6c 6f 67 3a 3a 73 65 74 66 6f 63 75 73 20 7b  alog::setfocus {
1cd0: 20 70 61 74 68 20 69 6e 64 65 78 20 7d 20 7b 0a   path index } {.
1ce0: 20 20 20 20 42 75 74 74 6f 6e 42 6f 78 3a 3a 73      ButtonBox::s
1cf0: 65 74 66 6f 63 75 73 20 24 70 61 74 68 2e 62 62  etfocus $path.bb
1d00: 6f 78 20 24 69 6e 64 65 78 0a 7d 0a 0a 0a 23 20  ox $index.}...# 
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 2d 2d 2d 2d 2d 2d  ----------------
1d50: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 20 20  ------------.#  
1d60: 43 6f 6d 6d 61 6e 64 20 44 69 61 6c 6f 67 3a 3a  Command Dialog::
1d70: 65 6e 64 64 69 61 6c 6f 67 0a 23 20 2d 2d 2d 2d  enddialog.# ----
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 2d 2d 2d 2d 2d  ----------------
1dc0: 2d 2d 2d 2d 2d 2d 2d 2d 0a 70 72 6f 63 20 44 69  --------.proc Di
1dd0: 61 6c 6f 67 3a 3a 65 6e 64 64 69 61 6c 6f 67 20  alog::enddialog 
1de0: 7b 20 70 61 74 68 20 72 65 73 75 6c 74 20 7d 20  { path result } 
1df0: 7b 0a 20 20 20 20 76 61 72 69 61 62 6c 65 20 5f  {.    variable _
1e00: 77 69 64 67 65 74 0a 0a 20 20 20 20 73 65 74 20  widget..    set 
1e10: 5f 77 69 64 67 65 74 28 24 70 61 74 68 2c 72 65  _widget($path,re
1e20: 73 75 6c 74 29 20 24 72 65 73 75 6c 74 0a 7d 0a  sult) $result.}.
1e30: 0a 0a 23 20 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 2d 2d 2d 2d 2d 2d 2d  ----------------
1e70: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1e80: 0a 23 20 20 43 6f 6d 6d 61 6e 64 20 44 69 61 6c  .#  Command Dial
1e90: 6f 67 3a 3a 64 72 61 77 0a 23 20 2d 2d 2d 2d 2d  og::draw.# -----
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 2d 2d 2d 2d  ----------------
1ee0: 2d 2d 2d 2d 2d 2d 2d 0a 70 72 6f 63 20 44 69 61  -------.proc Dia
1ef0: 6c 6f 67 3a 3a 64 72 61 77 20 7b 20 70 61 74 68  log::draw { path
1f00: 20 7b 66 6f 63 75 73 20 22 22 7d 20 7b 6f 76 65   {focus ""} {ove
1f10: 72 72 69 64 65 72 65 64 69 72 65 63 74 20 30 7d  rrideredirect 0}
1f20: 20 7b 67 65 6f 6d 65 74 72 79 20 22 22 7d 7d 20   {geometry ""}} 
1f30: 7b 0a 20 20 20 20 76 61 72 69 61 62 6c 65 20 5f  {.    variable _
1f40: 77 69 64 67 65 74 0a 0a 20 20 20 20 73 65 74 20  widget..    set 
1f50: 70 61 72 65 6e 74 20 5b 57 69 64 67 65 74 3a 3a  parent [Widget::
1f60: 67 65 74 6f 70 74 69 6f 6e 20 24 70 61 74 68 20  getoption $path 
1f70: 2d 70 61 72 65 6e 74 5d 0a 20 20 20 20 69 66 20  -parent].    if 
1f80: 7b 20 21 24 5f 77 69 64 67 65 74 28 24 70 61 74  { !$_widget($pat
1f90: 68 2c 72 65 61 6c 69 7a 65 64 29 20 7d 20 7b 0a  h,realized) } {.
1fa0: 20 20 20 20 20 20 20 20 73 65 74 20 5f 77 69 64          set _wid
1fb0: 67 65 74 28 24 70 61 74 68 2c 72 65 61 6c 69 7a  get($path,realiz
1fc0: 65 64 29 20 31 0a 20 20 20 20 20 20 20 20 69 66  ed) 1.        if
1fd0: 20 7b 20 5b 6c 6c 65 6e 67 74 68 20 5b 77 69 6e   { [llength [win
1fe0: 66 6f 20 63 68 69 6c 64 72 65 6e 20 24 70 61 74  fo children $pat
1ff0: 68 2e 62 62 6f 78 5d 5d 20 7d 20 7b 0a 20 20 20  h.bbox]] } {.   
2000: 20 20 20 20 20 20 20 20 20 73 65 74 20 73 69 64           set sid
2010: 65 20 5b 57 69 64 67 65 74 3a 3a 67 65 74 6f 70  e [Widget::getop
2020: 74 69 6f 6e 20 24 70 61 74 68 20 2d 73 69 64 65  tion $path -side
2030: 5d 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 66  ].            if
2040: 20 7b 5b 73 74 72 69 6e 67 20 65 71 75 61 6c 20   {[string equal 
2050: 24 73 69 64 65 20 22 6c 65 66 74 22 5d 20 7c 7c  $side "left"] ||
2060: 20 5b 73 74 72 69 6e 67 20 65 71 75 61 6c 20 24   [string equal $
2070: 73 69 64 65 20 22 72 69 67 68 74 22 5d 7d 20 7b  side "right"]} {
2080: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20  .               
2090: 20 73 65 74 20 70 61 64 20 20 2d 70 61 64 78 0a   set pad  -padx.
20a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
20b0: 73 65 74 20 66 69 6c 6c 20 79 0a 20 20 20 20 20  set fill y.     
20c0: 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a         } else {.
20d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
20e0: 73 65 74 20 70 61 64 20 20 2d 70 61 64 79 0a 20  set pad  -pady. 
20f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73                 s
2100: 65 74 20 66 69 6c 6c 20 78 0a 20 20 20 20 20 20  et fill x.      
2110: 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 20 20        }.        
2120: 20 20 20 20 70 61 63 6b 20 24 70 61 74 68 2e 62      pack $path.b
2130: 62 6f 78 20 2d 73 69 64 65 20 24 73 69 64 65 20  box -side $side 
2140: 2d 70 61 64 78 20 31 6d 20 2d 70 61 64 79 20 31  -padx 1m -pady 1
2150: 6d 20 5c 0a 09 09 2d 61 6e 63 68 6f 72 20 5b 57  m \...-anchor [W
2160: 69 64 67 65 74 3a 3a 67 65 74 6f 70 74 69 6f 6e  idget::getoption
2170: 20 24 70 61 74 68 20 2d 61 6e 63 68 6f 72 5d 0a   $path -anchor].
2180: 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b              if {
2190: 20 5b 77 69 6e 66 6f 20 65 78 69 73 74 73 20 24   [winfo exists $
21a0: 70 61 74 68 2e 73 65 70 5d 20 7d 20 7b 0a 20 20  path.sep] } {.  
21b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 70 61                pa
21c0: 63 6b 20 24 70 61 74 68 2e 73 65 70 20 2d 73 69  ck $path.sep -si
21d0: 64 65 20 24 73 69 64 65 20 2d 66 69 6c 6c 20 24  de $side -fill $
21e0: 66 69 6c 6c 20 24 70 61 64 20 32 6d 0a 20 20 20  fill $pad 2m.   
21f0: 20 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20           }.     
2200: 20 20 20 7d 0a 20 20 20 20 20 20 20 20 69 66 20     }.        if 
2210: 7b 20 5b 77 69 6e 66 6f 20 65 78 69 73 74 73 20  { [winfo exists 
2220: 24 70 61 74 68 2e 6c 61 62 65 6c 5d 20 7d 20 7b  $path.label] } {
2230: 0a 20 20 20 20 20 20 20 20 20 20 20 20 70 61 63  .            pac
2240: 6b 20 24 70 61 74 68 2e 6c 61 62 65 6c 20 2d 73  k $path.label -s
2250: 69 64 65 20 6c 65 66 74 20 2d 61 6e 63 68 6f 72  ide left -anchor
2260: 20 6e 20 2d 70 61 64 78 20 33 6d 20 2d 70 61 64   n -padx 3m -pad
2270: 79 20 33 6d 0a 20 20 20 20 20 20 20 20 7d 0a 20  y 3m.        }. 
2280: 20 20 20 20 20 20 20 70 61 63 6b 20 24 70 61 74         pack $pat
2290: 68 2e 66 72 61 6d 65 20 2d 70 61 64 78 20 31 6d  h.frame -padx 1m
22a0: 20 2d 70 61 64 79 20 31 6d 20 2d 66 69 6c 6c 20   -pady 1m -fill 
22b0: 62 6f 74 68 20 2d 65 78 70 61 6e 64 20 79 65 73  both -expand yes
22c0: 0a 20 20 20 20 7d 0a 0a 20 20 20 20 73 65 74 20  .    }..    set 
22d0: 67 65 6f 6d 20 5b 57 69 64 67 65 74 3a 3a 67 65  geom [Widget::ge
22e0: 74 4d 65 67 61 77 69 64 67 65 74 4f 70 74 69 6f  tMegawidgetOptio
22f0: 6e 20 24 70 61 74 68 20 2d 67 65 6f 6d 65 74 72  n $path -geometr
2300: 79 5d 0a 20 20 20 20 69 66 20 7b 20 24 67 65 6f  y].    if { $geo
2310: 6d 20 21 3d 20 22 22 20 7d 20 7b 0a 09 77 6d 20  m != "" } {..wm 
2320: 67 65 6f 6d 65 74 72 79 20 24 70 61 74 68 20 24  geometry $path $
2330: 67 65 6f 6d 0a 20 20 20 20 7d 0a 0a 20 20 20 20  geom.    }..    
2340: 69 66 20 7b 20 5b 73 74 72 69 6e 67 20 65 71 75  if { [string equ
2350: 61 6c 20 24 67 65 6f 6d 65 74 72 79 20 22 22 5d  al $geometry ""]
2360: 20 26 26 20 28 24 67 65 6f 6d 20 3d 3d 20 22 22   && ($geom == ""
2370: 29 20 7d 20 7b 0a 09 73 65 74 20 70 6c 61 63 65  ) } {..set place
2380: 20 5b 57 69 64 67 65 74 3a 3a 67 65 74 6f 70 74   [Widget::getopt
2390: 69 6f 6e 20 24 70 61 74 68 20 2d 70 6c 61 63 65  ion $path -place
23a0: 5d 0a 09 69 66 20 7b 20 21 5b 73 74 72 69 6e 67  ]..if { ![string
23b0: 20 65 71 75 61 6c 20 24 70 6c 61 63 65 20 6e 6f   equal $place no
23c0: 6e 65 5d 20 7d 20 7b 0a 09 20 20 20 20 69 66 20  ne] } {..    if 
23d0: 7b 20 5b 77 69 6e 66 6f 20 65 78 69 73 74 73 20  { [winfo exists 
23e0: 24 70 61 72 65 6e 74 5d 20 7d 20 7b 0a 09 09 42  $parent] } {...B
23f0: 57 69 64 67 65 74 3a 3a 70 6c 61 63 65 20 24 70  Widget::place $p
2400: 61 74 68 20 30 20 30 20 24 70 6c 61 63 65 20 24  ath 0 0 $place $
2410: 70 61 72 65 6e 74 0a 09 20 20 20 20 7d 20 65 6c  parent..    } el
2420: 73 65 20 7b 0a 09 09 42 57 69 64 67 65 74 3a 3a  se {...BWidget::
2430: 70 6c 61 63 65 20 24 70 61 74 68 20 30 20 30 20  place $path 0 0 
2440: 24 70 6c 61 63 65 0a 09 20 20 20 20 7d 0a 09 7d  $place..    }..}
2450: 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 09 69  .    } else {..i
2460: 66 20 7b 20 24 67 65 6f 6d 20 21 3d 20 22 22 20  f { $geom != "" 
2470: 7d 20 7b 0a 09 20 20 20 20 77 6d 20 67 65 6f 6d  } {..    wm geom
2480: 65 74 72 79 20 24 70 61 74 68 20 24 67 65 6f 6d  etry $path $geom
2490: 0a 09 7d 20 65 6c 73 65 20 7b 0a 09 20 20 20 20  ..} else {..    
24a0: 77 6d 20 67 65 6f 6d 65 74 72 79 20 24 70 61 74  wm geometry $pat
24b0: 68 20 24 67 65 6f 6d 65 74 72 79 0a 09 7d 0a 20  h $geometry..}. 
24c0: 20 20 20 7d 0a 20 20 20 20 75 70 64 61 74 65 20     }.    update 
24d0: 69 64 6c 65 74 61 73 6b 73 0a 20 20 20 20 77 6d  idletasks.    wm
24e0: 20 6f 76 65 72 72 69 64 65 72 65 64 69 72 65 63   overrideredirec
24f0: 74 20 24 70 61 74 68 20 24 6f 76 65 72 72 69 64  t $path $overrid
2500: 65 72 65 64 69 72 65 63 74 0a 20 20 20 20 77 6d  eredirect.    wm
2510: 20 64 65 69 63 6f 6e 69 66 79 20 24 70 61 74 68   deiconify $path
2520: 0a 0a 20 20 20 20 23 20 70 61 74 63 68 20 62 79  ..    # patch by
2530: 20 42 61 73 74 69 65 6e 20 43 68 65 76 72 65 75   Bastien Chevreu
2540: 78 20 28 62 61 63 68 40 6d 77 67 64 6e 61 2e 63  x ([email protected]
2550: 6f 6d 29 0a 20 20 20 20 23 20 41 73 20 73 65 65  om).    # As see
2560: 6e 20 6f 6e 20 57 69 6e 64 6f 77 73 20 73 79 73  n on Windows sys
2570: 74 65 6d 73 20 2a 73 69 67 68 2a 0a 20 20 20 20  tems *sigh*.    
2580: 23 20 57 68 65 6e 20 74 68 65 20 74 6f 70 6c 65  # When the tople
2590: 76 65 6c 20 69 73 20 77 69 74 68 64 72 61 77 6e  vel is withdrawn
25a0: 2c 20 74 68 65 20 74 6b 77 61 69 74 20 63 6f 6d  , the tkwait com
25b0: 6d 61 6e 64 20 77 69 6c 6c 20 77 61 69 74 20 66  mand will wait f
25c0: 6f 72 65 76 65 72 2e 0a 20 20 20 20 23 20 20 53  orever..    #  S
25d0: 6f 2c 20 63 68 65 63 6b 20 74 68 61 74 20 77 65  o, check that we
25e0: 20 61 72 65 20 6e 6f 74 20 77 69 74 68 64 72 61   are not withdra
25f0: 77 6e 0a 20 20 20 20 69 66 20 7b 21 5b 77 69 6e  wn.    if {![win
2600: 66 6f 20 65 78 69 73 74 73 20 24 70 61 72 65 6e  fo exists $paren
2610: 74 5d 20 7c 7c 20 5c 0a 09 20 20 20 20 28 5b 77  t] || \..    ([w
2620: 6d 20 73 74 61 74 65 20 5b 77 69 6e 66 6f 20 74  m state [winfo t
2630: 6f 70 6c 65 76 65 6c 20 24 70 61 72 65 6e 74 5d  oplevel $parent]
2640: 5d 20 21 3d 20 22 77 69 74 68 64 72 61 77 6e 22  ] != "withdrawn"
2650: 29 7d 20 7b 0a 09 74 6b 77 61 69 74 20 76 69 73  )} {..tkwait vis
2660: 69 62 69 6c 69 74 79 20 24 70 61 74 68 0a 20 20  ibility $path.  
2670: 20 20 7d 0a 20 20 20 20 42 57 69 64 67 65 74 3a    }.    BWidget:
2680: 3a 66 6f 63 75 73 20 73 65 74 20 24 70 61 74 68  :focus set $path
2690: 0a 20 20 20 20 69 66 20 7b 20 5b 77 69 6e 66 6f  .    if { [winfo
26a0: 20 65 78 69 73 74 73 20 24 66 6f 63 75 73 5d 20   exists $focus] 
26b0: 7d 20 7b 0a 20 20 20 20 20 20 20 20 66 6f 63 75  } {.        focu
26c0: 73 20 2d 66 6f 72 63 65 20 24 66 6f 63 75 73 0a  s -force $focus.
26d0: 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20      } else {.   
26e0: 20 20 20 20 20 42 75 74 74 6f 6e 42 6f 78 3a 3a       ButtonBox::
26f0: 73 65 74 66 6f 63 75 73 20 24 70 61 74 68 2e 62  setfocus $path.b
2700: 62 6f 78 20 64 65 66 61 75 6c 74 0a 20 20 20 20  box default.    
2710: 7d 0a 0a 20 20 20 20 69 66 20 7b 20 5b 73 65 74  }..    if { [set
2720: 20 67 72 61 62 20 5b 57 69 64 67 65 74 3a 3a 63   grab [Widget::c
2730: 67 65 74 20 24 70 61 74 68 20 2d 6d 6f 64 61 6c  get $path -modal
2740: 5d 5d 20 21 3d 20 22 6e 6f 6e 65 22 20 7d 20 7b  ]] != "none" } {
2750: 0a 20 20 20 20 20 20 20 20 42 57 69 64 67 65 74  .        BWidget
2760: 3a 3a 67 72 61 62 20 24 67 72 61 62 20 24 70 61  ::grab $grab $pa
2770: 74 68 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b  th.        if {[
2780: 69 6e 66 6f 20 65 78 69 73 74 73 20 5f 77 69 64  info exists _wid
2790: 67 65 74 28 24 70 61 74 68 2c 72 65 73 75 6c 74  get($path,result
27a0: 29 5d 7d 20 7b 20 0a 20 20 20 20 20 20 20 20 20  )]} { .         
27b0: 20 20 20 75 6e 73 65 74 20 5f 77 69 64 67 65 74     unset _widget
27c0: 28 24 70 61 74 68 2c 72 65 73 75 6c 74 29 0a 20  ($path,result). 
27d0: 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 20         }.       
27e0: 20 74 6b 77 61 69 74 20 76 61 72 69 61 62 6c 65   tkwait variable
27f0: 20 44 69 61 6c 6f 67 3a 3a 5f 77 69 64 67 65 74   Dialog::_widget
2800: 28 24 70 61 74 68 2c 72 65 73 75 6c 74 29 0a 20  ($path,result). 
2810: 20 20 20 20 20 20 20 69 66 20 7b 20 5b 69 6e 66         if { [inf
2820: 6f 20 65 78 69 73 74 73 20 5f 77 69 64 67 65 74  o exists _widget
2830: 28 24 70 61 74 68 2c 72 65 73 75 6c 74 29 5d 20  ($path,result)] 
2840: 7d 20 7b 0a 20 20 20 20 20 20 20 20 20 20 20 20  } {.            
2850: 73 65 74 20 72 65 73 20 24 5f 77 69 64 67 65 74  set res $_widget
2860: 28 24 70 61 74 68 2c 72 65 73 75 6c 74 29 0a 20  ($path,result). 
2870: 20 20 20 20 20 20 20 20 20 20 20 75 6e 73 65 74             unset
2880: 20 5f 77 69 64 67 65 74 28 24 70 61 74 68 2c 72   _widget($path,r
2890: 65 73 75 6c 74 29 0a 20 20 20 20 20 20 20 20 7d  esult).        }
28a0: 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 20 20   else {.        
28b0: 20 20 20 20 73 65 74 20 72 65 73 20 2d 31 0a 20      set res -1. 
28c0: 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 20         }.       
28d0: 20 77 69 74 68 64 72 61 77 20 24 70 61 74 68 0a   withdraw $path.
28e0: 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 24          return $
28f0: 72 65 73 0a 20 20 20 20 7d 0a 20 20 20 20 72 65  res.    }.    re
2900: 74 75 72 6e 20 22 22 0a 7d 0a 0a 0a 23 20 2d 2d  turn "".}...# --
2910: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2920: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2930: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2940: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2950: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 20 20 43 6f  ----------.#  Co
2960: 6d 6d 61 6e 64 20 44 69 61 6c 6f 67 3a 3a 77 69  mmand Dialog::wi
2970: 74 68 64 72 61 77 0a 23 20 2d 2d 2d 2d 2d 2d 2d  thdraw.# -------
2980: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2990: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
29a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
29b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
29c0: 2d 2d 2d 2d 2d 0a 70 72 6f 63 20 44 69 61 6c 6f  -----.proc Dialo
29d0: 67 3a 3a 77 69 74 68 64 72 61 77 20 7b 20 70 61  g::withdraw { pa
29e0: 74 68 20 7d 20 7b 0a 20 20 20 20 42 57 69 64 67  th } {.    BWidg
29f0: 65 74 3a 3a 67 72 61 62 20 72 65 6c 65 61 73 65  et::grab release
2a00: 20 24 70 61 74 68 0a 20 20 20 20 42 57 69 64 67   $path.    BWidg
2a10: 65 74 3a 3a 66 6f 63 75 73 20 72 65 6c 65 61 73  et::focus releas
2a20: 65 20 24 70 61 74 68 0a 20 20 20 20 69 66 20 7b  e $path.    if {
2a30: 20 5b 77 69 6e 66 6f 20 65 78 69 73 74 73 20 24   [winfo exists $
2a40: 70 61 74 68 5d 20 7d 20 7b 0a 20 20 20 20 20 20  path] } {.      
2a50: 20 20 77 6d 20 77 69 74 68 64 72 61 77 20 24 70    wm withdraw $p
2a60: 61 74 68 0a 20 20 20 20 7d 0a 7d 0a 0a 0a 23 20  ath.    }.}...# 
2a70: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2a80: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2a90: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2aa0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2ab0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 20 20  ------------.#  
2ac0: 43 6f 6d 6d 61 6e 64 20 44 69 61 6c 6f 67 3a 3a  Command Dialog::
2ad0: 5f 64 65 73 74 72 6f 79 0a 23 20 2d 2d 2d 2d 2d  _destroy.# -----
2ae0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2af0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2b00: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2b10: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2b20: 2d 2d 2d 2d 2d 2d 2d 0a 70 72 6f 63 20 44 69 61  -------.proc Dia
2b30: 6c 6f 67 3a 3a 5f 64 65 73 74 72 6f 79 20 7b 20  log::_destroy { 
2b40: 70 61 74 68 20 7d 20 7b 0a 20 20 20 20 76 61 72  path } {.    var
2b50: 69 61 62 6c 65 20 5f 77 69 64 67 65 74 0a 0a 20  iable _widget.. 
2b60: 20 20 20 44 69 61 6c 6f 67 3a 3a 65 6e 64 64 69     Dialog::enddi
2b70: 61 6c 6f 67 20 24 70 61 74 68 20 2d 31 0a 0a 20  alog $path -1.. 
2b80: 20 20 20 42 57 69 64 67 65 74 3a 3a 67 72 61 62     BWidget::grab
2b90: 20 20 72 65 6c 65 61 73 65 20 24 70 61 74 68 0a    release $path.
2ba0: 20 20 20 20 42 57 69 64 67 65 74 3a 3a 66 6f 63      BWidget::foc
2bb0: 75 73 20 72 65 6c 65 61 73 65 20 24 70 61 74 68  us release $path
2bc0: 0a 20 20 20 20 69 66 20 7b 5b 69 6e 66 6f 20 65  .    if {[info e
2bd0: 78 69 73 74 73 20 5f 77 69 64 67 65 74 28 24 70  xists _widget($p
2be0: 61 74 68 2c 72 65 73 75 6c 74 29 5d 7d 20 7b 0a  ath,result)]} {.
2bf0: 20 20 20 20 20 20 20 20 75 6e 73 65 74 20 5f 77          unset _w
2c00: 69 64 67 65 74 28 24 70 61 74 68 2c 72 65 73 75  idget($path,resu
2c10: 6c 74 29 0a 20 20 20 20 7d 0a 20 20 20 20 75 6e  lt).    }.    un
2c20: 73 65 74 20 5f 77 69 64 67 65 74 28 24 70 61 74  set _widget($pat
2c30: 68 2c 72 65 61 6c 69 7a 65 64 29 0a 20 20 20 20  h,realized).    
2c40: 75 6e 73 65 74 20 5f 77 69 64 67 65 74 28 24 70  unset _widget($p
2c50: 61 74 68 2c 6e 62 75 74 29 0a 0a 20 20 20 20 57  ath,nbut)..    W
2c60: 69 64 67 65 74 3a 3a 64 65 73 74 72 6f 79 20 24  idget::destroy $
2c70: 70 61 74 68 0a 7d 0a                             path.}.