head	1.26;
access;
symbols
	core-8-5-9:1.11.2.3
	core-8-5-8:1.11.2.2
	macosx-cocoa-merge:1.21
	macosx-cocoa-premerge:1.21
	macosx-carbon-freeze:1.21
	core-8-5-7:1.11.2.1
	core-8-5-6:1.11.2.1
	core-8-6-b1:1.20
	core-8-6-a3:1.13
	core-8-5-5:1.11
	core-8-6-a2:1.13
	core-8-5-4:1.11
	core-8-5-3:1.11
	core-8-6-a1:1.12
	core-8-5-branch:1.11.0.2
	core-8-5-2:1.11
	core-8-5-1:1.11
	core-8-5-0:1.9
	core-8-5-b3:1.8
	core-8-5-b2:1.7
	core-8-5-b1:1.7
	core-stablilizer-merge:1.7
	core-stabilizer-branch:1.7.0.2
	core-stabilizer-merge:1.11
	core-8-5-a6:1.7;
locks; strict;
comment	@ * @;


1.26
date	2010.02.05.21.33.14;	author jenglish;	state Exp;
branches;
next	1.25;

1.25
date	2010.02.05.17.42.21;	author nijtmans;	state Exp;
branches;
next	1.24;

1.24
date	2010.01.31.22.50.56;	author jenglish;	state Exp;
branches;
next	1.23;

1.23
date	2010.01.13.23.08.13;	author nijtmans;	state Exp;
branches;
next	1.22;

1.22
date	2009.11.01.18.12.44;	author jenglish;	state Exp;
branches;
next	1.21;

1.21
date	2009.02.08.19.35.35;	author jenglish;	state Exp;
branches;
next	1.20;

1.20
date	2008.12.03.18.44.50;	author jenglish;	state Exp;
branches;
next	1.19;

1.19
date	2008.11.16.17.14.16;	author jenglish;	state Exp;
branches;
next	1.18;

1.18
date	2008.11.13.01.13.54;	author jenglish;	state Exp;
branches;
next	1.17;

1.17
date	2008.11.11.23.39.30;	author jenglish;	state Exp;
branches;
next	1.16;

1.16
date	2008.11.09.23.53.09;	author jenglish;	state Exp;
branches;
next	1.15;

1.15
date	2008.11.09.21.37.13;	author jenglish;	state Exp;
branches;
next	1.14;

1.14
date	2008.10.31.18.01.35;	author jenglish;	state Exp;
branches;
next	1.13;

1.13
date	2008.07.23.23.24.44;	author nijtmans;	state Exp;
branches;
next	1.12;

1.12
date	2008.04.27.22.41.12;	author dkf;	state Exp;
branches;
next	1.11;

1.11
date	2008.01.06.22.35.41;	author jenglish;	state Exp;
branches
	1.11.2.1;
next	1.10;

1.10
date	2008.01.06.22.33.14;	author jenglish;	state Exp;
branches;
next	1.9;

1.9
date	2007.12.13.15.26.26;	author dgp;	state Exp;
branches;
next	1.8;

1.8
date	2007.10.30.15.22.51;	author jenglish;	state Exp;
branches;
next	1.7;

1.7
date	2007.04.23.21.15.19;	author das;	state Exp;
branches
	1.7.2.1;
next	1.6;

1.6
date	2007.03.07.23.49.38;	author das;	state Exp;
branches;
next	1.5;

1.5
date	2007.03.07.23.46.34;	author das;	state Exp;
branches;
next	1.4;

1.4
date	2007.01.03.05.06.25;	author nijtmans;	state Exp;
branches;
next	1.3;

1.3
date	2006.11.27.06.53.55;	author jenglish;	state Exp;
branches;
next	1.2;

1.2
date	2006.11.03.03.06.22;	author das;	state Exp;
branches;
next	1.1;

1.1
date	2006.10.31.01.42.26;	author hobbs;	state Exp;
branches;
next	;

1.7.2.1
date	2007.11.01.16.37.20;	author dgp;	state Exp;
branches;
next	1.7.2.2;

1.7.2.2
date	2008.01.23.16.39.12;	author dgp;	state Exp;
branches;
next	;

1.11.2.1
date	2008.12.22.18.34.55;	author jenglish;	state Exp;
branches;
next	1.11.2.2;

1.11.2.2
date	2009.05.14.00.53.04;	author patthoyts;	state Exp;
branches;
next	1.11.2.3;

1.11.2.3
date	2010.08.26.02.06.10;	author hobbs;	state Exp;
branches;
next	;


desc
@@


1.26
log
@Laxative patch: Revert contravariant const qualifiers added by the
previous commit to keep codebase in sync with the Tile extension,
which must remain 8.4 compatible.
@
text
@/* $Id: ttkWidget.c,v 1.25 2010/02/05 17:42:21 nijtmans Exp $
 * Copyright (c) 2003, Joe English
 *
 * Core widget utilities.
 */

#include <string.h>
#include <tk.h>
#include "ttkTheme.h"
#include "ttkWidget.h"

#ifdef MAC_OSX_TK
#define TK_NO_DOUBLE_BUFFERING 1
#endif

/*------------------------------------------------------------------------
 * +++ Internal helper routines.
 */

/* 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);

    if (newLayout) {
	if (corePtr->layout) {
	    Ttk_FreeLayout(corePtr->layout);
	}
	corePtr->layout = newLayout;
	return TCL_OK;
    }
    return TCL_ERROR;
}

/* 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;

    if (corePtr->widgetSpec->sizeProc(corePtr,&reqWidth,&reqHeight)) {
	Tk_GeometryRequest(corePtr->tkwin, reqWidth, reqHeight);
    }
}

#ifndef TK_NO_DOUBLE_BUFFERING

/* BeginDrawing --
 * 	Returns a Drawable for drawing the widget contents.
 *	This is normally an off-screen Pixmap, copied to
 *	the window by EndDrawing().
 */
static Drawable BeginDrawing(Tk_Window tkwin)
{
    return Tk_GetPixmap(Tk_Display(tkwin), Tk_WindowId(tkwin),
	    Tk_Width(tkwin), Tk_Height(tkwin), Tk_Depth(tkwin));
}

/* EndDrawing --
 *	Copy the drawable contents to the screen and release resources.
 */
static void EndDrawing(Tk_Window tkwin, Drawable d)
{
    XGCValues gcValues;
    GC gc;

    gcValues.function = GXcopy;
    gcValues.graphics_exposures = False;
    gc = Tk_GetGC(tkwin, GCFunction|GCGraphicsExposures, &gcValues);

    XCopyArea(Tk_Display(tkwin), d, Tk_WindowId(tkwin), gc,
	    0, 0, (unsigned) Tk_Width(tkwin), (unsigned) Tk_Height(tkwin),
	    0, 0);

    Tk_FreePixmap(Tk_Display(tkwin), d);
    Tk_FreeGC(Tk_Display(tkwin), gc);
}
#else
/* No double-buffering: draw directly into the window. */
static Drawable BeginDrawing(Tk_Window tkwin) { return Tk_WindowId(tkwin); }
static void EndDrawing(Tk_Window tkwin, Drawable d) { }
#endif

/* DrawWidget --
 *	Redraw a widget.  Called as an idle handler.
 */
static void DrawWidget(ClientData recordPtr)
{
    WidgetCore *corePtr = recordPtr;

    corePtr->flags &= ~REDISPLAY_PENDING;
    if (Tk_IsMapped(corePtr->tkwin)) {
	Drawable d = BeginDrawing(corePtr->tkwin);
	corePtr->widgetSpec->layoutProc(recordPtr);
	corePtr->widgetSpec->displayProc(recordPtr, d);
	EndDrawing(corePtr->tkwin, d);
    }
}

/* TtkRedisplayWidget --
 * 	Schedule redisplay as an idle handler.
 */
void TtkRedisplayWidget(WidgetCore *corePtr)
{
    if (corePtr->flags & WIDGET_DESTROYED) {
	return;
    }

    if (!(corePtr->flags & REDISPLAY_PENDING)) {
	Tcl_DoWhenIdle(DrawWidget, corePtr);
	corePtr->flags |= REDISPLAY_PENDING;
    }
}

/* TtkResizeWidget --
 * 	Recompute widget size, schedule geometry propagation and redisplay.
 */
void TtkResizeWidget(WidgetCore *corePtr)
{
    if (corePtr->flags & WIDGET_DESTROYED) {
	return;
    }

    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);
    }
}

/* WidgetInstanceObjCmd --
 *	Widget instance command implementation.
 */
static int
WidgetInstanceObjCmd(
    ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
    WidgetCore *corePtr = clientData;
    const Ttk_Ensemble *commands = corePtr->widgetSpec->commands;
    int status;

    Tcl_Preserve(clientData);
    status = Ttk_InvokeEnsemble(commands,1, clientData,interp,objc,objv);
    Tcl_Release(clientData);

    return status;
}

/*------------------------------------------------------------------------
 * +++ Widget destruction.
 *
 * A widget can be destroyed when the application explicitly
 * destroys the window or one of its ancestors via [destroy]
 * or Tk_DestroyWindow(); when the application deletes the widget
 * instance command; when there is an error in the widget constructor;
 * or when another application calls XDestroyWindow on the window ID.
 *
 * The window receives a <DestroyNotify> event in all cases,
 * so we do the bulk of the cleanup there.  See [#2207435] for
 * further notes (esp. re: Tk_FreeConfigOptions).
 *
 * Widget code that reenters the interp should only do so
 * when the widtget is Tcl_Preserve()d, and should check
 * the WIDGET_DESTROYED flag bit upon return.
 */

/* WidgetInstanceObjCmdDeleted --
 * 	Widget instance command	deletion callback.
 */
static void
WidgetInstanceObjCmdDeleted(ClientData clientData)
{
    WidgetCore *corePtr = clientData;
    corePtr->widgetCmd = NULL;
    if (corePtr->tkwin != NULL)
	Tk_DestroyWindow(corePtr->tkwin);
}

/* FreeWidget --
 *	 Final cleanup for widget; called via Tcl_EventuallyFree().
 */
static void
FreeWidget(char *memPtr)
{
    ckfree(memPtr);
}

/* DestroyWidget --
 * 	Main widget destructor; called from <DestroyNotify> event handler.
 */
static void
DestroyWidget(WidgetCore *corePtr)
{
    corePtr->flags |= WIDGET_DESTROYED;

    corePtr->widgetSpec->cleanupProc(corePtr);

    Tk_FreeConfigOptions(
	(ClientData)corePtr, corePtr->optionTable, corePtr->tkwin);

    if (corePtr->layout) {
	Ttk_FreeLayout(corePtr->layout);
    }

    if (corePtr->flags & REDISPLAY_PENDING) {
	Tcl_CancelIdleCall(DrawWidget, corePtr);
    }

    corePtr->tkwin = NULL;
    if (corePtr->widgetCmd) {
	Tcl_Command cmd = corePtr->widgetCmd;
	corePtr->widgetCmd = 0;
	/* NB: this can reenter the interpreter via a command traces */
	Tcl_DeleteCommandFromToken(corePtr->interp, cmd);
    }
    Tcl_EventuallyFree(corePtr, FreeWidget);
}

/*
 * CoreEventProc --
 *	Event handler for basic events.
 *	Processes Expose, Configure, FocusIn/Out, and Destroy events.
 *	Also handles <<ThemeChanged>> virtual events.
 *
 *	For Expose and Configure, simply schedule the widget for redisplay.
 *	For Destroy events, handle the cleanup process.
 *
 *	For Focus events, set/clear the focus bit in the state field.
 *	It turns out this is impossible to do correctly in a binding script,
 *	because Tk filters out focus events with detail == NotifyInferior.
 *
 *	For Deactivate/Activate pseudo-events, set/clear the background state
 *	flag.
 */

static const unsigned CoreEventMask
    = ExposureMask
    | StructureNotifyMask
    | FocusChangeMask
    | VirtualEventMask
    | ActivateMask
    | EnterWindowMask
    | LeaveWindowMask
    ;

static void CoreEventProc(ClientData clientData, XEvent *eventPtr)
{
    WidgetCore *corePtr = clientData;

    switch (eventPtr->type)
    {
	case ConfigureNotify :
	    TtkRedisplayWidget(corePtr);
	    break;
	case Expose :
	    if (eventPtr->xexpose.count == 0) {
		TtkRedisplayWidget(corePtr);
	    }
	    break;
	case DestroyNotify :
	    Tk_DeleteEventHandler(
		corePtr->tkwin, CoreEventMask,CoreEventProc,clientData);
	    DestroyWidget(corePtr);
	    break;
	case FocusIn:
	case FocusOut:
	    /* Don't process "virtual crossing" events */
	    if (   eventPtr->xfocus.detail == NotifyInferior
		|| eventPtr->xfocus.detail == NotifyAncestor
		|| eventPtr->xfocus.detail == NotifyNonlinear)
	    {
		if (eventPtr->type == FocusIn)
		    corePtr->state |= TTK_STATE_FOCUS;
		else
		    corePtr->state &= ~TTK_STATE_FOCUS;
		TtkRedisplayWidget(corePtr);
	    }
	    break;
	case ActivateNotify:
	    corePtr->state &= ~TTK_STATE_BACKGROUND;
	    TtkRedisplayWidget(corePtr);
	    break;
	case DeactivateNotify:
	    corePtr->state |= TTK_STATE_BACKGROUND;
	    TtkRedisplayWidget(corePtr);
	    break;
	case LeaveNotify:
	    corePtr->state &= ~TTK_STATE_HOVER;
	    TtkRedisplayWidget(corePtr);
	    break;
	case EnterNotify:
	    corePtr->state |= TTK_STATE_HOVER;
	    TtkRedisplayWidget(corePtr);
	    break;
	case VirtualEvent:
	    if (!strcmp("ThemeChanged", ((XVirtualEvent *)(eventPtr))->name)) {
		(void)UpdateLayout(corePtr->interp, corePtr);
		SizeChanged(corePtr);
		TtkRedisplayWidget(corePtr);
	    }
	default:
	    /* can't happen... */
	    break;
    }
}

/*
 * WidgetWorldChanged --
 * 	Default Tk_ClassWorldChangedProc() for widgets.
 * 	Invoked whenever fonts or other system resources are changed;
 * 	recomputes geometry.
 */
static void WidgetWorldChanged(ClientData clientData)
{
    WidgetCore *corePtr = clientData;
    SizeChanged(corePtr);
    TtkRedisplayWidget(corePtr);
}

static Tk_ClassProcs widgetClassProcs = {
    sizeof(Tk_ClassProcs),	/* size */
    WidgetWorldChanged,	/* worldChangedProc */
    NULL,					/* createProc */
    NULL					/* modalProc */
};

/*
 * TtkWidgetConstructorObjCmd --
 *	General-purpose widget constructor command implementation.
 *	ClientData is a WidgetSpec *.
 */
int TtkWidgetConstructorObjCmd(
    ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
    WidgetSpec *widgetSpec = clientData;
    const char *className = widgetSpec->className;
    Tk_OptionTable optionTable =
	Tk_CreateOptionTable(interp, widgetSpec->optionSpecs);
    Tk_Window tkwin;
    void *recordPtr;
    WidgetCore *corePtr;
    Tk_SavedOptions savedOptions;
    int i;

    if (objc < 2 || objc % 2 == 1) {
	Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?");
	return TCL_ERROR;
    }

    /* Check if a -class option has been specified.
     * We have to do this before the InitOptions() call,
     * since InitOptions() is affected by the widget class.
     */
    for (i = 2; i < objc; i += 2) {
	if (!strcmp(Tcl_GetString(objv[i]), "-class")) {
	    className = Tcl_GetString(objv[i+1]);
	    break;
	}
    }

    tkwin = Tk_CreateWindowFromPath(
	interp, Tk_MainWindow(interp), Tcl_GetString(objv[1]), NULL);
    if (tkwin == NULL)
	return TCL_ERROR;

    /*
     * Allocate and initialize the widget record.
     */
    recordPtr = ckalloc(widgetSpec->recordSize);
    memset(recordPtr, 0, widgetSpec->recordSize);
    corePtr = recordPtr;

    corePtr->tkwin	= tkwin;
    corePtr->interp 	= interp;
    corePtr->widgetSpec	= widgetSpec;
    corePtr->widgetCmd	= Tcl_CreateObjCommand(interp, Tk_PathName(tkwin),
	WidgetInstanceObjCmd, recordPtr, WidgetInstanceObjCmdDeleted);
    corePtr->optionTable = optionTable;
    corePtr->layout	= NULL;
    corePtr->flags 	= 0;
    corePtr->state 	= 0;

    Tk_SetClass(tkwin, className);
    Tk_SetClassProcs(tkwin, &widgetClassProcs, recordPtr);
    Tk_SetWindowBackgroundPixmap(tkwin, ParentRelative);

    widgetSpec->initializeProc(interp, recordPtr);

    Tk_CreateEventHandler(tkwin, CoreEventMask, CoreEventProc, recordPtr);

    /*
     * Initial configuration.
     */

    Tcl_Preserve(corePtr);
    if (Tk_InitOptions(interp, recordPtr, optionTable, tkwin) != TCL_OK) {
	goto error;
    }

    if (Tk_SetOptions(interp, recordPtr, optionTable,
	    objc - 2, objv + 2, tkwin, &savedOptions, NULL) != TCL_OK) {
	Tk_RestoreSavedOptions(&savedOptions);
	goto error;
    } else {
	Tk_FreeSavedOptions(&savedOptions);
    }
    if (widgetSpec->configureProc(interp, recordPtr, ~0) != TCL_OK)
	goto error;
    if (widgetSpec->postConfigureProc(interp, recordPtr, ~0) != TCL_OK)
	goto error;

    if (WidgetDestroyed(corePtr))
	goto error;

    Tcl_Release(corePtr);

    SizeChanged(corePtr);
    Tk_MakeWindowExist(tkwin);

    Tcl_SetObjResult(interp, Tcl_NewStringObj(Tk_PathName(tkwin), -1));
    return TCL_OK;

error:
    if (WidgetDestroyed(corePtr)) {
	Tcl_SetResult(interp, "Widget has been destroyed", TCL_STATIC);
    } else {
	Tk_DestroyWindow(tkwin);
    }
    Tcl_Release(corePtr);
    return TCL_ERROR;
}

/*------------------------------------------------------------------------
 * +++ Default implementations for widget hook procedures.
 */

/* TtkWidgetGetLayout --
 * 	Default getLayoutProc.
 *	Looks up the layout based on the -style resource (if specified),
 *	otherwise use the widget class.
 */
Ttk_Layout TtkWidgetGetLayout(
    Tcl_Interp *interp, Ttk_Theme themePtr, void *recordPtr)
{
    WidgetCore *corePtr = recordPtr;
    const char *styleName = 0;

    if (corePtr->styleObj)
    	styleName = Tcl_GetString(corePtr->styleObj);

    if (!styleName || *styleName == '\0')
    	styleName = corePtr->widgetSpec->className;

    return Ttk_CreateLayout(interp, themePtr, styleName,
	recordPtr, corePtr->optionTable, corePtr->tkwin);
}

/*
 * TtkWidgetGetOrientedLayout --
 * 	Helper routine.  Same as TtkWidgetGetLayout, but prefixes
 * 	"Horizontal." or "Vertical." to the style name, depending
 * 	on the value of the 'orient' option.
 */
Ttk_Layout TtkWidgetGetOrientedLayout(
    Tcl_Interp *interp, Ttk_Theme themePtr, void *recordPtr, Tcl_Obj *orientObj)
{
    WidgetCore *corePtr = recordPtr;
    const char *baseStyleName = 0;
    Tcl_DString styleName;
    int orient = TTK_ORIENT_HORIZONTAL;
    Ttk_Layout layout;

    Tcl_DStringInit(&styleName);

    /* Prefix:
     */
    Ttk_GetOrientFromObj(NULL, orientObj, &orient);
    if (orient == TTK_ORIENT_HORIZONTAL)
	Tcl_DStringAppend(&styleName, "Horizontal.", -1);
    else
	Tcl_DStringAppend(&styleName, "Vertical.", -1);

    /* Add base style name:
     */
    if (corePtr->styleObj)
    	baseStyleName = Tcl_GetString(corePtr->styleObj);
    if (!baseStyleName || *baseStyleName == '\0')
    	baseStyleName = corePtr->widgetSpec->className;

    Tcl_DStringAppend(&styleName, baseStyleName, -1);

    /* Create layout:
     */
    layout= Ttk_CreateLayout(interp, themePtr, Tcl_DStringValue(&styleName),
	recordPtr, corePtr->optionTable, corePtr->tkwin);

    Tcl_DStringFree(&styleName);

    return layout;
}

/* TtkNullInitialize --
 * 	Default widget initializeProc (no-op)
 */
void TtkNullInitialize(Tcl_Interp *interp, void *recordPtr)
{
}

/* TtkNullPostConfigure --
 * 	Default widget postConfigureProc (no-op)
 */
int TtkNullPostConfigure(Tcl_Interp *interp, void *clientData, int mask)
{
    return TCL_OK;
}

/* TtkCoreConfigure --
 * 	Default widget configureProc.
 * 	Handles -style option.
 */
int TtkCoreConfigure(Tcl_Interp *interp, void *clientData, int mask)
{
    WidgetCore *corePtr = clientData;
    int status = TCL_OK;

    if (mask & STYLE_CHANGED) {
	status = UpdateLayout(interp, corePtr);
    }

    return status;
}

/* TtkNullCleanup --
 * 	Default widget cleanupProc (no-op)
 */
void TtkNullCleanup(void *recordPtr)
{
    return;
}

/* TtkWidgetDoLayout --
 * 	Default widget layoutProc.
 */
void TtkWidgetDoLayout(void *clientData)
{
    WidgetCore *corePtr = clientData;
    Ttk_PlaceLayout(corePtr->layout,corePtr->state,Ttk_WinBox(corePtr->tkwin));
}

/* TtkWidgetDisplay --
 * 	Default widget displayProc.
 */
void TtkWidgetDisplay(void *recordPtr, Drawable d)
{
    WidgetCore *corePtr = recordPtr;
    Ttk_DrawLayout(corePtr->layout, corePtr->state, d);
}

/* TtkWidgetSize --
 * 	Default widget sizeProc()
 */
int TtkWidgetSize(void *recordPtr, int *widthPtr, int *heightPtr)
{
    WidgetCore *corePtr = recordPtr;
    Ttk_LayoutSize(corePtr->layout, corePtr->state, widthPtr, heightPtr);
    return 1;
}

/*------------------------------------------------------------------------
 * +++ Default implementations for widget subcommands.
 */

/* $w cget -option
 */
int TtkWidgetCgetCommand(
    void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
    WidgetCore *corePtr = recordPtr;
    Tcl_Obj *result;

    if (objc != 3) {
	Tcl_WrongNumArgs(interp, 2, objv, "option");
	return TCL_ERROR;
    }
    result = Tk_GetOptionValue(interp, recordPtr,
		corePtr->optionTable, objv[2], corePtr->tkwin);
    if (result == NULL)
	return TCL_ERROR;
    Tcl_SetObjResult(interp, result);
    return TCL_OK;
}

/* $w configure ?-option ?value ....??
 */
int TtkWidgetConfigureCommand(
    void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
    WidgetCore *corePtr = recordPtr;
    Tcl_Obj *result;

    if (objc == 2) {
	result = Tk_GetOptionInfo(interp, recordPtr,
		corePtr->optionTable, NULL, corePtr->tkwin);
    } else if (objc == 3) {
	result = Tk_GetOptionInfo(interp, recordPtr,
		corePtr->optionTable, objv[2], corePtr->tkwin);
    } else {
	Tk_SavedOptions savedOptions;
	int status;
	int mask = 0;

	status = Tk_SetOptions(interp, recordPtr,
		corePtr->optionTable, objc - 2, objv + 2,
		corePtr->tkwin, &savedOptions, &mask);
	if (status != TCL_OK)
	    return status;

	if (mask & READONLY_OPTION) {
	    Tcl_SetResult(interp,
		    "Attempt to change read-only option", TCL_STATIC);
	    Tk_RestoreSavedOptions(&savedOptions);
	    return TCL_ERROR;
	}

	status = corePtr->widgetSpec->configureProc(interp, recordPtr, mask);
	if (status != TCL_OK) {
	    Tk_RestoreSavedOptions(&savedOptions);
	    return status;
	}
	Tk_FreeSavedOptions(&savedOptions);

	status = corePtr->widgetSpec->postConfigureProc(interp,recordPtr,mask);
	if (WidgetDestroyed(corePtr)) {
	    Tcl_SetResult(interp, "Widget has been destroyed", TCL_STATIC);
	    status = TCL_ERROR;
	}
	if (status != TCL_OK) {
	    return status;
	}

	if (mask & (STYLE_CHANGED | GEOMETRY_CHANGED)) {
	    SizeChanged(corePtr);
	}

	TtkRedisplayWidget(corePtr);
	result = Tcl_NewObj();
    }

    if (result == 0) {
	return TCL_ERROR;
    }
    Tcl_SetObjResult(interp, result);
    return TCL_OK;
}

/* $w state ? $stateSpec ?
 *
 * 	If $stateSpec is specified, modify the widget state accordingly,
 * 	return a new stateSpec representing the changed bits.
 *
 * 	Otherwise, return a statespec matching all the currently-set bits.
 */

int TtkWidgetStateCommand(
    void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
    WidgetCore *corePtr = recordPtr;
    Ttk_StateSpec spec;
    int status;
    Ttk_State oldState, changed;

    if (objc == 2) {
	Tcl_SetObjResult(interp,
	    Ttk_NewStateSpecObj(corePtr->state, 0ul));
	return TCL_OK;
    }

    if (objc != 3) {
	Tcl_WrongNumArgs(interp, 2, objv, "state-spec");
	return TCL_ERROR;
    }
    status = Ttk_GetStateSpecFromObj(interp, objv[2], &spec);
    if (status != TCL_OK)
	return status;

    oldState = corePtr->state;
    corePtr->state = Ttk_ModifyState(corePtr->state, &spec);
    changed = corePtr->state ^ oldState;

    TtkRedisplayWidget(corePtr);

    Tcl_SetObjResult(interp,
	Ttk_NewStateSpecObj(oldState & changed, ~oldState & changed));
    return status;
}

/* $w instate $stateSpec ?$script?
 *
 * 	Tests if widget state matches $stateSpec.
 *	If $script is specified, execute script if state matches.
 *	Otherwise, return true/false
 */

int TtkWidgetInstateCommand(
    void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
    WidgetCore *corePtr = recordPtr;
    Ttk_State state = corePtr->state;
    Ttk_StateSpec spec;
    int status = TCL_OK;

    if (objc < 3 || objc > 4) {
	Tcl_WrongNumArgs(interp, 2, objv, "state-spec ?script?");
	return TCL_ERROR;
    }
    status = Ttk_GetStateSpecFromObj(interp, objv[2], &spec);
    if (status != TCL_OK)
	return status;

    if (objc == 3) {
	Tcl_SetObjResult(interp,
	    Tcl_NewBooleanObj(Ttk_StateMatches(state,&spec)));
    } else if (objc == 4) {
	if (Ttk_StateMatches(state,&spec)) {
	    status = Tcl_EvalObjEx(interp, objv[3], 0);
	}
    }
    return status;
}

/* $w identify $x $y
 * $w identify element $x $y
 * 	Returns: name of element at $x, $y
 */
int TtkWidgetIdentifyCommand(
    void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
    WidgetCore *corePtr = recordPtr;
    Ttk_Element element;
    static const char *whatTable[] = { "element", NULL };
    int x, y, what;

    if (objc < 4 || objc > 5) {
	Tcl_WrongNumArgs(interp, 2, objv, "?what? x y");
	return TCL_ERROR;
    }
    if (objc == 5) {
	/* $w identify element $x $y */
	if (Tcl_GetIndexFromObj(interp,objv[2],whatTable,"option",0,&what)
		!= TCL_OK)
	{
	    return TCL_ERROR;
	}
    }

    if (   Tcl_GetIntFromObj(interp, objv[objc-2], &x) != TCL_OK
	|| Tcl_GetIntFromObj(interp, objv[objc-1], &y) != TCL_OK
    ) {
	return TCL_ERROR;
    }

    element = Ttk_IdentifyElement(corePtr->layout, x, y);
    if (element) {
	const char *elementName = Ttk_ElementName(element);
	Tcl_SetObjResult(interp,Tcl_NewStringObj(elementName,-1));
    }

    return TCL_OK;
}

/*EOF*/
@


1.25
log
@Make the various stub tables and hook pointers const,
just as Tcl and Tk.
Make more internal tables "const"
@
text
@d1 1
a1 1
/* $Id: ttkWidget.c,v 1.24 2010/01/31 22:50:56 jenglish Exp $
d758 1
a758 1
    static const char *const whatTable[] = { "element", NULL };
@


1.24
log
@Change signature of widget subcommand procedures to match Tcl_ObjCmdProc.
Merge now-redundant ensemble dispatch code.
@
text
@d1 1
a1 1
/* $Id: ttkWidget.c,v 1.23 2010/01/13 23:08:13 nijtmans Exp $
d758 1
a758 1
    static const char *whatTable[] = { "element", NULL };
@


1.23
log
@Eliminate tkpMenubuttonClass
make tkpButtonProcs CONST
fix gcc warnings: missing initializer
@
text
@d1 1
a1 1
/* $Id: ttkWidget.c,v 1.22 2009/11/01 18:12:44 jenglish Exp $
a148 24
/* TtkWidgetEnsembleCommand --
 * 	Invoke an ensemble defined by a WidgetCommandSpec.
 */
int TtkWidgetEnsembleCommand(
    const WidgetCommandSpec *commands,	/* Ensemble definition */
    int cmdIndex,			/* Index of command word */
    Tcl_Interp *interp,			/* Interpreter to use */
    int objc, Tcl_Obj *const objv[],	/* Argument vector */
    void *clientData)			/* User data (widget record pointer) */
{
    int index;

    if (objc <= cmdIndex) {
	Tcl_WrongNumArgs(interp, cmdIndex, objv, "option ?arg arg...?");
	return TCL_ERROR;
    }
    if (Tcl_GetIndexFromObjStruct(interp, objv[cmdIndex], commands,
		sizeof(commands[0]), "command", 0, &index) != TCL_OK)
    {
	return TCL_ERROR;
    }
    return commands[index].command(interp, objc, objv, clientData);
}

d157 1
a157 1
    const WidgetCommandSpec *commands = corePtr->widgetSpec->commands;
d161 1
a161 1
    status = TtkWidgetEnsembleCommand(commands,1, interp,objc,objv,clientData);
d594 1
a594 1
Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr)
d614 1
a614 1
Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr)
d683 1
a683 1
    Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr)
d723 1
a723 1
    Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr)
d754 1
a754 1
    Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr)
@


1.22
log
@Uniform, extensible syntax for [$w identify] methods:
[$w identify $component $x $y].
All ttk::* widgets support [$w identify element $x $y];
widgets with other identifiable parts may have additional subcommands.
Notebook widgets support [$nb identify tab],
Panedwindow widgets support [$w identify sash].
Older 2-argument form [$w identify $x $y] still supported,
though it does different things depending on the widget.
@
text
@d1 1
a1 1
/* $Id: ttkWidget.c,v 1.21 2009/02/08 19:35:35 jenglish Exp $
d362 5
a366 3
static struct Tk_ClassProcs widgetClassProcs = {
    sizeof(Tk_ClassProcs),
    WidgetWorldChanged
@


1.21
log
@Renamed several internal data structures and functions:
ElementImpl -> ElementClass, LayoutNode -> Element.
Remove more unnecessary casts.
Add function Ttk_ClientRegion, common factor
of entry, scale, progress, and treeview widgets.
@
text
@d1 1
a1 1
/* $Id: ttkWidget.c,v 1.20 2008/12/03 18:44:50 jenglish Exp $
d772 1
d780 2
a781 1
    int x, y;
d783 2
a784 2
    if (objc != 4) {
	Tcl_WrongNumArgs(interp, 2, objv, "x y");
d787 8
d796 3
a798 2
    if (Tcl_GetIntFromObj(interp, objv[2], &x) != TCL_OK
	|| Tcl_GetIntFromObj(interp, objv[3], &y) != TCL_OK)
d800 1
@


1.20
log
@Add new "hover" state
(patch from Pat Thoyts; needed to support proper visual feedback on Vista).
@
text
@d1 1
a1 1
/* $Id: ttkWidget.c,v 1.19 2008/11/16 17:14:16 jenglish Exp $
d778 1
a778 1
    Ttk_LayoutNode *node;
d790 3
a792 3
    node = Ttk_LayoutIdentify(corePtr->layout, x, y);
    if (node) {
	const char *elementName = Ttk_LayoutNodeName(node);
@


1.19
log
@Widget self-destruction is not necessarily an error [Bug 2298720].
@
text
@d1 1
a1 1
/* $Id: ttkWidget.c,v 1.18 2008/11/13 01:13:54 jenglish Exp $
d284 2
d329 8
@


1.18
log
@ttkWidget.c: Reworked widget construction and destruction sequence;
fixes [#2207435] and several other problems discovered during
investigation of same.
ttkButton.c(CheckbuttonInitialize): Account for initializeProc being
called earlier in the construction sequence now.
@
text
@d1 1
a1 1
/* $Id: ttkWidget.c,v 1.17 2008/11/11 23:39:30 jenglish Exp $
a185 4
    if (WidgetDestroyed(corePtr)) {
	status = TCL_ERROR;
	Tcl_SetResult(interp, "Widget has been destroyed", TCL_STATIC);
    }
d663 4
@


1.17
log
@Don't crash when application uses nondefault visual [#2264732].
@
text
@d1 1
a1 1
/* $Id: ttkWidget.c,v 1.16 2008/11/09 23:53:09 jenglish Exp $
d173 1
a173 2
/*
 * WidgetInstanceObjCmd --
d178 1
a178 4
    ClientData clientData,		/* Widget record pointer */
    Tcl_Interp *interp,			/* Current interpreter. */
    int objc,				/* Number of arguments. */
    Tcl_Obj *const objv[])		/* Argument objects. */
d182 1
a182 1
    int status = TCL_OK;
d186 4
d195 20
a214 2
/*
 * Command deletion callback for widget instance commands.
d225 2
a226 7
/*
 * WidgetCleanup --
 *	 Final cleanup for widget.
 *
 * @@@@@@ TODO: check all code paths leading to widget destruction,
 * @@@@@@ describe here.
 * @@@@@@ Call widget-specific cleanup routine at an appropriate point.
d229 1
a229 1
WidgetCleanup(char *memPtr)
d234 31
d305 3
a307 26
	    corePtr->flags |= WIDGET_DESTROYED;

	    Tk_DeleteEventHandler(corePtr->tkwin,
		    CoreEventMask,CoreEventProc,clientData);

	    if (corePtr->flags & REDISPLAY_PENDING) {
		Tcl_CancelIdleCall(DrawWidget, clientData);
	    }

	    corePtr->widgetSpec->cleanupProc(corePtr);

	    Tk_FreeConfigOptions(
		clientData, corePtr->optionTable, corePtr->tkwin);
	    corePtr->tkwin = NULL;

	    if (corePtr->layout) {
		Ttk_FreeLayout(corePtr->layout);
	    }

	    /* NB: this can reenter the interpreter via a command traces */
	    if (corePtr->widgetCmd) {
		Tcl_Command cmd = corePtr->widgetCmd;
		corePtr->widgetCmd = 0;
		Tcl_DeleteCommandFromToken(corePtr->interp, cmd);
	    }
	    Tcl_EventuallyFree(clientData, WidgetCleanup);
a308 1

d371 4
d376 1
a376 3
    void *recordPtr;
    Tk_Window tkwin;
    Tk_OptionTable optionTable;
d379 1
a379 1
    if (objc < 2 || objc % 1 == 1) {
d384 1
a384 7
    tkwin = Tk_CreateWindowFromPath(
	interp, Tk_MainWindow(interp), Tcl_GetString(objv[1]), NULL);
    if (tkwin == NULL)
	return TCL_ERROR;

    /*
     * Check if a -class resource has been specified:
d395 4
a398 9
    Tk_SetClass(tkwin, className);

    /*
     * Set the BackgroundPixmap to ParentRelative here, so
     * subclasses don't need to worry about setting the background.
     */
    Tk_SetWindowBackgroundPixmap(tkwin, ParentRelative);

    optionTable = Tk_CreateOptionTable(interp, widgetSpec->optionSpecs);
d413 3
d417 1
d419 1
d421 1
a421 2
    if (Tk_InitOptions(interp, recordPtr, optionTable, tkwin) != TCL_OK)
    	goto error_nocleanup;
d423 5
a427 1
    widgetSpec->initializeProc(interp, recordPtr);
d429 2
a430 2
    if (Tk_SetOptions(interp, recordPtr, optionTable, objc - 2,
	    objv + 2, tkwin, NULL/*savePtr*/, NULL/*maskPtr*/) != TCL_OK)
d432 1
d434 7
a442 1

d449 1
a449 2
    if (UpdateLayout(interp, corePtr) != TCL_OK)
	goto error;
a451 2
    Tk_CreateEventHandler(tkwin, CoreEventMask, CoreEventProc, recordPtr);

a454 1

d458 4
a461 5
    widgetSpec->cleanupProc(recordPtr);
error_nocleanup:
    if (corePtr->layout) {
	Ttk_FreeLayout(corePtr->layout);
	corePtr->layout = 0;
d463 1
a463 6
    Tk_UndefineCursor(tkwin);	/* @@@@@@ TEMP: workaround for #2207435 */
    Tk_FreeConfigOptions(recordPtr, optionTable, tkwin);
    Tk_DestroyWindow(tkwin);
    corePtr->tkwin = 0;
    Tcl_DeleteCommandFromToken(interp, corePtr->widgetCmd);
    ckfree(recordPtr);
@


1.16
log
@Ttk widget initializeProc()s now return void instead of
a status code, and are no longer allowed to fail.
(Fix for #2207435 in progress).
@
text
@d1 1
a1 1
/* $Id: ttkWidget.c,v 1.15 2008/11/09 21:37:13 jenglish Exp $
d64 1
a64 2
	    Tk_Width(tkwin), Tk_Height(tkwin),
	    DefaultDepthOfScreen(Tk_Screen(tkwin)));
@


1.15
log
@Remove unnecessary casts from ttkWidget.c.

(More remain in other files; will get to those later).
@
text
@d1 1
a1 1
/* $Id: ttkWidget.c,v 1.14 2008/10/31 18:01:35 jenglish Exp $
d409 1
a409 2
    if (widgetSpec->initializeProc(interp, recordPtr) != TCL_OK)
	goto error_nocleanup;
d524 1
a524 1
int TtkNullInitialize(Tcl_Interp *interp, void *recordPtr)
a525 1
    return TCL_OK;
@


1.14
log
@Temporary workaround for [Bug 2207435]
@
text
@d1 1
a1 1
/* $Id: ttkWidget.c,v 1.13 2008/07/23 23:24:44 nijtmans Exp $
d119 1
a119 1
	Tcl_DoWhenIdle(DrawWidget, (ClientData) corePtr);
d185 1
a185 1
    WidgetCore *corePtr = (WidgetCore *)clientData;
d202 1
a202 1
    WidgetCore *corePtr = (WidgetCore *) clientData;
d249 1
a249 1
    WidgetCore *corePtr = (WidgetCore *) clientData;
d332 1
a332 1
    WidgetCore *corePtr = (WidgetCore*)clientData;
d350 1
a350 1
    WidgetSpec *widgetSpec = (WidgetSpec *)clientData;
d353 1
a353 1
    ClientData recordPtr;
d363 2
a364 2
    tkwin = Tk_CreateWindowFromPath(interp, Tk_MainWindow(interp),
	    Tcl_GetStringFromObj(objv[1], NULL), (char *) NULL);
d374 1
a374 2
	const char *resourceName = Tcl_GetString(objv[i]);
	if (!strcmp(resourceName, "-class")) {
d395 1
a395 1
    corePtr = (WidgetCore *)recordPtr;
d413 1
a413 1
	    objv + 2, tkwin, NULL/*savePtr*/, (int *)NULL/*maskPtr*/) != TCL_OK)
d624 1
a624 1
		corePtr->optionTable, (Tcl_Obj *) NULL, corePtr->tkwin);
@


1.13
log
@fix [2021443] inconsistant "wrong # args" messages (for Tk)
@
text
@d1 1
a1 1
/* $Id: ttkWidget.c,v 1.12 2008/04/27 22:41:12 dkf Exp $
d445 1
@


1.12
log
@Get rid of pre-C89-isms (esp. CONST vs const).
@
text
@d1 1
a1 1
/* $Id: ttkWidget.c,v 1.11 2008/01/06 22:35:41 jenglish Exp $
d359 1
a359 1
	Tcl_WrongNumArgs(interp, 1, objv, "pathName ?options?");
@


1.11
log
@(oops.  Missed a spot.)
@
text
@d1 1
a1 1
/* $Id: ttkWidget.c,v 1.10 2008/01/06 22:33:14 jenglish Exp $
d183 1
a183 1
    Tcl_Obj * const objv[])		/* Argument objects. */
d348 1
a348 1
    ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
d597 1
a597 1
Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[], void *recordPtr)
d617 1
a617 1
Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr)
d682 1
a682 1
    Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr)
d722 1
a722 1
    Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr)
d752 1
a752 1
    Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr)
@


1.11.2.1
log
@Don't crash when application uses nondefault visual [Bug 2264732]
(Backport from trunk change 2008-11-11)
Workaround for [Bug 2207435]
(Backport from trunk change 2008-10-31)
@
text
@d1 1
a1 1
/* $Id: ttkWidget.c,v 1.11 2008/01/06 22:35:41 jenglish Exp $
d64 2
a65 1
	    Tk_Width(tkwin), Tk_Height(tkwin),Tk_Depth(tkwin));
a272 1
	    Tk_UndefineCursor(corePtr->tkwin);	/* workaround for #2207435 */
@


1.11.2.2
log
@Backported support for the Vista theme.
This requires the vsapi element engine, the hover state and the theme script definition.
@
text
@d1 1
a1 1
/* $Id: ttkWidget.c,v 1.11.2.1 2008/12/22 18:34:55 jenglish Exp $
a243 2
    | EnterWindowMask
    | LeaveWindowMask
a311 8
	case LeaveNotify:
	    corePtr->state &= ~TTK_STATE_HOVER;
	    TtkRedisplayWidget(corePtr);
	    break;
	case EnterNotify:
	    corePtr->state |= TTK_STATE_HOVER;
	    TtkRedisplayWidget(corePtr);
	    break;
@


1.11.2.3
log
@        Major backport of 8.6 Ttk for 8.5.9.  Most changes were only being
        committed to head (8.6), although they could apply for 8.5 as well.
        This re-sync makes future work easier to maintain and adds some
        useful work for 8.5 users. Notable changes:
        - Lots of code cleanup
        - Some bug fixes never backported
        - Addition of ttk::spinbox
        - minor color changes
        - Improved Vista/7 styling
        - Move to tile version 0.8.6 (pseudo-package)
        - ABI and API compatible (even $w identify)
        - minor new features (extended $w identify)
@
text
@d1 1
a1 1
/* $Id: ttkWidget.c,v 1.26 2010/02/05 21:33:14 jenglish Exp $
d64 1
a64 1
	    Tk_Width(tkwin), Tk_Height(tkwin), Tk_Depth(tkwin));
d118 1
a118 1
	Tcl_DoWhenIdle(DrawWidget, corePtr);
d149 26
a174 1
/* WidgetInstanceObjCmd --
d179 4
a182 1
    ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
d184 3
a186 3
    WidgetCore *corePtr = clientData;
    const Ttk_Ensemble *commands = corePtr->widgetSpec->commands;
    int status;
d189 1
a189 1
    status = Ttk_InvokeEnsemble(commands,1, clientData,interp,objc,objv);
d195 2
a196 20
/*------------------------------------------------------------------------
 * +++ Widget destruction.
 *
 * A widget can be destroyed when the application explicitly
 * destroys the window or one of its ancestors via [destroy]
 * or Tk_DestroyWindow(); when the application deletes the widget
 * instance command; when there is an error in the widget constructor;
 * or when another application calls XDestroyWindow on the window ID.
 *
 * The window receives a <DestroyNotify> event in all cases,
 * so we do the bulk of the cleanup there.  See [#2207435] for
 * further notes (esp. re: Tk_FreeConfigOptions).
 *
 * Widget code that reenters the interp should only do so
 * when the widtget is Tcl_Preserve()d, and should check
 * the WIDGET_DESTROYED flag bit upon return.
 */

/* WidgetInstanceObjCmdDeleted --
 * 	Widget instance command	deletion callback.
d201 1
a201 1
    WidgetCore *corePtr = clientData;
d207 7
a213 2
/* FreeWidget --
 *	 Final cleanup for widget; called via Tcl_EventuallyFree().
d216 1
a216 1
FreeWidget(char *memPtr)
a220 31
/* DestroyWidget --
 * 	Main widget destructor; called from <DestroyNotify> event handler.
 */
static void
DestroyWidget(WidgetCore *corePtr)
{
    corePtr->flags |= WIDGET_DESTROYED;

    corePtr->widgetSpec->cleanupProc(corePtr);

    Tk_FreeConfigOptions(
	(ClientData)corePtr, corePtr->optionTable, corePtr->tkwin);

    if (corePtr->layout) {
	Ttk_FreeLayout(corePtr->layout);
    }

    if (corePtr->flags & REDISPLAY_PENDING) {
	Tcl_CancelIdleCall(DrawWidget, corePtr);
    }

    corePtr->tkwin = NULL;
    if (corePtr->widgetCmd) {
	Tcl_Command cmd = corePtr->widgetCmd;
	corePtr->widgetCmd = 0;
	/* NB: this can reenter the interpreter via a command traces */
	Tcl_DeleteCommandFromToken(corePtr->interp, cmd);
    }
    Tcl_EventuallyFree(corePtr, FreeWidget);
}

d250 1
a250 1
    WidgetCore *corePtr = clientData;
d263 27
a289 3
	    Tk_DeleteEventHandler(
		corePtr->tkwin, CoreEventMask,CoreEventProc,clientData);
	    DestroyWidget(corePtr);
d291 1
d342 1
a342 1
    WidgetCore *corePtr = clientData;
d347 3
a349 5
static Tk_ClassProcs widgetClassProcs = {
    sizeof(Tk_ClassProcs),	/* size */
    WidgetWorldChanged,	/* worldChangedProc */
    NULL,					/* createProc */
    NULL					/* modalProc */
d358 1
a358 1
    ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
d360 1
a360 1
    WidgetSpec *widgetSpec = clientData;
d362 2
a363 2
    Tk_OptionTable optionTable =
	Tk_CreateOptionTable(interp, widgetSpec->optionSpecs);
d365 1
a365 3
    void *recordPtr;
    WidgetCore *corePtr;
    Tk_SavedOptions savedOptions;
d368 2
a369 2
    if (objc < 2 || objc % 2 == 1) {
	Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?");
d373 7
a379 1
    /* Check if a -class option has been specified.
d384 2
a385 1
	if (!strcmp(Tcl_GetString(objv[i]), "-class")) {
d391 9
a399 4
    tkwin = Tk_CreateWindowFromPath(
	interp, Tk_MainWindow(interp), Tcl_GetString(objv[1]), NULL);
    if (tkwin == NULL)
	return TCL_ERROR;
d406 1
a406 1
    corePtr = recordPtr;
a413 3
    corePtr->layout	= NULL;
    corePtr->flags 	= 0;
    corePtr->state 	= 0;
a414 1
    Tk_SetClass(tkwin, className);
a415 1
    Tk_SetWindowBackgroundPixmap(tkwin, ParentRelative);
d417 2
a418 1
    widgetSpec->initializeProc(interp, recordPtr);
d420 2
a421 1
    Tk_CreateEventHandler(tkwin, CoreEventMask, CoreEventProc, recordPtr);
d423 2
a424 6
    /*
     * Initial configuration.
     */

    Tcl_Preserve(corePtr);
    if (Tk_InitOptions(interp, recordPtr, optionTable, tkwin) != TCL_OK) {
a425 1
    }
a426 7
    if (Tk_SetOptions(interp, recordPtr, optionTable,
	    objc - 2, objv + 2, tkwin, &savedOptions, NULL) != TCL_OK) {
	Tk_RestoreSavedOptions(&savedOptions);
	goto error;
    } else {
	Tk_FreeSavedOptions(&savedOptions);
    }
d429 1
d436 2
a437 1
    Tcl_Release(corePtr);
d440 2
d445 1
d449 5
a453 4
    if (WidgetDestroyed(corePtr)) {
	Tcl_SetResult(interp, "Widget has been destroyed", TCL_STATIC);
    } else {
	Tk_DestroyWindow(tkwin);
d455 5
a459 1
    Tcl_Release(corePtr);
d535 1
a535 1
void TtkNullInitialize(Tcl_Interp *interp, void *recordPtr)
d537 1
d607 1
a607 1
    void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
d627 1
a627 1
    void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
d634 1
a634 1
		corePtr->optionTable, NULL, corePtr->tkwin);
a663 4
	if (WidgetDestroyed(corePtr)) {
	    Tcl_SetResult(interp, "Widget has been destroyed", TCL_STATIC);
	    status = TCL_ERROR;
	}
d692 1
a692 1
    void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
d732 1
a732 1
    void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
a758 1
 * $w identify element $x $y
d762 1
a762 1
    void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
d765 5
a769 6
    Ttk_Element element;
    static const char *whatTable[] = { "element", NULL };
    int x, y, what;

    if (objc < 4 || objc > 5) {
	Tcl_WrongNumArgs(interp, 2, objv, "?what? x y");
a771 8
    if (objc == 5) {
	/* $w identify element $x $y */
	if (Tcl_GetIndexFromObj(interp,objv[2],whatTable,"option",0,&what)
		!= TCL_OK)
	{
	    return TCL_ERROR;
	}
    }
d773 2
a774 3
    if (   Tcl_GetIntFromObj(interp, objv[objc-2], &x) != TCL_OK
	|| Tcl_GetIntFromObj(interp, objv[objc-1], &y) != TCL_OK
    ) {
a775 1
    }
d777 3
a779 3
    element = Ttk_IdentifyElement(corePtr->layout, x, y);
    if (element) {
	const char *elementName = Ttk_ElementName(element);
@


1.10
log
@Call Tk_MakeWindowExist() in widget constructor.
Removed now-unnecessary initial ConfigureNotify processing.
@
text
@d1 1
a1 1
/* $Id: ttkWidget.c,v 1.9 2007/12/13 15:26:26 dgp Exp $
a236 10
 *
 *	<<NOTE-REALIZED>> On the first ConfigureNotify event
 *	(which indicates that the window has just been created),
 *	update the layout.  This is to work around two problems:
 *	(1) Virtual events aren't delivered to unrealized widgets
 *	(see bug #835997), so any intervening <<ThemeChanged>> events
 *	will not have been processed.
 *
 *	(2) Geometry calculations in the XP theme don't work
 *	until the widget is realized.
@


1.9
log
@merge stable branch onto HEAD
@
text
@d1 1
a1 1
/* $Id: ttkWidget.c,v 1.7.2.1 2007/11/01 16:37:20 dgp Exp $
d235 2
a236 1
 *	For Deactivate/Activate pseudo-events, clear/set the background state flag.
a263 6
	    if (!(corePtr->flags & WIDGET_REALIZED)) {
		/* See <<NOTE-REALIZED>> */
		(void)UpdateLayout(corePtr->interp, corePtr);
		SizeChanged(corePtr);
		corePtr->flags |= WIDGET_REALIZED;
	    }
d442 2
@


1.8
log
@* generic/ttk/ttkWidget.c: Split up RedisplayWidget()
to factor out double-buffering related code.

* macosx/ttkMacOSXAquaTheme.c: Use SetThemeBackGround/
kThemeBrushModelessDialogBackground{Active|Inactive}
instead of ApplyThemeBackground/kThemeBackgroundWindowHeader
(advice from DAS).

* library/ttk/aquaTheme.tcl: Use darker shade for inactive
and disabled text, to match typical values of most
kThemeXXXTextColorInactive values.
@
text
@d1 1
a1 1
/* $Id: ttkWidget.c,v 1.7 2007/04/23 21:15:19 das Exp $
@


1.7
log
@	* generic/tkCanvas.c:	allow -selectforeground option to be None; add
	* generic/tkCanvText.c:	fallback to fgColor when selFgColor is None
	* generic/tkEntry.c:	(new default on aqua to match native L&F).
	* generic/tkListbox.c:
	* generic/tkText.c:

	* generic/tkCanvas.c:	   add support for bypassing all of Tk's double
	* generic/tkEntry.c:	   buffered drawing into intermediate pixmaps
	* generic/tkFrame.c:	   (via TK_NO_DOUBLE_BUFFERING #define), it is
	* generic/tkListbox.c:	   unnecessary & wasteful on aqua where all
	* generic/tkPanedWindow.c: drawing is already double-buffered by the
	* generic/tkTextDisp.c:	   window server. (Use of this on other
	* generic/ttk/ttkWidget.c: platforms would only require implementation
	* unix/tkUnixScale.c:	   of TkpClipDrawableToRect()).
@
text
@d1 1
a1 1
/* $Id: ttkWidget.c,v 1.6 2007/03/07 23:49:38 das Exp $
d4 1
a4 2
 * Ttk widget implementation, core widget utilities.
 *
d22 1
a22 1
 * 	Returns TCL_OK if successful, returns TCL_ERROR and leaves 
d28 1
a28 1
    Ttk_Layout newLayout = 
d54 6
a59 3
/*
 * RedisplayWidget --
 *	Redraw a widget.  Called as an idle handler.
d61 6
d68 4
a71 1
static void RedisplayWidget(ClientData recordPtr)
a72 4
    WidgetCore *corePtr = (WidgetCore *)recordPtr;
    Tk_Window tkwin = corePtr->tkwin;
    Drawable d;
#ifndef TK_NO_DOUBLE_BUFFERING
a74 1
#endif /* TK_NO_DOUBLE_BUFFERING */
a75 16
    corePtr->flags &= ~REDISPLAY_PENDING;
    if (!Tk_IsMapped(tkwin)) {
	return;
    }

#ifndef TK_NO_DOUBLE_BUFFERING
    /*
     * Get a Pixmap for drawing in the background:
     */
    d = Tk_GetPixmap(Tk_Display(tkwin), Tk_WindowId(tkwin),
	    Tk_Width(tkwin), Tk_Height(tkwin),
	    DefaultDepthOfScreen(Tk_Screen(tkwin)));

    /*
     * Get a GC for blitting the pixmap to the display:
     */
d78 1
a78 10
    gc = Tk_GetGC(corePtr->tkwin, GCFunction|GCGraphicsExposures, &gcValues);
#else
    d = Tk_WindowId(tkwin);
#endif /* TK_NO_DOUBLE_BUFFERING */

    /*
     * Recompute layout and draw widget contents:
     */
    corePtr->widgetSpec->layoutProc(recordPtr);
    corePtr->widgetSpec->displayProc(recordPtr, d);
a79 4
#ifndef TK_NO_DOUBLE_BUFFERING
    /*
     * Copy to the screen.
     */
a83 3
    /*
     * Release resources
     */
d86 21
a106 1
#endif /* TK_NO_DOUBLE_BUFFERING */
d109 1
a109 1
/* TtkRedisplayWidget -- 
d112 1
a112 1
void TtkRedisplayWidget(WidgetCore *corePtr) 
d119 1
a119 1
	Tcl_DoWhenIdle(RedisplayWidget, (ClientData) corePtr);
d125 1
a125 1
 * 	Recompute widget size, schedule geometry propagation and redisplay. 
d237 1
a237 1
 *	<<NOTE-REALIZED>> On the first ConfigureNotify event 
d283 1
a283 1
		Tcl_CancelIdleCall(RedisplayWidget, clientData);
d481 1
a481 1
    if (corePtr->styleObj) 
d493 2
a494 2
 * 	Helper routine.  Same as TtkWidgetGetLayout, but prefixes 
 * 	"Horizontal." or "Vertical." to the style name, depending 
d508 1
a508 1
    /* Prefix: 
d513 1
a513 1
    else 
a515 1

d518 1
a518 1
    if (corePtr->styleObj) 
d527 1
a527 1
    layout= Ttk_CreateLayout(interp, themePtr, Tcl_DStringValue(&styleName), 
d780 1
a780 1
    node = Ttk_LayoutIdentify(corePtr->layout, x, y); 
@


1.7.2.1
log
@merge updates from HEAD
@
text
@d1 1
a1 1
/* $Id: ttkWidget.c,v 1.7 2007/04/23 21:15:19 das Exp $
d4 2
a5 1
 * Core widget utilities.
d23 1
a23 1
 * 	Returns TCL_OK if successful, returns TCL_ERROR and leaves
d29 1
a29 1
    Ttk_Layout newLayout =
d55 3
a57 6
#ifndef TK_NO_DOUBLE_BUFFERING

/* BeginDrawing --
 * 	Returns a Drawable for drawing the widget contents.
 *	This is normally an off-screen Pixmap, copied to
 *	the window by EndDrawing().
a58 6
static Drawable BeginDrawing(Tk_Window tkwin)
{
    return Tk_GetPixmap(Tk_Display(tkwin), Tk_WindowId(tkwin),
	    Tk_Width(tkwin), Tk_Height(tkwin),
	    DefaultDepthOfScreen(Tk_Screen(tkwin)));
}
d60 1
a60 4
/* EndDrawing --
 *	Copy the drawable contents to the screen and release resources.
 */
static void EndDrawing(Tk_Window tkwin, Drawable d)
d62 4
d68 1
d70 16
d88 10
a97 1
    gc = Tk_GetGC(tkwin, GCFunction|GCGraphicsExposures, &gcValues);
d99 4
d107 3
d112 1
a112 21
}
#else
/* No double-buffering: draw directly into the window. */
static Drawable BeginDrawing(Tk_Window tkwin) { return Tk_WindowId(tkwin); }
static void EndDrawing(Tk_Window tkwin, Drawable d) { }
#endif

/* DrawWidget --
 *	Redraw a widget.  Called as an idle handler.
 */
static void DrawWidget(ClientData recordPtr)
{
    WidgetCore *corePtr = recordPtr;

    corePtr->flags &= ~REDISPLAY_PENDING;
    if (Tk_IsMapped(corePtr->tkwin)) {
	Drawable d = BeginDrawing(corePtr->tkwin);
	corePtr->widgetSpec->layoutProc(recordPtr);
	corePtr->widgetSpec->displayProc(recordPtr, d);
	EndDrawing(corePtr->tkwin, d);
    }
d115 1
a115 1
/* TtkRedisplayWidget --
d118 1
a118 1
void TtkRedisplayWidget(WidgetCore *corePtr)
d125 1
a125 1
	Tcl_DoWhenIdle(DrawWidget, (ClientData) corePtr);
d131 1
a131 1
 * 	Recompute widget size, schedule geometry propagation and redisplay.
d243 1
a243 1
 *	<<NOTE-REALIZED>> On the first ConfigureNotify event
d289 1
a289 1
		Tcl_CancelIdleCall(DrawWidget, clientData);
d487 1
a487 1
    if (corePtr->styleObj)
d499 2
a500 2
 * 	Helper routine.  Same as TtkWidgetGetLayout, but prefixes
 * 	"Horizontal." or "Vertical." to the style name, depending
d514 1
a514 1
    /* Prefix:
d519 1
a519 1
    else
d522 1
d525 1
a525 1
    if (corePtr->styleObj)
d534 1
a534 1
    layout= Ttk_CreateLayout(interp, themePtr, Tcl_DStringValue(&styleName),
d787 1
a787 1
    node = Ttk_LayoutIdentify(corePtr->layout, x, y);
@


1.7.2.2
log
@merge updates from HEAD
@
text
@d1 1
a1 1
/* $Id: ttkWidget.c,v 1.10 2008/01/06 22:33:14 jenglish Exp $
d235 11
a245 2
 *	For Deactivate/Activate pseudo-events, set/clear the background state
 *	flag.
d263 6
a446 2
    Tk_MakeWindowExist(tkwin);

@


1.6
log
@revert premature commit
@
text
@d1 1
a1 1
/* $Id: ttkWidget.c,v 1.5 2007/03/07 23:46:34 das Exp $
d13 4
d65 1
d68 1
d75 1
d89 3
d99 1
d112 1
@


1.5
log
@	* generic/tkMain.c (Tk_MainEx): replicate macosx-specific code from
	TkpInit() that ensures the console window appears when wish is started
	from the OS X Finder (i.e. with stdin == /dev/null), jeffh's 2006-11-24
	change rendered the corresponding code in TkpInit() ineffective in wish
	because Tk_MainEx() sets tcl_interactive before calling TkpInit().

	* generic/ttk/ttkGenStubs.tcl (new): add ttk-specific genstubs.tcl from
	* unix/Makefile.in (genstubs):       tile and run it from 'genstubs'
	target, restores ability to generate all of Tk's stub sources.

	* generic/ttk/ttkTreeview.c: #ifdef out unused declaration.

	* macosx/tkMacOSXDebug.c (TkMacOSXGetNamedDebugSymbol): add fix for
	libraries loaded with a DYLD_IMAGE_SUFFIX.

	* macosx/Wish.xcodeproj/project.pbxproj: ensure gcc version used by
	* macosx/Wish.xcodeproj/default.pbxuser: Xcode and configure/make are
	* macosx/Wish-Common.xcconfig:		 consistent and independent of
	gcc_select default and CC env var; fixes for Xcode 3.0.

	* unix/tcl.m4 (Darwin): s/CFLAGS/CPPFLAGS/ in macosx-version-min check.
	* unix/configure: autoconf-2.59
@
text
@d1 1
a1 1
/* $Id: ttkWidget.c,v 1.4 2007/01/03 05:06:25 nijtmans Exp $
a12 4
#ifdef MAC_OSX_TK
#define TK_NO_DOUBLE_BUFFERING 1
#endif

a60 1
#ifndef TK_NO_DOUBLE_BUFFERING
a62 1
#endif
a68 1
#ifndef TK_NO_DOUBLE_BUFFERING
a81 3
#else
    d = Tk_WindowId(tkwin);
#endif
a88 1
#ifndef TK_NO_DOUBLE_BUFFERING
a100 1
#endif
@


1.4
log
@various "const" additions, in line with TIP #27
@
text
@d1 1
a1 1
/* $Id: ttkWidget.c,v 1.3 2006/11/27 06:53:55 jenglish Exp $
d13 4
d65 1
d68 1
d75 1
d89 3
d99 1
d112 1
@


1.3
log
@* 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].
@
text
@d1 1
a1 1
/* $Id: ttkWidget.c,v 1.2 2006/11/03 03:06:22 das Exp $
d148 1
a148 1
    WidgetCommandSpec *commands,	/* Ensemble definition */
d177 1
a177 1
    Tcl_Obj * CONST objv[])		/* Argument objects. */
d180 1
a180 1
    WidgetCommandSpec *commands = corePtr->widgetSpec->commands;
@


1.2
log
@	* generic/ttk/ttkBlink.c, generic/ttk/ttkButton.c:
	* generic/ttk/ttkClamTheme.c, generic/ttk/ttkClassicTheme.c:
	* generic/ttk/ttkDecls.h, generic/ttk/ttkDefaultTheme.c:
	* generic/ttk/ttkElements.c, generic/ttk/ttkEntry.c:
	* generic/ttk/ttkFrame.c, generic/ttk/ttkImage.c:
	* generic/ttk/ttkInit.c, generic/ttk/ttkLabel.c:
	* generic/ttk/ttkLayout.c, generic/ttk/ttkManager.h:
	* generic/ttk/ttkNotebook.c, generic/ttk/ttkPanedwindow.c:
	* generic/ttk/ttkProgress.c, generic/ttk/ttkScale.c:
	* generic/ttk/ttkScroll.c, generic/ttk/ttkScrollbar.c:
	* generic/ttk/ttkSeparator.c, generic/ttk/ttkSquare.c:
	* generic/ttk/ttkStubInit.c, generic/ttk/ttkStubLib.c:
	* generic/ttk/ttkTheme.c, generic/ttk/ttkTheme.h:
	* generic/ttk/ttkThemeInt.h, generic/ttk/ttkTrack.c:
	* generic/ttk/ttkTreeview.c, generic/ttk/ttkWidget.c:
	* generic/ttk/ttkWidget.h, macosx/ttkMacOSXTheme.c:
	* win/ttkWinMonitor.c, win/ttkWinTheme.c, win/ttkWinXPTheme.c: ensure
	all global Ttk symbols have Ttk or ttk prefix; declare all externally
	visible Ttk symbols not contained in stubs table as MODULE_SCOPE (or as
	static when possible); so that 'make check{exports,stubs}' once again
	complete without errors.
@
text
@d1 1
a1 1
/* $Id: ttkWidget.c,v 1.1 2006/10/31 01:42:26 hobbs Exp $
d14 1
a14 1
 * Helper routines.
d17 6
a22 1
static void UpdateLayout(Tcl_Interp *interp, WidgetCore *corePtr)
a27 1
    /* TODO: @@@@@@ Check for errors */
d33 1
d35 1
d38 5
a42 1
static void UpdateGeometry(WidgetCore *corePtr)
a105 1

a120 1

d127 1
a127 1
    UpdateGeometry(corePtr);
d131 13
d184 1
a184 1
    status = TtkWidgetEnsembleCommand(commands, 1, interp, objc, objv, clientData);
d259 2
a260 2
		UpdateLayout(corePtr->interp, corePtr);
		UpdateGeometry(corePtr);
d323 2
a324 2
		UpdateLayout(corePtr->interp, corePtr);
		UpdateGeometry(corePtr);
d342 1
a342 1
    UpdateGeometry(corePtr);
d417 1
a417 1
    	goto error;
d420 1
a420 1
	goto error;
d435 2
a436 2
    UpdateLayout(interp, corePtr);
    UpdateGeometry(corePtr);
d438 1
d446 2
d460 2
a461 3
/*
 * TtkWidgetChangeState --
 * 	Set / clear the specified bits in the 'state' flag,
a462 9
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);
    }
}
d464 1
a464 2
/*
 * TtkWidgetGetLayout --
d530 1
a530 2
/*
 * TtkNullInitialize --
d533 1
a533 1
int  TtkNullInitialize(Tcl_Interp *interp, void *recordPtr)
d538 1
a538 2
/*
 * TtkNullPostConfigure --
d548 1
d553 2
a554 1
    
d556 1
a556 11
	Ttk_Theme theme = Ttk_GetCurrentTheme(interp);
	Ttk_Layout newLayout =
	    corePtr->widgetSpec->getLayoutProc(interp,theme,corePtr);

	if (!newLayout) {
	    return TCL_ERROR;
	}
	if (corePtr->layout) {
	    Ttk_FreeLayout(corePtr->layout);
	}
	corePtr->layout = newLayout;
d559 1
a559 1
    return TCL_OK;
d562 1
a562 2
/*
 * TtkNullCleanup --
d570 1
a570 2
/*
 * TtkWidgetDoLayout --
d579 1
a579 2
/*
 * TtkWidgetDisplay --
d588 1
a588 2
/*
 * TtkWidgetSize --
a595 5

/* OR: (@@@@@@)
    return *widthPtr > Tk_Width(corePtr->tkwin) 
	|| *heightPtr > Tk_Height(corePtr->tkwin);
*/
d598 3
d602 2
a603 2
/* Default implementations for widget subcommands:
*/
d622 2
d667 1
a667 1
	    UpdateGeometry(corePtr);
d681 1
a681 2
/* $w state $stateSpec
 * $w state
@


1.1
log
@	* doc/ttk_Geometry.3, doc/ttk_Theme.3, doc/ttk_button.n:
	* doc/ttk_checkbutton.n, doc/ttk_combobox.n, doc/ttk_dialog.n:
	* doc/ttk_entry.n, doc/ttk_frame.n, doc/ttk_image.n:
	* doc/ttk_intro.n, doc/ttk_label.n, doc/ttk_labelframe.n:
	* doc/ttk_menubutton.n, doc/ttk_notebook.n, doc/ttk_panedwindow.n:
	* doc/ttk_progressbar.n, doc/ttk_radiobutton.n, doc/ttk_scrollbar.n:
	* doc/ttk_separator.n, doc/ttk_sizegrip.n, doc/ttk_style.n:
	* doc/ttk_treeview.n, doc/ttk_widget.n,:
	* generic/ttk/ttk.decls, generic/ttk/ttkBlink.c:
	* generic/ttk/ttkButton.c, generic/ttk/ttkCache.c:
	* generic/ttk/ttkClamTheme.c, generic/ttk/ttkClassicTheme.c:
	* generic/ttk/ttkDecls.h, generic/ttk/ttkDefaultTheme.c:
	* generic/ttk/ttkElements.c, generic/ttk/ttkEntry.c:
	* generic/ttk/ttkFrame.c, generic/ttk/ttkImage.c:
	* generic/ttk/ttkInit.c, generic/ttk/ttkLabel.c:
	* generic/ttk/ttkLayout.c, generic/ttk/ttkManager.c:
	* generic/ttk/ttkManager.h, generic/ttk/ttkNotebook.c:
	* generic/ttk/ttkPanedwindow.c, generic/ttk/ttkProgress.c:
	* generic/ttk/ttkScale.c, generic/ttk/ttkScroll.c:
	* generic/ttk/ttkScrollbar.c, generic/ttk/ttkSeparator.c:
	* generic/ttk/ttkSquare.c, generic/ttk/ttkState.c:
	* generic/ttk/ttkStubInit.c, generic/ttk/ttkStubLib.c:
	* generic/ttk/ttkTagSet.c, generic/ttk/ttkTheme.c:
	* generic/ttk/ttkTheme.h, generic/ttk/ttkThemeInt.h:
	* generic/ttk/ttkTrace.c, generic/ttk/ttkTrack.c:
	* generic/ttk/ttkTreeview.c, generic/ttk/ttkWidget.c:
	* generic/ttk/ttkWidget.h:
	* library/demos/ttk_demo.tcl, library/demos/ttk_iconlib.tcl:
	* library/demos/ttk_repeater.tcl:
	* library/ttk/altTheme.tcl, library/ttk/aquaTheme.tcl:
	* library/ttk/button.tcl, library/ttk/clamTheme.tcl:
	* library/ttk/classicTheme.tcl, library/ttk/combobox.tcl:
	* library/ttk/cursors.tcl, library/ttk/defaults.tcl:
	* library/ttk/dialog.tcl, library/ttk/entry.tcl:
	* library/ttk/fonts.tcl, library/ttk/icons.tcl:
	* library/ttk/keynav.tcl, library/ttk/menubutton.tcl:
	* library/ttk/notebook.tcl, library/ttk/panedwindow.tcl:
	* library/ttk/progress.tcl, library/ttk/scale.tcl:
	* library/ttk/scrollbar.tcl, library/ttk/sizegrip.tcl:
	* library/ttk/treeview.tcl, library/ttk/ttk.tcl:
	* library/ttk/utils.tcl, library/ttk/winTheme.tcl:
	* library/ttk/xpTheme.tcl:
	* macosx/ttkMacOSXTheme.c:
	* tests/ttk/all.tcl, tests/ttk/bwidget.test, tests/ttk/combobox.test:
	* tests/ttk/entry.test, tests/ttk/image.test:
	* tests/ttk/labelframe.test, tests/ttk/layout.test:
	* tests/ttk/misc.test, tests/ttk/notebook.test:
	* tests/ttk/panedwindow.test, tests/ttk/progressbar.test:
	* tests/ttk/scrollbar.test, tests/ttk/treetags.test:
	* tests/ttk/treeview.test, tests/ttk/ttk.test, tests/ttk/validate.test:
	* win/ttkWinMonitor.c, win/ttkWinTheme.c, win/ttkWinXPTheme.c:
	First import of Ttk themed Tk widgets as branched from tile 0.7.8

	* generic/tkInt.h, generic/tkWindow.c: add Ttk_Init call, copy
	tk classic widgets to ::tk namespace.
	* library/tk.tcl: add source of ttk/ttk.tcl, define $::ttk::library.
	* unix/Makefile.in, win/Makefile.in: add Ttk build bits
	* win/configure, win/configure.in: check for uxtheme.h (XP theme).
@
text
@d1 1
a1 1
/* $Id: widget.c,v 1.47 2005/10/08 15:53:42 jenglish Exp $
d123 1
a123 1
/* WidgetEnsembleCommand --
d126 1
a126 1
int WidgetEnsembleCommand(
d163 1
a163 1
    status = WidgetEnsembleCommand(commands, 1, interp, objc, objv, clientData);
d331 1
a331 1
 * WidgetConstructorObjCmd --
d335 1
a335 1
int WidgetConstructorObjCmd(
d437 1
a437 1
 * WidgetChangeState --
d440 1
a440 1
void WidgetChangeState(WidgetCore *corePtr,
d451 1
a451 1
 * WidgetGetLayout --
d456 1
a456 1
Ttk_Layout WidgetGetLayout(
d473 2
a474 2
 * WidgetGetOrientedLayout --
 * 	Helper routine.  Same as WidgetGetLayout, but prefixes 
d478 1
a478 1
Ttk_Layout WidgetGetOrientedLayout(
d518 1
a518 1
 * NullInitialize --
d521 1
a521 1
int  NullInitialize(Tcl_Interp *interp, void *recordPtr)
d527 1
a527 1
 * NullPostConfigure --
d530 1
a530 1
int NullPostConfigure(Tcl_Interp *interp, void *clientData, int mask)
d535 1
a535 1
/* CoreConfigure --
d538 1
a538 1
int CoreConfigure(Tcl_Interp *interp, void *clientData, int mask)
d560 1
a560 1
 * NullCleanup --
d563 1
a563 1
void NullCleanup(void *recordPtr)
d569 1
a569 1
 * WidgetDoLayout --
d572 1
a572 1
void WidgetDoLayout(void *clientData)
d579 1
a579 1
 * WidgetDisplay --
d582 1
a582 1
void WidgetDisplay(void *recordPtr, Drawable d)
d589 1
a589 1
 * WidgetSize --
d592 1
a592 1
int WidgetSize(void *recordPtr, int *widthPtr, int *heightPtr)
d607 1
a607 1
int WidgetCgetCommand(
d625 1
a625 1
int WidgetConfigureCommand(
d691 1
a691 1
int WidgetStateCommand(
d731 1
a731 1
int WidgetInstateCommand(
d761 1
a761 1
int WidgetIdentifyCommand(
@

