#!/usr/local/wish -f
#
# modified by k.furukawa, apr.1993. for 16bit kanji font
#
# This script demonstrates the various widgets provided by Tk,
# along with many of the features of the Tk toolkit.  This file
# only contains code to generate the main window for the
# application, which invokes individual demonstrations.  The
# code for the actual demonstrations is contained in separate
# ".tcl" files is this directory, which are auto-loaded by Tcl
# when they are needed.  To find the code for a particular
# demo, look below for the procedure that's invoked by its menu
# entry, then grep for the file that contains the procedure
# definition.

#set auto_path "$tk_library/demos $auto_path"
set auto_path ". $tk_library/jdemos $tk_library/demos $auto_path"
wm title . "Widget Demonstration"

option add *Menubutton.font k14
option add *Menu.font k14
set normalfont "-Adobe-Helvetica-Bold-R-Normal--*-120-*"

#-------------------------------------------------------
# The code below create the main window, consisting of a
# menu bar and a message explaining the basic operation
# of the program.
#-------------------------------------------------------

frame .menu -relief raised -borderwidth 1
message .msg -font k14 -relief raised -width 500 \
-borderwidth 1 -text "Υץꥱץϣԣġ륭åȤ󶡤ף򸫤ƤޤΥ˥塼ϣףΥפȤ˹Ƥơ줾Υ˥塼ˤб륿פΣףΥǥ󥹥ȥ졼󤬤ĤޤޤƤޤǥ󥹥ȥ졼ưˤϥޥΥܥ󣱤򲡤ƾΥ˥塼ܥΰĤɥå˥塼ιߤιܤӡޥΥܥΥޤΤĤ˥塼ܸΥǥ󥹥ȥ졼󤬵ưޤ

Υץλ뤿ˤϡƤ¾ǤΥ˥塼ƽλǤ򤷤ޤ"

pack append . .menu {top fillx} .msg {bottom expand fill}

#-------------------------------------------------------
# The code below creates all the menus, which invoke procedures
# to create particular demonstrations of various widgets.
#-------------------------------------------------------

menubutton .menu.button -text "٥롿ܥ" -menu .menu.button.m
menu .menu.button.m
.menu.button.m add command -label "٥" -command "mkLabel"
.menu.button.m add command -label "ܥ" -command "mkButton"
.menu.button.m add command -label "åܥ" -command "mkCheck" \
	-underline 0
.menu.button.m add command -label "饸ܥ" -command "mkRadio"
.menu.button.m add command -label "ѥ" -command "mkPuzzle"
.menu.button.m add command -label "ܥ" -command "mkIcon"

menubutton .menu.listbox -text "ꥹȥܥå" -menu .menu.listbox.m
menu .menu.listbox.m
.menu.listbox.m add command -label "ܤθ̾" -command mkListbox -underline 0
.menu.listbox.m add command -label "" -command mkListbox2
.menu.listbox.m add command -label "" -command mkListbox3

menubutton .menu.entry -text "ȥ" -menu .menu.entry.m
menu .menu.entry.m
.menu.entry.m add command -label "Сʤ" -command mkEntry
.menu.entry.m add command -label "С" -command mkEntry2 \
    -underline 0
.menu.entry.m add command -label "ñʥե" -command mkForm

menubutton .menu.text -text "ƥ" -menu .menu.text.m
menu .menu.text.m
.menu.text.m add command -label "ܥƥ" -command mkBasic \
    -underline 0
.menu.text.m add command -label "ɽ" -command mkStyles \
    -underline 0
.menu.text.m add command -label "ޥɥХǥ" -command mkTextBind
.menu.text.m add command -label "" -command mkTextSearch

menubutton .menu.scroll -text "С" -menu .menu.scroll.m
menu .menu.scroll.m
.menu.scroll.m add command -label "ľ" -command mkListbox2
.menu.scroll.m add command -label "ʿ" -command mkEntry2 -underline 0

menubutton .menu.scale -text "" -menu .menu.scale.m
menu .menu.scale.m
.menu.scale.m add command -label "ľ" -command mkVScale
.menu.scale.m add command -label "ʿ" -command mkHScale

menubutton .menu.canvas -text "Х" -menu .menu.canvas.m
menu .menu.canvas.m
.menu.canvas.m add command -label "" -command mkItems -underline 0
.menu.canvas.m add command -label "ץå" -command mkPlot
.menu.canvas.m add command -label "ƥ" -command mkCanvText -underline 0
.menu.canvas.m add command -label "η" -command mkArrow
.menu.canvas.m add command -label "롼" -command mkRuler
.menu.canvas.m add command -label "뤹륭Х" -command mkScroll
.menu.canvas.m add command -label "ۥǥ" -command mkFloor

menubutton .menu.menu -text "˥塼" -menu .menu.menu.m
menu .menu.menu.m
.menu.menu.m add command -label "ˤϤȽϤ" -command {puts stdout "ˤ"} \
    -accelerator Control+a -underline 0
bind .msg <Control-a> {puts stdout "ˤ"}
.menu.menu.m add command -label "褦ʤȽϤ" -command {\
    puts stdout "褦ʤ"} -accelerator Control+b -underline 0
bind .msg <Control-b> {puts stdout "褦ʤ"}
.menu.menu.m add command -label "طʿ" \
    -command {.msg config -bg "LightBlue1"}
.menu.menu.m add command -label "ƥե˥塼ˤĤ" -command mkTear
.menu.menu.m add cascade -label "åܥ" -menu .menu.menu.m.check \
    -underline 0
.menu.menu.m add cascade -label "饸ܥ" -menu .menu.menu.m.radio \
    -underline 0
.menu.menu.m add command -bitmap @$tk_library/demos/bitmaps/pattern \
    -command {
	mkDialog .pattern {-text {The menu entry you invoked displays a bitmap rather than a text string.  Other than this, it is just like any other menu entry.} -aspect 250} {OK {}}
    }

menu .menu.menu.m.check
.menu.menu.m.check add check -label "ǳǧ" -variable oil
.menu.menu.m.check add check -label "®ǧ" -variable trans
.menu.menu.m.check add check -label "֥졼ǧ" -variable brakes
.menu.menu.m.check add check -label "ǧ" -variable lights
.menu.menu.m.check add separator
.menu.menu.m.check add command -label "ɽ" \
    -command "showVars .menu.menu.dialog oil trans brakes lights"
.menu.menu.m.check invoke 1
.menu.menu.m.check invoke 3

menu .menu.menu.m.radio
.menu.menu.m.radio add radio -label "10 point" -variable pointSize -value 10 -font $normalfont
.menu.menu.m.radio add radio -label "14 point" -variable pointSize -value 14 -font $normalfont
.menu.menu.m.radio add radio -label "18 point" -variable pointSize -value 18 -font $normalfont
.menu.menu.m.radio add radio -label "24 point" -variable pointSize -value 24 -font $normalfont
.menu.menu.m.radio add radio -label "32 point" -variable pointSize -value 32 -font $normalfont
.menu.menu.m.radio add sep
.menu.menu.m.radio add radio -label "Roman" -variable style -value roman -font $normalfont
.menu.menu.m.radio add radio -label "Bold" -variable style -value bold -font $normalfont
.menu.menu.m.radio add radio -label "Italic" -variable style -value italic -font $normalfont
.menu.menu.m.radio add sep
.menu.menu.m.radio add command -label "Show current values" -command \
    "showVars .menu.menu.dialog pointSize style" -font $normalfont
.menu.menu.m.radio invoke 1
.menu.menu.m.radio invoke 7

menubutton .menu.misc -text "¾" -menu .menu.misc.m
menu .menu.misc.m
.menu.misc.m add command -label "ɽ⡼" -command {
    mkDialog .modal {-text {This dialog box is a modal one.  It uses Tk's "grab" command to create a "local grab" on the dialog box.  The grab prevents any pointer-related events from getting to any other windows in the application.  If you press the "OK" button below (or hit the Return key) then the dialog box will go away and things will return to normal.} -aspect 250 -justify left} {OK {}}
    dpos .modal
    tkwait visibility .modal
    grab .modal
    tkwait window .modal
}
.menu.misc.m add command -label "⡼" -command {
    mkDialog .modal {-text {This is another modal dialog box.  However, in this case a "global grab" is used, which locks up the display so you can't talk to any windows in any applications anywhere, except for the dialog.  If you press the "OK" button below (or hit the Return key) then the dialog box will go away and things will return to normal.} -aspect 250 -justify left} {OK {}}
    dpos .modal
    tkwait visibility .modal
    grab -global .modal
    tkwait window .modal
}
.menu.misc.m add command -label "λ" -command "destroy ."

pack append .menu .menu.button left .menu.listbox left \
    .menu.entry left .menu.text left .menu.scroll left .menu.scale left \
    .menu.canvas left .menu.menu left .menu.misc left

# Set up for keyboard-based menu traversal

tk_bindForTraversal .msg
bind . <Any-Enter> {focus .msg}
tk_menuBar .menu .menu.button .menu.listbox .menu.entry .menu.text \
	.menu.scroll .menu.scale .menu.canvas .menu.menu .menu.misc

# Position a dialog box at a reasonable place on the screen.

proc dpos w {
    wm geometry $w +300+300
}
