summaryrefslogtreecommitdiff
path: root/tix/demos/MkManag.tcl
blob: 045aacbdebc322c580f5046bbd56093ba67d4912 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# MkManag.tcl --
#
#	This file implements the "Manager" page in the widget demo
#
#	This file has not been properly documented. It is NOT intended
#	to be used as an introductory demo program about Tix
#	programming. For such demos, please see the files in the
#	demos/samples directory or go to the "Samples" page in the
#	"widget demo"
#
#
# Copyright (c) 1996, Expert Interface Technologies
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#

proc MkManager {nb page} {
    set w [$nb subwidget $page]

    set name [tixOptionName $w]
    option add *$name*TixLabelFrame*label.padX 4

    tixLabelFrame $w.pane -label "tixPanedWindow"
    tixLabelFrame $w.note -label "tixNoteBook"

    MkPanedWindow [$w.pane subwidget frame]
    MkNoteBook    [$w.note subwidget frame]

    tixForm $w.pane -top 0 -left 0   -right $w.note -bottom -1
    tixForm $w.note -top 0  -right -1 -bottom -1
}

proc MkPanedWindow {w} {
    set name [tixOptionName $w]

    message $w.msg -font -*-helvetica-bold-r-normal-*-14-*-*-*-*-*-*-*\
	-relief flat -width 240 -anchor n\
	-text {The PanedWindow widget allows the user to interactively\
manipulate the\
sizes of several panes. The panes can be arranged either vertically or\
horizontally.}

    label $w.group -text "Newsgroup: comp.lang.tcl"

    tixPanedWindow $w.pane

    set p1 [$w.pane add list -min 70 -size 100]
    set p2 [$w.pane add text -min 70]

    tixScrolledListBox $p1.list
    $p1.list subwidget listbox config -font [tix option get fixed_font]

    tixScrolledText    $p2.text
    $p2.text subwidget text    config -font [tix option get fixed_font]

    $p1.list subwidget listbox insert end \
	"  12324 Re: TK is good for your health" \
	"+ 12325 Re: TK is good for your health" \
	"+ 12326 Re: Tix is even better for your health (Was: TK is good...)" \
	"  12327 Re: Tix is even better for your health (Was: TK is good...)" \
	"+ 12328 Re: Tix is even better for your health (Was: TK is good...)" \
	"  12329 Re: Tix is even better for your health (Was: TK is good...)" \
	"+ 12330 Re: Tix is even better for your health (Was: TK is good...)"

    $p2.text subwidget text config -wrap none -bg \
	[$p1.list subwidget listbox cget -bg]
    $p2.text subwidget text insert end {
Mon, 19 Jun 1995 11:39:52        comp.lang.tcl              Thread   34 of  220
Lines 353       A new way to put text and bitmaps together iNo responses
ioi@xpi.com                  Ioi K. Lam at Expert Interface Technologies

Hi,

I have implemented a new image type called "compound". It allows you
to glue together a bunch of bitmaps, images and text strings together
to form a bigger image. Then you can use this image with widgets that
support the -image option. This way you can display very fancy stuffs
in your GUI. For example, you can display a text string string
together with a bitmap, at the same time, inside a TK button widget. A
screenshot of compound images can be found at the bottom of this page:

        http://www.xpi.com/tix/screenshot.html

You can also you is in other places such as putting fancy bitmap+text
in menus, tabs of tixNoteBook widgets, etc. This feature will be
included in the next release of Tix (4.0b1). Count on it to make jazzy
interfaces!}

    pack $p1.list -expand yes -fill both -padx 4 -pady 6
    pack $p2.text -expand yes -fill both -padx 4 -pady 6

    pack $w.msg   -side top -padx 3 -pady 3 -fill both
    pack $w.group -side top -padx 3 -pady 3 -fill both
    pack $w.pane  -side top -padx 3 -pady 3 -expand yes -fill both
}

proc MkNoteBook  {w} {

    message $w.msg -font -*-helvetica-bold-r-normal-*-14-*-*-*-*-*-*-*\
	-relief flat -width 240 -anchor n\
	-text {The NoteBook widget allows you to lay out a complex\
interface into individual pages.}

    # We use these options to set the sizes of the subwidgets inside the
    # notebook, so that they are well-aligned on the screen.
    #
    set name [tixOptionName $w]
    option add *$name*TixControl*entry.width 10
    option add *$name*TixControl*label.width 18
    option add *$name*TixControl*label.anchor e
    option add *$name*TixNoteBook*tagPadX 8


    tixNoteBook $w.nb -ipadx 6 -ipady 6

    # Create the two tabs on the notebook. The -underline option
    # puts a underline on the first character of the labels of the tabs.
    # Keyboard accelerators will be defined automatically according
    # to the underlined character.	
    #
    $w.nb add hard_disk -label "Hard Disk" -underline 8
    $w.nb add network   -label "Network"   -underline 0
   
    # Create the first page
    #
    set f [$w.nb subwidget hard_disk]

    # the frame for the buttons that are present in all the pages
    #
    frame $f.common
    pack $f.common -side right -padx 2 -pady 2 -fill y
    CreateCommonButtons $w $f.common


    # Create the controls that only belong to this page
    #
    tixControl $f.a -value 12   -label "Access Time: "
    tixControl $f.w -value 400  -label "Write Throughput: "
    tixControl $f.r -value 400  -label "Read Throughput: "
    tixControl $f.c -value 1021 -label "Capacity: "
    pack $f.a $f.w $f.r $f.c  -side top -padx 20 -pady 2
    
    # Create the second page	
    #
    set f [$w.nb subwidget network]

    # the frame for the buttons that are present in all the pages
    #
    frame $f.common
    pack $f.common -side right -padx 2 -pady 2 -fill y

    tixControl $f.a -value 12   -label "Access Time: "
    tixControl $f.w -value 400  -label "Write Throughput: "
    tixControl $f.r -value 400  -label "Read Throughput: "
    tixControl $f.c -value 1021 -label "Capacity: "
    tixControl $f.u -value 10   -label "Users: "
    
    CreateCommonButtons $w $f.common

    pack $f.a $f.w $f.r $f.c $f.u -side top -padx 20 -pady 2
    pack $w.msg  -side top -padx 3 -pady 3 -fill both
    pack $w.nb   -expand yes -fill both -padx 5 -pady 5 -side top
 }

proc CreateCommonButtons {w f} {
    button $f.ok     -text OK     -width 6
    button $f.cancel -text Cancel -width 6

    pack $f.ok $f.cancel -side top -padx 2 -pady 2
}