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