/usr/share/amsn/utils/BWidget-1.9.0/messagedlg.tcl is in amsn-data 0.98.9-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | # ------------------------------------------------------------------------------
# messagedlg.tcl
# This file is part of Unifix BWidget Toolkit
# ------------------------------------------------------------------------------
# Index of commands:
# - MessageDlg::create
# ------------------------------------------------------------------------------
namespace eval MessageDlg {
Widget::define MessageDlg messagedlg Dialog
Widget::tkinclude MessageDlg message .frame.msg \
remove [list -cursor -highlightthickness \
-highlightbackground -highlightcolor \
-relief -borderwidth -takefocus -textvariable \
] \
rename [list -text -message] \
initialize [list -aspect 800 -anchor c -justify center]
Widget::bwinclude MessageDlg Dialog :cmd \
remove [list -modal -image -bitmap -side -anchor -separator \
-homogeneous -padx -pady -spacing]
Widget::declare MessageDlg {
{-icon Enum info 0 {none error info question warning}}
{-type Enum user 0 {abortretryignore ok okcancel \
retrycancel yesno yesnocancel user}}
{-buttons String "" 0}
{-buttonwidth String 0 0}
}
Widget::addmap MessageDlg "" tkMBox {
-parent {} -message {} -default {} -title {}
}
}
# ------------------------------------------------------------------------------
# Command MessageDlg::create
# ------------------------------------------------------------------------------
proc MessageDlg::create { path args } {
global tcl_platform
array set maps [list MessageDlg {} :cmd {} .frame.msg {} tkMBox {}]
array set maps [Widget::parseArgs MessageDlg $args]
Widget::initFromODB MessageDlg "$path#Message" $maps(MessageDlg)
array set dialogArgs $maps(:cmd)
set type [Widget::cget "$path#Message" -type]
set icon [Widget::cget "$path#Message" -icon]
set width [Widget::cget "$path#Message" -buttonwidth]
set defb -1
set canb -1
switch -- $type {
abortretryignore {set lbut {abort retry ignore}; set defb 0}
ok {set lbut {ok}; set defb 0 }
okcancel {set lbut {ok cancel}; set defb 0; set canb 1}
retrycancel {set lbut {retry cancel}; set defb 0; set canb 1}
yesno {set lbut {yes no}; set defb 0; set canb 1}
yesnocancel {set lbut {yes no cancel}; set defb 0; set canb 2}
user {set lbut [Widget::cget "$path#Message" -buttons]}
}
# If the user didn't specify a default button, use our type-specific
# default, adding its flag/value to the "user" settings and to the tkMBox
# settings
if { ![info exists dialogArgs(-default)] } {
lappend maps(:cmd) -default $defb
lappend maps(tkMBox) -default $defb
}
if { ![info exists dialogArgs(-cancel)] } {
lappend maps(:cmd) -cancel $canb
}
# Same with title as with default
if { ![info exists dialogArgs(-title)] } {
set frame [frame $path -class MessageDlg]
set title [option get $frame "${icon}Title" MessageDlg]
destroy $frame
if { $title == "" } {
set title "Message"
}
lappend maps(:cmd) -title $title
lappend maps(tkMBox) -title $title
}
# Create the "user" type dialog
if { $type == "user" } {
if { $icon != "none" } {
set image [Bitmap::get $icon]
} else {
set image ""
}
eval [list Dialog::create $path] $maps(:cmd) \
[list -image $image -modal local -side bottom -anchor e]
foreach but $lbut {
Dialog::add $path -text $but -name $but -width $width
}
set frame [Dialog::getframe $path]
eval [list message $frame.msg] $maps(.frame.msg) \
[list -relief flat -borderwidth 0 -highlightthickness 0 \
-textvariable ""]
pack $frame.msg -side left -padx 3m -pady 1m -fill x -expand yes
set res [Dialog::draw $path]
destroy $path
} else {
# Do some translation of args into tk_messageBox syntax, then create
# the tk_messageBox
array set tkMBoxArgs $maps(tkMBox)
set tkMBoxArgs(-default) [lindex $lbut $tkMBoxArgs(-default)]
if { ![string equal $icon "none"] } {
set tkMBoxArgs(-icon) $icon
}
if {[info exists tkMBoxArgs(-parent)]
&& ![winfo exists $tkMBoxArgs(-parent)]} {
unset tkMBoxArgs(-parent)
}
set tkMBoxArgs(-type) $type
set res [eval [list tk_messageBox] [array get tkMBoxArgs]]
set res [lsearch $lbut $res]
}
Widget::destroy "$path#Message"
return $res
}
|