OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [tags/] [start/] [insight/] [itcl/] [iwidgets3.0.0/] [demos/] [mainwindow] - Blame information for rev 1782

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
#!/bin/sh
2
# ----------------------------------------------------------------------
3
#  DEMO: mainwindow in [incr Widgets]
4
# ----------------------------------------------------------------------
5
#\
6
exec itkwish "$0" ${1+"$@"}
7
package require Iwidgets 3.0
8
 
9
#
10
# Demo script for the Mainwindow class
11
#
12
iwidgets::mainwindow .mw
13
 
14
set imagedir [file join ${iwidgets::library} demos images]
15
 
16
#
17
# Add a File menubutton
18
#
19
.mw menubar add menubutton file -text "File" -underline 0 -padx 8 -pady 2 \
20
    -menu {options -tearoff no
21
           command new -label "New" -underline 0 \
22
               -helpstr "Create a new file"
23
           command open -label "Open ..." -underline 0 \
24
               -helpstr "Open an existing file"
25
           command save -label "Save" -underline 0 \
26
               -helpstr "Save the current file"
27
           command saveas -label "Save As ..." -underline 5 \
28
               -helpstr "Save the file as a differnet name"
29
           command print -label "Print" -underline 0 \
30
               -helpstr "Print the file"
31
           separator sep1
32
           command close -label "Close" -underline 0 \
33
               -helpstr "Close the file"
34
           separator sep2
35
           command exit -label "Exit" -underline 1 \
36
               -helpstr "Exit this application" -command ::exit
37
    }
38
 
39
#
40
# Add the Edit menubutton.
41
#
42
.mw menubar add menubutton edit -text "Edit" -underline 0 -padx 8 -pady 2 \
43
    -menu {options -tearoff no
44
           command cut -label "Cut" -underline 2 \
45
               -helpstr "Cut the selection into the clipboard"
46
           command copy -label "Copy" -underline 0 \
47
               -helpstr "Copy the selection to the clipboard"
48
           command paste -label "Paste" -underline 0 \
49
               -helpstr "Paste the clipboard to the current point"
50
           separator sep3
51
           command find -label "Find" -underline 2 \
52
               -helpstr "Search the text"
53
           separator sep4
54
           command clear -label "Clear" -underline 2 \
55
               -helpstr "Clear the selection"
56
    }
57
 
58
#
59
# Add the Help menubutton.
60
#
61
.mw menubar add menubutton help -text "Help" -underline 0 -padx 8 -pady 2 \
62
    -menu {options -tearoff no
63
           command onwindow -label "On Window" -underline 3 \
64
               -helpstr "Obtain help on the window"
65
           command onkeys -label "On Keys" -underline 3 \
66
               -helpstr "Obtain help on the keys"
67
           command index -label "Index" -underline 0 \
68
               -helpstr "View the help index"
69
           command onhelp -label "On Help" -underline 2 \
70
               -helpstr "Obtain help on help"
71
           command onversion -label "On Version" -underline 2 \
72
               -helpstr "View the version information"
73
    }
74
 
75
#
76
# Add items to the toolbar.
77
#
78
.mw toolbar add frame filler1 -width 108 -relief raised -borderwidth 2
79
 
80
.mw toolbar add button new \
81
    -image [image create photo new-img -file [file join $imagedir new.gif]] \
82
    -helpstr "Create a new file" \
83
    -balloonstr "New"
84
 
85
.mw toolbar add button open \
86
    -image [image create photo open-img -file [file join $imagedir open.gif]] \
87
    -helpstr "Open an existing file" \
88
    -balloonstr "Open"
89
 
90
.mw toolbar add button close \
91
    -image [image create photo close-img -file [file join $imagedir close.gif]] \
92
    -helpstr "Close the file" \
93
    -balloonstr "Close"
94
 
95
.mw toolbar add frame filler2 -width 20 -relief raised -borderwidth 2
96
 
97
.mw toolbar add button cut \
98
    -image [image create photo cut-img -file [file join $imagedir cut.gif]] \
99
    -helpstr "Cut the selection into the cut buffer" \
100
    -balloonstr "Cut"
101
 
102
.mw toolbar add button copy \
103
    -image [image create photo copy-img -file [file join $imagedir copy.gif]] \
104
    -helpstr "Copy the selection to the cut buffer" \
105
    -balloonstr "Copy"
106
 
107
.mw toolbar add button paste \
108
    -image [image create photo paste-img -file [file join $imagedir paste.gif]] \
109
    -helpstr "Paste the cut buffer to the current point" \
110
    -balloonstr "Paste"
111
 
112
.mw toolbar add button clear \
113
    -image [image create photo clear-img -file [file join $imagedir clear.gif]] \
114
    -helpstr "Clear the selection" \
115
    -balloonstr "Clear"
116
 
117
.mw toolbar add frame filler3 -relief raised -borderwidth 2
118
 
119
#
120
# Add items to the menubar.
121
#
122
.mw mousebar add button save \
123
    -image [image create photo save-img -file [file join $imagedir save.gif]] \
124
    -helpstr "Save the current file"
125
 
126
.mw mousebar add button print \
127
    -image [image create photo print-img -file [file join $imagedir print.gif]] \
128
    -helpstr "Print the file"
129
 
130
.mw mousebar add button find \
131
    -image [image create photo find-img -file [file join $imagedir find.gif]] \
132
    -helpstr "Search the text"
133
 
134
.mw mousebar add frame filler1 -height 20 -relief raised -borderwidth 2
135
 
136
.mw mousebar add button help \
137
    -image [image create photo help-img -file [file join $imagedir help.gif]] \
138
    -helpstr "Obtain help for this window"
139
 
140
.mw mousebar add frame filler2 -relief raised -borderwidth 2
141
 
142
.mw mousebar add button exit \
143
    -image [image create photo exit-img -file [file join $imagedir exit.gif]] \
144
    -helpstr "Exit this application" -command ::exit
145
 
146
.mw mousebar add frame filler3 -height 5
147
 
148
#
149
# Change the packing of the last fillers in the tool and mouse bar
150
# so that it expands across and down the rest of the mainwindow.
151
#
152
pack [.mw toolbar component filler3] -expand yes -fill both
153
pack [.mw mousebar component filler2] -expand yes -fill both
154
 
155
 
156
#
157
# Install a scrolledtext widget in the childsite.
158
#
159
iwidgets::scrolledtext [.mw childsite].st -visibleitems 40x8
160
pack [.mw childsite].st -fill both -expand yes
161
 
162
#
163
# Activate the main window.
164
#
165
.mw activate

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.