# Numbers Script

global telephone_number
set w .phonebook
catch {destroy $w}
toplevel $w
wm title $w "Phone Book - G53UID Phone Interface Demo"
wm iconname $w "Phone MessageBox"

frame $w.fnum0
frame $w.fnum0.maintitles
frame $w.fnum0.selections 
frame $w.fnum0.selections.em 
frame $w.fnum0.selections.grp
frame $w.fnum0.selections.con
frame $w.fnum0.systembuttons

pack $w.fnum0
pack $w.fnum0.maintitles -side top
pack $w.fnum0.selections -side top
pack $w.fnum0.selections.em $w.fnum0.selections.grp $w.fnum0.selections.con -side left
pack $w.fnum0.systembuttons -side bottom -fill x

label $w.fnum0.main_label -text ""
label $w.fnum0.maintitles.em_label -text "Emergency Numbers" -width 25
label $w.fnum0.maintitles.grp_label -text "Groups" -width 25
label $w.fnum0.maintitles.con_label -text "Group Contents" -width 25

button $w.fnum0.systembuttons.newGroup -text "New Group" -command "notimpl_proc $w"
button $w.fnum0.systembuttons.newNumber -text "New Number" -command "notimpl_proc $w"
button $w.fnum0.systembuttons.remove -text "Remove" -command "notimpl_proc $w"
button $w.fnum0.systembuttons.change -text "Change" -command "notimpl_proc $w"
button $w.fnum0.systembuttons.closebook -text "Close" -command "destroy $w"
button $w.fnum0.systembuttons.dial -text "DIAL" -command "notimpl_proc $w"

pack $w.fnum0.systembuttons.change $w.fnum0.systembuttons.remove $w.fnum0.systembuttons.newNumber $w.fnum0.systembuttons.newGroup -side left
pack $w.fnum0.systembuttons.dial $w.fnum0.systembuttons.closebook -side right
pack $w.fnum0.main_label -fill x -side left
pack $w.fnum0.maintitles.em_label $w.fnum0.maintitles.grp_label $w.fnum0.maintitles.con_label -side left

# Emergency Numbers ---------------------
scrollbar $w.fnum0.selections.em.em_scroll -command "$w.fnum0.selections.em.em_listbox yview"
listbox $w.fnum0.selections.em.em_listbox -yscroll "$w.fnum0.selections.em.em_scroll set" -setgrid 1 -height 8 -background "gold1"

pack $w.fnum0.selections.em.em_scroll -side right -fill y
pack $w.fnum0.selections.em.em_listbox -side left -expand 1 

#would be read in from user file
$w.fnum0.selections.em.em_listbox insert 0 \
	"Doctor" \
	"Dentist" \
	" " \
	"Police" \
	"Ambulance" \
	"Fire Brigade" 

# Groups -------------------------------------
scrollbar $w.fnum0.selections.grp.grp_scroll -command "$w.fnum0.selections.grp.grp_listbox yview"
listbox $w.fnum0.selections.grp.grp_listbox -yscroll "$w.fnum0.selections.grp.grp_scroll set" -setgrid 1 -height 8 -background "SkyBlue3"

pack $w.fnum0.selections.grp.grp_scroll -side right -fill y
pack $w.fnum0.selections.grp.grp_listbox -side left -expand 1 -fill both

#would be read in from user file
$w.fnum0.selections.grp.grp_listbox insert 0 \
	"Friends" "Relatives" "Business" "Entertainment" "Services" "Charities" 


# Group Contents numbers -----------------------
scrollbar $w.fnum0.selections.con.con_scroll -command "$w.fnum0.selections.con.con_listbox yview"
listbox $w.fnum0.selections.con.con_listbox -yscroll "$w.fnum0.selections.con.con_scroll set" -setgrid 1 -height 8 -background "SkyBlue3" 
bind $w.fnum0.selections.con.con_listbox selectMode multiple

pack $w.fnum0.selections.con.con_scroll -side right -fill y
pack $w.fnum0.selections.con.con_listbox -side left -expand 1 -fill both

#would be read in from user file
$w.fnum0.selections.con.con_listbox insert 0 \
	"Andrew Davis" "Anne Price" "Chris Davis" "Richard Pearce" "Tim Hinks" "Lyndon Hearn" "John Whiting" "Roger Wood" "Vic Reeves" "Alan Partridge" "Auntie Hilder"



#tk_messageBox -icon info -message "Favorite and emergency numbers\n\nNot implemented" -type ok -title "G5BUID Phone Interface - Message box"

proc notimpl_proc {w} {
	tk_messageBox -icon warning -message "Feature not implemented" \
	 -type ok -title "G5BUID Phone Interface - Message box" -parent $w
}


bind $w.fnum0.selections.con.con_listbox 