STList.tcl 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. # -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
  2. #
  3. # $Id: STList.tcl,v 1.4 2001/12/09 05:04:02 idiscovery Exp $
  4. #
  5. # STList.tcl --
  6. #
  7. # This file implements Scrolled TList widgets
  8. #
  9. # Copyright (c) 1993-1999 Ioi Kim Lam.
  10. # Copyright (c) 2000-2001 Tix Project Group.
  11. #
  12. # See the file "license.terms" for information on usage and redistribution
  13. # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  14. #
  15. tixWidgetClass tixScrolledTList {
  16. -classname TixScrolledTList
  17. -superclass tixScrolledWidget
  18. -method {
  19. }
  20. -flag {
  21. }
  22. -configspec {
  23. }
  24. -default {
  25. {.scrollbar auto}
  26. {*borderWidth 1}
  27. {*tlist.background #c3c3c3}
  28. {*tlist.highlightBackground #d9d9d9}
  29. {*tlist.relief sunken}
  30. {*tlist.takeFocus 1}
  31. {*Scrollbar.takeFocus 0}
  32. }
  33. }
  34. proc tixScrolledTList:ConstructWidget {w} {
  35. upvar #0 $w data
  36. tixChainMethod $w ConstructWidget
  37. set data(w:tlist) \
  38. [tixTList $w.tlist]
  39. set data(w:hsb) \
  40. [scrollbar $w.hsb -orient horizontal]
  41. set data(w:vsb) \
  42. [scrollbar $w.vsb -orient vertical ]
  43. set data(pw:client) $data(w:tlist)
  44. }
  45. proc tixScrolledTList:SetBindings {w} {
  46. upvar #0 $w data
  47. tixChainMethod $w SetBindings
  48. $data(w:tlist) config \
  49. -xscrollcommand "$data(w:hsb) set"\
  50. -yscrollcommand "$data(w:vsb) set"\
  51. -sizecmd [list tixScrolledWidget:Configure $w]
  52. $data(w:hsb) config -command "$data(w:tlist) xview"
  53. $data(w:vsb) config -command "$data(w:tlist) yview"
  54. }
  55. #----------------------------------------------------------------------
  56. #
  57. # option configs
  58. #----------------------------------------------------------------------
  59. proc tixScrolledTList:config-takefocus {w value} {
  60. upvar #0 $w data
  61. $data(w:tlist) config -takefocus $value
  62. }
  63. #----------------------------------------------------------------------
  64. #
  65. # Widget commands
  66. #----------------------------------------------------------------------
  67. #----------------------------------------------------------------------
  68. #
  69. # Private Methods
  70. #----------------------------------------------------------------------
  71. #----------------------------------------------------------------------
  72. # virtual functions to query the client window's scroll requirement
  73. #----------------------------------------------------------------------
  74. proc tixScrolledTList:GeometryInfo {w mW mH} {
  75. upvar #0 $w data
  76. return [$data(w:tlist) geometryinfo $mW $mH]
  77. }