File: menubar

package info (click to toggle)
itcl3.0 3.0.1-3
  • links: PTS
  • area: main
  • in suites: potato
  • size: 10,124 kB
  • ctags: 3,519
  • sloc: tcl: 32,416; ansic: 12,683; sh: 3,911; makefile: 693; awk: 273; perl: 265
file content (79 lines) | stat: -rw-r--r-- 2,541 bytes parent folder | download | duplicates (14)
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
#!/bin/sh
# ----------------------------------------------------------------------
#  DEMO: menubar in [incr Widgets]
# ----------------------------------------------------------------------
#\
exec itkwish -f "$0" ${1+"$@"}
package require -exact Iwidgets 2.2

iwidgets::menubar .mb -helpvariable helpVar -menubuttons {
    menubutton file -text "File" -menu {
        options -tearoff false

        command new -label "New" \
                -helpstr "Open new document" \
                -command {puts "selected: New"}

        command close -label "Close" \
                -helpstr "Close current document" \
                -command {puts "selected: Close"}

        separator sep1

        command exit -label "Exit" -command {exit} \
                -helpstr "Exit application"
    }

    menubutton edit -text "Edit" -menu {
        options -tearoff false

        command undo -label "Undo" -underline 0 \
                -helpstr "Undo last command" \
                -command {puts "selected: Undo"}

        separator sep2

        command cut -label "Cut" -underline 1 \
                -helpstr "Cut selection to clipboard" \
                -command {puts CUT}

        command copy -label "Copy" -underline 1 \
                -helpstr "Copy selection to clipboard" \
                -command {puts "selected: Copy"}

        command paste -label "Paste" -underline 0 \
                -helpstr "Paste clipboard contents into document" \
                -command {puts "selected: Paste"}
    }

    menubutton options -text "Options" -menu {
        options -tearoff false -selectcolor blue

        radiobutton byName -variable viewMode \
                -value NAME -label "by Name" \
                -helpstr "View files by name order" \
                -command {puts "selected: by Name"}

        radiobutton byDate -variable viewMode \
                -value DATE -label "by Date" \
                -helpstr "View files by date order" \
                -command {puts "selected: by Date"}

        cascade prefs -label "Preferences" -menu {
            command colors -label Colors... \
                -helpstr "Change text colors" \
                -command {puts "selected: Colors..."}

            command fonts -label "Fonts..." \
                -helpstr "Change text font" \
                -command {puts "selected: Fonts..."}
        }
    }
}
pack .mb -fill x

frame .fr -width 200 -height 200 -background white
pack .fr -fill both

label .help -anchor w -textvariable helpVar -width 40
pack .help -fill x