summaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authornijtmans@users.sourceforge.net <jan.nijtmans>2012-08-09 08:22:44 (GMT)
committernijtmans@users.sourceforge.net <jan.nijtmans>2012-08-09 08:22:44 (GMT)
commit88c5b81b6b4e45bfb86c664e07903fdc88cec580 (patch)
tree0565d2b08b7fe90e0fb1172f05081b62657c4bfe /library
parent7e859951e8c7454b928b088ed303970dc33c1878 (diff)
parent40e750bd233b5100880d4d03461cc7f799319115 (diff)
downloadtk-88c5b81b6b4e45bfb86c664e07903fdc88cec580.zip
tk-88c5b81b6b4e45bfb86c664e07903fdc88cec580.tar.gz
tk-88c5b81b6b4e45bfb86c664e07903fdc88cec580.tar.bz2
formatting, unnecessary if's
Diffstat (limited to 'library')
-rw-r--r--library/demos/toolbar.tcl67
1 files changed, 28 insertions, 39 deletions
diff --git a/library/demos/toolbar.tcl b/library/demos/toolbar.tcl
index e7c87e2..0ae4669 100644
--- a/library/demos/toolbar.tcl
+++ b/library/demos/toolbar.tcl
@@ -15,57 +15,46 @@ wm title $w "Toolbar Demonstration"
wm iconname $w "toolbar"
positionWindow $w
-if {[tk windowingsystem] ne {}} {
- ttk::label $w.msg -wraplength 4i -text "This is a demonstration of how to do\
- a toolbar that is styled correctly and which can be torn off. The\
- buttons are configured to be \u201Ctoolbar style\u201D buttons by\
- telling them that they are to use the Toolbutton style. At the left\
- end of the toolbar is a simple marker that the cursor changes to a\
- movement icon over; drag that away from the toolbar to tear off the\
- whole toolbar into a separate toplevel widget. When the dragged-off\
- toolbar is no longer needed, just close it like any normal toplevel\
- and it will reattach to the window it was torn off from."
-} else {
ttk::label $w.msg -wraplength 4i -text "This is a demonstration of how to do\
- a toolbar that is styled correctly. The buttons are configured to\
- be \u201Ctoolbar style\u201D buttons by telling them that they are\
- to use the Toolbutton style."
-}
+ a toolbar that is styled correctly and which can be torn off. The\
+ buttons are configured to be \u201Ctoolbar style\u201D buttons by\
+ telling them that they are to use the Toolbutton style. At the left\
+ end of the toolbar is a simple marker that the cursor changes to a\
+ movement icon over; drag that away from the toolbar to tear off the\
+ whole toolbar into a separate toplevel widget. When the dragged-off\
+ toolbar is no longer needed, just close it like any normal toplevel\
+ and it will reattach to the window it was torn off from."
## Set up the toolbar hull
set t [frame $w.toolbar] ;# Must be a frame!
ttk::separator $w.sep
ttk::frame $t.tearoff -cursor fleur
-if {[tk windowingsystem] ne {}} {
- ttk::separator $t.tearoff.to -orient vertical
- ttk::separator $t.tearoff.to2 -orient vertical
- pack $t.tearoff.to -fill y -expand 1 -padx 2 -side left
- pack $t.tearoff.to2 -fill y -expand 1 -side left
-}
+ttk::separator $t.tearoff.to -orient vertical
+ttk::separator $t.tearoff.to2 -orient vertical
+pack $t.tearoff.to -fill y -expand 1 -padx 2 -side left
+pack $t.tearoff.to2 -fill y -expand 1 -side left
ttk::frame $t.contents
grid $t.tearoff $t.contents -sticky nsew
grid columnconfigure $t $t.contents -weight 1
grid columnconfigure $t.contents 1000 -weight 1
-if {[tk windowingsystem] ne {}} {
- ## Bindings so that the toolbar can be torn off and reattached
- bind $t.tearoff <B1-Motion> [list tearoff $t %X %Y]
- bind $t.tearoff.to <B1-Motion> [list tearoff $t %X %Y]
- bind $t.tearoff.to2 <B1-Motion> [list tearoff $t %X %Y]
- proc tearoff {w x y} {
- if {[string match $w* [winfo containing $x $y]]} {
- return
- }
- grid remove $w
- grid remove $w.tearoff
- wm manage $w
- wm protocol $w WM_DELETE_WINDOW [list untearoff $w]
- }
- proc untearoff {w} {
- wm forget $w
- grid $w.tearoff
- grid $w
+## Bindings so that the toolbar can be torn off and reattached
+bind $t.tearoff <B1-Motion> [list tearoff $t %X %Y]
+bind $t.tearoff.to <B1-Motion> [list tearoff $t %X %Y]
+bind $t.tearoff.to2 <B1-Motion> [list tearoff $t %X %Y]
+proc tearoff {w x y} {
+ if {[string match $w* [winfo containing $x $y]]} {
+ return
}
+ grid remove $w
+ grid remove $w.tearoff
+ wm manage $w
+ wm protocol $w WM_DELETE_WINDOW [list untearoff $w]
+}
+proc untearoff {w} {
+ wm forget $w
+ grid $w.tearoff
+ grid $w
}
## Toolbar contents