| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | |
| | |
| | namespace eval ::tk::dialog {} |
| |
|
| | image create bitmap ::tk::dialog::b1 -foreground black \ |
| | -data "#define b1_width 32\n#define b1_height 32 |
| | static unsigned char q1_bits[] = { |
| | 0x00, 0xf8, 0x1f, 0x00, 0x00, 0x07, 0xe0, 0x00, 0xc0, 0x00, 0x00, 0x03, |
| | 0x20, 0x00, 0x00, 0x04, 0x10, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x10, |
| | 0x04, 0x00, 0x00, 0x20, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, |
| | 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, |
| | 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, |
| | 0x01, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, |
| | 0x04, 0x00, 0x00, 0x20, 0x08, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x08, |
| | 0x60, 0x00, 0x00, 0x04, 0x80, 0x03, 0x80, 0x03, 0x00, 0x0c, 0x78, 0x00, |
| | 0x00, 0x30, 0x04, 0x00, 0x00, 0x40, 0x04, 0x00, 0x00, 0x40, 0x04, 0x00, |
| | 0x00, 0x80, 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x06, 0x00, |
| | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};" |
| | image create bitmap ::tk::dialog::b2 -foreground white \ |
| | -data "#define b2_width 32\n#define b2_height 32 |
| | static unsigned char b2_bits[] = { |
| | 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x1f, 0x00, 0x00, 0xff, 0xff, 0x00, |
| | 0xc0, 0xff, 0xff, 0x03, 0xe0, 0xff, 0xff, 0x07, 0xf0, 0xff, 0xff, 0x0f, |
| | 0xf8, 0xff, 0xff, 0x1f, 0xfc, 0xff, 0xff, 0x3f, 0xfc, 0xff, 0xff, 0x3f, |
| | 0xfe, 0xff, 0xff, 0x7f, 0xfe, 0xff, 0xff, 0x7f, 0xfe, 0xff, 0xff, 0x7f, |
| | 0xfe, 0xff, 0xff, 0x7f, 0xfe, 0xff, 0xff, 0x7f, 0xfe, 0xff, 0xff, 0x7f, |
| | 0xfe, 0xff, 0xff, 0x7f, 0xfc, 0xff, 0xff, 0x3f, 0xfc, 0xff, 0xff, 0x3f, |
| | 0xf8, 0xff, 0xff, 0x1f, 0xf0, 0xff, 0xff, 0x0f, 0xe0, 0xff, 0xff, 0x07, |
| | 0x80, 0xff, 0xff, 0x03, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0xf0, 0x07, 0x00, |
| | 0x00, 0xc0, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, |
| | 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, |
| | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};" |
| | image create bitmap ::tk::dialog::q -foreground blue \ |
| | -data "#define q_width 32\n#define q_height 32 |
| | static unsigned char q_bits[] = { |
| | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x07, 0x00, |
| | 0x00, 0x10, 0x0f, 0x00, 0x00, 0x18, 0x1e, 0x00, 0x00, 0x38, 0x1e, 0x00, |
| | 0x00, 0x38, 0x1e, 0x00, 0x00, 0x10, 0x0f, 0x00, 0x00, 0x80, 0x07, 0x00, |
| | 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, |
| | 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0xe0, 0x01, 0x00, |
| | 0x00, 0xe0, 0x01, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};" |
| | image create bitmap ::tk::dialog::i -foreground blue \ |
| | -data "#define i_width 32\n#define i_height 32 |
| | static unsigned char i_bits[] = { |
| | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| | 0x00, 0xe0, 0x01, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0xf0, 0x03, 0x00, |
| | 0x00, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| | 0x00, 0xf8, 0x03, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0xe0, 0x03, 0x00, |
| | 0x00, 0xe0, 0x03, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xe0, 0x03, 0x00, |
| | 0x00, 0xe0, 0x03, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xf0, 0x07, 0x00, |
| | 0x00, 0xf8, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};" |
| | image create bitmap ::tk::dialog::w1 -foreground black \ |
| | -data "#define w1_width 32\n#define w1_height 32 |
| | static unsigned char w1_bits[] = { |
| | 0x00, 0x80, 0x01, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x20, 0x04, 0x00, |
| | 0x00, 0x10, 0x04, 0x00, 0x00, 0x10, 0x08, 0x00, 0x00, 0x08, 0x08, 0x00, |
| | 0x00, 0x08, 0x10, 0x00, 0x00, 0x04, 0x10, 0x00, 0x00, 0x04, 0x20, 0x00, |
| | 0x00, 0x02, 0x20, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x01, 0x40, 0x00, |
| | 0x00, 0x01, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x00, 0x01, |
| | 0x40, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, 0x02, |
| | 0x20, 0x00, 0x00, 0x04, 0x10, 0x00, 0x00, 0x04, 0x10, 0x00, 0x00, 0x08, |
| | 0x08, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x10, 0x04, 0x00, 0x00, 0x10, |
| | 0x04, 0x00, 0x00, 0x20, 0x02, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x40, |
| | 0x01, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x20, |
| | 0xfc, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00};" |
| | image create bitmap ::tk::dialog::w2 -foreground yellow \ |
| | -data "#define w2_width 32\n#define w2_height 32 |
| | static unsigned char w2_bits[] = { |
| | 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0xc0, 0x03, 0x00, |
| | 0x00, 0xe0, 0x03, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xf0, 0x07, 0x00, |
| | 0x00, 0xf0, 0x0f, 0x00, 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xf8, 0x1f, 0x00, |
| | 0x00, 0xfc, 0x1f, 0x00, 0x00, 0xfc, 0x3f, 0x00, 0x00, 0xfe, 0x3f, 0x00, |
| | 0x00, 0xfe, 0x7f, 0x00, 0x00, 0xff, 0x7f, 0x00, 0x00, 0xff, 0xff, 0x00, |
| | 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x01, 0xc0, 0xff, 0xff, 0x01, |
| | 0xc0, 0xff, 0xff, 0x03, 0xe0, 0xff, 0xff, 0x03, 0xe0, 0xff, 0xff, 0x07, |
| | 0xf0, 0xff, 0xff, 0x07, 0xf0, 0xff, 0xff, 0x0f, 0xf8, 0xff, 0xff, 0x0f, |
| | 0xf8, 0xff, 0xff, 0x1f, 0xfc, 0xff, 0xff, 0x1f, 0xfe, 0xff, 0xff, 0x3f, |
| | 0xfe, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0xff, 0x3f, 0xfc, 0xff, 0xff, 0x1f, |
| | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};" |
| | image create bitmap ::tk::dialog::w3 -foreground black \ |
| | -data "#define w3_width 32\n#define w3_height 32 |
| | static unsigned char w3_bits[] = { |
| | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| | 0x00, 0xc0, 0x03, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, |
| | 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, |
| | 0x00, 0xc0, 0x03, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x00, 0xc0, 0x03, 0x00, |
| | 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, |
| | 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0xc0, 0x03, 0x00, |
| | 0x00, 0xc0, 0x03, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, |
| | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};" |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | proc ::tk::MessageBox {args} { |
| | global tk_strictMotif |
| | variable ::tk::Priv |
| |
|
| | set w ::tk::PrivMsgBox |
| | upvar $w data |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | set specs { |
| | {-default "" "" ""} |
| | {-detail "" "" ""} |
| | {-icon "" "" "info"} |
| | {-message "" "" ""} |
| | {-parent "" "" .} |
| | {-title "" "" " "} |
| | {-type "" "" "ok"} |
| | } |
| |
|
| | tclParseConfigSpec $w $specs "" $args |
| |
|
| | if {$data(-icon) ni {info warning error question}} { |
| | return -code error -errorcode [list TK LOOKUP ICON $data(-icon)] \ |
| | "bad -icon value \"$data(-icon)\": must be error, info, question, or warning" |
| | } |
| | set windowingsystem [tk windowingsystem] |
| | if {$windowingsystem eq "aqua"} { |
| | switch -- $data(-icon) { |
| | "error" {set data(-icon) "stop"} |
| | "warning" {set data(-icon) "caution"} |
| | "info" {set data(-icon) "note"} |
| | } |
| | } |
| |
|
| | if {![winfo exists $data(-parent)]} { |
| | return -code error -errorcode [list TK LOOKUP WINDOW $data(-parent)] \ |
| | "bad window path name \"$data(-parent)\"" |
| | } |
| |
|
| | switch -- $data(-type) { |
| | abortretryignore { |
| | set names [list abort retry ignore] |
| | set labels [list &Abort &Retry &Ignore] |
| | set cancel abort |
| | } |
| | ok { |
| | set names [list ok] |
| | set labels {&OK} |
| | set cancel ok |
| | } |
| | okcancel { |
| | set names [list ok cancel] |
| | set labels [list &OK &Cancel] |
| | set cancel cancel |
| | } |
| | retrycancel { |
| | set names [list retry cancel] |
| | set labels [list &Retry &Cancel] |
| | set cancel cancel |
| | } |
| | yesno { |
| | set names [list yes no] |
| | set labels [list &Yes &No] |
| | set cancel no |
| | } |
| | yesnocancel { |
| | set names [list yes no cancel] |
| | set labels [list &Yes &No &Cancel] |
| | set cancel cancel |
| | } |
| | default { |
| | return -code error -errorcode [list TK LOOKUP DLG_TYPE $data(-type)] \ |
| | "bad -type value \"$data(-type)\": must be\ |
| | abortretryignore, ok, okcancel, retrycancel,\ |
| | yesno, or yesnocancel" |
| | } |
| | } |
| |
|
| | set buttons {} |
| | foreach name $names lab $labels { |
| | lappend buttons [list $name -text [mc $lab]] |
| | } |
| |
|
| | |
| | |
| |
|
| | if {$data(-default) eq ""} { |
| | set data(-default) [lindex [lindex $buttons 0] 0] |
| | } |
| |
|
| | set valid 0 |
| | foreach btn $buttons { |
| | if {[lindex $btn 0] eq $data(-default)} { |
| | set valid 1 |
| | break |
| | } |
| | } |
| | if {!$valid} { |
| | return -code error -errorcode {TK MSGBOX DEFAULT} \ |
| | "bad -default value \"$data(-default)\": must be\ |
| | abort, retry, ignore, ok, cancel, no, or yes" |
| | } |
| |
|
| | |
| | |
| | |
| | if {$data(-parent) ne "."} { |
| | set w $data(-parent).__tk__messagebox |
| | } else { |
| | set w .__tk__messagebox |
| | } |
| |
|
| | |
| | set bg [ttk::style lookup . -background] |
| |
|
| | |
| | |
| |
|
| | catch {destroy $w} |
| | toplevel $w -class Dialog -bg $bg |
| | wm title $w $data(-title) |
| | wm iconname $w Dialog |
| | wm protocol $w WM_DELETE_WINDOW [list $w.$cancel invoke] |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | if {[winfo viewable [winfo toplevel $data(-parent)]] } { |
| | wm transient $w $data(-parent) |
| | } |
| |
|
| | if {$windowingsystem eq "aqua"} { |
| | ::tk::unsupported::MacWindowStyle style $w moveableModal {} |
| | } elseif {$windowingsystem eq "x11"} { |
| | wm attributes $w -type dialog |
| | } |
| |
|
| | ttk::frame $w.bot |
| | grid anchor $w.bot center |
| | pack $w.bot -side bottom -fill both |
| | ttk::frame $w.top |
| | pack $w.top -side top -fill both -expand 1 |
| |
|
| | |
| | |
| | |
| |
|
| | option add *Dialog.msg.wrapLength 3i widgetDefault |
| | option add *Dialog.dtl.wrapLength 3i widgetDefault |
| | option add *Dialog.msg.font TkCaptionFont widgetDefault |
| | option add *Dialog.dtl.font TkDefaultFont widgetDefault |
| |
|
| | ttk::label $w.msg -anchor nw -justify left -text $data(-message) |
| | if {$data(-detail) ne ""} { |
| | ttk::label $w.dtl -anchor nw -justify left -text $data(-detail) |
| | } |
| | if {$data(-icon) ne ""} { |
| | if {([winfo depth $w] < 4) || $tk_strictMotif} { |
| | |
| | label $w.bitmap -bitmap $data(-icon) -background $bg |
| | } else { |
| | switch $data(-icon) { |
| | error { |
| | ttk::label $w.bitmap -image ::tk::icons::error |
| | } |
| | info { |
| | ttk::label $w.bitmap -image ::tk::icons::information |
| | } |
| | question { |
| | ttk::label $w.bitmap -image ::tk::icons::question |
| | } |
| | default { |
| | ttk::label $w.bitmap -image ::tk::icons::warning |
| | } |
| | } |
| | } |
| | } |
| | grid $w.bitmap $w.msg -in $w.top -sticky news -padx 2m -pady 2m |
| | grid configure $w.bitmap -sticky nw |
| | grid columnconfigure $w.top 1 -weight 1 |
| | if {$data(-detail) ne ""} { |
| | grid ^ $w.dtl -in $w.top -sticky news -padx 2m -pady {0 2m} |
| | grid rowconfigure $w.top 1 -weight 1 |
| | } else { |
| | grid rowconfigure $w.top 0 -weight 1 |
| | } |
| |
|
| | |
| |
|
| | set i 0 |
| | foreach but $buttons { |
| | set name [lindex $but 0] |
| | set opts [lrange $but 1 end] |
| | if {![llength $opts]} { |
| | |
| | set capName [string toupper $name 0] |
| | set opts [list -text $capName] |
| | } |
| |
|
| | eval [list tk::AmpWidget ttk::button $w.$name] $opts \ |
| | [list -command [list set tk::Priv(button) $name]] |
| |
|
| | if {$name eq $data(-default)} { |
| | $w.$name configure -default active |
| | } else { |
| | $w.$name configure -default normal |
| | } |
| | grid $w.$name -in $w.bot -row 0 -column $i -padx 3m -pady 2m -sticky ew |
| | grid columnconfigure $w.bot $i -uniform buttons |
| | |
| | if {$windowingsystem eq "aqua"} { |
| | set tmp [string tolower $name] |
| | if {$tmp eq "ok" || $tmp eq "cancel" || $tmp eq "yes" || |
| | $tmp eq "no" || $tmp eq "abort" || $tmp eq "retry" || |
| | $tmp eq "ignore"} { |
| | grid columnconfigure $w.bot $i -minsize 90 |
| | } |
| | grid configure $w.$name -pady 7 |
| | } |
| | incr i |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | } |
| | bind $w <Alt-Key> [list ::tk::AltKeyInDialog $w %A] |
| |
|
| | if {$data(-default) ne ""} { |
| | bind $w <FocusIn> { |
| | if {[winfo class %W] in "Button TButton"} { |
| | %W configure -default active |
| | } |
| | } |
| | bind $w <FocusOut> { |
| | if {[winfo class %W] in "Button TButton"} { |
| | %W configure -default normal |
| | } |
| | } |
| | } |
| |
|
| | |
| |
|
| | bind $w <Return> { |
| | if {[winfo class %W] in "Button TButton"} { |
| | %W invoke |
| | } |
| | } |
| |
|
| | |
| | bind $w <Escape> [list $w.$cancel invoke] |
| |
|
| | |
| | bind $w.msg <Destroy> [list set tk::Priv(button) $cancel] |
| |
|
| | |
| | |
| | |
| |
|
| | ::tk::PlaceWindow $w widget $data(-parent) |
| |
|
| | |
| |
|
| | if {$data(-default) ne ""} { |
| | set focus $w.$data(-default) |
| | } else { |
| | set focus $w |
| | } |
| | ::tk::SetFocusGrab $w $focus |
| |
|
| | |
| | |
| | |
| | |
| | |
| |
|
| | vwait ::tk::Priv(button) |
| | |
| | |
| | set result $Priv(button) |
| |
|
| | ::tk::RestoreFocusGrab $w $focus |
| |
|
| | return $result |
| | } |
| |
|