head	1.60;
access;
symbols
	core-8-5-9:1.51.2.3
	core-8-5-8:1.51.2.1
	macosx-cocoa-merge:1.57
	macosx-cocoa-premerge:1.57
	macosx-carbon-freeze:1.57
	core-8-5-7:1.51.2.1
	core-8-5-6:1.51
	core-8-6-b1:1.54
	core-8-6-a3:1.51
	core-8-5-5:1.51
	core-8-6-a2:1.51
	core-8-5-4:1.51
	core-8-5-3:1.51
	core-8-6-a1:1.51
	core-8-4-19:1.9.2.3
	core-8-5-branch:1.51.0.2
	core-8-5-2:1.51
	core-8-4-18:1.9.2.3
	core-8-5-1:1.49
	core-8-4-17:1.9.2.3
	core-8-5-0:1.49
	core-8-5-b3:1.47
	core-8-5-b2:1.40
	core-8-4-16:1.9.2.2
	core-8-5-b1:1.30
	core-stablilizer-merge:1.30
	core-stabilizer-branch:1.29.0.2
	core-stabilizer-merge:1.51
	core-8-4-15:1.9.2.2
	core-8-5-a6:1.28
	core-8-5-a5:1.28
	core-8-4-14:1.9.2.2
	core-8-5-a4:1.27
	core-8-4-13:1.9.2.1
	core-8-4-12:1.9.2.1
	core-8-4-11:1.9.2.1
	core-8-5-a3:1.27
	core-8-4-10:1.9.2.1
	core-8-4-9-branch:1.9.2.1.0.2
	core-8-5-a2:1.27
	core-8-4-9:1.9.2.1
	core-8-4-8:1.9.2.1
	core-8-4-7:1.9.2.1
	core-8-5-a1:1.22
	core-8-4-6:1.9.2.1
	core-8-4-5:1.9.2.1
	mistachkin-dev-branch:1.17.0.2
	core-8-4-4:1.9
	core-8-4-3:1.9
	core-8-4-branch:1.9.0.2
	core-8-4-2:1.9
	core-8-4-1:1.8
	core-8-3-5:1.2
	core-8-4-0:1.8
	macosx-8-4-merge-2002-08-31-trunk:1.8
	macosx-8-4-premerge-2002-08-31-branch:1.3.2.4
	macosx-8-4-premerge-2002-08-31-trunk:1.7
	macosx-8-4-merge-2002-08-30-branch:1.3.2.3
	macosx-8-4-merge-2002-08-30-trunk:1.7
	macosx-8-4-merge-2002-08-20-branch:1.3.2.3
	macosx-8-4-merge-2002-08-20-trunk:1.7
	core-8-4-b2:1.7
	core-8-4-b1:1.7
	macosx-premerge-6-9-02:1.3.2.2
	core-8-4-a4:1.7
	core-8-3-4:1.2
	macosx-8-4-branch:1.3.0.2
	macosx-8-4-branchpoint:1.3
	core-8-4-a3:1.2
	core-8-3-3:1.2
	dgp-privates-into-namespace:1.2.0.22
	tclpro-1-5-0:1.2
	core-8-4-win-speedup:1.2.0.20
	core-8-4-a2:1.2
	tclpro-1-4-1:1.2
	tclpro-1-4-0:1.2
	core-8-3-2:1.2
	ajuba-ajuba2-2-1-base:1.2
	ajuba-ajuba2-2-0:1.2
	core-8-4-a1:1.2
	core-8-3-1-branch:1.2.0.18
	core-8-3-1:1.2
	scriptics-sc-2-0-b5:1.2
	scriptics-sc-2-0-fixed:1.2
	scriptics-sc-2-0-b2:1.2
	scriptics-sc-2-0-b1:1.2
	core-8-3-0:1.2
	core-8-3-b2:1.2
	core-8-3-b1:1.2
	scriptics-sc-1-1:1.2
	scriptics-sc-1-1-b1:1.2
	core-8-2-3:1.2
	scriptics-sc-1-1-branch:1.2.0.16
	scriptics-sc-1-1-base:1.2
	scriptics-sc-1-0:1.2
	scriptics-sc-1-0-branch:1.2.0.14
	scriptics-sc-1-0-base:1.2
	core-8-2-2:1.2
	core-8-2-1:1.2
	scriptics-bc-1-0-b1:1.2
	core-8-2-1-branch:1.2.0.12
	scriptics-tclpro-1-3-0:1.2
	core-8-2-0:1.2
	core-8-2-b3-branch:1.2.0.10
	core-8-2-b3-base:1.2
	scriptics-tclpro-1-3-b4:1.2
	core-8-2-b2:1.2
	scriptics-tclpro-1-3-b3:1.2
	core-8-2-b1:1.2
	scriptics-tclpro-1-3-b2:1.2
	merge-to-mainline-5/21/99:1.2
	scriptics-tclpro-1-3-b2-branch:1.2.0.8
	core-8-1-1:1.2
	scriptics-tclpro-1-3-b1:1.2
	core-8-1-1-base:1.2
	core-8-1-0:1.2
	merge-to-mainline-4-29-99:1.2
	merge-to-mainline-4-23-99:1.2
	core-8-1-branch-old:1.1.0.4
	core-8-0-6-branch:1.2.0.6
	core-8-0-6-base:1.2
	core-8-0-5:1.2
	core-8-1-b3:1.1.4.1
	core-8-1-b2:1.1.4.1
	dev-8-1-stubs-branch:1.1.4.1.0.2
	dev-stubs-branch:1.2.0.4
	scriptics-tclpro-1-2:1.2
	scriptics-tclpro-1-2-b2:1.2
	core-8-1-merge-2/10/99:1.2
	core-8-0-5-branch:1.2.0.2
	core-8-0-5-base:1.2
	scriptics-tclpro-1-2-b1:1.2
	scriptics-tclpro-1-2-a1:1.2
	core-8-1-b1:1.1.4.1
	core-8-0-4:1.2
	core-8-1-a2:1.1
	core-8-0-2:1.1
	core-8-0-3:1.2;
locks; strict;
comment	@# @;


1.60
date	2010.11.05.07.49.34;	author nijtmans;	state Exp;
branches;
next	1.59;

1.59
date	2010.01.19.01.27.41;	author patthoyts;	state Exp;
branches;
next	1.58;

1.58
date	2009.12.10.11.48.38;	author dkf;	state Exp;
branches;
next	1.57;

1.57
date	2009.04.10.16.40.03;	author das;	state Exp;
branches;
next	1.56;

1.56
date	2009.04.08.12.28.32;	author dkf;	state Exp;
branches;
next	1.55;

1.55
date	2009.03.25.23.27.14;	author nijtmans;	state Exp;
branches;
next	1.54;

1.54
date	2008.12.20.01.33.59;	author das;	state Exp;
branches;
next	1.53;

1.53
date	2008.12.12.02.02.35;	author patthoyts;	state Exp;
branches;
next	1.52;

1.52
date	2008.12.11.18.13.08;	author jenglish;	state Exp;
branches;
next	1.51;

1.51
date	2008.03.11.22.30.17;	author das;	state Exp;
branches
	1.51.2.1;
next	1.50;

1.50
date	2008.02.29.22.48.07;	author patthoyts;	state Exp;
branches;
next	1.49;

1.49
date	2007.12.13.15.27.07;	author dgp;	state Exp;
branches;
next	1.48;

1.48
date	2007.12.05.22.29.50;	author hobbs;	state Exp;
branches;
next	1.47;

1.47
date	2007.11.04.10.38.09;	author das;	state Exp;
branches;
next	1.46;

1.46
date	2007.11.02.23.53.07;	author dkf;	state Exp;
branches;
next	1.45;

1.45
date	2007.11.02.23.48.11;	author dkf;	state Exp;
branches;
next	1.44;

1.44
date	2007.11.01.11.34.00;	author das;	state Exp;
branches;
next	1.43;

1.43
date	2007.10.31.16.17.57;	author dkf;	state Exp;
branches;
next	1.42;

1.42
date	2007.10.31.16.17.06;	author dkf;	state Exp;
branches;
next	1.41;

1.41
date	2007.10.30.01.57.55;	author hobbs;	state Exp;
branches;
next	1.40;

1.40
date	2007.10.23.06.31.16;	author das;	state Exp;
branches;
next	1.39;

1.39
date	2007.10.22.14.21.10;	author dkf;	state Exp;
branches;
next	1.38;

1.38
date	2007.10.21.14.51.47;	author das;	state Exp;
branches;
next	1.37;

1.37
date	2007.10.18.14.34.06;	author dkf;	state Exp;
branches;
next	1.36;

1.36
date	2007.10.17.20.22.41;	author das;	state Exp;
branches;
next	1.35;

1.35
date	2007.10.17.18.55.05;	author das;	state Exp;
branches;
next	1.34;

1.34
date	2007.10.17.18.21.49;	author das;	state Exp;
branches;
next	1.33;

1.33
date	2007.10.17.14.59.27;	author dkf;	state Exp;
branches;
next	1.32;

1.32
date	2007.10.16.15.15.19;	author dkf;	state Exp;
branches;
next	1.31;

1.31
date	2007.10.15.21.06.17;	author dkf;	state Exp;
branches;
next	1.30;

1.30
date	2007.05.27.13.14.36;	author das;	state Exp;
branches;
next	1.29;

1.29
date	2007.05.04.21.29.22;	author patthoyts;	state Exp;
branches
	1.29.2.1;
next	1.28;

1.28
date	2006.09.11.14.41.04;	author das;	state Exp;
branches;
next	1.27;

1.27
date	2004.11.08.21.57.53;	author dkf;	state Exp;
branches;
next	1.26;

1.26
date	2004.11.07.22.41.11;	author dkf;	state Exp;
branches;
next	1.25;

1.25
date	2004.11.07.17.28.21;	author dkf;	state Exp;
branches;
next	1.24;

1.24
date	2004.09.10.12.13.43;	author vincentdarley;	state Exp;
branches;
next	1.23;

1.23
date	2004.03.17.18.15.45;	author das;	state Exp;
branches;
next	1.22;

1.22
date	2004.02.25.13.22.32;	author cc_benny;	state Exp;
branches;
next	1.21;

1.21
date	2003.12.04.12.28.37;	author vincentdarley;	state Exp;
branches;
next	1.20;

1.20
date	2003.11.05.13.31.12;	author dkf;	state Exp;
branches;
next	1.19;

1.19
date	2003.11.04.13.26.33;	author dkf;	state Exp;
branches;
next	1.18;

1.18
date	2003.11.03.15.30.45;	author dkf;	state Exp;
branches;
next	1.17;

1.17
date	2003.09.30.14.54.30;	author dkf;	state Exp;
branches;
next	1.16;

1.16
date	2003.09.25.05.37.00;	author das;	state Exp;
branches;
next	1.15;

1.15
date	2003.08.22.22.44.15;	author dkf;	state Exp;
branches;
next	1.14;

1.14
date	2003.08.21.00.02.56;	author hobbs;	state Exp;
branches;
next	1.13;

1.13
date	2003.08.20.23.47.44;	author hobbs;	state Exp;
branches;
next	1.12;

1.12
date	2003.08.20.23.23.34;	author hobbs;	state Exp;
branches;
next	1.11;

1.11
date	2003.08.20.23.02.18;	author hobbs;	state Exp;
branches;
next	1.10;

1.10
date	2003.05.19.14.44.04;	author dkf;	state Exp;
branches;
next	1.9;

1.9
date	2003.02.19.16.13.15;	author dkf;	state Exp;
branches
	1.9.2.1;
next	1.8;

1.8
date	2002.08.31.06.12.28;	author das;	state Exp;
branches;
next	1.7;

1.7
date	2002.02.22.14.07.01;	author dkf;	state Exp;
branches;
next	1.6;

1.6
date	2001.11.30.11.25.41;	author dkf;	state Exp;
branches;
next	1.5;

1.5
date	2001.11.19.14.02.29;	author dkf;	state Exp;
branches;
next	1.4;

1.4
date	2001.10.30.11.21.50;	author dkf;	state Exp;
branches;
next	1.3;

1.3
date	2001.09.26.21.36.19;	author pspjuth;	state Exp;
branches
	1.3.2.1;
next	1.2;

1.2
date	98.09.14.18.23.30;	author stanton;	state Exp;
branches
	1.2.20.1;
next	1.1;

1.1
date	98.04.01.09.54.31;	author rjohnson;	state Exp;
branches
	1.1.4.1;
next	;

1.1.4.1
date	98.09.30.02.17.57;	author stanton;	state Exp;
branches;
next	;

1.2.20.1
date	2002.04.02.20.58.51;	author hobbs;	state Exp;
branches;
next	;

1.3.2.1
date	2001.10.15.09.22.00;	author wolfsuit;	state Exp;
branches;
next	1.3.2.2;

1.3.2.2
date	2002.02.05.02.25.16;	author wolfsuit;	state Exp;
branches;
next	1.3.2.3;

1.3.2.3
date	2002.06.10.05.38.24;	author wolfsuit;	state Exp;
branches;
next	1.3.2.4;

1.3.2.4
date	2002.08.30.18.18.14;	author das;	state Exp;
branches;
next	;

1.9.2.1
date	2003.09.25.05.37.48;	author das;	state Exp;
branches;
next	1.9.2.2;

1.9.2.2
date	2006.09.11.14.41.16;	author das;	state Exp;
branches;
next	1.9.2.3;

1.9.2.3
date	2007.11.09.06.48.32;	author das;	state Exp;
branches;
next	;

1.29.2.1
date	2007.05.29.11.36.43;	author dgp;	state Exp;
branches;
next	1.29.2.2;

1.29.2.2
date	2007.10.16.04.03.54;	author dgp;	state Exp;
branches;
next	1.29.2.3;

1.29.2.3
date	2007.10.17.14.37.05;	author dgp;	state Exp;
branches;
next	1.29.2.4;

1.29.2.4
date	2007.10.19.14.35.33;	author dgp;	state Exp;
branches;
next	1.29.2.5;

1.29.2.5
date	2007.10.24.12.59.33;	author dgp;	state Exp;
branches;
next	1.29.2.6;

1.29.2.6
date	2007.11.01.16.37.23;	author dgp;	state Exp;
branches;
next	1.29.2.7;

1.29.2.7
date	2007.11.05.14.24.18;	author dgp;	state Exp;
branches;
next	1.29.2.8;

1.29.2.8
date	2007.12.06.07.00.05;	author dgp;	state Exp;
branches;
next	1.29.2.9;

1.29.2.9
date	2008.03.07.22.03.49;	author dgp;	state Exp;
branches;
next	1.29.2.10;

1.29.2.10
date	2008.03.13.14.57.32;	author dgp;	state Exp;
branches;
next	;

1.51.2.1
date	2009.04.10.16.40.12;	author das;	state Exp;
branches;
next	1.51.2.2;

1.51.2.2
date	2009.12.10.11.44.07;	author dkf;	state Exp;
branches;
next	1.51.2.3;

1.51.2.3
date	2010.01.20.23.43.51;	author patthoyts;	state Exp;
branches;
next	;


desc
@@


1.60
log
@Use unicode copyright sign, in stead of depending on translation.
@
text
@#!/bin/sh
# the next line restarts using wish \
exec wish "$0" ${1+"$@@"}

# widget --
# This script demonstrates the various widgets provided by Tk, along with many
# of the features of the Tk toolkit. This file only contains code to generate
# the main window for the application, which invokes individual
# demonstrations. The code for the actual demonstrations is contained in
# separate ".tcl" files is this directory, which are sourced by this script as
# needed.
#
# RCS: @@(#) $Id: widget,v 1.59 2010/01/19 01:27:41 patthoyts Exp $

package require Tcl	8.5
package require Tk	8.5
package require msgcat

eval destroy [winfo child .]
set tk_demoDirectory [file join [pwd] [file dirname [info script]]]
::msgcat::mcload $tk_demoDirectory
namespace import ::msgcat::mc
wm title . [mc "Widget Demonstration"]
if {[tk windowingsystem] eq "x11"} {
    # This won't work everywhere, but there's no other way in core Tk at the
    # moment to display a coloured icon.
    image create photo TclPowered \
	    -file [file join $tk_library images logo64.gif]
    wm iconwindow . [toplevel ._iconWindow]
    pack [label ._iconWindow.i -image TclPowered]
    wm iconname . [mc "tkWidgetDemo"]
}

if {"defaultFont" ni [font names]} {
    # TIP #145 defines some standard named fonts
    if {"TkDefaultFont" in [font names] && "TkFixedFont" in [font names]} {
        # FIX ME: the following technique of cloning the font to copy it works
        #         fine but means that if the system font is changed by Tk
        #         cannot update the copied font. font alias might be useful
        #         here -- or fix the app to use TkDefaultFont etc.
        font create mainFont   {*}[font configure TkDefaultFont]
        font create fixedFont  {*}[font configure TkFixedFont]
        font create boldFont   {*}[font configure TkDefaultFont] -weight bold
        font create titleFont  {*}[font configure TkDefaultFont] -weight bold
        font create statusFont {*}[font configure TkDefaultFont]
        font create varsFont   {*}[font configure TkDefaultFont]
	if {[tk windowingsystem] eq "aqua"} {
	    font configure titleFont -size 17
	}
    } else {
        font create mainFont   -family Helvetica -size 12
        font create fixedFont  -family Courier   -size 10
        font create boldFont   -family Helvetica -size 12 -weight bold
        font create titleFont  -family Helvetica -size 18 -weight bold
        font create statusFont -family Helvetica -size 10
        font create varsFont   -family Helvetica -size 14
    }
}

set widgetDemo 1
set font mainFont

image create photo ::img::refresh -format GIF -data {
    R0lGODlhEAAQAJEDAP///wAAACpnKv///yH5BAEAAAMALAAAAAAQABAAAAI63IKp
    xgcPH2ouwgBCw1HIxHCQ4F3hSJKmwZXqWrmWxj7lKJ2dndcon9EBUq+gz3brVXAR
    2tICU0gXBQA7
}

image create photo ::img::view -format GIF -data {
    R0lGODlhEAAQAKIHAP///wwMDAAAAMDAwNnZ2SYmJmZmZv///yH5BAEAAAcALAAA
    AAAQABAAAANMKLos90+ASamDRxJCgw9YVnlDOXiQBgRDBRgHKE6sW8QR3doPKK27
    yg33q/GIOhdg6OsEJzeZykiBSUcs06e56Xx6np8ScIkFGuhQAgA7
}

image create photo ::img::delete -format GIF -data {
    R0lGODlhEAAQAIABAIQAAP///yH5BAEAAAEALAAAAAAQABAAAAIjjI+pmwAc3HGy
    PUSvqYpuvWQg40FfSVacBa5nN6JYDI3mzRQAOw==
}

image create photo ::img::print -format GIF -data {
    R0lGODlhEAAQALMKAAAAAP///52VunNkl8C82Yl+qldBgq+pyrOzs1fYAP///wAA
    AAAAAAAAAAAAAAAAACH5BAEAAAoALAAAAAAQABAAAARGUMlJKwU4AztB+ODGeUiJ
    fGLlgeEYmGWQXmx7aXgmAUTv/74N4EAsGhOJg1DAbDqbwoJ0Sp0KB9isNis0eL/g
    ryhH5pgnEQA7
}

# Note that this is run through the message catalog! This is because this is
# actually an image of a word.
image create photo ::img::new -format GIF -data [mc {
    R0lGODlhHgAOALMPALMAANyIiOu7u8dEROaqqvru7sxVVeGZmbgREfXd3b0iItZ3
    d8IzM9FmZvDMzP///yH5BAEAAA8ALAAAAAAeAA4AAASa8MlJq7046827WVOCHEkw
    nANhUgJlEBIABJIwL3K+4IcUALCHjfbItYZDSgJgkBiYPmBMAUAkkLPKs/BAyLgM
    wAQwOAAY2ByCaw4QAFQSoDEePJ6DmU1xInYZTw5nOEFFdgVUelkVDTIMd3AKFGQ1
    MgI2AwEmQW8APZ0gdRONAks5nhIFVVxdAAkUAS2pAVwFl7ITB4UqHb0XEQA7
}]

#----------------------------------------------------------------
# The code below create the main window, consisting of a menu bar and a text
# widget that explains how to use the program, plus lists all of the demos as
# hypertext items.
#----------------------------------------------------------------

menu .menuBar -tearoff 0

if {[tk windowingsystem] ne "aqua"} {
    # This is a tk-internal procedure to make i18n easier
    ::tk::AmpMenuArgs .menuBar add cascade -label [mc "&File"] \
	    -menu .menuBar.file
    menu .menuBar.file -tearoff 0
    ::tk::AmpMenuArgs .menuBar.file add command -label [mc "&About..."] \
	    -command {tkAboutDialog} -accelerator [mc "<F1>"]
    bind . <F1> {tkAboutDialog}
    .menuBar.file add sep
    if {[string match win* [tk windowingsystem]]} {
	# Windows doesn't usually have a Meta key
	::tk::AmpMenuArgs .menuBar.file add command -label [mc "&Quit"] \
		-command {exit} -accelerator [mc "Ctrl+Q"]
	bind . <[mc "Control-q"]> {exit}
    } else {
	::tk::AmpMenuArgs .menuBar.file add command -label [mc "&Quit"] \
		-command {exit} -accelerator [mc "Meta-Q"]
	bind . <[mc "Meta-q"]> {exit}
    }
}

. configure -menu .menuBar

ttk::frame .statusBar
ttk::label .statusBar.lab -text "   " -anchor w
if {[tk windowingsystem] eq "aqua"} {
    ttk::separator .statusBar.sep
    pack .statusBar.sep -side top -expand yes -fill x -pady 0
}
pack .statusBar.lab -side left -padx 2 -expand yes -fill both
if {[tk windowingsystem] ne "aqua"} {
    ttk::sizegrip .statusBar.foo
    pack .statusBar.foo -side left -padx 2
}
pack .statusBar -side bottom -fill x -pady 2

set textheight 30
catch {
    set textheight [expr {
	([winfo screenheight .] * 0.7) /
	[font metrics mainFont -displayof . -linespace]
    }]
}

ttk::frame .textFrame
scrollbar .s -orient vertical -command {.t yview} -takefocus 1
pack .s -in .textFrame -side right -fill y
text .t -yscrollcommand {.s set} -wrap word -width 70 -height $textheight \
	-font mainFont -setgrid 1 -highlightthickness 0 \
	-padx 4 -pady 2 -takefocus 0
pack .t -in .textFrame -expand y -fill both -padx 1
pack .textFrame -expand yes -fill both
if {[tk windowingsystem] eq "aqua"} {
    pack configure .statusBar.lab -padx {10 18} -pady {4 6}
    pack configure .statusBar -pady 0
    .t configure -padx 10 -pady 0
}

# Create a bunch of tags to use in the text widget, such as those for section
# titles and demo descriptions. Also define the bindings for tags.

.t tag configure title -font titleFont
.t tag configure subtitle -font titleFont
.t tag configure bold  -font boldFont
if {[tk windowingsystem] eq "aqua"} {
    .t tag configure title -spacing1 8
    .t tag configure subtitle -spacing3 3
}

# We put some "space" characters to the left and right of each demo
# description so that the descriptions are highlighted only when the mouse
# cursor is right over them (but not when the cursor is to their left or
# right).
#
.t tag configure demospace -lmargin1 1c -lmargin2 1c

if {[winfo depth .] == 1} {
    .t tag configure demo -lmargin1 1c -lmargin2 1c \
	-underline 1
    .t tag configure visited -lmargin1 1c -lmargin2 1c \
	-underline 1
    .t tag configure hot -background black -foreground white
} else {
    .t tag configure demo -lmargin1 1c -lmargin2 1c \
	-foreground blue -underline 1
    .t tag configure visited -lmargin1 1c -lmargin2 1c \
	-foreground #303080 -underline 1
    .t tag configure hot -foreground red -underline 1
}
.t tag bind demo <ButtonRelease-1> {
    invoke [.t index {@@%x,%y}]
}
set lastLine ""
.t tag bind demo <Enter> {
    set lastLine [.t index {@@%x,%y linestart}]
    .t tag add hot "$lastLine +1 chars" "$lastLine lineend -1 chars"
    .t config -cursor [::ttk::cursor link]
    showStatus [.t index {@@%x,%y}]
}
.t tag bind demo <Leave> {
    .t tag remove hot 1.0 end
    .t config -cursor [::ttk::cursor text]
    .statusBar.lab config -text ""
}
.t tag bind demo <Motion> {
    set newLine [.t index {@@%x,%y linestart}]
    if {$newLine ne $lastLine} {
	.t tag remove hot 1.0 end
	set lastLine $newLine

	set tags [.t tag names {@@%x,%y}]
	set i [lsearch -glob $tags demo-*]
	if {$i >= 0} {
	    .t tag add hot "$lastLine +1 chars" "$lastLine lineend -1 chars"
	}
    }
    showStatus [.t index {@@%x,%y}]
}

##############################################################################
# Create the text for the text widget.

# addFormattedText --
#
#	Add formatted text (but not hypertext) to the text widget after first
#	passing it through the message catalog to allow for localization.
#	Lines starting with @@@@ are formatting directives (insert title, insert
#	demo hyperlink, begin newline, or change style) and all other lines
#	are literal strings to be inserted. Substitutions are performed,
#	allowing processing pieces through the message catalog. Blank lines
#	are ignored.
#
proc addFormattedText {formattedText} {
    set style normal
    set isNL 1
    set demoCount 0
    set new 0
    foreach line [split $formattedText \n] {
	set line [string trim $line]
	if {$line eq ""} {
	    continue
	}
	if {[string match @@@@* $line]} {
	    set data [string range $line 2 end]
	    set key [lindex $data 0]
	    set values [lrange $data 1 end]
	    switch -exact -- $key {
		title {
		    .t insert end [mc $values]\n title \n normal
		}
		newline {
		    .t insert end \n $style
		    set isNL 1
		}
		subtitle {
		    .t insert end "\n" {} [mc $values] subtitle \
			    " \n " demospace
		    set demoCount 0
		}
		demo {
		    set description [lassign $values name]
		    .t insert end "[incr demoCount]. [mc $description]" \
			    [list demo demo-$name]
		    if {$new} {
			.t image create end -image ::img::new -padx 5
			set new 0
		    }
		    .t insert end " \n " demospace
		}
		new {
		    set new 1
		}
		default {
		    set style $key
		}
	    }
	    continue
	}
	if {!$isNL} {
	    .t insert end " " $style
	}
	set isNL 0
	.t insert end [mc $line] $style
    }
}

addFormattedText {
    @@@@title	Tk Widget Demonstrations

    This application provides a front end for several short scripts
    that demonstrate what you can do with Tk widgets.  Each of the
    numbered lines below describes a demonstration; you can click on
    it to invoke the demonstration.  Once the demonstration window
    appears, you can click the
    @@@@bold
    See Code
    @@@@normal
    button to see the Tcl/Tk code that created the demonstration.  If
    you wish, you can edit the code and click the
    @@@@bold
    Rerun Demo
    @@@@normal
    button in the code window to reinvoke the demonstration with the
    modified code.
    @@@@newline

    @@@@subtitle	Labels, buttons, checkbuttons, and radiobuttons
    @@@@demo label	Labels (text and bitmaps)
    @@@@demo unicodeout	Labels and UNICODE text
    @@@@demo button	Buttons
    @@@@demo check	Check-buttons (select any of a group)
    @@@@demo radio	Radio-buttons (select one of a group)
    @@@@demo puzzle	A 15-puzzle game made out of buttons
    @@@@demo icon		Iconic buttons that use bitmaps
    @@@@demo image1	Two labels displaying images
    @@@@demo image2	A simple user interface for viewing images
    @@@@demo labelframe	Labelled frames
    @@@@demo ttkbut	The simple Themed Tk widgets

    @@@@subtitle	Listboxes and Trees
    @@@@demo states	The 50 states
    @@@@demo colors	Colors: change the color scheme for the application
    @@@@demo sayings	A collection of famous and infamous sayings
    @@@@demo mclist	A multi-column list of countries
    @@@@demo tree		A directory browser tree

    @@@@subtitle	Entries, Spin-boxes and Combo-boxes
    @@@@demo entry1	Entries without scrollbars
    @@@@demo entry2	Entries with scrollbars
    @@@@demo entry3	Validated entries and password fields
    @@@@demo spin		Spin-boxes
    @@@@demo combo	Combo-boxes
    @@@@demo form		Simple Rolodex-like form

    @@@@subtitle	Text
    @@@@demo text		Basic editable text
    @@@@demo style	Text display styles
    @@@@demo bind		Hypertext (tag bindings)
    @@@@demo twind	A text widget with embedded windows and other features
    @@@@demo search	A search tool built with a text widget
    @@@@demo textpeer	Peering text widgets

    @@@@subtitle	Canvases
    @@@@demo items	The canvas item types
    @@@@demo plot		A simple 2-D plot
    @@@@demo ctext	Text items in canvases
    @@@@demo arrow	An editor for arrowheads on canvas lines
    @@@@demo ruler	A ruler with adjustable tab stops
    @@@@demo floor	A building floor plan
    @@@@demo cscroll	A simple scrollable canvas
    @@@@demo knightstour  A Knight's tour of the chess board

    @@@@subtitle	Scales and Progress Bars
    @@@@demo hscale	Horizontal scale
    @@@@demo vscale	Vertical scale
    @@@@new
    @@@@demo ttkscale	Themed scale linked to a label with traces
    @@@@demo ttkprogress	Progress bar

    @@@@subtitle	Paned Windows and Notebooks
    @@@@demo paned1	Horizontal paned window
    @@@@demo paned2	Vertical paned window
    @@@@demo ttkpane	Themed nested panes
    @@@@demo ttknote	Notebook widget

    @@@@subtitle	Menus and Toolbars
    @@@@demo menu		Menus and cascades (sub-menus)
    @@@@demo menubu	Menu-buttons
    @@@@demo ttkmenu	Themed menu buttons
    @@@@demo toolbar	Themed toolbar

    @@@@subtitle	Common Dialogs
    @@@@demo msgbox	Message boxes
    @@@@demo filebox	File selection dialog
    @@@@demo clrpick	Color picker
    @@@@demo fontchoose	Font selection dialog

    @@@@subtitle	Animation
    @@@@demo anilabel	Animated labels
    @@@@demo aniwave	Animated wave
    @@@@demo pendulum	Pendulum simulation
    @@@@demo goldberg	A celebration of Rube Goldberg

    @@@@subtitle	Miscellaneous
    @@@@demo bitmap	The built-in bitmaps
    @@@@demo dialog1	A dialog box with a local grab
    @@@@demo dialog2	A dialog box with a global grab
}

##############################################################################

.t configure -state disabled
focus .s

# addSeeDismiss --
# Add "See Code" and "Dismiss" button frame, with optional "See Vars"
#
# Arguments:
# w -		The name of the frame to use.

proc addSeeDismiss {w show {vars {}} {extra {}}} {
    ## See Code / Dismiss buttons
    ttk::frame $w
    ttk::separator $w.sep
    #ttk::frame $w.sep -height 2 -relief sunken
    grid $w.sep -columnspan 4 -row 0 -sticky ew -pady 2
    ttk::button $w.dismiss -text [mc "Dismiss"] \
	-image ::img::delete -compound left \
	-command [list destroy [winfo toplevel $w]]
    ttk::button $w.code -text [mc "See Code"] \
	-image ::img::view -compound left \
	-command [list showCode $show]
    set buttons [list x $w.code $w.dismiss]
    if {[llength $vars]} {
	ttk::button $w.vars -text [mc "See Variables"] \
	    -image ::img::view -compound left \
	    -command [concat [list showVars $w.dialog] $vars]
	set buttons [linsert $buttons 1 $w.vars]
    }
    if {$extra ne ""} {
	set buttons [linsert $buttons 1 [uplevel 1 $extra]]
    }
    grid {*}$buttons -padx 4 -pady 4
    grid columnconfigure $w 0 -weight 1
    if {[tk windowingsystem] eq "aqua"} {
	foreach b [lrange $buttons 1 end] {$b configure -takefocus 0}
	grid configure $w.sep -pady 0
	grid configure {*}$buttons -pady {10 12}
	grid configure [lindex $buttons 1] -padx {16 4}
	grid configure [lindex $buttons end] -padx {4 18}
    }
    return $w
}

# positionWindow --
# This procedure is invoked by most of the demos to position a new demo
# window.
#
# Arguments:
# w -		The name of the window to position.

proc positionWindow w {
    wm geometry $w +300+300
}

# showVars --
# Displays the values of one or more variables in a window, and updates the
# display whenever any of the variables changes.
#
# Arguments:
# w -		Name of new window to create for display.
# args -	Any number of names of variables.

proc showVars {w args} {
    catch {destroy $w}
    toplevel $w
    if {[tk windowingsystem] eq "x11"} {wm attributes $w -type dialog}
    wm title $w [mc "Variable values"]

    set b [ttk::frame $w.frame]
    grid $b -sticky news
    set f [ttk::labelframe $b.title -text [mc "Variable values:"]]
    foreach var $args {
	ttk::label $f.n$var -text "$var:" -anchor w
	ttk::label $f.v$var -textvariable $var -anchor w
	grid $f.n$var $f.v$var -padx 2 -pady 2 -sticky w
    }
    ttk::button $b.ok -text [mc "OK"] \
	-command [list destroy $w] -default active
    bind $w <Return> [list $b.ok invoke]
    bind $w <Escape> [list $b.ok invoke]

    grid $f -sticky news -padx 4
    grid $b.ok -sticky e -padx 4 -pady {6 4}
    if {[tk windowingsystem] eq "aqua"} {
	$b.ok configure -takefocus 0
	grid configure $b.ok -pady {10 12} -padx {16 18}
	grid configure $f -padx 10 -pady {10 0}
    }
    grid columnconfig $f 1 -weight 1
    grid rowconfigure $f 100 -weight 1
    grid columnconfig $b 0 -weight 1
    grid rowconfigure $b 0 -weight 1
    grid columnconfig $w 0 -weight 1
    grid rowconfigure $w 0 -weight 1
}

# invoke --
# This procedure is called when the user clicks on a demo description. It is
# responsible for invoking the demonstration.
#
# Arguments:
# index -	The index of the character that the user clicked on.

proc invoke index {
    global tk_demoDirectory
    set tags [.t tag names $index]
    set i [lsearch -glob $tags demo-*]
    if {$i < 0} {
	return
    }
    set cursor [.t cget -cursor]
    .t configure -cursor [::ttk::cursor busy]
    update
    set demo [string range [lindex $tags $i] 5 end]
    uplevel 1 [list source [file join $tk_demoDirectory $demo.tcl]]
    update
    .t configure -cursor $cursor

    .t tag add visited "$index linestart +1 chars" "$index lineend -1 chars"
}

# showStatus --
#
#	Show the name of the demo program in the status bar. This procedure is
#	called when the user moves the cursor over a demo description.
#
proc showStatus index {
    set tags [.t tag names $index]
    set i [lsearch -glob $tags demo-*]
    set cursor [.t cget -cursor]
    if {$i < 0} {
	.statusBar.lab config -text " "
	set newcursor [::ttk::cursor text]
    } else {
	set demo [string range [lindex $tags $i] 5 end]
	.statusBar.lab config -text [mc "Run the \"%s\" sample program" $demo]
	set newcursor [::ttk::cursor link]
    }
    if {$cursor ne $newcursor} {
	.t config -cursor $newcursor
    }
}

# evalShowCode --
#
# Arguments:
# w -		Name of text widget containing code to eval

proc evalShowCode {w} {
    set code [$w get 1.0 end-1c]
    uplevel #0 $code
}

# showCode --
# This procedure creates a toplevel window that displays the code for a
# demonstration and allows it to be edited and reinvoked.
#
# Arguments:
# w -		The name of the demonstration's window, which can be used to
#		derive the name of the file containing its code.

proc showCode w {
    global tk_demoDirectory
    set file [string range $w 1 end].tcl
    set top .code
    if {![winfo exists $top]} {
	toplevel $top
	if {[tk windowingsystem] eq "x11"} {wm attributes $top -type dialog}

	set t [frame $top.f]
	set text [text $t.text -font fixedFont -height 24 -wrap word \
		      -xscrollcommand [list $t.xscroll set] \
		      -yscrollcommand [list $t.yscroll set] \
		      -setgrid 1 -highlightthickness 0 -pady 2 -padx 3]
	scrollbar $t.xscroll -command [list $t.text xview] -orient horizontal
	scrollbar $t.yscroll -command [list $t.text yview] -orient vertical

	grid $t.text $t.yscroll -sticky news
	#grid $t.xscroll
	grid rowconfigure $t 0 -weight 1
	grid columnconfig $t 0 -weight 1

	set btns [ttk::frame $top.btns]
	ttk::separator $btns.sep
	grid $btns.sep -columnspan 4 -row 0 -sticky ew -pady 2
	ttk::button $btns.dismiss -text [mc "Dismiss"] \
	    -default active -command [list destroy $top] \
	    -image ::img::delete -compound left
	ttk::button $btns.print   -text [mc "Print Code"] \
	    -command [list printCode $text $file] \
	    -image ::img::print -compound left
	ttk::button $btns.rerun   -text [mc "Rerun Demo"] \
	    -command [list evalShowCode $text] \
	    -image ::img::refresh -compound left
	set buttons [list x $btns.rerun $btns.print $btns.dismiss]
	grid {*}$buttons -padx 4 -pady 4
	grid columnconfigure $btns 0 -weight 1
	if {[tk windowingsystem] eq "aqua"} {
	    foreach b [lrange $buttons 1 end] {$b configure -takefocus 0}
	    grid configure $btns.sep -pady 0
	    grid configure {*}$buttons -pady {10 12}
	    grid configure [lindex $buttons 1] -padx {16 4}
	    grid configure [lindex $buttons end] -padx {4 18}
	}
	grid $t    -sticky news
	grid $btns -sticky ew
	grid rowconfigure $top 0 -weight 1
	grid columnconfig $top 0 -weight 1

	bind $top <Return> {
	    if {[winfo class %W] ne "Text"} { .code.btns.dismiss invoke }
	}
	bind $top <Escape> [bind $top <Return>]
    } else {
	wm deiconify $top
	raise $top
    }
    wm title $top [mc "Demo code: %s" [file join $tk_demoDirectory $file]]
    wm iconname $top $file
    set id [open [file join $tk_demoDirectory $file]]
    $top.f.text delete 1.0 end
    $top.f.text insert 1.0 [read $id]
    $top.f.text mark set insert 1.0
    close $id
}

# printCode --
# Prints the source code currently displayed in the See Code dialog. Much
# thanks to Arjen Markus for this.
#
# Arguments:
# w -		Name of text widget containing code to print
# file -		Name of the original file (implicitly for title)

proc printCode {w file} {
    set code [$w get 1.0 end-1c]

    set dir "."
    if {[info exists ::env(HOME)]} {
	set dir "$::env(HOME)"
    }
    if {[info exists ::env(TMP)]} {
	set dir $::env(TMP)
    }
    if {[info exists ::env(TEMP)]} {
	set dir $::env(TEMP)
    }

    set filename [file join $dir "tkdemo-$file"]
    set outfile [open $filename "w"]
    puts $outfile $code
    close $outfile

    switch -- $::tcl_platform(platform) {
	unix {
	    if {[catch {exec lp -c $filename} msg]} {
		tk_messageBox -title "Print spooling failure" \
			-message "Print spooling probably failed: $msg"
	    }
	}
	windows {
	    if {[catch {PrintTextWin32 $filename} msg]} {
		tk_messageBox -title "Print spooling failure" \
			-message "Print spooling probably failed: $msg"
	    }
	}
	default {
	    tk_messageBox -title "Operation not Implemented" \
		    -message "Wow! Unknown platform: $::tcl_platform(platform)"
	}
    }

    #
    # Be careful to throw away the temporary file in a gentle manner ...
    #
    if {[file exists $filename]} {
	catch {file delete $filename}
    }
}

# PrintTextWin32 --
#    Print a file under Windows using all the "intelligence" necessary
#
# Arguments:
# filename -		Name of the file
#
# Note:
# Taken from the Wiki page by Keith Vetter, "Printing text files under
# Windows".
# Note:
# Do not execute the command in the background: that way we can dispose of the
# file smoothly.
#
proc PrintTextWin32 {filename} {
    package require registry
    set app [auto_execok notepad.exe]
    set pcmd "$app /p %1"
    catch {
	set app [registry get {HKEY_CLASSES_ROOT\.txt} {}]
	set pcmd [registry get \
		{HKEY_CLASSES_ROOT\\$app\\shell\\print\\command} {}]
    }

    regsub -all {%1} $pcmd $filename pcmd
    puts $pcmd

    regsub -all {\\} $pcmd {\\\\} pcmd
    set command "[auto_execok start] /min $pcmd"
    eval exec $command
}

# tkAboutDialog --
#
#	Pops up a message box with an "about" message
#
proc tkAboutDialog {} {
    tk_messageBox -icon info -type ok -title [mc "About Widget Demo"] \
	    -message [mc "Tk widget demonstration application"] -detail \
"[mc "Copyright \u00a9 %s" {1996-1997 Sun Microsystems, Inc.}]
[mc "Copyright \u00a9 %s" {1997-2000 Ajuba Solutions, Inc.}]
[mc "Copyright \u00a9 %s" {2001-2009 Donal K. Fellows}]
[mc "Copyright \u00a9 %s" {2002-2007 Daniel A. Steffen}]"
}

# Local Variables:
# mode: tcl
# End:
@


1.59
log
@TIP #359: Extended window manager hints support for X11.

Modern unix window managers use a set of window properties to give
hints as to the purpose of a toplevel window. They then use these
hints to apply various animation and decoration options based on the
type (dialog, menu, tooltip and more).

This patch adds a [wm attributes $w -type] option to control and read
the type hint and makes use of this for the ttk::combobox and the
dialogs raised from the Tk library scripts.

Signed-off-by: Pat Thoyts <patthoyts@@users.sourceforge.net>
@
text
@d13 1
a13 1
# RCS: @@(#) $Id: widget,v 1.58 2009/12/10 11:48:38 dkf Exp $
d714 4
a717 4
"[mc {Copyright (c) %s} {1996-1997 Sun Microsystems, Inc.}]
[mc {Copyright (c) %s} {1997-2000 Ajuba Solutions, Inc.}]
[mc {Copyright (c) %s} {2001-2009 Donal K. Fellows}]
[mc {Copyright (c) %s} {2002-2007 Daniel A. Steffen}]"
@


1.58
log
@Added demo of ttk::scale widget.
@
text
@d13 1
a13 1
# RCS: @@(#) $Id: widget,v 1.57 2009/04/10 16:40:03 das Exp $
d461 1
d563 1
@


1.57
log
@	* library/demos/widget: GOOBE: use ttk::cursor
@
text
@d13 1
a13 1
# RCS: @@(#) $Id: widget,v 1.56 2009/04/08 12:28:32 dkf Exp $
d360 2
@


1.56
log
@Remove 'NEW' tags from sub-demos.
@
text
@d13 1
a13 1
# RCS: @@(#) $Id: widget,v 1.55 2009/03/25 23:27:14 nijtmans Exp $
d201 1
a201 1
    .t config -cursor hand2
d206 1
a206 1
    .t config -cursor xterm
d504 1
a504 1
    .t configure -cursor watch
d525 1
a525 1
	set newcursor xterm
d529 1
a529 1
	set newcursor hand2
@


1.55
log
@bring doc and demos in line with http://wiki.tcl.tk/812
@
text
@d13 1
a13 1
# RCS: @@(#) $Id: widget,v 1.54 2008/12/20 01:33:59 das Exp $
a321 1
    @@@@new
a327 1
    @@@@new
a328 1
    @@@@new
a335 1
    @@@@new
a344 1
    @@@@new
a354 1
    @@@@new
a359 1
    @@@@new
a364 1
    @@@@new
a365 1
    @@@@new
a370 1
    @@@@new
a371 1
    @@@@new
a377 1
    @@@@new
a380 1
    @@@@new
a381 1
    @@@@new
a382 1
    @@@@new
a383 1
    @@@@new
d712 1
a712 1
[mc {Copyright (c) %s} {2001-2007 Donal K. Fellows}]
@


1.54
log
@mark fontchooser demo as new
@
text
@d3 1
a3 1
exec wish "$0" "$@@"
d13 1
a13 1
# RCS: @@(#) $Id: widget,v 1.53 2008/12/12 02:02:35 patthoyts Exp $
@


1.53
log
@Added a simple fontchooser demo to the common dialogs section.
@
text
@d13 1
a13 1
# RCS: @@(#) $Id: widget,v 1.52 2008/12/11 18:13:08 jenglish Exp $
d389 1
@


1.52
log
@library/demos/*.tcl: Omit contraindicated [package require Ttk].
Remove logic that switches [ttk::scrollbar]s to [tk::scrollbar]s
based on [tk windowingsystem]; this is already handled in
library/ttk/scrollbar.tcl.
@
text
@d13 1
a13 1
# RCS: @@(#) $Id: widget,v 1.51 2008/03/11 22:30:17 das Exp $
d389 1
@


1.51
log
@	* library/demos/knightstour.tcl:	Aqua GOOBE.
	* library/demos/widget:
@
text
@d13 1
a13 1
# RCS: @@(#) $Id: widget,v 1.50 2008/02/29 22:48:07 patthoyts Exp $
a17 1
package require Ttk
@


1.51.2.1
log
@	* library/demos/widget: GOOBE: use ttk::cursor
@
text
@d13 1
a13 1
# RCS: @@(#) $Id: widget,v 1.51 2008/03/11 22:30:17 das Exp $
d202 1
a202 1
    .t config -cursor [::ttk::cursor link]
d207 1
a207 1
    .t config -cursor [::ttk::cursor text]
d519 1
a519 1
    .t configure -cursor [::ttk::cursor busy]
d540 1
a540 1
	set newcursor [::ttk::cursor text]
d544 1
a544 1
	set newcursor [::ttk::cursor link]
@


1.51.2.2
log
@Added demo of ttk::scale widget.
@
text
@d13 1
a13 1
# RCS: @@(#) $Id: widget,v 1.51.2.1 2009/04/10 16:40:12 das Exp $
a367 2
    @@@@demo ttkscale	Themed scale linked to a label with traces
    @@@@new
@


1.51.2.3
log
@TIP #359: Extended window manager hints support for X11.
@
text
@d13 1
a13 1
# RCS: @@(#) $Id: widget,v 1.51.2.2 2009/12/10 11:44:07 dkf Exp $
a475 1
    if {[tk windowingsystem] eq "x11"} {wm attributes $w -type dialog}
a576 1
	if {[tk windowingsystem] eq "x11"} {wm attributes $top -type dialog}
@


1.50
log
@Added a Knights tour canvas demo.
@
text
@d13 1
a13 1
# RCS: @@(#) $Id: widget,v 1.49 2007/12/13 15:27:07 dgp Exp $
d361 1
@


1.49
log
@merge stable branch onto HEAD
@
text
@d13 1
a13 1
# RCS: @@(#) $Id: widget,v 1.29.2.8 2007/12/06 07:00:05 dgp Exp $
d361 1
@


1.48
log
@	* library/demos/widget: reduce start size to 70% of screenheight
	from sh-200 for a more reasonable size.
@
text
@d13 1
a13 1
# RCS: @@(#) $Id: widget,v 1.47 2007/11/04 10:38:09 das Exp $
@


1.47
log
@	* library/demos/mclist.tcl:	Aqua GOOBE.
	* library/demos/tree.tcl:
	* library/demos/ttknote.tcl:
	* library/demos/widget:
@
text
@d13 1
a13 1
# RCS: @@(#) $Id: widget,v 1.46 2007/11/02 23:53:07 dkf Exp $
d145 1
a145 1
	([winfo screenheight .] - 200) /
@


1.46
log
@Tinkering with the default demo widget height
@
text
@d13 1
a13 1
# RCS: @@(#) $Id: widget,v 1.45 2007/11/02 23:48:11 dkf Exp $
d106 1
a106 6
# On the Mac use the special .apple menu for the about item
if {[tk windowingsystem] eq "aqua"} {
    .menuBar add cascade -menu .menuBar.apple
    menu .menuBar.apple -tearoff 0
    .menuBar.apple add command -label [mc "About..."] -command {aboutBox}
} else {
d112 2
a113 2
	    -command {aboutBox} -accelerator [mc "<F1>"]
    bind . <F1> {aboutBox}
d716 1
a716 1
# aboutBox --
d720 1
a720 1
proc aboutBox {} {
@


1.45
log
@Added a demo of how to do a multi-column sortable listbox.
@
text
@d13 1
a13 1
# RCS: @@(#) $Id: widget,v 1.44 2007/11/01 11:34:00 das Exp $
d148 6
a153 2
catch {set textheight [expr {([winfo screenheight .] - 100) / 
	[font metrics mainFont -displayof . -linespace]}]}
@


1.44
log
@	* library/demos/widget:	increase height of main window text widget to
				use more of the available vertical space.
@
text
@d13 1
a13 1
# RCS: @@(#) $Id: widget,v 1.43 2007/10/31 16:17:57 dkf Exp $
d332 2
@


1.43
log
@D'uh, now make the code more idiomatic!
@
text
@d13 1
a13 1
# RCS: @@(#) $Id: widget,v 1.42 2007/10/31 16:17:06 dkf Exp $
d147 4
d154 3
a156 3
text .t -yscrollcommand {.s set}  -wrap word  -width 70  -height 30 \
	-font mainFont  -setgrid 1  -highlightthickness 0 \
	-padx 4  -pady 2  -takefocus 0
@


1.42
log
@Minor GOOBE boost on Unix and OSX
@
text
@d13 1
a13 1
# RCS: @@(#) $Id: widget,v 1.41 2007/10/30 01:57:55 hobbs Exp $
d717 1
a717 1
	    -message "[mc {Tk widget demonstration application}]" -detail \
@


1.41
log
@	* tests/listbox.test, tests/panedwindow.test, tests/scrollbar.test:
	* library/bgerror.tcl, library/dialog.tcl, library/listbox.tcl:
	* library/msgbox.tcl, library/optMenu.tcl, library/tclIndex:
	* library/tkfbox.tcl, library/demos/floor.tcl, library/demos/rmt:
	* library/demos/tcolor, library/demos/text.tcl:
	* library/demos/twind.tcl, library/demos/widget: Buh-bye Motif look
	* library/ttk/fonts.tcl:    Update of Tk default look in 8.5
	* macosx/tkMacOSXDefault.h: Trims border sizes, cleaner X11 look
	* unix/tkUnixDefault.h:     with minor modifications for Win32/Aqua.
	* win/tkWinDefault.h:       Uses Tk*Font definitions throughout for
	* win/tkWinFont.c:          classic widgets. [Bug #1820344]
	* library/obsolete.tcl (::tk::classic::restore): This restores
	changes made to defaults in 8.5 using the 'option' command,
	segmented into logical groups.
@
text
@d13 1
a13 1
# RCS: @@(#) $Id: widget,v 1.40 2007/10/23 06:31:16 das Exp $
d717 2
a718 3
	    -message "[mc {Tk widget demonstration application}]

[mc {Copyright (c) %s} {1996-1997 Sun Microsystems, Inc.}]
@


1.40
log
@	* library/demos/combo.tcl:	Aqua GOOBE.
	* library/demos/toolbar.tcl:
	* library/demos/tree.tcl:
	* library/demos/ttknote.tcl:
	* library/demos/ttkprogress.tcl:
	* library/demos/widget:
@
text
@d13 1
a13 1
# RCS: @@(#) $Id: widget,v 1.39 2007/10/22 14:21:10 dkf Exp $
d38 1
a38 1
        # FIX ME: the following tecnique of cloning the font to copy it works
d148 1
a148 2
scrollbar .s -orient vertical -command {.t yview} -highlightthickness 0 \
    -takefocus 1 -bd 1
d152 1
a152 1
	-padx 4  -pady 2  -takefocus 0 -bd 1
d158 1
a158 2
    .s configure -bd 0
    .t configure -padx 10 -pady 0 -bd 0
d264 1
a264 1
		    .t insert end "[incr demoCount]. [mc $description]." \
d477 1
a477 1
    ttk::button $b.ok -width 8 -text [mc "OK"] \
d515 1
a515 1
    uplevel [list source [file join $tk_demoDirectory $demo.tcl]]
d570 1
a570 1
	set text [text $t.text -font fixedFont -height 30 -wrap word -bd 1 \
d574 2
a575 7
	scrollbar $t.xscroll -command [list $t.text xview] \
	    -highlightthickness 0 -orient horizontal -bd 1
	scrollbar $t.yscroll -command [list $t.text yview] \
	    -highlightthickness 0 -orient vertical -bd 1
	if {[tk windowingsystem] eq "aqua"} {
	    foreach i [list $t.text $t.xscroll $t.yscroll] {$i configure -bd 0}
	}
@


1.39
log
@More widget demos!
@
text
@d13 1
a13 1
# RCS: @@(#) $Id: widget,v 1.38 2007/10/21 14:51:47 das Exp $
d379 1
a379 1
    @@@@demo toolbar	Detachable toolbar
@


1.38
log
@	* library/demos/ttkmenu.tcl:	Aqua GOOBE.
	* library/demos/ttkpane.tcl:
	* library/demos/widget:
@
text
@d13 1
a13 1
# RCS: @@(#) $Id: widget,v 1.37 2007/10/18 14:34:06 dkf Exp $
d88 3
a90 1
image create photo ::img::new -format GIF -data {
d96 1
a96 1
}
d118 1
d120 10
a129 4
    ::tk::AmpMenuArgs .menuBar.file add command -label [mc "&Quit"] \
	    -command {exit} -accelerator [mc "Meta-Q"]
    bind . <[mc "Meta-q"]> {exit}
    bind . <F1>     {aboutBox}
d233 3
a235 1
#	are literal strings to be inserted. Blank lines are ignored.
d242 1
a242 1
    foreach line [split [mc $formattedText] \n] {
d260 2
a261 1
		    .t insert end "\n" {} [mc $values] subtitle " \n " demospace
d287 1
a287 1
	.t insert end $line $style
d325 1
a325 1
    @@@@subtitle	Listboxes
d329 2
d332 1
a332 1
    @@@@subtitle	Entries and Spin-boxes
d337 2
d359 1
a359 1
    @@@@subtitle	Scales
d362 2
d365 1
a365 1
    @@@@subtitle	Paned Windows
d370 2
d373 1
a373 1
    @@@@subtitle	Menus
d378 2
d724 1
a724 1
	-message "[mc {Tk widget demonstration application}]
@


1.37
log
@More Ttk demos
@
text
@d13 1
a13 1
# RCS: @@(#) $Id: widget,v 1.36 2007/10/17 20:22:41 das Exp $
d48 3
@


1.36
log
@icon beautification
@
text
@d13 1
a13 1
# RCS: @@(#) $Id: widget,v 1.35 2007/10/17 18:55:05 das Exp $
d347 2
d353 2
@


1.35
log
@more GOOBE
@
text
@d13 1
a13 1
# RCS: @@(#) $Id: widget,v 1.34 2007/10/17 18:21:49 das Exp $
d62 2
a63 2
    R0lGODlhEAAQAPEAMf///ypnKv8A/wAAACH5BAEAAAIALAAAAAAQABAAAAI6lIap
    xgcPH2ouwgFGwzHIxHBQ4F3hSJKmwZXqWrmWxj7lKJ2dndcon9EBUq+gz3brVXAR
d68 3
a70 4
    R0lGODlhEAAQAPMAMf////8A/8DAwAwMDNnZ2SYmJmZmZgAAAAAAAAAAAAAAAAAA
    AAAAAAAAAAAAAAAAACH5BAEAAAEALAAAAAAQABAAAARP8MlJX7j3gc25xYFGENxg
    DmDYmUIrmJgIDEIHGAGqbrRd5BlezXdBaWbDzg947BGZQhtgaSwlNz+dzMnBaVc0
    16k6Kp2KpqMU8MkNKvBUBAA7
d74 2
a75 2
    R0lGODlhEAAQAPEAMf///4QAAP8A/wAAACH5BAEAAAIALAAAAAAQABAAAAIjlI+p
    mxEs3HGyPUSvqYpuvWQg40FfSVacBa5nN6JYDI3mzRQAOw==
d79 3
a81 3
    R0lGODlhEAAQAPMAMf///1dBglfYAHNkl4l+qp2Vuq+pyrOzs8C82f8A/wAAAAAA
    AAAAAAAAAAAAAAAAACH5BAEAAAkALAAAAAAQABAAAARGMMlJK1U4KzsV+ODGeUd5
    fGLlgeEImCWQXmx7aXgmKUjv/76NwkAsGgUCg7DAbDqbQoJ0Sp0KB9isNisMeL/g
d86 5
a90 4
    R0lGODlhHgAOAPMAMf////8AAP//AP8A/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    AAAAAAAAAAAAAAAAACH5BAEAAAMALAAAAAAeAA4AAARhcMhJq71XTC2F91uYBZpA
    DmagnmZ5ViZBBnJM3DU91zAt67EVKajiUWzF3eqjS3I2OlkONyQCe1Jgsxq9Hps3
    pYqZNUJ/Yeuwa+5op7hasA11uYSc1isjQn2eKIEYg4QXEQA7
d254 1
a254 1
			.t image create end -image ::img::new
@


1.34
log
@	* library/demos/widget:		Aqua GOOBE, cleanup icons.
	* library/demos/ttkbut.tcl:

	* library/demos/button.tcl:	restore setting of button
					highlightbackground on Aqua.
@
text
@d13 1
a13 1
# RCS: @@(#) $Id: widget,v 1.33 2007/10/17 14:59:27 dkf Exp $
d551 3
@


1.33
log
@Added demo of basic Ttk widgets.
@
text
@d13 1
a13 1
# RCS: @@(#) $Id: widget,v 1.32 2007/10/16 15:15:19 dkf Exp $
d61 23
a83 46
image create photo ::img::refresh -height 16 -format GIF -data {
    R0lGODlhEAAQAPMAAMz/zCpnKdb/1z9mPypbKBtLGy9NMPL/9Or+6+P+4j1Y
    PwQKBP7//xMLFAYBCAEBASH5BAEAAAAALAAAAAAQABAAAwR0EAD3Gn0Vyw0e
    ++CncU7IIAezMA/nhUqSLJizvSdCEEjy2ZIV46AwDAoDHwPYGSoEiUJAAGJ6
    EDHBNCFINW5OqABKSFk/B9lUa94IDwIFgewFMwQDQwCZQCztTgM9Sl8SOEMG
    KSAthiaOjBMPDhQONBiXABEAOw==
}

image create photo ::img::view -height 16 -format GIF -data {
    R0lGODlhEAAQAPMAAMz/zP///8DAwICAgH9/fwAAAAAAAAAAAAAAAAAAAAAA
    AAAAAAAAAAAAAAAAAAAAACH5BAEAAAAALAAAAAAQABAAAwRIcMhJB7h3hM33
    KFjWdQQYap1QrCaGBmrRrS4nj5b53jOgbwXBKGACoYLDIuAoHCmZyYvR1rT5
    RMAq8LqcIYGsrjPsW1XOmFUEADs=
}

image create photo ::img::delete -height 16 -format GIF -data {
    R0lGODlhEAAOAKEAAIQAAO/n3v///////yH5BAEKAAIALAAAAAAQAA4AAAIm
    lI9pAKHbIHNoVhYhTdjlJ2AWKG2g+CldmB6rxo2uybYhbS80eRQAOw==
}

image create photo ::img::print -height 19 -format GIF -data {
    R0lGODlhGgATAPcAACEQOTEpQjEpUkIpc0IxY0I5c0oxjEo5SlJCY1JCe1JK
    UlpChFpCjFpGkFpSc1paa2NKc2NKnGNja2tapWtjc29KnHNanHNjc3NjrXNr
    jHNrnHNzc3tjpXtrtXtzhICAgIRzvYSEjIZzqox7tYyEnIyMjJSEtZSEvZSM
    lJyMtZyMvZyUlJyUrZyUvZycnKWctaWlpa2czq2lzrWtvbWtzrW1tb21xr21
    1sa9zs693s7OztbO3tbO597W1t7W7+fe7+fn5////+/n7+/v7+/v9////wAA
    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    AAAAAAAAAAAAAAAAAAAAACH5BAEAAEEALAAAAAAaABMAQAj/AIMIHBhkg0GC
    CBMGIQEiQgseQT4oeCBBAokgRYYQ0JBixg8hRIiUUEBBYYmTByBwiCBCRYwH
    CxY8cKFw4AogRXLqLAJkQ80gCBBg3BkxZswTNGh4MGqgQQUMJRHCwMkTSE+D
    Pn8eCKBhxIMhO3ei2OHDBw6sWSlMMMoWgwwfMDZI8GBjx44NARZwEGGi5MkS
    PcIWKRGz5YgLbAco+KkQBQoJIRgjdGEVq+SaJajqtNrzMgsPCmoIzqmDgmWE
    KOBuUKAAwYabYTfs4OHjY0giGyhk4MAWRI4eKyRQqPgggYUXPH4A+XBAgwoK
    DiIsCFxjA9sFEVQQCRJCAYAFDJxiKhAxvMTonEFimrhhYinTBgWiCvxLNX3M
    DkkpsKV5OYhjBxCMYAICAigUEAA7
d87 5
a91 40
    R0lGODlhHgAOAPcAAAAAAIAAAACAAICAAAAAgIAAgACAgICAgMDAwP8AAAD/
    AP//AAAA//8A/wD//////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    AAAAMwAAZgAAmQAAzAAA/wAzAAAzMwAzZgAzmQAzzAAz/wBmAABmMwBmZgBm
    mQBmzABm/wCZAACZMwCZZgCZmQCZzACZ/wDMAADMMwDMZgDMmQDMzADM/wD/
    AAD/MwD/ZgD/mQD/zAD//zMAADMAMzMAZjMAmTMAzDMA/zMzADMzMzMzZjMz
    mTMzzDMz/zNmADNmMzNmZjNmmTNmzDNm/zOZADOZMzOZZjOZmTOZzDOZ/zPM
    ADPMMzPMZjPMmTPMzDPM/zP/ADP/MzP/ZjP/mTP/zDP//2YAAGYAM2YAZmYA
    mWYAzGYA/2YzAGYzM2YzZmYzmWYzzGYz/2ZmAGZmM2ZmZmZmmWZmzGZm/2aZ
    AGaZM2aZZmaZmWaZzGaZ/2bMAGbMM2bMZmbMmWbMzGbM/2b/AGb/M2b/Zmb/
    mWb/zGb//5kAAJkAM5kAZpkAmZkAzJkA/5kzAJkzM5kzZpkzmZkzzJkz/5lm
    AJlmM5lmZplmmZlmzJlm/5mZAJmZM5mZZpmZmZmZzJmZ/5nMAJnMM5nMZpnM
    mZnMzJnM/5n/AJn/M5n/Zpn/mZn/zJn//8wAAMwAM8wAZswAmcwAzMwA/8wz
    AMwzM8wzZswzmcwzzMwz/8xmAMxmM8xmZsxmmcxmzMxm/8yZAMyZM8yZZsyZ
    mcyZzMyZ/8zMAMzMM8zMZszMmczMzMzM/8z/AMz/M8z/Zsz/mcz/zMz///8A
    AP8AM/8AZv8Amf8AzP8A//8zAP8zM/8zZv8zmf8zzP8z//9mAP9mM/9mZv9m
    mf9mzP9m//+ZAP+ZM/+ZZv+Zmf+ZzP+Z///MAP/MM//MZv/Mmf/MzP/M////
    AP//M///Zv//mf//zP///yH5BAEAABAALAAAAAAeAA4AAAiWAMMJFPhvYEGC
    /xIeDLdw4UCC+gr+i8hQn0WLEilOdAiRW0R9HidyGznyY0iQFA2CROGRG8uV
    KGK+dNnyZUOYI2eyJGmR5sqQKl3u1FnSJNGUFWmy1BnzJM2cQDsu9fk0osip
    NoMOPYrx51SkV3MS5enV502qTGV6LIu0o0mTJEOKRMkRYsaMF1NubPuQoUGD
    Ch0q7BsQADs=
}
apply {{} {
    # Fix the 'new' image's lack of transparency using a "once only" procedure
    # (really a lambda application...)
    # TODO: rework the image to have the transparent bit set
    set i ::img::new
    set t "255 0 255"
    set w [image width $i]
    set h [image height $i]

    for {set x 0} {$x < $w} {incr x} {
	for {set y 0} {$y < $h} {incr y} {
	    if {[$i get $x $y] eq $t} {
		$i trans set $x $y 1
	    }
	}
    }
}}
d124 4
a127 1
ttk::sizegrip .statusBar.foo
d129 4
a132 1
pack .statusBar.foo -side left -padx 2
d143 7
a149 1
pack  .textFrame -expand yes -fill both
d155 1
d157 4
a168 1

d246 1
a246 1
		    .t insert end "\n" {} [mc $values] title " \n " demospace
d408 7
d442 3
a444 1
    set f [ttk::labelframe $w.title -text [mc "Variable values:"]]
d450 1
a450 1
    ttk::button $w.ok -width 8 -text [mc "OK"] \
d452 2
a453 2
    bind $w <Return> [list $w.ok invoke]
    bind $w <Escape> [list $w.ok invoke]
d456 6
a461 1
    grid $w.ok -sticky e -padx 4 -pady {6 4}
d464 2
d557 3
a559 2
	set btns [frame $top.btns]

d569 2
a570 2

	grid x $btns.rerun $btns.print $btns.dismiss -padx 4 -pady {6 4}
d572 7
a578 1

d696 2
a697 1
[mc {Copyright (c) %s} {2001-2007 Donal K. Fellows}]"
@


1.32
log
@More improvements for the widget demo main structure, including 'new' flagging.
@
text
@d13 1
a13 1
# RCS: @@(#) $Id: widget,v 1.31 2007/10/15 21:06:17 dkf Exp $
d349 2
@


1.31
log
@GOOBE work on the widget demo, plus a new demo of text widget peering.
@
text
@d13 1
a13 1
# RCS: @@(#) $Id: widget,v 1.30 2007/05/27 13:14:36 das Exp $
d35 1
a35 1
if {[lsearch -exact [font names] defaultFont] == -1} {
d37 1
a37 2
    if {[lsearch -exact [font names] TkDefaultFont] != -1 &&
	    [lsearch -exact [font names] TkFixedFont] != -1} {
d109 42
d253 2
a254 1

d261 3
a263 3
#	Lines starting with @@@@ are formatting directives (begin newline, or
#	change style) and all other lines are literal strings to be inserted.
#	Blank lines are ignored.
d268 2
a274 5
	if {$line eq "@@@@newline"} {
	    .t insert end \n $style
	    set isNL 1
	    continue
	}
d276 32
a307 1
	    set style [string range $line 2 end]
a317 15
# addDemoSection --
#
#	Add a new section of demos with a title and a (stride-2) list of demo
#	files and their descriptions. Titles and descriptions are passed
#	through the message catalog to allow for localization.
#
proc addDemoSection {title demos} {
    .t insert end "\n" {} [mc $title] title " \n " demospace
    set num 0
    foreach {name description} $demos {
	.t insert end "[incr num]. [mc $description]." [list demo demo-$name]
	.t insert end " \n " demospace
    }
}

d319 1
a319 5
    @@@@title
    Tk Widget Demonstrations
    @@@@newline
    @@@@normal
    @@@@newline
d337 74
d412 2
a413 69
addDemoSection "Labels, buttons, checkbuttons, and radiobuttons" {
    label	"Labels (text and bitmaps)"
    unicodeout	"Labels and UNICODE text"
    button	"Buttons"
    check	"Check-buttons (select any of a group)"
    radio	"Radio-buttons (select one of a group)"
    puzzle	"A 15-puzzle game made out of buttons"
    icon	"Iconic buttons that use bitmaps"
    image1	"Two labels displaying images"
    image2	"A simple user interface for viewing images"
    labelframe	"Labelled frames"
}
addDemoSection "Listboxes" {
    states	"The 50 states"
    colors	"Colors: change the color scheme for the application"
    sayings	"A collection of famous and infamous sayings"
}
addDemoSection "Entries and Spin-boxes" {
    entry1	"Entries without scrollbars"
    entry2	"Entries with scrollbars"
    entry3	"Validated entries and password fields"
    spin	"Spin-boxes"
    form	"Simple Rolodex-like form"
}
addDemoSection "Text" {
    text	"Basic editable text"
    style	"Text display styles"
    bind	"Hypertext (tag bindings)"
    twind	"A text widget with embedded windows and other features"
    search	"A search tool built with a text widget"
    textpeer	"Peering text widgets"
}
addDemoSection "Canvases" {
    items	"The canvas item types"
    plot	"A simple 2-D plot"
    ctext	"Text items in canvases"
    arrow	"An editor for arrowheads on canvas lines"
    ruler	"A ruler with adjustable tab stops"
    floor	"A building floor plan"
    cscroll	"A simple scrollable canvas"
}
addDemoSection "Scales" {
    hscale	"Horizontal scale"
    vscale	"Vertical scale"
}
addDemoSection "Paned Windows" {
    paned1	"Horizontal paned window"
    paned2	"Vertical paned window"
}
addDemoSection "Menus" {
    menu	"Menus and cascades (sub-menus)"
    menubu	"Menu-buttons"
}
addDemoSection "Common Dialogs" {
    msgbox	"Message boxes"
    filebox	"File selection dialog"
    clrpick	"Color picker"
}
addDemoSection "Animation" {
    anilabel	"Animated labels"
    aniwave	"Animated wave"
    pendulum	"Pendulum simulation"
    goldberg	"A celebration of Rube Goldberg"
}
addDemoSection "Miscellaneous" {
    bitmap	"The built-in bitmaps"
    dialog1	"A dialog box with a local grab"
    dialog2	"A dialog box with a global grab"
}
@


1.30
log
@fix TIP #145 breakage on Aqua
@
text
@d6 6
a11 7
# This script demonstrates the various widgets provided by Tk,
# along with many of the features of the Tk toolkit.  This file
# only contains code to generate the main window for the
# application, which invokes individual demonstrations.  The
# code for the actual demonstrations is contained in separate
# ".tcl" files is this directory, which are sourced by this script
# as needed.
d13 1
a13 1
# RCS: @@(#) $Id: widget,v 1.29 2007/05/04 21:29:22 patthoyts Exp $
d18 1
d26 2
a27 2
    # This won't work everywhere, but there's no other way in core Tk
    # at the moment to display a coloured icon.
d40 3
a42 3
        #         fine but means that if the system font is changed by
        #         Tk cannot update the copied font. font alias might be
        #         useful here -- or fix the app to use TkDefaultFont etc.
d49 1
a49 1
    } else {        
d111 3
a113 3
# The code below create the main window, consisting of a menu bar
# and a text widget that explains how to use the program, plus lists
# all of the demos as hypertext items.
d139 3
a141 5
frame .statusBar
label .statusBar.lab -text "   " -relief sunken -bd 1 \
	-font statusFont -anchor w
label .statusBar.foo -width 8 -relief sunken -bd 1 \
	-font statusFont -anchor w
d146 1
a146 1
frame .textFrame
d156 2
a157 3
# Create a bunch of tags to use in the text widget, such as those for
# section titles and demo descriptions.  Also define the bindings for
# tags.
d162 4
a165 3
# We put some "space" characters to the left and right of each demo description
# so that the descriptions are highlighted only when the mouse cursor
# is right over them (but not when the cursor is to their left or right)
d217 5
a221 5
#	Add formatted text (but not hypertext) to the text widget after
#	first passing it through the message catalog to allow for
#	localization.  Lines starting with @@@@ are formatting directives
#	(begin newline, or change style) and all other lines are literal
#	strings to be inserted.  Blank lines are ignored.
d250 3
a252 3
#	Add a new section of demos with a title and a (stride-2) list of
#	demo files and their descriptions.  Titles and descriptions are
#	passed through the message catalog to allow for localization.
d272 1
a272 1
    numbered lines below describes a demonstration;  you can click on
d317 1
d368 3
a370 2
    frame $w
    frame $w.sep -height 2 -relief sunken -bd 2
d372 1
a372 1
    button $w.dismiss -text [mc "Dismiss"] \
d375 1
a375 1
    button $w.code -text [mc "See Code"] \
d380 1
a380 1
	button $w.vars -text [mc "See Variables"] \
d388 1
a388 1
    eval grid $buttons -padx 4 -pady 4
d394 2
a395 2
# This procedure is invoked by most of the demos to position a
# new demo window.
d405 2
a406 2
# Displays the values of one or more variables in a window, and
# updates the display whenever any of the variables changes.
d417 1
a417 1
    set f [labelframe $w.title -text [mc "Variable values:"] -font varsFont]
d419 2
a420 2
	label $f.n$var -text "$var:" -anchor w
	label $f.v$var -textvariable $var -anchor w
d423 1
a423 1
    button $w.ok -width 8 -text [mc "OK"] \
d437 2
a438 2
# This procedure is called when the user clicks on a demo description.
# It is responsible for invoking the demonstration.
d463 2
a464 2
#	Show the name of the demo program in the status bar. This procedure
#	is called when the user moves the cursor over a demo description.
d494 2
a495 2
# This procedure creates a toplevel window that displays the code for
# a demonstration and allows it to be edited and reinvoked.
d498 2
a499 2
# w -		The name of the demonstration's window, which can be
#		used to derive the name of the file containing its code.
d525 1
a525 1
	button $btns.dismiss -text [mc "Dismiss"] \
d528 1
a528 1
	button $btns.print   -text [mc "Print Code"] \
d531 1
a531 1
	button $btns.rerun   -text [mc "Rerun Demo"] \
d561 2
a562 2
# Prints the source code currently displayed in the See Code dialog.
# Much thanks to Arjen Markus for this.
d621 2
a622 2
# Taken from the Wiki page by Keith Vetter, "Printing text files
# under Windows"
d624 2
a625 2
# Do not execute the command in the background: that way we can dispose
# of the file smoothly
d655 1
a655 1
[mc {Copyright (c) %s} {2001-2003 Donal K. Fellows}]"
@


1.29
log
@TIP #145 implementation
@
text
@d14 1
a14 1
# RCS: @@(#) $Id: widget,v 1.28 2006/09/11 14:41:04 das Exp $
d37 2
a38 1
    if {[lsearch -exact [font names] TkDefaultFont] != -1} {
@


1.29.2.1
log
@merge updates from HEAD
@
text
@d14 1
a14 1
# RCS: @@(#) $Id: widget,v 1.30 2007/05/27 13:14:36 das Exp $
d37 1
a37 2
    if {[lsearch -exact [font names] TkDefaultFont] != -1 &&
	    [lsearch -exact [font names] TkFixedFont] != -1} {
@


1.29.2.2
log
@merge updates from HEAD
@
text
@d6 7
a12 6
# This script demonstrates the various widgets provided by Tk, along with many
# of the features of the Tk toolkit. This file only contains code to generate
# the main window for the application, which invokes individual
# demonstrations. The code for the actual demonstrations is contained in
# separate ".tcl" files is this directory, which are sourced by this script as
# needed.
d14 1
a14 1
# RCS: @@(#) $Id: widget,v 1.29.2.1 2007/05/29 11:36:43 dgp Exp $
a18 1
package require Ttk
d26 2
a27 2
    # This won't work everywhere, but there's no other way in core Tk at the
    # moment to display a coloured icon.
d40 3
a42 3
        #         fine but means that if the system font is changed by Tk
        #         cannot update the copied font. font alias might be useful
        #         here -- or fix the app to use TkDefaultFont etc.
d49 1
a49 1
    } else {
d111 3
a113 3
# The code below create the main window, consisting of a menu bar and a text
# widget that explains how to use the program, plus lists all of the demos as
# hypertext items.
d139 5
a143 3
ttk::frame .statusBar
ttk::label .statusBar.lab -text "   " -anchor w
ttk::sizegrip .statusBar.foo
d148 1
a148 1
ttk::frame .textFrame
d158 3
a160 2
# Create a bunch of tags to use in the text widget, such as those for section
# titles and demo descriptions. Also define the bindings for tags.
d165 3
a167 4
# We put some "space" characters to the left and right of each demo
# description so that the descriptions are highlighted only when the mouse
# cursor is right over them (but not when the cursor is to their left or
# right).
d219 5
a223 5
#	Add formatted text (but not hypertext) to the text widget after first
#	passing it through the message catalog to allow for localization.
#	Lines starting with @@@@ are formatting directives (begin newline, or
#	change style) and all other lines are literal strings to be inserted.
#	Blank lines are ignored.
d252 3
a254 3
#	Add a new section of demos with a title and a (stride-2) list of demo
#	files and their descriptions. Titles and descriptions are passed
#	through the message catalog to allow for localization.
d274 1
a274 1
    numbered lines below describes a demonstration; you can click on
a318 1
    textpeer	"Peering text widgets"
d369 2
a370 3
    ttk::frame $w
    ttk::separator $w.sep
    #ttk::frame $w.sep -height 2 -relief sunken
d372 1
a372 1
    ttk::button $w.dismiss -text [mc "Dismiss"] \
d375 1
a375 1
    ttk::button $w.code -text [mc "See Code"] \
d380 1
a380 1
	ttk::button $w.vars -text [mc "See Variables"] \
d388 1
a388 1
    grid {*}$buttons -padx 4 -pady 4
d394 2
a395 2
# This procedure is invoked by most of the demos to position a new demo
# window.
d405 2
a406 2
# Displays the values of one or more variables in a window, and updates the
# display whenever any of the variables changes.
d417 1
a417 1
    set f [ttk::labelframe $w.title -text [mc "Variable values:"]]
d419 2
a420 2
	ttk::label $f.n$var -text "$var:" -anchor w
	ttk::label $f.v$var -textvariable $var -anchor w
d423 1
a423 1
    ttk::button $w.ok -width 8 -text [mc "OK"] \
d437 2
a438 2
# This procedure is called when the user clicks on a demo description. It is
# responsible for invoking the demonstration.
d463 2
a464 2
#	Show the name of the demo program in the status bar. This procedure is
#	called when the user moves the cursor over a demo description.
d494 2
a495 2
# This procedure creates a toplevel window that displays the code for a
# demonstration and allows it to be edited and reinvoked.
d498 2
a499 2
# w -		The name of the demonstration's window, which can be used to
#		derive the name of the file containing its code.
d525 1
a525 1
	ttk::button $btns.dismiss -text [mc "Dismiss"] \
d528 1
a528 1
	ttk::button $btns.print   -text [mc "Print Code"] \
d531 1
a531 1
	ttk::button $btns.rerun   -text [mc "Rerun Demo"] \
d561 2
a562 2
# Prints the source code currently displayed in the See Code dialog. Much
# thanks to Arjen Markus for this.
d621 2
a622 2
# Taken from the Wiki page by Keith Vetter, "Printing text files under
# Windows".
d624 2
a625 2
# Do not execute the command in the background: that way we can dispose of the
# file smoothly.
d655 1
a655 1
[mc {Copyright (c) %s} {2001-2007 Donal K. Fellows}]"
@


1.29.2.3
log
@merge updates from HEAD
@
text
@d13 1
a13 1
# RCS: @@(#) $Id: widget,v 1.29.2.2 2007/10/16 04:03:54 dgp Exp $
d35 1
a35 1
if {"defaultFont" ni [font names]} {
d37 2
a38 1
    if {"TkDefaultFont" in [font names] && "TkFixedFont" in [font names]} {
a109 42
image create photo ::img::new -format GIF -data {
    R0lGODlhHgAOAPcAAAAAAIAAAACAAICAAAAAgIAAgACAgICAgMDAwP8AAAD/
    AP//AAAA//8A/wD//////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    AAAAMwAAZgAAmQAAzAAA/wAzAAAzMwAzZgAzmQAzzAAz/wBmAABmMwBmZgBm
    mQBmzABm/wCZAACZMwCZZgCZmQCZzACZ/wDMAADMMwDMZgDMmQDMzADM/wD/
    AAD/MwD/ZgD/mQD/zAD//zMAADMAMzMAZjMAmTMAzDMA/zMzADMzMzMzZjMz
    mTMzzDMz/zNmADNmMzNmZjNmmTNmzDNm/zOZADOZMzOZZjOZmTOZzDOZ/zPM
    ADPMMzPMZjPMmTPMzDPM/zP/ADP/MzP/ZjP/mTP/zDP//2YAAGYAM2YAZmYA
    mWYAzGYA/2YzAGYzM2YzZmYzmWYzzGYz/2ZmAGZmM2ZmZmZmmWZmzGZm/2aZ
    AGaZM2aZZmaZmWaZzGaZ/2bMAGbMM2bMZmbMmWbMzGbM/2b/AGb/M2b/Zmb/
    mWb/zGb//5kAAJkAM5kAZpkAmZkAzJkA/5kzAJkzM5kzZpkzmZkzzJkz/5lm
    AJlmM5lmZplmmZlmzJlm/5mZAJmZM5mZZpmZmZmZzJmZ/5nMAJnMM5nMZpnM
    mZnMzJnM/5n/AJn/M5n/Zpn/mZn/zJn//8wAAMwAM8wAZswAmcwAzMwA/8wz
    AMwzM8wzZswzmcwzzMwz/8xmAMxmM8xmZsxmmcxmzMxm/8yZAMyZM8yZZsyZ
    mcyZzMyZ/8zMAMzMM8zMZszMmczMzMzM/8z/AMz/M8z/Zsz/mcz/zMz///8A
    AP8AM/8AZv8Amf8AzP8A//8zAP8zM/8zZv8zmf8zzP8z//9mAP9mM/9mZv9m
    mf9mzP9m//+ZAP+ZM/+ZZv+Zmf+ZzP+Z///MAP/MM//MZv/Mmf/MzP/M////
    AP//M///Zv//mf//zP///yH5BAEAABAALAAAAAAeAA4AAAiWAMMJFPhvYEGC
    /xIeDLdw4UCC+gr+i8hQn0WLEilOdAiRW0R9HidyGznyY0iQFA2CROGRG8uV
    KGK+dNnyZUOYI2eyJGmR5sqQKl3u1FnSJNGUFWmy1BnzJM2cQDsu9fk0osip
    NoMOPYrx51SkV3MS5enV502qTGV6LIu0o0mTJEOKRMkRYsaMF1NubPuQoUGD
    Ch0q7BsQADs=
}
apply {{} {
    # Fix the 'new' image's lack of transparency using a "once only" procedure
    # (really a lambda application...)
    # TODO: rework the image to have the transparent bit set
    set i ::img::new
    set t "255 0 255"
    set w [image width $i]
    set h [image height $i]

    for {set x 0} {$x < $w} {incr x} {
	for {set y 0} {$y < $h} {incr y} {
	    if {[$i get $x $y] eq $t} {
		$i trans set $x $y 1
	    }
	}
    }
}}

d212 1
a212 2

##############################################################################
d219 3
a221 3
#	Lines starting with @@@@ are formatting directives (insert title, insert
#	demo hyperlink, begin newline, or change style) and all other lines
#	are literal strings to be inserted. Blank lines are ignored.
a225 2
    set demoCount 0
    set new 0
d231 5
d237 1
a237 32
	    set data [string range $line 2 end]
	    set key [lindex $data 0]
	    set values [lrange $data 1 end]
	    switch -exact -- $key {
		title {
		    .t insert end [mc $values]\n title \n normal
		}
		newline {
		    .t insert end \n $style
		    set isNL 1
		}
		subtitle {
		    .t insert end "\n" {} [mc $values] title " \n " demospace
		    set demoCount 0
		}
		demo {
		    set description [lassign $values name]
		    .t insert end "[incr demoCount]. [mc $description]." \
			    [list demo demo-$name]
		    if {$new} {
			.t image create end -image ::img::new
			set new 0
		    }
		    .t insert end " \n " demospace
		}
		new {
		    set new 1
		}
		default {
		    set style $key
		}
	    }
d248 15
d264 5
a268 1
    @@@@title	Tk Widget Demonstrations
a285 74

    @@@@subtitle	Labels, buttons, checkbuttons, and radiobuttons
    @@@@demo label	Labels (text and bitmaps)
    @@@@demo unicodeout	Labels and UNICODE text
    @@@@demo button	Buttons
    @@@@demo check	Check-buttons (select any of a group)
    @@@@demo radio	Radio-buttons (select one of a group)
    @@@@demo puzzle	A 15-puzzle game made out of buttons
    @@@@demo icon		Iconic buttons that use bitmaps
    @@@@demo image1	Two labels displaying images
    @@@@demo image2	A simple user interface for viewing images
    @@@@demo labelframe	Labelled frames

    @@@@subtitle	Listboxes
    @@@@demo states	The 50 states
    @@@@demo colors	Colors: change the color scheme for the application
    @@@@demo sayings	A collection of famous and infamous sayings

    @@@@subtitle	Entries and Spin-boxes
    @@@@demo entry1	Entries without scrollbars
    @@@@demo entry2	Entries with scrollbars
    @@@@demo entry3	Validated entries and password fields
    @@@@demo spin		Spin-boxes
    @@@@demo form		Simple Rolodex-like form

    @@@@subtitle	Text
    @@@@demo text		Basic editable text
    @@@@demo style	Text display styles
    @@@@demo bind		Hypertext (tag bindings)
    @@@@demo twind	A text widget with embedded windows and other features
    @@@@demo search	A search tool built with a text widget
    @@@@new
    @@@@demo textpeer	Peering text widgets

    @@@@subtitle	Canvases
    @@@@demo items	The canvas item types
    @@@@demo plot		A simple 2-D plot
    @@@@demo ctext	Text items in canvases
    @@@@demo arrow	An editor for arrowheads on canvas lines
    @@@@demo ruler	A ruler with adjustable tab stops
    @@@@demo floor	A building floor plan
    @@@@demo cscroll	A simple scrollable canvas

    @@@@subtitle	Scales
    @@@@demo hscale	Horizontal scale
    @@@@demo vscale	Vertical scale

    @@@@subtitle	Paned Windows
    @@@@demo paned1	Horizontal paned window
    @@@@demo paned2	Vertical paned window

    @@@@subtitle	Menus
    @@@@demo menu		Menus and cascades (sub-menus)
    @@@@demo menubu	Menu-buttons

    @@@@subtitle	Common Dialogs
    @@@@demo msgbox	Message boxes
    @@@@demo filebox	File selection dialog
    @@@@demo clrpick	Color picker

    @@@@subtitle	Animation
    @@@@new
    @@@@demo anilabel	Animated labels
    @@@@new
    @@@@demo aniwave	Animated wave
    @@@@new
    @@@@demo pendulum	Pendulum simulation
    @@@@new
    @@@@demo goldberg	A celebration of Rube Goldberg

    @@@@subtitle	Miscellaneous
    @@@@demo bitmap	The built-in bitmaps
    @@@@demo dialog1	A dialog box with a local grab
    @@@@demo dialog2	A dialog box with a global grab
d287 69
a355 2

##############################################################################
@


1.29.2.4
log
@merge updates from HEAD
@
text
@d13 1
a13 1
# RCS: @@(#) $Id: widget,v 1.29.2.3 2007/10/17 14:37:05 dgp Exp $
d61 46
a106 22
image create photo ::img::refresh -format GIF -data {
    R0lGODlhEAAQAJEDAP///wAAACpnKv///yH5BAEAAAMALAAAAAAQABAAAAI63IKp
    xgcPH2ouwgBCw1HIxHCQ4F3hSJKmwZXqWrmWxj7lKJ2dndcon9EBUq+gz3brVXAR
    2tICU0gXBQA7
}

image create photo ::img::view -format GIF -data {
    R0lGODlhEAAQAKIHAP///wwMDAAAAMDAwNnZ2SYmJmZmZv///yH5BAEAAAcALAAA
    AAAQABAAAANMKLos90+ASamDRxJCgw9YVnlDOXiQBgRDBRgHKE6sW8QR3doPKK27
    yg33q/GIOhdg6OsEJzeZykiBSUcs06e56Xx6np8ScIkFGuhQAgA7
}

image create photo ::img::delete -format GIF -data {
    R0lGODlhEAAQAIABAIQAAP///yH5BAEAAAEALAAAAAAQABAAAAIjjI+pmwAc3HGy
    PUSvqYpuvWQg40FfSVacBa5nN6JYDI3mzRQAOw==
}

image create photo ::img::print -format GIF -data {
    R0lGODlhEAAQALMKAAAAAP///52VunNkl8C82Yl+qldBgq+pyrOzs1fYAP///wAA
    AAAAAAAAAAAAAAAAACH5BAEAAAoALAAAAAAQABAAAARGUMlJKwU4AztB+ODGeUiJ
    fGLlgeEYmGWQXmx7aXgmAUTv/74N4EAsGhOJg1DAbDqbwoJ0Sp0KB9isNis0eL/g
    ryhH5pgnEQA7
d110 40
a149 6
    R0lGODlhHgAOALMPALMAANyIiOu7u8dEROaqqvru7sxVVeGZmbgREfXd3b0iItZ3
    d8IzM9FmZvDMzP///yH5BAEAAA8ALAAAAAAeAA4AAASa8MlJq7046827WVOCHEkw
    nANhUgJlEBIABJIwL3K+4IcUALCHjfbItYZDSgJgkBiYPmBMAUAkkLPKs/BAyLgM
    wAQwOAAY2ByCaw4QAFQSoDEePJ6DmU1xInYZTw5nOEFFdgVUelkVDTIMd3AKFGQ1
    MgI2AwEmQW8APZ0gdRONAks5nhIFVVxdAAkUAS2pAVwFl7ITB4UqHb0XEQA7
}
d182 1
a182 4
if {[tk windowingsystem] eq "aqua"} {
    ttk::separator .statusBar.sep
    pack .statusBar.sep -side top -expand yes -fill x -pady 0
}
d184 1
a184 4
if {[tk windowingsystem] ne "aqua"} {
    ttk::sizegrip .statusBar.foo
    pack .statusBar.foo -side left -padx 2
}
d195 1
a195 7
pack .textFrame -expand yes -fill both
if {[tk windowingsystem] eq "aqua"} {
    pack configure .statusBar.lab -padx {10 18} -pady {4 6}
    pack configure .statusBar -pady 0
    .s configure -bd 0
    .t configure -padx 10 -pady 0 -bd 0
}
a200 1
.t tag configure subtitle -font titleFont
a201 4
if {[tk windowingsystem] eq "aqua"} {
    .t tag configure title -spacing1 8
    .t tag configure subtitle -spacing3 3
}
d210 1
d288 1
a288 1
		    .t insert end "\n" {} [mc $values] subtitle " \n " demospace
d296 1
a296 1
			.t image create end -image ::img::new -padx 5
a348 2
    @@@@new
    @@@@demo ttkbut	The simple Themed Tk widgets
a386 2
    @@@@new
    @@@@demo ttkpane	Themed nested panes
a390 2
    @@@@new
    @@@@demo ttkmenu	Themed menu buttons
a447 7
    if {[tk windowingsystem] eq "aqua"} {
	foreach b [lrange $buttons 1 end] {$b configure -takefocus 0}
	grid configure $w.sep -pady 0
	grid configure {*}$buttons -pady {10 12}
	grid configure [lindex $buttons 1] -padx {16 4}
	grid configure [lindex $buttons end] -padx {4 18}
    }
d475 1
a475 3
    set b [ttk::frame $w.frame]
    grid $b -sticky news
    set f [ttk::labelframe $b.title -text [mc "Variable values:"]]
d481 1
a481 1
    ttk::button $b.ok -width 8 -text [mc "OK"] \
d483 2
a484 2
    bind $w <Return> [list $b.ok invoke]
    bind $w <Escape> [list $b.ok invoke]
d487 1
a487 6
    grid $b.ok -sticky e -padx 4 -pady {6 4}
    if {[tk windowingsystem] eq "aqua"} {
	$b.ok configure -takefocus 0
	grid configure $b.ok -pady {10 12} -padx {16 18}
	grid configure $f -padx 10 -pady {10 0}
    }
a489 2
    grid columnconfig $b 0 -weight 1
    grid rowconfigure $b 0 -weight 1
a574 3
	if {[tk windowingsystem] eq "aqua"} {
	    foreach i [list $t.text $t.xscroll $t.yscroll] {$i configure -bd 0}
	}
d581 2
a582 3
	set btns [ttk::frame $top.btns]
	ttk::separator $btns.sep
	grid $btns.sep -columnspan 4 -row 0 -sticky ew -pady 2
d592 2
a593 2
	set buttons [list x $btns.rerun $btns.print $btns.dismiss]
	grid {*}$buttons -padx 4 -pady 4
d595 1
a595 7
	if {[tk windowingsystem] eq "aqua"} {
	    foreach b [lrange $buttons 1 end] {$b configure -takefocus 0}
	    grid configure $btns.sep -pady 0
	    grid configure {*}$buttons -pady {10 12}
	    grid configure [lindex $buttons 1] -padx {16 4}
	    grid configure [lindex $buttons end] -padx {4 18}
	}
d713 1
a713 2
[mc {Copyright (c) %s} {2001-2007 Donal K. Fellows}]
[mc {Copyright (c) %s} {2002-2007 Daniel A. Steffen}]"
@


1.29.2.5
log
@merge updates from HEAD
@
text
@d13 1
a13 1
# RCS: @@(#) $Id$
a47 3
	if {[tk windowingsystem] eq "aqua"} {
	    font configure titleFont -size 17
	}
d85 1
a85 3
# Note that this is run through the message catalog! This is because this is
# actually an image of a word.
image create photo ::img::new -format GIF -data [mc {
d91 1
a91 1
}]
a112 1
    bind . <F1> {aboutBox}
d114 4
a117 10
    if {[string match win* [tk windowingsystem]]} {
	# Windows doesn't usually have a Meta key
	::tk::AmpMenuArgs .menuBar.file add command -label [mc "&Quit"] \
		-command {exit} -accelerator [mc "Ctrl+Q"]
	bind . <[mc "Control-q"]> {exit}
    } else {
	::tk::AmpMenuArgs .menuBar.file add command -label [mc "&Quit"] \
		-command {exit} -accelerator [mc "Meta-Q"]
	bind . <[mc "Meta-q"]> {exit}
    }
d221 1
a221 3
#	are literal strings to be inserted. Substitutions are performed,
#	allowing processing pieces through the message catalog. Blank lines
#	are ignored.
d228 1
a228 1
    foreach line [split $formattedText \n] {
d246 1
a246 2
		    .t insert end "\n" {} [mc $values] subtitle \
			    " \n " demospace
d272 1
a272 1
	.t insert end [mc $line] $style
d310 1
a310 1
    @@@@subtitle	Listboxes and Trees
a313 2
    @@@@new
    @@@@demo tree		A directory browser tree
d315 1
a315 1
    @@@@subtitle	Entries, Spin-boxes and Combo-boxes
a319 2
    @@@@new
    @@@@demo combo	Combo-boxes
d340 1
a340 1
    @@@@subtitle	Scales and Progress Bars
a342 2
    @@@@new
    @@@@demo ttkprogress	Progress bar
d344 1
a344 1
    @@@@subtitle	Paned Windows and Notebooks
a348 2
    @@@@new
    @@@@demo ttknote	Notebook widget
d350 1
a350 1
    @@@@subtitle	Menus and Toolbars
a354 2
    @@@@new
    @@@@demo toolbar	Themed toolbar
d699 1
a699 1
	    -message "[mc {Tk widget demonstration application}]
@


1.29.2.6
log
@merge updates from HEAD
@
text
@d13 1
a13 1
# RCS: @@(#) $Id: widget,v 1.29.2.5 2007/10/24 12:59:33 dgp Exp $
d38 1
a38 1
        # FIX ME: the following technique of cloning the font to copy it works
a146 4
set textheight 30
catch {set textheight [expr {([winfo screenheight .] - 100) / 
	[font metrics mainFont -displayof . -linespace]}]}

d148 2
a149 1
scrollbar .s -orient vertical -command {.t yview} -takefocus 1
d151 3
a153 3
text .t -yscrollcommand {.s set} -wrap word -width 70 -height $textheight \
	-font mainFont -setgrid 1 -highlightthickness 0 \
	-padx 4 -pady 2 -takefocus 0
d159 2
a160 1
    .t configure -padx 10 -pady 0
d266 1
a266 1
		    .t insert end "[incr demoCount]. [mc $description]" \
d479 1
a479 1
    ttk::button $b.ok -text [mc "OK"] \
d517 1
a517 1
    uplevel 1 [list source [file join $tk_demoDirectory $demo.tcl]]
d572 1
a572 1
	set text [text $t.text -font fixedFont -height 24 -wrap word \
d576 7
a582 2
	scrollbar $t.xscroll -command [list $t.text xview] -orient horizontal
	scrollbar $t.yscroll -command [list $t.text yview] -orient vertical
d724 3
a726 2
	    -message [mc "Tk widget demonstration application"] -detail \
"[mc {Copyright (c) %s} {1996-1997 Sun Microsystems, Inc.}]
@


1.29.2.7
log
@merge updates from HEAD
@
text
@d13 1
a13 1
# RCS: @@(#) $Id: widget,v 1.29.2.6 2007/11/01 16:37:23 dgp Exp $
d106 6
a111 1
if {[tk windowingsystem] ne "aqua"} {
d117 2
a118 2
	    -command {tkAboutDialog} -accelerator [mc "<F1>"]
    bind . <F1> {tkAboutDialog}
d148 2
a149 6
catch {
    set textheight [expr {
	([winfo screenheight .] - 200) /
	[font metrics mainFont -displayof . -linespace]
    }]
}
a331 2
    @@@@demo mclist	A multi-column list of countries
    @@@@new
d715 1
a715 1
# tkAboutDialog --
d719 1
a719 1
proc tkAboutDialog {} {
@


1.29.2.8
log
@merge updates from HEAD
@
text
@d13 1
a13 1
# RCS: @@(#) $Id: widget,v 1.29.2.7 2007/11/05 14:24:18 dgp Exp $
d145 1
a145 1
	([winfo screenheight .] * 0.7) /
@


1.29.2.9
log
@merge updates from HEAD
@
text
@d13 1
a13 1
# RCS: @@(#) $Id: widget,v 1.29.2.8 2007/12/06 07:00:05 dgp Exp $
a360 1
    @@@@demo knightstour  A Knight's tour of the chess board
@


1.29.2.10
log
@merge updates from HEAD
@
text
@d13 1
a13 1
# RCS: @@(#) $Id: widget,v 1.29.2.9 2008/03/07 22:03:49 dgp Exp $
a360 1
    @@@@new
@


1.28
log
@	* macosx/tkMacOSXWm.c (TkMacOSXMakeRealWindowExist): revert part of
	2006-05-16 change that had set overrideredirect windows to not become
	activated by the window manager, as this prevented interaction with
	native widgets in such windows [Bug 1472624]; apply changes to carbon
	window attributes even if native window has already been created.

	* macosx/tkMacOSXKeyEvent.c (TkMacOSXProcessKeyboardEvent): fix app
	* macosx/tkMacOSXMenu.c (DrawMenuBarWhenIdle): menu item key shortcuts
	* macosx/tkMacOSXInt.h: when custom ".apple" menu is installed.

	* library/demos/widget: on TkAqua, don't install file menu with single
	quit menu item, as the application menu already has a quit item.

	* macosx/tkMacOSXColor.c: fix building on Mac OS X 10.2.
@
text
@d14 1
a14 1
# RCS: @@(#) $Id: widget,v 1.27 2004/11/08 21:57:53 dkf Exp $
d36 20
a55 6
    font create mainFont   -family Helvetica -size 12
    font create fixedFont  -family Courier   -size 10
    font create boldFont   -family Helvetica -size 12 -weight bold
    font create titleFont  -family Helvetica -size 18 -weight bold
    font create statusFont -family Helvetica -size 10
    font create varsFont   -family Helvetica -size 14
@


1.27
log
@Added Keith Vetter's tkGoldberg as an animation demo. Thanks Keith!
@
text
@d14 1
a14 1
# RCS: @@(#) $Id: widget,v 1.26 2004/11/07 22:41:11 dkf Exp $
a101 3
# This is a tk-internal procedure to make i18n easier
::tk::AmpMenuArgs .menuBar add cascade -label [mc "&File"] -menu .menuBar.file
menu .menuBar.file -tearoff 0
d103 1
a103 1
# On the Mac use the specia .apple menu for the about item
d109 4
d116 4
a121 2
::tk::AmpMenuArgs .menuBar.file add command -label [mc "&Quit"] \
	-command {exit} -accelerator [mc "Meta-Q"]
a122 2
bind . <F1>     {aboutBox}
bind . <[mc "Meta-q"]> {exit}
@


1.26
log
@More animation demos
@
text
@d14 1
a14 1
# RCS: @@(#) $Id: widget,v 1.25 2004/11/07 17:28:21 dkf Exp $
d334 1
@


1.25
log
@Added a demo of simple animation to the widget tour.
@
text
@d14 1
a14 1
# RCS: @@(#) $Id: widget,v 1.24 2004/09/10 12:13:43 vincentdarley Exp $
d332 2
@


1.24
log
@text widget 'peer' subcommand -- TIP#169 implementation
@
text
@d14 1
a14 1
# RCS: @@(#) $Id: widget,v 1.23 2004/03/17 18:15:45 das Exp $
d330 3
@


1.23
log
@Removed support for Mac OS Classic platform [Patch 918139]
@
text
@d14 1
a14 1
# RCS: @@(#) $Id: widget,v 1.22 2004/02/25 13:22:32 cc_benny Exp $
d16 2
a17 2
package require Tcl	8.4
package require Tk	8.4
@


1.22
log
@* (addFormattedText): Correct off-by-one error.
@
text
@d14 1
a14 1
# RCS: @@(#) $Id: widget,v 1.21 2003/12/04 12:28:37 vincentdarley Exp $
d107 1
a107 1
if {[tk windowingsystem] eq "classic" || [tk windowingsystem] eq "aqua"} {
a577 4
	macintosh {
	    tk_messageBox -title "Operation not Implemented" \
		    -message "Oops, sorry: not implemented yet!"
	}
@


1.21
log
@fix to text widget tabs and xy-scroll-command
@
text
@d14 1
a14 1
# RCS: @@(#) $Id: widget,v 1.20 2003/11/05 13:31:12 dkf Exp $
d223 1
a223 1
	    set style [string range $line 1 end]
@


1.20
log
@Dutch messages for widget demo from Arjen Markus. [Patch 836368]
@
text
@d14 1
a14 1
# RCS: @@(#) $Id: widget,v 1.19 2003/11/04 13:26:33 dkf Exp $
d301 1
a301 1
    twind	"A text widget with embedded windows"
@


1.19
log
@Add 'Print Code' support to Widget demo [Patch 835644]
@
text
@d14 1
a14 1
# RCS: @@(#) $Id: widget,v 1.18 2003/11/03 15:30:45 dkf Exp $
d121 1
a121 1
bind . <Meta-q> {exit}
@


1.18
log
@Make demo location independent of main Tk library location.  [Patch 832691]
@
text
@d14 1
a14 1
# RCS: @@(#) $Id: widget,v 1.17 2003/09/30 14:54:30 dkf Exp $
d67 28
d506 3
d513 1
a513 1
	grid x $btns.rerun $btns.dismiss -padx 4 -pady {6 4}
d536 89
@


1.17
log
@Added [package require] to demos. [FRQ 815118]
@
text
@d14 1
a14 1
# RCS: @@(#) $Id: widget,v 1.16 2003/09/25 05:37:00 das Exp $
d21 2
a22 1
::msgcat::mcload [file join $tk_library demos]
d394 1
a394 1
    global tk_library
d404 1
a404 1
    uplevel [list source [file join $tk_library demos $demo.tcl]]
a416 1
    global tk_library
d452 1
a452 1
    global tk_library
d498 1
a498 1
    wm title $top [mc "Demo code: %s" [file join $tk_library demos $file]]
d500 1
a500 1
    set id [open [file join $tk_library demos $file]]
@


1.16
log
@	* library/demos/widget: don't create iconwindow on aqua, but add
	about menu like on classic.
	* macosx/Makefile: pass MAKEOVERRIDES to pxbuild.
	* macosx/tkMacOSXButton.c: added -compound support for bevel buttons.
@
text
@d14 5
a18 1
# RCS: @@(#) $Id: widget,v 1.15 2003/08/22 22:44:15 dkf Exp $
a20 1
package require msgcat
@


1.15
log
@Brought tk_messageBox demo into line with the newer look-and-feel for the demos.
@
text
@d14 1
a14 1
# RCS: @@(#) $Id: widget,v 1.14 2003/08/21 00:02:56 hobbs Exp $
d21 1
a21 1
if {$tcl_platform(platform) eq "unix"} {
d75 1
a75 1
if {[tk windowingsystem] eq "classic"} {
@


1.14
log
@make images align at 16pix height and do not allow Dismiss Return to trigger in text widget
@
text
@d14 1
a14 1
# RCS: @@(#) $Id: widget,v 1.13 2003/08/20 23:47:44 hobbs Exp $
d313 1
a313 1
proc addSeeDismiss {w show {vars {}}} {
d324 1
d329 1
a329 3
	grid x $w.vars $w.code $w.dismiss -padx 4 -pady 4
    } else {
	grid x $w.code $w.dismiss -padx 4 -pady 4
d331 4
@


1.13
log
@use delete image for dismiss button
@
text
@d14 1
a14 1
# RCS: @@(#) $Id: widget,v 1.12 2003/08/20 23:23:34 hobbs Exp $
d43 1
a43 1
image create photo ::img::refresh -format GIF -data {
d51 1
a51 1
image create photo ::img::view -format GIF -data {
d58 1
a58 1
image create photo ::img::delete -format GIF -data {
d484 4
a487 2
	bind $top <Return> [list $btns.dismiss invoke]
	bind $top <Escape> [list $btns.dismiss invoke]
@


1.12
log
@add sep frame to seecode/dismiss button frame
@
text
@d14 1
a14 1
# RCS: @@(#) $Id: widget,v 1.11 2003/08/20 23:02:18 hobbs Exp $
d319 1
a319 1
	-image ::img::refresh -compound left \
@


1.11
log
@	* library/demos/widget:      Redo code view dialog, use named fonts,
	* library/demos/arrow.tcl:   add basic see/dismiss routine with
	* library/demos/bind.tcl:    images for better look & feel
	* library/demos/bitmap.tcl:
	* library/demos/button.tcl:
	* library/demos/check.tcl:
	* library/demos/clrpick.tcl:
	* library/demos/colors.tcl:
	* library/demos/cscroll.tcl:
	* library/demos/ctext.tcl:
	* library/demos/entry1.tcl:
	* library/demos/entry2.tcl:
	* library/demos/entry3.tcl:
	* library/demos/filebox.tcl:
	* library/demos/floor.tcl:
	* library/demos/form.tcl:
	* library/demos/hscale.tcl:
	* library/demos/icon.tcl:
	* library/demos/image1.tcl:
	* library/demos/image2.tcl:
	* library/demos/items.tcl:
	* library/demos/label.tcl:
	* library/demos/labelframe.tcl:
	* library/demos/menu.tcl:
	* library/demos/menubu.tcl:
	* library/demos/paned1.tcl:
	* library/demos/paned2.tcl:
	* library/demos/plot.tcl:
	* library/demos/puzzle.tcl:
	* library/demos/radio.tcl:
	* library/demos/ruler.tcl:
	* library/demos/sayings.tcl:
	* library/demos/search.tcl:
	* library/demos/spin.tcl:
	* library/demos/states.tcl:
	* library/demos/style.tcl:
	* library/demos/text.tcl:
	* library/demos/twind.tcl:
	* library/demos/unicodeout.tcl:
	* library/demos/vscale.tcl:
@
text
@d14 1
a14 1
# RCS: @@(#) $Id: widget,v 1.10 2003/05/19 14:44:04 dkf Exp $
d316 2
d328 1
a328 1
	grid x $w.vars $w.code $w.dismiss -padx 4 -pady {6 4}
d330 1
a330 1
	grid x $w.code $w.dismiss -padx 4 -pady {6 4}
d366 2
a367 1
    button $w.ok -text [mc "OK"] -command [list destroy $w] -default active
@


1.10
log
@I18n (and some l10n) for the console and the main window of the widget demo.
@
text
@d14 1
a14 1
# RCS: @@(#) $Id: widget,v 1.9 2003/02/19 16:13:15 dkf Exp $
d31 7
a37 6
array set widgetFont {
    main   {Helvetica 12}
    bold   {Helvetica 12 bold}
    title  {Helvetica 18 bold}
    status {Helvetica 10}
    vars   {Helvetica 14}
d41 21
a61 1
set font $widgetFont(main)
d93 1
a93 1
	-font $widgetFont(status) -anchor w
d95 1
a95 1
	-font $widgetFont(status) -anchor w
d102 1
a102 1
    -takefocus 1
d105 2
a106 2
	-font $widgetFont(main)  -setgrid 1  -highlightthickness 0 \
	-padx 4  -pady 2  -takefocus 0
d114 2
a115 2
.t tag configure title -font $widgetFont(title)
.t tag configure bold  -font $widgetFont(bold)
d307 27
a353 1
    global widgetFont
d357 6
a362 16
    label $w.title -text [mc "Variable values:"] -width 20 -anchor center \
	    -font $widgetFont(vars)
    pack $w.title -side top -fill x
    set len 1
    foreach i $args {
	if {[string length $i] > $len} {
	    set len [string length $i]
	}
    }
    foreach i $args {
	frame $w.$i
	label $w.$i.name -text "$i: " -width [expr $len + 2] -anchor w
	label $w.$i.value -textvar $i -anchor w
	pack $w.$i.name -side left
	pack $w.$i.value -side left -expand 1 -fill x
	pack $w.$i -side top -anchor w -fill x
d365 9
a373 3
    bind $w <Return> [list tkButtonInvoke $w.ok]
    bind $w <Escape> [list tkButtonInvoke $w.ok]
    pack $w.ok -side bottom -pady 2
d424 9
d445 38
a482 30
    if {![winfo exists .code]} {
	toplevel .code
	frame .code.buttons
	pack .code.buttons -side bottom -fill x
	button .code.buttons.dismiss -text [mc "Dismiss"] \
		-default active -command {destroy .code}
	button .code.buttons.rerun -text [mc "Rerun Demo"] -command {
	    eval [.code.text get 1.0 end]
	}
	pack .code.buttons.dismiss .code.buttons.rerun -side left \
		-expand 1 -pady 2
	frame .code.frame
	pack  .code.frame -expand yes -fill both -padx 1 -pady 1
	text .code.text -height 40 -wrap word \
		-xscrollcommand {.code.xscroll set} \
		-yscrollcommand {.code.yscroll set} \
		-setgrid 1 -highlightthickness 0 -pady 2 -padx 3
	scrollbar .code.xscroll -command {.code.text xview} \
		-highlightthickness 0 -orient horizontal
	scrollbar .code.yscroll -command {.code.text yview} \
		-highlightthickness 0 -orient vertical

	grid .code.text -in .code.frame -padx 1 -pady 1 \
	    -row 0 -column 0 -rowspan 1 -columnspan 1 -sticky news
	grid .code.yscroll -in .code.frame -padx 1 -pady 1 \
	    -row 0 -column 1 -rowspan 1 -columnspan 1 -sticky news
#	grid .code.xscroll -in .code.frame -padx 1 -pady 1 \
#	    -row 1 -column 0 -rowspan 1 -columnspan 1 -sticky news
	grid rowconfig    .code.frame 0 -weight 1 -minsize 0
	grid columnconfig .code.frame 0 -weight 1 -minsize 0
d484 2
a485 2
	wm deiconify .code
	raise .code
d487 2
a488 2
    wm title .code [mc "Demo code: %s" [file join $tk_library demos $file]]
    wm iconname .code $file
d490 3
a492 3
    .code.text delete 1.0 end
    .code.text insert 1.0 [read $id]
    .code.text mark set insert 1.0
d502 1
a502 1
	    -message "[mc {Tk widget demonstration application}]
@


1.9
log
@New part for the widget demo showing Tk's UNICODE output. [Patch #627453]
@
text
@d14 1
a14 1
# RCS: @@(#) $Id: widget,v 1.8 2002/08/31 06:12:28 das Exp $
d17 4
a20 1
wm title . "Widget Demonstration"
d28 1
a28 1
    wm iconname . "tkWidgetDemo"
d49 2
a50 1
.menuBar add cascade -menu .menuBar.file -label "File" -underline 0
d54 1
a54 1
if {[string equal [tk windowingsystem] "classic"]} {
d57 1
a57 1
    .menuBar.apple add command -label "About..." -command "aboutBox"
d59 2
a60 2
    .menuBar.file add command -label "About..." -command "aboutBox" \
	-underline 0 -accelerator "<F1>"
d64 2
a65 2
.menuBar.file add command -label "Quit" -command "exit" -underline 0 \
    -accelerator "Meta-Q"
d67 2
a68 1
bind . <F1> aboutBox
d133 1
a133 1
    if {[string compare $newLine $lastLine] != 0} {
d148 39
d188 1
a188 1
    .t insert end "\n" {} $title title " \n " demospace
d191 1
a191 1
	.t insert end "[incr num]. $description." [list demo demo-$name]
d196 24
a219 10
.t insert end "Tk Widget Demonstrations\n" title
.t insert end "\nThis application provides a front end for several short\
	scripts that demonstrate what you can do with Tk widgets.  Each of\
	the numbered lines below describes a demonstration;  you can click\
	on it to invoke the demonstration.  Once the demonstration window\
	appears, you can click the " {} "See Code" bold " button to see the\
	Tcl/Tk code that created the demonstration.  If you wish, you can\
	edit the code and click the " {} "Rerun Demo" bold " button in the\
	code window to reinvoke the demonstration with the modified code.\n"

d309 2
a310 2
    wm title $w "Variable values"
    label $w.title -text "Variable values:" -width 20 -anchor center \
d327 3
a329 2
    button $w.ok -text OK -command "destroy $w" -default active
    bind $w <Return> "tkButtonInvoke $w.ok"
d373 1
a373 1
	.statusBar.lab config -text "Run the \"$demo\" sample program"
d376 1
a376 1
    if [string compare $cursor $newcursor] {
d393 1
a393 1
    if ![winfo exists .code] {
d397 3
a399 3
	button .code.buttons.dismiss -text Dismiss \
            -default active -command "destroy .code"
	button .code.buttons.rerun -text "Rerun Demo" -command {
d403 1
a403 1
	    -expand 1 -pady 2
d406 8
a413 8
	text .code.text -height 40 -wrap word\
	    -xscrollcommand ".code.xscroll set" \
	    -yscrollcommand ".code.yscroll set" \
	    -setgrid 1 -highlightthickness 0 -pady 2 -padx 3
	scrollbar .code.xscroll -command ".code.text xview" \
	    -highlightthickness 0 -orient horizontal
	scrollbar .code.yscroll -command ".code.text yview" \
	    -highlightthickness 0 -orient vertical
d427 1
a427 1
    wm title .code "Demo code: [file join $tk_library demos $file]"
d441 2
a442 6
    tk_messageBox -icon info -type ok -title "About Widget Demo" -message \
"Tk widget demonstration

Copyright (c) 1996-1997 Sun Microsystems, Inc.

Copyright (c) 1997-2000 Ajuba Solutions, Inc.
d444 3
a446 1
Copyright (c) 2001-2002 Donal K. Fellows"
@


1.9.2.1
log
@	* library/demos/widget: don't create iconwindow on aqua, but add
	about menu like on classic.
	* macosx/Makefile: pass MAKEOVERRIDES to pxbuild.
	* macosx/tkMacOSXButton.c: added -compound support for bevel buttons.
@
text
@d14 1
a14 1
# RCS: @@(#) $Id: widget,v 1.9 2003/02/19 16:13:15 dkf Exp $
d18 1
a18 1
if {[tk windowingsystem] eq "x11"} {
d50 1
a50 1
if {[tk windowingsystem] eq "classic" || [tk windowingsystem] eq "aqua"} {
@


1.9.2.2
log
@	* macosx/tkMacOSXWm.c (TkMacOSXMakeRealWindowExist): revert part of
	2006-05-16 change that had set overrideredirect windows to not become
	activated by the window manager, as this prevented interaction with
	native widgets in such windows [Bug 1472624]; apply changes to carbon
	window attributes even if native window has already been created.

	* macosx/tkMacOSXKeyEvent.c (TkMacOSXProcessKeyboardEvent): fix app
	* macosx/tkMacOSXMenu.c (DrawMenuBarWhenIdle): menu item key shortcuts
	* macosx/tkMacOSXInt.h: when custom ".apple" menu is installed.

	* library/demos/widget: on TkAqua, don't install file menu with single
	quit menu item, as the application menu already has a quit item.

	* macosx/tkMacOSXColor.c: fix building on Mac OS X 10.2.
@
text
@d14 1
a14 1
# RCS: @@(#) $Id: widget,v 1.9.2.1 2003/09/25 05:37:48 das Exp $
d46 2
d49 1
a49 1
# On the Mac use the special .apple menu for the about item
a54 2
    .menuBar add cascade -menu .menuBar.file -label "File" -underline 0
    menu .menuBar.file -tearoff 0
a57 3
    .menuBar.file add command -label "Quit" -command "exit" -underline 0 \
	-accelerator "Meta-Q"
    bind . <F1> aboutBox
d60 2
d63 1
@


1.9.2.3
log
@	Backport from HEAD of Aqua changes from 2007-10-12 to 2007-11-09
@
text
@d14 1
a14 1
# RCS: @@(#) $Id: widget,v 1.9.2.2 2006/09/11 14:41:16 das Exp $
d47 6
a52 1
if {[tk windowingsystem] ne "classic" && [tk windowingsystem] ne "aqua"} {
d55 1
a55 1
    .menuBar.file add command -label "About..." -command "tkAboutDialog" \
d60 1
a60 1
    bind . <F1> tkAboutDialog
a73 8
set textheight 30
catch {
    set textheight [expr {
	([winfo screenheight .] - 200) /
	[font metrics $widgetFont(main) -displayof . -linespace]
    }]
}

d78 1
a78 1
text .t -yscrollcommand {.s set}  -wrap word  -width 70  -height $textheight \
d377 1
a377 1
# tkAboutDialog --
d381 1
a381 1
proc tkAboutDialog {} {
d389 1
a389 3
Copyright (c) 2001-2002 Donal K. Fellows

Copyright (c) 2002-2007 Daniel A. Steffen"
@


1.8
log
@	*** macosx-8-4-branch merged into the mainline [tcl patch #602770] ***

	* generic/tk.decls:
	* generic/tkInt.decls: added new "aqua" specific entries to the
	stubs tables. Changed all "unix" entries to "x11" to allow us to
	distinguish and build both "aqua" on MacOSX and "x11" on MacOSX.

	* generic/tk.h: added a #ifnded RESOURCE_INCLUDED so that tk.h can
	be passed to the resource compiler.

	* generic/tkCmds.c (Tk_TkObjCmd): added [tk windowingsystem]
	subcommand: returns "x11" when running on X11, "win32" on Windows,
	"classic" on MacOS9 and "aqua" on MacOSX Aqua (i.e. Carbon)

	* generic/tkFont.c (TkFontGetFirstTextLayout): new private function
	returning the first chunk of a Tk_TextLayout, i.e. until the first
	font change on the first line (or the whole first line if there is
	no such font change).

	* generic/tkMain.c: made Tcl_ThreadDataKey static

	* library/demos/puzzle.tcl: fixed button metrics for aqua

	* tests/cursor.test: check for presence of arrow cursor instead of
	heart cursor

	* xlib/xcolors.c: changed xColors static initialization to more
	standard C

	* macosx/Wish.pbproj/jingham.pbxuser (new):
	* macosx/Wish.pbproj/project.pbxproj (new): project for Apple's
	ProjectBuilder IDE.

	* macosx/Makefile (new): simple makefile for building the project
	from the command line via the ProjectBuilder tool 'pbxbuild'.

	* macosx/tkMacOSXAppInit.c (new): macosx specific AppInit looking
	for a AppMain.tcl file in its bundled Resources/Scripts folder. If
	present, argv[1] is set to that file and the Scripts folder is
	added to the auto_path. This allows tk apps to embed scripts within
	their bundle directory structure.

	* macosx/tkMacOSXInit.c (new): macosx adapted version of
	tkUnixInit.c: we initialize & cache the Carbon native encoding
	(e.g. 'macRoman') and try to find the tk script library files
	inside Tk packaged as a framework.

	* macosx/tkMacOSXNotify.c (new): new macosx specific merged
	Carbon/select-based notifier.

	* macosx/tkMacOSXEvent.c (new):
	* macosx/tkMacOSXEvent.h (new):
	* macosx/tkMacOSXKeyEvent.c (new):
	* macosx/tkMacOSXMouseEvent.c (new):
	* macosx/tkMacOSXWindowEvent.c (new): new macosx specific event
	handling functionality.

	* macosx/tkMacOSX.h (new):
	* macosx/tkMacOSXBitmap.c (new):
	* macosx/tkMacOSXButton.c (new):
	* macosx/tkMacOSXClipboard.c (new):
	* macosx/tkMacOSXColor.c (new):
	* macosx/tkMacOSXConfig.c (new):
	* macosx/tkMacOSXCursor.c (new):
	* macosx/tkMacOSXDefault.h (new):
	* macosx/tkMacOSXDialog.c (new):
	* macosx/tkMacOSXDraw.c (new):
	* macosx/tkMacOSXEmbed.c (new):
	* macosx/tkMacOSXFont.c (new):
	* macosx/tkMacOSXHLEvents.c (new):
	* macosx/tkMacOSXInt.h (new):
	* macosx/tkMacOSXKeyboard.c (new):
	* macosx/tkMacOSXMenu.c (new):
	* macosx/tkMacOSXMenubutton.c (new):
	* macosx/tkMacOSXMenus.c (new):
	* macosx/tkMacOSXPort.h (new):
	* macosx/tkMacOSXRegion.c (new):
	* macosx/tkMacOSXScale.c (new):
	* macosx/tkMacOSXScrlbr.c (new):
	* macosx/tkMacOSXSubwindows.c (new):
	* macosx/tkMacOSXTest.c (new):
	* macosx/tkMacOSXUtil.c (new):
	* macosx/tkMacOSXUtil.h (new):
	* macosx/tkMacOSXWm.c (new):
	* macosx/tkMacOSXWm.h (new):
	* macosx/tkMacOSXXStubs.c (new): macosx ports of classic mac Tk
	implementation in tk/mac.

	* macosx/tkMacOSXSend.c (new): only send to local interp
	implemented currently.

	* macosx/tkMacOSXDebug.h (new):
	* macosx/tkMacOSXDebug.c (new): new macosx specific functions for
	debugging MacOS events, regions, etc.

	* macosx/tkAboutDlg.r (new):
	* macosx/tkMacOSXApplication.r (new):
	* macosx/tkMacOSXCursors.r (new):
	* macosx/tkMacOSXLibrary.r (new):
	* macosx/tkMacOSXMenu.r (new):
	* macosx/tkMacOSXResource.r (new):
	* macosx/tkMacOSXXCursors.r (new):
	* macosx/tclets.r (new): sources for Rez resource compiler.

	* macosx/Wish.icns (new): Wish application icon.

	* generic/tk.h:
	* generic/default.h:
	* generic/tkBind.c:
	* generic/tkCmds.c:
	* generic/tkGrab.c:
	* generic/tkPointer.c:
	* generic/tkPort.h:
	* generic/tkSelect.c:
	* generic/tkStubLib.c:
	* generic/tkTest.c:
	* generic/tkText.c:
	* generic/tkWindow.c:
	* unix/tkUnix3d.c:
	* xlib/xgc.c:
	* xlib/X11/X.h:
	* xlib/X11/Xlib.h:
	* xlib/X11/Xutil.h: added #includes and #ifdefs for macosx

	* library/bgerror.tcl:
	* library/button.tcl:
	* library/console.tcl:
	* library/dialog.tcl:
	* library/entry.tcl:
	* library/listbox.tcl:
	* library/menu.tcl:
	* library/msgbox.tcl:
	* library/scrlbar.tcl:
	* library/spinbox.tcl:
	* library/text.tcl:
	* library/tk.tcl:
	* library/demos/menu.tcl:
	* library/demos/menubu.tcl:
	* library/demos/widget: check [tk windowingsystem] instead of
	and/or in addition to $tcl_platform(platform).

	* generic/tkInt.h:
	* mac/tkMacBitmap.c:
	* mac/tkMacWm.c: added missing CONSTification

	* generic/tkIntDecls.h:
	* generic/tkIntPlatDecls.h:
	* generic/tkIntXlibDecls.h:
	* generic/tkPlatDecls.h:
	* generic/tkStubInit.c: regen
@
text
@d14 1
a14 1
# RCS: @@(#) $Id$
d164 1
@


1.7
log
@Fixed panedwindow binding bugs and added demos for it too.
@
text
@d14 1
a14 1
# RCS: @@(#) $Id: widget,v 1.6 2001/11/30 11:25:41 dkf Exp $
d50 1
a50 1
if {$tcl_platform(platform) == "macintosh"} {
@


1.6
log
@More widget demo improvements.
@
text
@d14 1
a14 1
# RCS: @@(#) $Id: widget,v 1.5 2001/11/19 14:02:29 dkf Exp $
d202 1
d204 4
a207 1
    hscale	"Horizontal scale"
d388 1
a388 1
Copyright (c) 2001 Donal K. Fellows"
@


1.5
log
@Some neatening up of the widget demo launcher, and a new validated entry demo
@
text
@d14 1
a14 1
# RCS: @@(#) $Id: widget,v 1.4 2001/10/30 11:21:50 dkf Exp $
d18 18
d37 1
a44 1
set font {Helvetica 14}
d67 1
a67 1
    -font -*-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-* -anchor w
d69 1
a69 1
    -font -*-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-* -anchor w
d78 3
a80 2
text .t -yscrollcommand {.s set} -wrap word -width 60 -height 30 -font $font \
    -setgrid 1 -highlightthickness 0 -padx 4 -pady 2 -takefocus 0
d88 2
a89 1
.t tag configure title -font {Helvetica 18 bold}
d153 9
a161 3
.t insert end {
This application provides a front end for several short scripts that demonstrate what you can do with Tk widgets.  Each of the numbered lines below describes a demonstration;  you can click on it to invoke the demonstration.  Once the demonstration window appears, you can click the "See Code" button to see the Tcl/Tk code that created the demonstration.  If you wish, you can edit the code and click the "Rerun Demo" button in the code window to reinvoke the demonstration with the modified code.
}
d243 1
d248 1
a248 1
	    -font {Helvetica 18}
d378 6
a383 2
"Tk widget demonstration\n\n\
Copyright (c) 1996-1997 Sun Microsystems, Inc.\n
@


1.4
log
@Improvements to widget demo (integrates/demonstrates the new 8.4 widgets)
@
text
@d14 1
a14 1
# RCS: @@(#) $Id: widget,v 1.3 2001/09/26 21:36:19 pspjuth Exp $
d123 9
a134 1

d136 57
a192 106
.t insert end "Labels, buttons, checkbuttons, and radiobuttons" title
.t insert end " \n " {demospace}
.t insert end "1. Labels (text and bitmaps)." {demo demo-label}
.t insert end " \n " {demospace}
.t insert end "2. Buttons." {demo demo-button}
.t insert end " \n " {demospace}
.t insert end "3. Checkbuttons (select any of a group)." {demo demo-check}
.t insert end " \n " {demospace}
.t insert end "4. Radiobuttons (select one of a group)." {demo demo-radio}
.t insert end " \n " {demospace}
.t insert end "5. A 15-puzzle game made out of buttons." {demo demo-puzzle}
.t insert end " \n " {demospace}
.t insert end "6. Iconic buttons that use bitmaps." {demo demo-icon}
.t insert end " \n " {demospace}
.t insert end "7. Two labels displaying images." {demo demo-image1}
.t insert end " \n " {demospace}
.t insert end "8. A simple user interface for viewing images." \
    {demo demo-image2}
.t insert end " \n " {demospace}
.t insert end "9. Labelled frames." {demo demo-labelframe}
.t insert end " \n " {demospace}

.t insert end \n {} "Listboxes" title
.t insert end " \n " {demospace}
.t insert end "1. 50 states." {demo demo-states}
.t insert end " \n " {demospace}
.t insert end "2. Colors: change the color scheme for the application." \
	{demo demo-colors}
.t insert end " \n " {demospace}
.t insert end "3. A collection of famous sayings." {demo demo-sayings}
.t insert end " \n " {demospace}

.t insert end \n {} "Entries and Spin-boxes" title
.t insert end " \n " {demospace}
.t insert end "1. Entries without scrollbars." {demo demo-entry1}
.t insert end " \n " {demospace}
.t insert end "2. Entries with scrollbars." {demo demo-entry2}
.t insert end " \n " {demospace}
.t insert end "3. Spin-boxes." {demo demo-spin}
.t insert end " \n " {demospace}
.t insert end "4. Simple Rolodex-like form." {demo demo-form}
.t insert end " \n " {demospace}

.t insert end \n {} "Text" title
.t insert end " \n " {demospace}
.t insert end "1. Basic editable text." {demo demo-text}
.t insert end " \n " {demospace}
.t insert end "2. Text display styles." {demo demo-style}
.t insert end " \n " {demospace}
.t insert end "3. Hypertext (tag bindings)." {demo demo-bind}
.t insert end " \n " {demospace}
.t insert end "4. A text widget with embedded windows." {demo demo-twind}
.t insert end " \n " {demospace}
.t insert end "5. A search tool built with a text widget." {demo demo-search}
.t insert end " \n " {demospace}

.t insert end \n {} "Canvases" title
.t insert end " \n " {demospace}
.t insert end "1. The canvas item types." {demo demo-items}
.t insert end " \n " {demospace}
.t insert end "2. A simple 2-D plot." {demo demo-plot}
.t insert end " \n " {demospace}
.t insert end "3. Text items in canvases." {demo demo-ctext}
.t insert end " \n " {demospace}
.t insert end "4. An editor for arrowheads on canvas lines." {demo demo-arrow}
.t insert end " \n " {demospace}
.t insert end "5. A ruler with adjustable tab stops." {demo demo-ruler}
.t insert end " \n " {demospace}
.t insert end "6. A building floor plan." {demo demo-floor}
.t insert end " \n " {demospace}
.t insert end "7. A simple scrollable canvas." {demo demo-cscroll}
.t insert end " \n " {demospace}

.t insert end \n {} "Scales" title
.t insert end " \n " {demospace}
.t insert end "1. Vertical scale." {demo demo-vscale}
.t insert end " \n " {demospace}
.t insert end "2. Horizontal scale." {demo demo-hscale}
.t insert end " \n " {demospace}

.t insert end \n {} "Menus" title
.t insert end " \n " {demospace}
.t insert end "1. Menus and cascades." \
	{demo demo-menu}
.t insert end " \n " {demospace}
.t insert end "2. Menubuttons"\
	{demo demo-menubu}
.t insert end " \n " {demospace}

.t insert end \n {} "Common Dialogs" title
.t insert end " \n " {demospace}
.t insert end "1. Message boxes." {demo demo-msgbox}
.t insert end " \n " {demospace}
.t insert end "2. File selection dialog." {demo demo-filebox}
.t insert end " \n " {demospace}
.t insert end "3. Color picker." {demo demo-clrpick}
.t insert end " \n " {demospace}

.t insert end \n {} "Miscellaneous" title
.t insert end " \n " {demospace}
.t insert end "1. The built-in bitmaps." {demo demo-bitmap}
.t insert end " \n " {demospace}
.t insert end "2. A dialog box with a local grab." {demo demo-dialog1}
.t insert end " \n " {demospace}
.t insert end "3. A dialog box with a global grab." {demo demo-dialog2}
.t insert end " \n " {demospace}
d352 2
a353 1
Copyright (c) 1996-1997 Sun Microsystems, Inc."
@


1.3
log
@Added labelframe widget. TIP#18.
@
text
@d14 1
a14 1
# RCS: @@(#) $Id: widget,v 1.2 1998/09/14 18:23:30 stanton Exp $
d147 2
d160 3
a162 1
.t insert end \n {} "Entries" title
d164 1
a164 1
.t insert end "1. Without scrollbars." {demo demo-entry1}
d166 1
a166 1
.t insert end "2. With scrollbars." {demo demo-entry2}
d168 1
a168 1
.t insert end "3. Simple Rolodex-like form." {demo demo-form}
a216 6
.t insert end \n {} "Labelframes" title
.t insert end " \n " {demospace}
.t insert end "1. Labelframe." \
	{demo demo-labelframe}
.t insert end " \n " {demospace}

d396 3
@


1.3.2.1
log
@First checkin of support for Tk on Mac OS X.
@
text
@d14 1
a14 1
# RCS: @@(#) $Id$
d32 1
a32 1
if {[string equal $tcl_platform(windowingsystem) "classic"]} {
@


1.3.2.2
log
@Merge with current TOT
Added support for the wm stackorder command
Fixed crash when selecting Menu items in the Application menu that we didn't
put there.
Added first bits of the use of CG for low-level drawing.  The line-drawing works,
the rest doesn't yet.  You have to set the file static useCGDrawing to 1 and
rebuild to activate this code.
@
text
@d14 1
a14 1
# RCS: @@(#) $Id: widget,v 1.3.2.1 2001/10/15 09:22:00 wolfsuit Exp $
a17 18
if {$tcl_platform(platform) eq "unix"} {
    # This won't work everywhere, but there's no other way in core Tk
    # at the moment to display a coloured icon.
    image create photo TclPowered \
	    -file [file join $tk_library images logo64.gif]
    wm iconwindow . [toplevel ._iconWindow]
    pack [label ._iconWindow.i -image TclPowered]
    wm iconname . "tkWidgetDemo"
}

array set widgetFont {
    main   {Helvetica 12}
    bold   {Helvetica 12 bold}
    title  {Helvetica 18 bold}
    status {Helvetica 10}
    vars   {Helvetica 14}
}

a18 1
set font $widgetFont(main)
d26 1
d49 1
a49 1
	-font $widgetFont(status) -anchor w
d51 1
a51 1
	-font $widgetFont(status) -anchor w
d60 2
a61 3
text .t -yscrollcommand {.s set}  -wrap word  -width 70  -height 30 \
	-font $widgetFont(main)  -setgrid 1  -highlightthickness 0 \
	-padx 4  -pady 2  -takefocus 0
d69 1
a69 2
.t tag configure title -font $widgetFont(title)
.t tag configure bold  -font $widgetFont(bold)
d123 3
a125 8
proc addDemoSection {title demos} {
    .t insert end "\n" {} $title title " \n " demospace
    set num 0
    foreach {name description} $demos {
	.t insert end "[incr num]. $description." [list demo demo-$name]
	.t insert end " \n " demospace
    }
}
a126 66
.t insert end "Tk Widget Demonstrations\n" title
.t insert end "\nThis application provides a front end for several short\
	scripts that demonstrate what you can do with Tk widgets.  Each of\
	the numbered lines below describes a demonstration;  you can click\
	on it to invoke the demonstration.  Once the demonstration window\
	appears, you can click the " {} "See Code" bold " button to see the\
	Tcl/Tk code that created the demonstration.  If you wish, you can\
	edit the code and click the " {} "Rerun Demo" bold " button in the\
	code window to reinvoke the demonstration with the modified code.\n"

addDemoSection "Labels, buttons, checkbuttons, and radiobuttons" {
    label	"Labels (text and bitmaps)"
    button	"Buttons"
    check	"Check-buttons (select any of a group)"
    radio	"Radio-buttons (select one of a group)"
    puzzle	"A 15-puzzle game made out of buttons"
    icon	"Iconic buttons that use bitmaps"
    image1	"Two labels displaying images"
    image2	"A simple user interface for viewing images"
    labelframe	"Labelled frames"
}
addDemoSection "Listboxes" {
    states	"The 50 states"
    colors	"Colors: change the color scheme for the application"
    sayings	"A collection of famous and infamous sayings"
}
addDemoSection "Entries and Spin-boxes" {
    entry1	"Entries without scrollbars"
    entry2	"Entries with scrollbars"
    entry3	"Validated entries and password fields"
    spin	"Spin-boxes"
    form	"Simple Rolodex-like form"
}
addDemoSection "Text" {
    text	"Basic editable text"
    style	"Text display styles"
    bind	"Hypertext (tag bindings)"
    twind	"A text widget with embedded windows"
    search	"A search tool built with a text widget"
}
addDemoSection "Canvases" {
    items	"The canvas item types"
    plot	"A simple 2-D plot"
    ctext	"Text items in canvases"
    arrow	"An editor for arrowheads on canvas lines"
    ruler	"A ruler with adjustable tab stops"
    floor	"A building floor plan"
    cscroll	"A simple scrollable canvas"
}
addDemoSection "Scales" {
    vscale	"Vertical scale"
    hscale	"Horizontal scale"
}
addDemoSection "Menus" {
    menu	"Menus and cascades (sub-menus)"
    menubu	"Menu-buttons"
}
addDemoSection "Common Dialogs" {
    msgbox	"Message boxes"
    filebox	"File selection dialog"
    clrpick	"Color picker"
}
addDemoSection "Miscellaneous" {
    bitmap	"The built-in bitmaps"
    dialog1	"A dialog box with a local grab"
    dialog2	"A dialog box with a global grab"
d128 108
a259 1
    global widgetFont
d264 1
a264 1
	    -font $widgetFont(vars)
d394 2
a395 7
"Tk widget demonstration

Copyright (c) 1996-1997 Sun Microsystems, Inc.

Copyright (c) 1997-2000 Ajuba Solutions, Inc.

Copyright (c) 2001 Donal K. Fellows"
a397 3
# Local Variables:
# mode: tcl
# End:
@


1.3.2.3
log
@Merging with TOT as of 06/09/2002.
@
text
@d14 1
a14 1
# RCS: @@(#) $Id$
d202 1
a203 5
    vscale	"Vertical scale"
}
addDemoSection "Paned Windows" {
    paned1	"Horizontal paned window"
    paned2	"Vertical paned window"
d384 1
a384 1
Copyright (c) 2001-2002 Donal K. Fellows"
@


1.3.2.4
log
@various project cleanups & enhancements
added macosx/Makefile to facilitate building from cli
added [tk windowingsystem] and removed $::tcl_plaform(windowingsystem)
changed all runtime library references to the above
removed duplicate entries in tk.decls & tkInt.decls
CONSTification and other small changes in macosx/ to remove compiler warnings
@
text
@d50 1
a50 1
if {[string equal [tk windowingsystem] "classic"]} {
@


1.2
log
@Replaced SCCS strings, fixed binary files
@
text
@d14 1
a14 1
# RCS: @@(#) $Id$
d211 6
@


1.2.20.1
log
@sync with head
@
text
@d14 1
a14 1
# RCS: @@(#) $Id: widget,v 1.7 2002/02/22 14:07:01 dkf Exp $
a17 18
if {$tcl_platform(platform) eq "unix"} {
    # This won't work everywhere, but there's no other way in core Tk
    # at the moment to display a coloured icon.
    image create photo TclPowered \
	    -file [file join $tk_library images logo64.gif]
    wm iconwindow . [toplevel ._iconWindow]
    pack [label ._iconWindow.i -image TclPowered]
    wm iconname . "tkWidgetDemo"
}

array set widgetFont {
    main   {Helvetica 12}
    bold   {Helvetica 12 bold}
    title  {Helvetica 18 bold}
    status {Helvetica 10}
    vars   {Helvetica 14}
}

a18 1
set font $widgetFont(main)
d26 1
d49 1
a49 1
	-font $widgetFont(status) -anchor w
d51 1
a51 1
	-font $widgetFont(status) -anchor w
d60 2
a61 3
text .t -yscrollcommand {.s set}  -wrap word  -width 70  -height 30 \
	-font $widgetFont(main)  -setgrid 1  -highlightthickness 0 \
	-padx 4  -pady 2  -takefocus 0
d69 1
a69 2
.t tag configure title -font $widgetFont(title)
.t tag configure bold  -font $widgetFont(bold)
d123 3
a125 8
proc addDemoSection {title demos} {
    .t insert end "\n" {} $title title " \n " demospace
    set num 0
    foreach {name description} $demos {
	.t insert end "[incr num]. $description." [list demo demo-$name]
	.t insert end " \n " demospace
    }
}
a126 70
.t insert end "Tk Widget Demonstrations\n" title
.t insert end "\nThis application provides a front end for several short\
	scripts that demonstrate what you can do with Tk widgets.  Each of\
	the numbered lines below describes a demonstration;  you can click\
	on it to invoke the demonstration.  Once the demonstration window\
	appears, you can click the " {} "See Code" bold " button to see the\
	Tcl/Tk code that created the demonstration.  If you wish, you can\
	edit the code and click the " {} "Rerun Demo" bold " button in the\
	code window to reinvoke the demonstration with the modified code.\n"

addDemoSection "Labels, buttons, checkbuttons, and radiobuttons" {
    label	"Labels (text and bitmaps)"
    button	"Buttons"
    check	"Check-buttons (select any of a group)"
    radio	"Radio-buttons (select one of a group)"
    puzzle	"A 15-puzzle game made out of buttons"
    icon	"Iconic buttons that use bitmaps"
    image1	"Two labels displaying images"
    image2	"A simple user interface for viewing images"
    labelframe	"Labelled frames"
}
addDemoSection "Listboxes" {
    states	"The 50 states"
    colors	"Colors: change the color scheme for the application"
    sayings	"A collection of famous and infamous sayings"
}
addDemoSection "Entries and Spin-boxes" {
    entry1	"Entries without scrollbars"
    entry2	"Entries with scrollbars"
    entry3	"Validated entries and password fields"
    spin	"Spin-boxes"
    form	"Simple Rolodex-like form"
}
addDemoSection "Text" {
    text	"Basic editable text"
    style	"Text display styles"
    bind	"Hypertext (tag bindings)"
    twind	"A text widget with embedded windows"
    search	"A search tool built with a text widget"
}
addDemoSection "Canvases" {
    items	"The canvas item types"
    plot	"A simple 2-D plot"
    ctext	"Text items in canvases"
    arrow	"An editor for arrowheads on canvas lines"
    ruler	"A ruler with adjustable tab stops"
    floor	"A building floor plan"
    cscroll	"A simple scrollable canvas"
}
addDemoSection "Scales" {
    hscale	"Horizontal scale"
    vscale	"Vertical scale"
}
addDemoSection "Paned Windows" {
    paned1	"Horizontal paned window"
    paned2	"Vertical paned window"
}
addDemoSection "Menus" {
    menu	"Menus and cascades (sub-menus)"
    menubu	"Menu-buttons"
}
addDemoSection "Common Dialogs" {
    msgbox	"Message boxes"
    filebox	"File selection dialog"
    clrpick	"Color picker"
}
addDemoSection "Miscellaneous" {
    bitmap	"The built-in bitmaps"
    dialog1	"A dialog box with a local grab"
    dialog2	"A dialog box with a global grab"
d128 102
a253 1
    global widgetFont
d258 1
a258 1
	    -font $widgetFont(vars)
d388 2
a389 7
"Tk widget demonstration

Copyright (c) 1996-1997 Sun Microsystems, Inc.

Copyright (c) 1997-2000 Ajuba Solutions, Inc.

Copyright (c) 2001-2002 Donal K. Fellows"
a391 3
# Local Variables:
# mode: tcl
# End:
@


1.1
log
@Initial revision
@
text
@d14 1
a14 1
# SCCS: @@(#) widget 1.35 97/07/19 15:42:22
@


1.1.4.1
log
@Merged 8.0.3 changes into 8.1
@
text
@d14 1
a14 1
# RCS: @@(#) $Id: widget,v 1.2 1998/09/14 18:23:30 stanton Exp $
@


