diff options
Diffstat (limited to 'library/demos/ttkpane.tcl')
-rw-r--r-- | library/demos/ttkpane.tcl | 46 |
1 files changed, 30 insertions, 16 deletions
diff --git a/library/demos/ttkpane.tcl b/library/demos/ttkpane.tcl index fc1d74c..ad30a42 100644 --- a/library/demos/ttkpane.tcl +++ b/library/demos/ttkpane.tcl @@ -2,7 +2,7 @@ # # This demonstration script creates a Ttk pane with some content. # -# RCS: @(#) $Id: ttkpane.tcl,v 1.1 2007/10/18 14:34:10 dkf Exp $ +# RCS: @(#) $Id: ttkpane.tcl,v 1.2 2007/10/21 14:51:47 das Exp $ if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." @@ -14,7 +14,7 @@ package require Ttk set w .ttkpane catch {destroy $w} toplevel $w -wm title $w "Ttk Menu Buttons" +wm title $w "Themed Nested Panes" wm iconname $w "ttkpane" positionWindow $w @@ -24,6 +24,9 @@ pack $w.msg [ttk::separator $w.msgSep] -side top -fill x ## See Code / Dismiss pack [addSeeDismiss $w.seeDismiss $w] -side bottom -fill x +ttk::frame $w.f +pack $w.f -fill both -expand 1 +set w $w.f ttk::panedwindow $w.outer -orient horizontal $w.outer add [ttk::panedwindow $w.outer.inLeft -orient vertical] $w.outer add [ttk::panedwindow $w.outer.inRight -orient vertical] @@ -31,6 +34,11 @@ $w.outer.inLeft add [ttk::labelframe $w.outer.inLeft.top -text Button] $w.outer.inLeft add [ttk::labelframe $w.outer.inLeft.bot -text Clocks] $w.outer.inRight add [ttk::labelframe $w.outer.inRight.top -text Progress] $w.outer.inRight add [ttk::labelframe $w.outer.inRight.bot -text Text] +if {[tk windowingsystem] eq "aqua"} { + foreach i [list inLeft.top inLeft.bot inRight.top inRight.bot] { + $w.outer.$i configure -padding 3 + } +} # Fill the button pane ttk::button $w.outer.inLeft.top.b -text "Press Me" -command { @@ -78,18 +86,24 @@ pack $w.outer.inRight.top.progress -fill both -expand 1 $w.outer.inRight.top.progress start # Fill the text pane +if {[tk windowingsystem] ne "aqua"} { + # The trick with the ttk::frame makes the text widget look like it fits with + # the current Ttk theme despite not being a themed widget itself. It is done + # by styling the frame like an entry, turning off the border in the text + # widget, and putting the text widget in the frame with enough space to allow + # the surrounding border to show through (2 pixels seems to be enough). + ttk::frame $w.outer.inRight.bot.f -style TEntry + text $w.txt -wrap word -yscroll "$w.sb set" -width 30 -borderwidth 0 + pack $w.txt -fill both -expand 1 -in $w.outer.inRight.bot.f -pady 2 -padx 2 + ttk::scrollbar $w.sb -orient vertical -command "$w.txt yview" + pack $w.sb -side right -fill y -in $w.outer.inRight.bot + pack $w.outer.inRight.bot.f -fill both -expand 1 + pack $w.outer -fill both -expand 1 +} else { + text $w.txt -wrap word -yscroll "$w.sb set" -width 30 -borderwidth 0 + scrollbar $w.sb -orient vertical -command "$w.txt yview" + pack $w.sb -side right -fill y -in $w.outer.inRight.bot + pack $w.txt -fill both -expand 1 -in $w.outer.inRight.bot + pack $w.outer -fill both -expand 1 -padx 10 -pady {6 10} +} -# The trick with the ttk::frame makes the text widget look like it fits with -# the current Ttk theme despite not being a themed widget itself. It is done -# by styling the frame like an entry, turning off the border in the text -# widget, and putting the text widget in the frame with enough space to allow -# the surrounding border to show through (2 pixels seems to be enough). -ttk::frame $w.outer.inRight.bot.f -style TEntry -text $w.txt -wrap word -yscroll "$w.sb set" -width 30 -borderwidth 0 -pack $w.txt -fill both -expand 1 -in $w.outer.inRight.bot.f -pady 2 -padx 2 - -ttk::scrollbar $w.sb -orient vertical -command "$w.txt yview" -pack $w.sb -side right -fill y -in $w.outer.inRight.bot -pack $w.outer.inRight.bot.f -fill both -expand 1 - -pack $w.outer -fill both -expand 1 |