1# ---------------------------------------------------------------------------- 2# progressdlg.tcl 3# This file is part of Unifix BWidget Toolkit 4# ---------------------------------------------------------------------------- 5# Index of commands: 6# - ProgressDlg::create 7# ---------------------------------------------------------------------------- 8 9namespace eval ProgressDlg { 10 Widget::define ProgressDlg progressdlg Dialog ProgressBar 11 12 Widget::bwinclude ProgressDlg Dialog :cmd \ 13 remove { 14 -modal -image -bitmap -side -anchor -cancel -default 15 -homogeneous -padx -pady -spacing 16 } 17 18 Widget::bwinclude ProgressDlg ProgressBar .frame.pb \ 19 remove {-orient -width -height} 20 21 Widget::declare ProgressDlg { 22 {-width TkResource 25 0 label} 23 {-height TkResource 2 0 label} 24 {-textvariable TkResource "" 0 label} 25 {-font TkResource "" 0 label} 26 {-stop String "" 0} 27 {-command String "" 0} 28 } 29 30 Widget::addmap ProgressDlg :cmd .frame.msg \ 31 {-width {} -height {} -textvariable {} -font {} -background {}} 32} 33 34 35# ---------------------------------------------------------------------------- 36# Command ProgressDlg::create 37# ---------------------------------------------------------------------------- 38proc ProgressDlg::create { path args } { 39 array set maps [list ProgressDlg {} :cmd {} .frame.msg {} .frame.pb {}] 40 array set maps [Widget::parseArgs ProgressDlg $args] 41 42 eval [list Dialog::create] $path $maps(:cmd) \ 43 [list -image [Bitmap::get hourglass] \ 44 -modal none -side bottom -anchor c -class ProgressDlg] 45 46 Widget::initFromODB ProgressDlg "$path#ProgressDlg" $maps(ProgressDlg) 47 48 wm protocol $path WM_DELETE_WINDOW {;} 49 50 set frame [Dialog::getframe $path] 51 bind $frame <Destroy> [list Widget::destroy $path\#ProgressDlg] 52 $frame configure -cursor watch 53 54 eval [list label $frame.msg] $maps(.frame.msg) \ 55 -relief flat -borderwidth 0 \ 56 -highlightthickness 0 -anchor w -justify left 57 pack $frame.msg -side top -pady 3m -anchor nw -fill x -expand yes 58 59 eval [list ProgressBar::create] $frame.pb $maps(.frame.pb) -width 100 60 pack $frame.pb -side bottom -anchor w -fill x -expand yes 61 62 set stop [Widget::cget "$path#ProgressDlg" -stop] 63 set cmd [Widget::cget "$path#ProgressDlg" -command] 64 if { $stop != "" && $cmd != "" } { 65 Dialog::add $path -text $stop -name $stop -command $cmd 66 } 67 Dialog::draw $path 68 BWidget::grab local $path 69 70 return [Widget::create ProgressDlg $path 0] 71} 72 73 74# ---------------------------------------------------------------------------- 75# Command ProgressDlg::configure 76# ---------------------------------------------------------------------------- 77proc ProgressDlg::configure { path args } { 78 return [Widget::configure "$path#ProgressDlg" $args] 79} 80 81 82# ---------------------------------------------------------------------------- 83# Command ProgressDlg::cget 84# ---------------------------------------------------------------------------- 85proc ProgressDlg::cget { path option } { 86 return [Widget::cget "$path#ProgressDlg" $option] 87} 88