summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--doc/ttk_treeview.n5
-rw-r--r--generic/ttk/ttkImage.c18
-rw-r--r--generic/ttk/ttkPanedwindow.c4
-rw-r--r--generic/ttk/ttkTreeview.c6
-rw-r--r--generic/ttk/ttkWidget.c134
-rw-r--r--library/ttk/button.tcl6
-rw-r--r--library/ttk/combobox.tcl4
-rw-r--r--library/ttk/utils.tcl39
9 files changed, 123 insertions, 101 deletions
diff --git a/ChangeLog b/ChangeLog
index 704491b..7171d7e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2006-11-26 Joe English <jenglish@users.sourceforge.net>
+ * generic/ttk/ttkWidget.c, generic/ttk/ttkPaned.c Fix for #1603506
+ * library/ttk/button.tcl, library/ttk/combobox.tcl,
+ library/ttk/utils.tcl: Rename ttk::CopyBindings to ttk::copyBindings
+ * generic/ttk/ttkTreeview.c, doc/ttk_treeview.n:
+ -displaycolumns {} now means "no columns" instead of "all columns".
+ Use -displaycolumns #all for "all columns" [Fixes #1547622].
+
2006-11-26 Daniel Steffen <das@users.sourceforge.net>
* tcl.m4 (Linux): --enable-64bit support. [Patch 1597389], [Bug 1230558]
diff --git a/doc/ttk_treeview.n b/doc/ttk_treeview.n
index c24b7f8..a15bfe9 100644
--- a/doc/ttk_treeview.n
+++ b/doc/ttk_treeview.n
@@ -49,9 +49,10 @@ specifying the number of columns and their names.
A list of column identifiers
(either symbolic names or integer indices)
specifying which data columns are displayed
-and the order in which they appear.
+and the order in which they appear,
+or the string \fB#all\fP.
.br
-If empty (the default), all columns are shown in the order given.
+If set to \fB#all\fP (the default), all columns are shown in the order given.
.OP \-height height Height
Specifies the number of rows which should be visible.
Note:
diff --git a/generic/ttk/ttkImage.c b/generic/ttk/ttkImage.c
index 130fcee..4d80f48 100644
--- a/generic/ttk/ttkImage.c
+++ b/generic/ttk/ttkImage.c
@@ -1,4 +1,4 @@
-/* $Id: ttkImage.c,v 1.2 2006/11/03 03:06:22 das Exp $
+/* $Id: ttkImage.c,v 1.3 2006/11/27 06:53:55 jenglish Exp $
* Ttk widget set -- image element factory.
*
* Copyright (C) 2004 Pat Thoyts <patthoyts@users.sf.net>
@@ -109,18 +109,10 @@ static void FreeImageData(void *clientData)
{
ImageData *imageData = clientData;
Tcl_DecrRefCount(imageData->baseImage);
- if (imageData->imageMap) {
- Tcl_DecrRefCount(imageData->imageMap);
- }
- if (imageData->stickyObj) {
- Tcl_DecrRefCount(imageData->stickyObj);
- }
- if (imageData->borderObj) {
- Tcl_DecrRefCount(imageData->borderObj);
- }
- if (imageData->paddingObj) {
- Tcl_DecrRefCount(imageData->paddingObj);
- }
+ if (imageData->imageMap) { Tcl_DecrRefCount(imageData->imageMap); }
+ if (imageData->stickyObj) { Tcl_DecrRefCount(imageData->stickyObj); }
+ if (imageData->borderObj) { Tcl_DecrRefCount(imageData->borderObj); }
+ if (imageData->paddingObj) { Tcl_DecrRefCount(imageData->paddingObj); }
ckfree(clientData);
}
diff --git a/generic/ttk/ttkPanedwindow.c b/generic/ttk/ttkPanedwindow.c
index e207a58..2bd3f1b 100644
--- a/generic/ttk/ttkPanedwindow.c
+++ b/generic/ttk/ttkPanedwindow.c
@@ -1,4 +1,4 @@
-/* $Id: ttkPanedwindow.c,v 1.4 2006/11/24 18:04:14 jenglish Exp $
+/* $Id: ttkPanedwindow.c,v 1.5 2006/11/27 06:53:55 jenglish Exp $
*
* Copyright (c) 2005, Joe English. Freely redistributable.
*
@@ -475,8 +475,6 @@ static Ttk_Layout PanedGetLayout(
if (pw->paned.sashThickness < MIN_SASH_THICKNESS)
pw->paned.sashThickness = MIN_SASH_THICKNESS;
- Ttk_ManagerSizeChanged(pw->paned.mgr);
-
return panedLayout;
}
diff --git a/generic/ttk/ttkTreeview.c b/generic/ttk/ttkTreeview.c
index 6d8a4eb..70b328e 100644
--- a/generic/ttk/ttkTreeview.c
+++ b/generic/ttk/ttkTreeview.c
@@ -1,5 +1,5 @@
/*
- * $Id: ttkTreeview.c,v 1.4 2006/11/24 18:04:14 jenglish Exp $
+ * $Id: ttkTreeview.c,v 1.5 2006/11/27 06:53:55 jenglish Exp $
* Copyright (c) 2004, Joe English
*
* ttk::treeview widget implementation.
@@ -420,7 +420,7 @@ static Tk_OptionSpec TreeviewOptionSpecs[] =
"", Tk_Offset(Treeview,tree.columnsObj), -1,
0,0,COLUMNS_CHANGED | GEOMETRY_CHANGED /*| READONLY_OPTION*/ },
{TK_OPTION_STRING, "-displaycolumns","displayColumns","DisplayColumns",
- "", Tk_Offset(Treeview,tree.displayColumnsObj), -1,
+ "#all", Tk_Offset(Treeview,tree.displayColumnsObj), -1,
0,0,DCOLUMNS_CHANGED | GEOMETRY_CHANGED },
{TK_OPTION_STRING, "-show", "show", "Show",
DEFAULT_SHOW, Tk_Offset(Treeview,tree.showObj), -1,
@@ -708,7 +708,7 @@ static int TreeviewInitDisplayColumns(Tcl_Interp *interp, Treeview *tv)
return TCL_ERROR;
}
- if (ndcols == 0) {
+ if (!strcmp(Tcl_GetString(tv->tree.displayColumnsObj), "#all")) {
ndcols = tv->tree.nColumns;
displayColumns = (TreeColumn**)ckalloc((ndcols+1)*sizeof(TreeColumn*));
for (index = 0; index < ndcols; ++index) {
diff --git a/generic/ttk/ttkWidget.c b/generic/ttk/ttkWidget.c
index 77a6641..8dc3de6 100644
--- a/generic/ttk/ttkWidget.c
+++ b/generic/ttk/ttkWidget.c
@@ -1,4 +1,4 @@
-/* $Id: ttkWidget.c,v 1.2 2006/11/03 03:06:22 das Exp $
+/* $Id: ttkWidget.c,v 1.3 2006/11/27 06:53:55 jenglish Exp $
* Copyright (c) 2003, Joe English
*
* Ttk widget implementation, core widget utilities.
@@ -11,25 +11,35 @@
#include "ttkWidget.h"
/*------------------------------------------------------------------------
- * Helper routines.
+ * +++ Internal helper routines.
*/
-static void UpdateLayout(Tcl_Interp *interp, WidgetCore *corePtr)
+/* UpdateLayout --
+ * Call the widget's get-layout hook to recompute corePtr->layout.
+ * Returns TCL_OK if successful, returns TCL_ERROR and leaves
+ * the layout unchanged otherwise.
+ */
+static int UpdateLayout(Tcl_Interp *interp, WidgetCore *corePtr)
{
Ttk_Theme themePtr = Ttk_GetCurrentTheme(interp);
Ttk_Layout newLayout =
corePtr->widgetSpec->getLayoutProc(interp, themePtr,corePtr);
- /* TODO: @@@ Check for errors */
if (newLayout) {
if (corePtr->layout) {
Ttk_FreeLayout(corePtr->layout);
}
corePtr->layout = newLayout;
+ return TCL_OK;
}
+ return TCL_ERROR;
}
-static void UpdateGeometry(WidgetCore *corePtr)
+/* SizeChanged --
+ * Call the widget's sizeProc to compute new requested size
+ * and pass it to the geometry manager.
+ */
+static void SizeChanged(WidgetCore *corePtr)
{
int reqWidth = 1, reqHeight = 1;
@@ -93,7 +103,6 @@ static void RedisplayWidget(ClientData recordPtr)
/* TtkRedisplayWidget --
* Schedule redisplay as an idle handler.
*/
-
void TtkRedisplayWidget(WidgetCore *corePtr)
{
if (corePtr->flags & WIDGET_DESTROYED) {
@@ -109,17 +118,29 @@ void TtkRedisplayWidget(WidgetCore *corePtr)
/* TtkResizeWidget --
* Recompute widget size, schedule geometry propagation and redisplay.
*/
-
void TtkResizeWidget(WidgetCore *corePtr)
{
if (corePtr->flags & WIDGET_DESTROYED) {
return;
}
- UpdateGeometry(corePtr);
+ SizeChanged(corePtr);
TtkRedisplayWidget(corePtr);
}
+/* TtkWidgetChangeState --
+ * Set / clear the specified bits in the 'state' flag,
+ */
+void TtkWidgetChangeState(WidgetCore *corePtr,
+ unsigned int setBits, unsigned int clearBits)
+{
+ Ttk_State oldState = corePtr->state;
+ corePtr->state = (oldState & ~clearBits) | setBits;
+ if (corePtr->state ^ oldState) {
+ TtkRedisplayWidget(corePtr);
+ }
+}
+
/* TtkWidgetEnsembleCommand --
* Invoke an ensemble defined by a WidgetCommandSpec.
*/
@@ -160,7 +181,7 @@ WidgetInstanceObjCmd(
int status = TCL_OK;
Tcl_Preserve(clientData);
- status = TtkWidgetEnsembleCommand(commands, 1, interp, objc, objv, clientData);
+ status = TtkWidgetEnsembleCommand(commands,1, interp,objc,objv,clientData);
Tcl_Release(clientData);
return status;
@@ -235,8 +256,8 @@ static void CoreEventProc(ClientData clientData, XEvent *eventPtr)
case ConfigureNotify :
if (!(corePtr->flags & WIDGET_REALIZED)) {
/* See <<NOTE-REALIZED>> */
- UpdateLayout(corePtr->interp, corePtr);
- UpdateGeometry(corePtr);
+ (void)UpdateLayout(corePtr->interp, corePtr);
+ SizeChanged(corePtr);
corePtr->flags |= WIDGET_REALIZED;
}
TtkRedisplayWidget(corePtr);
@@ -299,8 +320,8 @@ static void CoreEventProc(ClientData clientData, XEvent *eventPtr)
break;
case VirtualEvent:
if (!strcmp("ThemeChanged", ((XVirtualEvent *)(eventPtr))->name)) {
- UpdateLayout(corePtr->interp, corePtr);
- UpdateGeometry(corePtr);
+ (void)UpdateLayout(corePtr->interp, corePtr);
+ SizeChanged(corePtr);
TtkRedisplayWidget(corePtr);
}
default:
@@ -318,7 +339,7 @@ static void CoreEventProc(ClientData clientData, XEvent *eventPtr)
static void WidgetWorldChanged(ClientData clientData)
{
WidgetCore *corePtr = (WidgetCore*)clientData;
- UpdateGeometry(corePtr);
+ SizeChanged(corePtr);
TtkRedisplayWidget(corePtr);
}
@@ -393,10 +414,10 @@ int TtkWidgetConstructorObjCmd(
Tk_SetClassProcs(tkwin, &widgetClassProcs, recordPtr);
if (Tk_InitOptions(interp, recordPtr, optionTable, tkwin) != TCL_OK)
- goto error;
+ goto error_nocleanup;
if (widgetSpec->initializeProc(interp, recordPtr) != TCL_OK)
- goto error;
+ goto error_nocleanup;
if (Tk_SetOptions(interp, recordPtr, optionTable, objc - 2,
objv + 2, tkwin, NULL/*savePtr*/, (int *)NULL/*maskPtr*/) != TCL_OK)
@@ -411,9 +432,10 @@ int TtkWidgetConstructorObjCmd(
if (WidgetDestroyed(corePtr))
goto error;
- UpdateLayout(interp, corePtr);
- UpdateGeometry(corePtr);
+ if (UpdateLayout(interp, corePtr) != TCL_OK)
+ goto error;
+ SizeChanged(corePtr);
Tk_CreateEventHandler(tkwin, CoreEventMask, CoreEventProc, recordPtr);
Tcl_SetObjResult(interp, Tcl_NewStringObj(Tk_PathName(tkwin), -1));
@@ -421,6 +443,8 @@ int TtkWidgetConstructorObjCmd(
return TCL_OK;
error:
+ widgetSpec->cleanupProc(recordPtr);
+error_nocleanup:
if (corePtr->layout) {
Ttk_FreeLayout(corePtr->layout);
corePtr->layout = 0;
@@ -433,22 +457,11 @@ error:
return TCL_ERROR;
}
-/*
- * TtkWidgetChangeState --
- * Set / clear the specified bits in the 'state' flag,
+/*------------------------------------------------------------------------
+ * +++ Default implementations for widget hook procedures.
*/
-void TtkWidgetChangeState(WidgetCore *corePtr,
- unsigned int setBits, unsigned int clearBits)
-{
- Ttk_State oldState = corePtr->state;
- corePtr->state = (oldState & ~clearBits) | setBits;
- if (corePtr->state ^ oldState) {
- TtkRedisplayWidget(corePtr);
- }
-}
-/*
- * TtkWidgetGetLayout --
+/* TtkWidgetGetLayout --
* Default getLayoutProc.
* Looks up the layout based on the -style resource (if specified),
* otherwise use the widget class.
@@ -514,17 +527,15 @@ Ttk_Layout TtkWidgetGetOrientedLayout(
return layout;
}
-/*
- * TtkNullInitialize --
+/* TtkNullInitialize --
* Default widget initializeProc (no-op)
*/
-int TtkNullInitialize(Tcl_Interp *interp, void *recordPtr)
+int TtkNullInitialize(Tcl_Interp *interp, void *recordPtr)
{
return TCL_OK;
}
-/*
- * TtkNullPostConfigure --
+/* TtkNullPostConfigure --
* Default widget postConfigureProc (no-op)
*/
int TtkNullPostConfigure(Tcl_Interp *interp, void *clientData, int mask)
@@ -534,30 +545,21 @@ int TtkNullPostConfigure(Tcl_Interp *interp, void *clientData, int mask)
/* TtkCoreConfigure --
* Default widget configureProc.
+ * Handles -style option.
*/
int TtkCoreConfigure(Tcl_Interp *interp, void *clientData, int mask)
{
WidgetCore *corePtr = clientData;
-
- if (mask & STYLE_CHANGED) {
- Ttk_Theme theme = Ttk_GetCurrentTheme(interp);
- Ttk_Layout newLayout =
- corePtr->widgetSpec->getLayoutProc(interp,theme,corePtr);
+ int status = TCL_OK;
- if (!newLayout) {
- return TCL_ERROR;
- }
- if (corePtr->layout) {
- Ttk_FreeLayout(corePtr->layout);
- }
- corePtr->layout = newLayout;
+ if (mask & STYLE_CHANGED) {
+ status = UpdateLayout(interp, corePtr);
}
- return TCL_OK;
+ return status;
}
-/*
- * TtkNullCleanup --
+/* TtkNullCleanup --
* Default widget cleanupProc (no-op)
*/
void TtkNullCleanup(void *recordPtr)
@@ -565,8 +567,7 @@ void TtkNullCleanup(void *recordPtr)
return;
}
-/*
- * TtkWidgetDoLayout --
+/* TtkWidgetDoLayout --
* Default widget layoutProc.
*/
void TtkWidgetDoLayout(void *clientData)
@@ -575,8 +576,7 @@ void TtkWidgetDoLayout(void *clientData)
Ttk_PlaceLayout(corePtr->layout,corePtr->state,Ttk_WinBox(corePtr->tkwin));
}
-/*
- * TtkWidgetDisplay --
+/* TtkWidgetDisplay --
* Default widget displayProc.
*/
void TtkWidgetDisplay(void *recordPtr, Drawable d)
@@ -585,8 +585,7 @@ void TtkWidgetDisplay(void *recordPtr, Drawable d)
Ttk_DrawLayout(corePtr->layout, corePtr->state, d);
}
-/*
- * TtkWidgetSize --
+/* TtkWidgetSize --
* Default widget sizeProc()
*/
int TtkWidgetSize(void *recordPtr, int *widthPtr, int *heightPtr)
@@ -594,16 +593,14 @@ int TtkWidgetSize(void *recordPtr, int *widthPtr, int *heightPtr)
WidgetCore *corePtr = recordPtr;
Ttk_LayoutSize(corePtr->layout, corePtr->state, widthPtr, heightPtr);
return 1;
-
-/* OR: (@@@)
- return *widthPtr > Tk_Width(corePtr->tkwin)
- || *heightPtr > Tk_Height(corePtr->tkwin);
-*/
}
+/*------------------------------------------------------------------------
+ * +++ Default implementations for widget subcommands.
+ */
-/* Default implementations for widget subcommands:
-*/
+/* $w cget -option
+ */
int TtkWidgetCgetCommand(
Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[], void *recordPtr)
{
@@ -622,6 +619,8 @@ Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[], void *recordPtr)
return TCL_OK;
}
+/* $w configure ?-option ?value ....??
+ */
int TtkWidgetConfigureCommand(
Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr)
{
@@ -665,7 +664,7 @@ Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr)
}
if (mask & (STYLE_CHANGED | GEOMETRY_CHANGED)) {
- UpdateGeometry(corePtr);
+ SizeChanged(corePtr);
}
TtkRedisplayWidget(corePtr);
@@ -679,8 +678,7 @@ Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr)
return TCL_OK;
}
-/* $w state $stateSpec
- * $w state
+/* $w state ? $stateSpec ?
*
* If $stateSpec is specified, modify the widget state accordingly,
* return a new stateSpec representing the changed bits.
diff --git a/library/ttk/button.tcl b/library/ttk/button.tcl
index ccc1fb4..494a674 100644
--- a/library/ttk/button.tcl
+++ b/library/ttk/button.tcl
@@ -1,5 +1,5 @@
#
-# $Id: button.tcl,v 1.1 2006/10/31 01:42:26 hobbs Exp $
+# $Id: button.tcl,v 1.2 2006/11/27 06:53:55 jenglish Exp $
#
# Bindings for Buttons, Checkbuttons, and Radiobuttons.
#
@@ -36,8 +36,8 @@ bind TButton <Button1-Enter> \
# Checkbuttons and Radiobuttons have the same bindings as Buttons:
#
-ttk::CopyBindings TButton TCheckbutton
-ttk::CopyBindings TButton TRadiobutton
+ttk::copyBindings TButton TCheckbutton
+ttk::copyBindings TButton TRadiobutton
# ...plus a few more:
diff --git a/library/ttk/combobox.tcl b/library/ttk/combobox.tcl
index 7df9f61..6c7099c 100644
--- a/library/ttk/combobox.tcl
+++ b/library/ttk/combobox.tcl
@@ -1,5 +1,5 @@
#
-# $Id: combobox.tcl,v 1.1 2006/10/31 01:42:27 hobbs Exp $
+# $Id: combobox.tcl,v 1.2 2006/11/27 06:53:55 jenglish Exp $
#
# Ttk widget set: combobox bindings.
#
@@ -21,7 +21,7 @@ namespace eval ttk::combobox {
# Duplicate the Entry bindings, override if needed:
#
-ttk::CopyBindings TEntry TCombobox
+ttk::copyBindings TEntry TCombobox
bind TCombobox <KeyPress-Down> { ttk::combobox::Post %W }
bind TCombobox <KeyPress-Escape> { ttk::combobox::Unpost %W }
diff --git a/library/ttk/utils.tcl b/library/ttk/utils.tcl
index 11f85b9..8019303 100644
--- a/library/ttk/utils.tcl
+++ b/library/ttk/utils.tcl
@@ -1,7 +1,7 @@
#
-# $Id: utils.tcl,v 1.2 2006/11/07 03:45:28 jenglish Exp $
+# $Id: utils.tcl,v 1.3 2006/11/27 06:53:55 jenglish Exp $
#
-# Ttk widget set: utilities for widget implementations.
+# Utilities for widget implementations.
#
### Focus management.
@@ -17,6 +17,30 @@ proc ttk::takefocus {w} {
expr {[$w instate !disabled] && [winfo viewable $w]}
}
+# ttk::traverseTo $w --
+# Set the keyboard focus to the specified window.
+#
+proc ttk::traverseTo {w} {
+ set focus [focus]
+ if {$focus ne ""} {
+ event generate $focus <<TraverseOut>>
+ }
+ focus $w
+ event generate $w <<TraverseIn>>
+}
+
+## ttk::traverseTo $w --
+# Set the keyboard focus to the specified window.
+#
+proc ttk::traverseTo {w} {
+ set focus [focus]
+ if {$focus ne ""} {
+ event generate $focus <<TraverseOut>>
+ }
+ focus $w
+ event generate $w <<TraverseIn>>
+}
+
## ttk::clickToFocus $w --
# Utility routine, used in <ButtonPress-1> bindings --
# Assign keyboard focus to the specified widget if -takefocus is enabled.
@@ -58,15 +82,16 @@ proc ttk::takesFocus {w} {
return 0
}
-# ttk::focusFirst $w --
+## ttk::focusFirst $w --
# Return the first descendant of $w, in preorder traversal order,
# that can take keyboard focus, "" if none do.
#
# See also: tk_focusNext
#
+
proc ttk::focusFirst {w} {
- if {[ttk::takesFocus $w]} {
- return $w
+ if {[ttk::takesFocus $w]} {
+ return $w
}
foreach child [winfo children $w] {
if {[set c [ttk::focusFirst $child]] ne ""} {
@@ -222,10 +247,10 @@ proc ttk::CancelRepeat {} {
### Miscellaneous.
#
-## ttk::CopyBindings $from $to --
+## ttk::copyBindings $from $to --
# Utility routine; copies bindings from one bindtag onto another.
#
-proc ttk::CopyBindings {from to} {
+proc ttk::copyBindings {from to} {
foreach event [bind $from] {
bind $to $event [bind $from $event]
}