gooderp18绿色标准版
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

183 lines
5.8KB

  1. # -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
  2. #
  3. # $Id: CmpImg1.tcl,v 1.3 2001/12/09 05:31:07 idiscovery Exp $
  4. #
  5. # Tix Demostration Program
  6. #
  7. # This sample program is structured in such a way so that it can be
  8. # executed from the Tix demo program "widget": it must have a
  9. # procedure called "RunSample". It should also have the "if" statment
  10. # at the end of this file so that it can be run as a standalone
  11. # program using tixwish.
  12. # This file demonstrates the use of the tixNoteBook widget, which allows
  13. # you to lay out your interface using a "notebook" metaphore
  14. #
  15. proc RunSample {w} {
  16. # We use these options to set the sizes of the subwidgets inside the
  17. # notebook, so that they are well-aligned on the screen.
  18. #
  19. set name [tixOptionName $w]
  20. option add *$name*TixControl*entry.width 10
  21. option add *$name*TixControl*label.width 18
  22. option add *$name*TixControl*label.anchor e
  23. option add *$name*TixNoteBook*tabPadX 8
  24. # Create the notebook widget and set its backpagecolor to gray.
  25. # Note that the -backpagecolor option belongs to the "nbframe"
  26. # subwidget.
  27. tixNoteBook $w.nb -ipadx 6 -ipady 6
  28. $w config -bg gray
  29. $w.nb subwidget nbframe config -backpagecolor gray -tabpady 0
  30. # Create the two tabs on the notebook. The -underline option
  31. # puts a underline on the first character of the labels of the tabs.
  32. # Keyboard accelerators will be defined automatically according
  33. # to the underlined character.
  34. #
  35. global network_pixmap hard_disk_pixmap
  36. set img0 [image create pixmap -data $network_pixmap]
  37. set img1 [image create pixmap -data $hard_disk_pixmap]
  38. set hd_img [image create compound -window [$w.nb subwidget nbframe]]
  39. $hd_img add line
  40. $hd_img add text -text "Hard Disk" -underline 0
  41. $hd_img add space -width 7
  42. $hd_img add image -image $img1
  43. $w.nb add hard_disk -image $hd_img
  44. set net_img [image create compound -window [$w.nb subwidget nbframe]]
  45. $net_img add line
  46. $net_img add text -text "Network" -underline 0
  47. $net_img add space -width 7
  48. $net_img add image -image $img0
  49. $w.nb add network -image $net_img
  50. # Create the first page
  51. #
  52. set f [$w.nb subwidget hard_disk]
  53. tixControl $f.a -value 12 -label "Access Time: "
  54. tixControl $f.w -value 400 -label "Write Throughput: "
  55. tixControl $f.r -value 400 -label "Read Throughput: "
  56. tixControl $f.c -value 1021 -label "Capacity: "
  57. pack $f.a $f.w $f.r $f.c -side top -padx 20 -pady 2
  58. # Create the second page
  59. #
  60. set f [$w.nb subwidget network]
  61. tixControl $f.a -value 12 -label "Access Time: "
  62. tixControl $f.w -value 400 -label "Write Throughput: "
  63. tixControl $f.r -value 400 -label "Read Throughput: "
  64. tixControl $f.c -value 1021 -label "Capacity: "
  65. tixControl $f.u -value 10 -label "Users: "
  66. pack $f.a $f.w $f.r $f.c $f.u -side top -padx 20 -pady 2
  67. pack $w.nb -expand yes -fill both -padx 5 -pady 5
  68. }
  69. set network_pixmap {/* XPM */
  70. static char * netw_xpm[] = {
  71. /* width height ncolors chars_per_pixel */
  72. "32 32 7 1",
  73. /* colors */
  74. " s None c None",
  75. ". c #000000000000",
  76. "X c white",
  77. "o c #c000c000c000",
  78. "O c #404040",
  79. "+ c blue",
  80. "@ c red",
  81. /* pixels */
  82. " ",
  83. " .............. ",
  84. " .XXXXXXXXXXXX. ",
  85. " .XooooooooooO. ",
  86. " .Xo.......XoO. ",
  87. " .Xo.++++o+XoO. ",
  88. " .Xo.++++o+XoO. ",
  89. " .Xo.++oo++XoO. ",
  90. " .Xo.++++++XoO. ",
  91. " .Xo.+o++++XoO. ",
  92. " .Xo.++++++XoO. ",
  93. " .Xo.XXXXXXXoO. ",
  94. " .XooooooooooO. ",
  95. " .Xo@ooo....oO. ",
  96. " .............. .XooooooooooO. ",
  97. " .XXXXXXXXXXXX. .XooooooooooO. ",
  98. " .XooooooooooO. .OOOOOOOOOOOO. ",
  99. " .Xo.......XoO. .............. ",
  100. " .Xo.++++o+XoO. @ ",
  101. " .Xo.++++o+XoO. @ ",
  102. " .Xo.++oo++XoO. @ ",
  103. " .Xo.++++++XoO. @ ",
  104. " .Xo.+o++++XoO. @ ",
  105. " .Xo.++++++XoO. ..... ",
  106. " .Xo.XXXXXXXoO. .XXX. ",
  107. " .XooooooooooO.@@@@@@.X O. ",
  108. " .Xo@ooo....oO. .OOO. ",
  109. " .XooooooooooO. ..... ",
  110. " .XooooooooooO. ",
  111. " .OOOOOOOOOOOO. ",
  112. " .............. ",
  113. " "};}
  114. set hard_disk_pixmap {/* XPM */
  115. static char * drivea_xpm[] = {
  116. /* width height ncolors chars_per_pixel */
  117. "32 32 5 1",
  118. /* colors */
  119. " s None c None",
  120. ". c #000000000000",
  121. "X c white",
  122. "o c #c000c000c000",
  123. "O c #800080008000",
  124. /* pixels */
  125. " ",
  126. " ",
  127. " ",
  128. " ",
  129. " ",
  130. " ",
  131. " ",
  132. " ",
  133. " ",
  134. " .......................... ",
  135. " .XXXXXXXXXXXXXXXXXXXXXXXo. ",
  136. " .XooooooooooooooooooooooO. ",
  137. " .Xooooooooooooooooo..oooO. ",
  138. " .Xooooooooooooooooo..oooO. ",
  139. " .XooooooooooooooooooooooO. ",
  140. " .Xoooooooo.......oooooooO. ",
  141. " .Xoo...................oO. ",
  142. " .Xoooooooo.......oooooooO. ",
  143. " .XooooooooooooooooooooooO. ",
  144. " .XooooooooooooooooooooooO. ",
  145. " .XooooooooooooooooooooooO. ",
  146. " .XooooooooooooooooooooooO. ",
  147. " .oOOOOOOOOOOOOOOOOOOOOOOO. ",
  148. " .......................... ",
  149. " ",
  150. " ",
  151. " ",
  152. " ",
  153. " ",
  154. " ",
  155. " ",
  156. " "};}
  157. if {![info exists tix_demo_running]} {
  158. wm withdraw .
  159. set w .demo
  160. toplevel $w; wm transient $w ""
  161. RunSample $w
  162. bind $w <Destroy> exit
  163. }
上海开阖软件有限公司 沪ICP备12045867号-1