head	1.10;
access;
symbols
	core-8-5-9:1.7.2.1
	core-8-5-8:1.7
	macosx-cocoa-merge:1.8
	macosx-cocoa-premerge:1.8
	macosx-carbon-freeze:1.8
	core-8-5-7:1.7
	core-8-5-6:1.7
	core-8-6-b1:1.8
	core-8-6-a3:1.8
	core-8-5-5:1.7
	core-8-6-a2:1.8
	core-8-5-4:1.7
	core-8-5-3:1.7
	core-8-6-a1:1.8
	core-8-5-branch:1.7.0.2
	core-8-5-2:1.7
	core-8-5-1:1.7
	core-8-5-0:1.7
	core-8-5-b3:1.6
	core-8-5-b2:1.5
	core-8-5-b1:1.5
	core-stablilizer-merge:1.5
	core-stabilizer-branch:1.5.0.2
	core-stabilizer-merge:1.7
	core-8-5-a6:1.5;
locks; strict;
comment	@ * @;


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

1.9
date	2010.02.05.17.42.21;	author nijtmans;	state Exp;
branches;
next	1.8;

1.8
date	2008.04.27.22.41.12;	author dkf;	state Exp;
branches;
next	1.7;

1.7
date	2007.12.13.15.26.26;	author dgp;	state Exp;
branches
	1.7.2.1;
next	1.6;

1.6
date	2007.11.08.01.40.25;	author jenglish;	state Exp;
branches;
next	1.5;

1.5
date	2006.12.14.19.51.04;	author jenglish;	state Exp;
branches
	1.5.2.1;
next	1.4;

1.4
date	2006.12.09.20.53.35;	author jenglish;	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.5.2.1
date	2007.11.12.19.22.37;	author dgp;	state Exp;
branches;
next	;

1.7.2.1
date	2010.08.26.02.06.09;	author hobbs;	state Exp;
branches;
next	;


desc
@@


1.10
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: ttkImage.c,v 1.9 2010/02/05 17:42:21 nijtmans Exp $
 *	Image specifications and image element factory.
 *
 * Copyright (C) 2004 Pat Thoyts <patthoyts@@users.sf.net>
 * Copyright (C) 2004 Joe English
 *
 * An imageSpec is a multi-element list; the first element
 * is the name of the default image to use, the remainder of the
 * list is a sequence of statespec/imagename options as per
 * [style map].
 */

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

#define MIN(a,b) ((a) < (b) ? (a) : (b))

/*------------------------------------------------------------------------
 * +++ ImageSpec management.
 */

struct TtkImageSpec {
    Tk_Image 		baseImage;	/* Base image to use */
    int 		mapCount;	/* #state-specific overrides */
    Ttk_StateSpec	*states;	/* array[mapCount] of states ... */
    Tk_Image		*images;	/* ... per-state images to use */
};

/* NullImageChanged --
 * 	Do-nothing Tk_ImageChangedProc.
 */
static void NullImageChanged(ClientData clientData,
    int x, int y, int width, int height, int imageWidth, int imageHeight)
{ /* No-op */ }

/* TtkGetImageSpec --
 * 	Constructs a Ttk_ImageSpec * from a Tcl_Obj *.
 * 	Result must be released using TtkFreeImageSpec.  
 *
 * TODO: Need a variant of this that takes a user-specified ImageChanged proc
 */
Ttk_ImageSpec *
TtkGetImageSpec(Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr)
{
    Ttk_ImageSpec *imageSpec = 0;
    int i = 0, n = 0, objc;
    Tcl_Obj **objv;

    imageSpec = (Ttk_ImageSpec *)ckalloc(sizeof(*imageSpec));
    imageSpec->baseImage = 0;
    imageSpec->mapCount = 0;
    imageSpec->states = 0;
    imageSpec->images = 0;

    if (Tcl_ListObjGetElements(interp, objPtr, &objc, &objv) != TCL_OK) {
	goto error;
    }

    if ((objc % 2) != 1) {
	if (interp) {
	    Tcl_SetResult(interp,
		"image specification must contain an odd number of elements",
		TCL_STATIC);
	}
	goto error;
    }

    n = (objc - 1) / 2;
    imageSpec->states = (Ttk_StateSpec*)ckalloc(n * sizeof(Ttk_StateSpec));
    imageSpec->images = (Tk_Image*)ckalloc(n * sizeof(Tk_Image *));

    /* Get base image:
    */
    imageSpec->baseImage = Tk_GetImage(
	    interp, tkwin, Tcl_GetString(objv[0]), NullImageChanged, NULL);
    if (!imageSpec->baseImage) {
    	goto error;
    }

    /* Extract state and image specifications:
     */
    for (i = 0; i < n; ++i) {
	Tcl_Obj *stateSpec = objv[2*i + 1];
	const char *imageName = Tcl_GetString(objv[2*i + 2]);
	Ttk_StateSpec state;

	if (Ttk_GetStateSpecFromObj(interp, stateSpec, &state) != TCL_OK) {
	    goto error;
	}
	imageSpec->states[i] = state;

	imageSpec->images[i] = Tk_GetImage(
	    interp, tkwin, imageName, NullImageChanged, NULL);
	if (imageSpec->images[i] == NULL) {
	    goto error;
	}
	imageSpec->mapCount = i+1;
    }

    return imageSpec;

error:
    TtkFreeImageSpec(imageSpec);
    return NULL;
}

/* TtkFreeImageSpec --
 * 	Dispose of an image specification.
 */
void TtkFreeImageSpec(Ttk_ImageSpec *imageSpec)
{
    int i;

    for (i=0; i < imageSpec->mapCount; ++i) {
	Tk_FreeImage(imageSpec->images[i]);
    }

    if (imageSpec->baseImage) { Tk_FreeImage(imageSpec->baseImage); }
    if (imageSpec->states) { ckfree((ClientData)imageSpec->states); }
    if (imageSpec->images) { ckfree((ClientData)imageSpec->images); }

    ckfree((ClientData)imageSpec);
}

/* TtkSelectImage --
 * 	Return a state-specific image from an ImageSpec
 */
Tk_Image TtkSelectImage(Ttk_ImageSpec *imageSpec, Ttk_State state)
{
    int i;
    for (i = 0; i < imageSpec->mapCount; ++i) {
	if (Ttk_StateMatches(state, imageSpec->states+i)) {
	    return imageSpec->images[i];
	}
    }
    return imageSpec->baseImage;
}

/*------------------------------------------------------------------------
 * +++ Drawing utilities.
 */

/* LPadding, CPadding, RPadding --
 * 	Split a box+padding pair into left, center, and right boxes.
 */
static Ttk_Box LPadding(Ttk_Box b, Ttk_Padding p)
    { return Ttk_MakeBox(b.x, b.y, p.left, b.height); }

static Ttk_Box CPadding(Ttk_Box b, Ttk_Padding p)
    { return Ttk_MakeBox(b.x+p.left, b.y, b.width-p.left-p.right, b.height); }

static Ttk_Box RPadding(Ttk_Box b, Ttk_Padding p)
    { return  Ttk_MakeBox(b.x+b.width-p.right, b.y, p.right, b.height); }

/* TPadding, MPadding, BPadding --
 * 	Split a box+padding pair into top, middle, and bottom parts.
 */
static Ttk_Box TPadding(Ttk_Box b, Ttk_Padding p)
    { return Ttk_MakeBox(b.x, b.y, b.width, p.top); }

static Ttk_Box MPadding(Ttk_Box b, Ttk_Padding p)
    { return Ttk_MakeBox(b.x, b.y+p.top, b.width, b.height-p.top-p.bottom); }

static Ttk_Box BPadding(Ttk_Box b, Ttk_Padding p)
    { return Ttk_MakeBox(b.x, b.y+b.height-p.bottom, b.width, p.bottom); }

/* Ttk_Fill --
 *	Fill the destination area of the drawable by replicating
 *	the source area of the image.
 */
static void Ttk_Fill(
    Tk_Window tkwin, Drawable d, Tk_Image image, Ttk_Box src, Ttk_Box dst)
{
    int dr = dst.x + dst.width;
    int db = dst.y + dst.height;
    int x,y;

    if (!(src.width && src.height && dst.width && dst.height))
	return;

    for (x = dst.x; x < dr; x += src.width) {
	int cw = MIN(src.width, dr - x);
	for (y = dst.y; y <= db; y += src.height) {
	    int ch = MIN(src.height, db - y);
	    Tk_RedrawImage(image, src.x, src.y, cw, ch, d, x, y);
	}
    }
}

/* Ttk_Stripe --
 * 	Fill a horizontal stripe of the destination drawable.
 */
static void Ttk_Stripe(
    Tk_Window tkwin, Drawable d, Tk_Image image,
    Ttk_Box src, Ttk_Box dst, Ttk_Padding p)
{
    Ttk_Fill(tkwin, d, image, LPadding(src,p), LPadding(dst,p));
    Ttk_Fill(tkwin, d, image, CPadding(src,p), CPadding(dst,p));
    Ttk_Fill(tkwin, d, image, RPadding(src,p), RPadding(dst,p));
}

/* Ttk_Tile --
 * 	Fill successive horizontal stripes of the destination drawable.
 */
static void Ttk_Tile(
    Tk_Window tkwin, Drawable d, Tk_Image image,
    Ttk_Box src, Ttk_Box dst, Ttk_Padding p)
{
    Ttk_Stripe(tkwin, d, image, TPadding(src,p), TPadding(dst,p), p);
    Ttk_Stripe(tkwin, d, image, MPadding(src,p), MPadding(dst,p), p);
    Ttk_Stripe(tkwin, d, image, BPadding(src,p), BPadding(dst,p), p);
}

/*------------------------------------------------------------------------
 * +++ Image element definition.
 */

typedef struct {		/* ClientData for image elements */
    Ttk_ImageSpec *imageSpec;	/* Image(s) to use */
    int minWidth;		/* Minimum width; overrides image width */
    int minHeight;		/* Minimum width; overrides image width */
    Ttk_Sticky sticky;		/* -stickiness specification */
    Ttk_Padding border;		/* Fixed border region */
    Ttk_Padding padding;	/* Internal padding */

#if TILE_07_COMPAT
    Ttk_ResourceCache cache;	/* Resource cache for images */
    Ttk_StateMap imageMap;	/* State-based lookup table for images */
#endif
} ImageData;

static void FreeImageData(void *clientData)
{
    ImageData *imageData = clientData;
    if (imageData->imageSpec)	{ TtkFreeImageSpec(imageData->imageSpec); }
#if TILE_07_COMPAT
    if (imageData->imageMap)	{ Tcl_DecrRefCount(imageData->imageMap); }
#endif
    ckfree(clientData);
}

static void ImageElementSize(
    void *clientData, void *elementRecord, Tk_Window tkwin,
    int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
    ImageData *imageData = clientData;
    Tk_Image image = imageData->imageSpec->baseImage;

    if (image) {
	Tk_SizeOfImage(image, widthPtr, heightPtr);
    }
    if (imageData->minWidth >= 0) {
	*widthPtr = imageData->minWidth;
    }
    if (imageData->minHeight >= 0) {
	*heightPtr = imageData->minHeight;
    }

    *paddingPtr = imageData->padding;
}

static void ImageElementDraw(
    void *clientData, void *elementRecord, Tk_Window tkwin,
    Drawable d, Ttk_Box b, unsigned int state)
{
    ImageData *imageData = clientData;
    Tk_Image image = 0;
    int imgWidth, imgHeight;
    Ttk_Box src, dst;

#if TILE_07_COMPAT
    if (imageData->imageMap) {
	Tcl_Obj *imageObj = Ttk_StateMapLookup(NULL,imageData->imageMap,state);
	if (imageObj) {
	    image = Ttk_UseImage(imageData->cache, tkwin, imageObj);
	}
    }
    if (!image) {
	image = TtkSelectImage(imageData->imageSpec, state);
    }
#else
    image = TtkSelectImage(imageData->imageSpec, state);
#endif

    if (!image) {
	return;
    }

    Tk_SizeOfImage(image, &imgWidth, &imgHeight);
    src = Ttk_MakeBox(0, 0, imgWidth, imgHeight);
    dst = Ttk_StickBox(b, imgWidth, imgHeight, imageData->sticky);

    Ttk_Tile(tkwin, d, image, src, dst, imageData->border);
}

static Ttk_ElementSpec ImageElementSpec =
{
    TK_STYLE_VERSION_2,
    sizeof(NullElement),
    TtkNullElementOptions,
    ImageElementSize,
    ImageElementDraw
};

/*------------------------------------------------------------------------
 * +++ Image element factory.
 */
static int
Ttk_CreateImageElement(
    Tcl_Interp *interp,
    void *clientData,
    Ttk_Theme theme,
    const char *elementName,
    int objc, Tcl_Obj *const objv[])
{
    const char *optionStrings[] =
	 { "-border","-height","-padding","-sticky","-width",NULL };
    enum { O_BORDER, O_HEIGHT, O_PADDING, O_STICKY, O_WIDTH };

    Ttk_ImageSpec *imageSpec = 0;
    ImageData *imageData = 0;
    int padding_specified = 0;
    int i;

    if (objc <= 0) {
	Tcl_AppendResult(interp, "Must supply a base image", NULL);
	return TCL_ERROR;
    }

    imageSpec = TtkGetImageSpec(interp, Tk_MainWindow(interp), objv[0]);
    if (!imageSpec) {
	return TCL_ERROR;
    }

    imageData = (ImageData*)ckalloc(sizeof(*imageData));
    imageData->imageSpec = imageSpec;
    imageData->minWidth = imageData->minHeight = -1;
    imageData->sticky = TTK_FILL_BOTH;
    imageData->border = imageData->padding = Ttk_UniformPadding(0);
#if TILE_07_COMPAT
    imageData->cache = Ttk_GetResourceCache(interp);
    imageData->imageMap = 0;
#endif

    for (i = 1; i < objc; i += 2) {
	int option;

	if (i == objc - 1) {
	    Tcl_AppendResult(interp,
		"Value for ", Tcl_GetString(objv[i]), " missing",
		NULL);
	    goto error;
	}

#if TILE_07_COMPAT
	if (!strcmp("-map", Tcl_GetString(objv[i]))) {
	    imageData->imageMap = objv[i+1];
	    Tcl_IncrRefCount(imageData->imageMap);
	    continue;
	}
#endif

	if (Tcl_GetIndexFromObj(interp, objv[i], optionStrings,
		    "option", 0, &option) != TCL_OK) { goto error; }

	switch (option) {
	    case O_BORDER:
		if (Ttk_GetBorderFromObj(interp, objv[i+1], &imageData->border)
			!= TCL_OK) { goto error; }
		if (!padding_specified) {
		    imageData->padding = imageData->border;
		}
		break;
	    case O_PADDING:
		if (Ttk_GetBorderFromObj(interp, objv[i+1], &imageData->padding)
			!= TCL_OK) { goto error; }
		padding_specified = 1;
		break;
	    case O_WIDTH:
		if (Tcl_GetIntFromObj(interp, objv[i+1], &imageData->minWidth)
			!= TCL_OK) { goto error; }
		break;
	    case O_HEIGHT:
		if (Tcl_GetIntFromObj(interp, objv[i+1], &imageData->minHeight)
			!= TCL_OK) { goto error; }
		break;
	    case O_STICKY:
		if (Ttk_GetStickyFromObj(interp, objv[i+1], &imageData->sticky)
			!= TCL_OK) { goto error; }
	}
    }

    if (!Ttk_RegisterElement(interp, theme, elementName, &ImageElementSpec,
		imageData))
    {
	goto error;
    }

    Ttk_RegisterCleanup(interp, imageData, FreeImageData);
    Tcl_SetObjResult(interp, Tcl_NewStringObj(elementName, -1));
    return TCL_OK;

error:
    FreeImageData(imageData);
    return TCL_ERROR;
}

MODULE_SCOPE
void TtkImage_Init(Tcl_Interp *interp)
{
    Ttk_RegisterElementFactory(interp, "image", Ttk_CreateImageElement, NULL);
}

/*EOF*/
@


1.9
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: ttkImage.c,v 1.8 2008/04/27 22:41:12 dkf Exp $
d317 1
a317 1
    const char *const optionStrings[] =
@


1.8
log
@Get rid of pre-C89-isms (esp. CONST vs const).
@
text
@d1 1
a1 1
/* $Id: ttkImage.c,v 1.7 2007/12/13 15:26:26 dgp Exp $
d317 1
a317 1
    const char *optionStrings[] =
@


1.7
log
@merge stable branch onto HEAD
@
text
@d1 1
a1 1
/* $Id: ttkImage.c,v 1.5.2.1 2007/11/12 19:22:37 dgp Exp $
d315 1
a315 1
    int objc, Tcl_Obj *CONST objv[])
@


1.7.2.1
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: ttkImage.c,v 1.10 2010/02/05 21:33:14 jenglish Exp $
d315 1
a315 1
    int objc, Tcl_Obj *const objv[])
@


1.6
log
@Ttk_ElementSize: Fixed longstanding, subtle bug that caused element padding
to sometimes be counted twice in size computations.

Fix ElementSizeProcs affected by previous change.
@
text
@d1 1
a1 1
/* $Id: ttkImage.c,v 1.5 2006/12/14 19:51:04 jenglish Exp $
@


1.5
log
@Global reduction: use per-file *_Init() routines to reduce
the number of globally-visible initialization records.
@
text
@d1 1
a1 1
/* $Id: ttkImage.c,v 1.4 2006/12/09 20:53:35 jenglish Exp $
a260 2
    *widthPtr -= Ttk_PaddingWidth(imageData->padding);
    *heightPtr -= Ttk_PaddingHeight(imageData->padding);
@


1.5.2.1
log
@merge updates from HEAD
@
text
@d1 1
a1 1
/* $Id: ttkImage.c,v 1.5 2006/12/14 19:51:04 jenglish Exp $
d261 2
@


1.4
log
@Merged duplicate functionality between image element factory,
image element, and -image option processing.  Image element
factory now takes an imageSpec argument instead of a separate
image name and -map option.
@
text
@d1 1
a1 1
/* $Id: ttkImage.c,v 1.3 2006/11/27 06:53:55 jenglish Exp $
d411 2
a412 2
MODULE_SCOPE int Ttk_ImageInit(Tcl_Interp *);
int Ttk_ImageInit(Tcl_Interp *interp)
d414 1
a414 2
    return Ttk_RegisterElementFactory(interp, "image",
	    Ttk_CreateImageElement, NULL);
@


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 2
a2 2
/* $Id: ttkImage.c,v 1.2 2006/11/03 03:06:22 das Exp $
 * 	Ttk widget set -- image element factory.
d7 4
d20 121
d220 1
a220 6
    Ttk_ResourceCache cache;	/* Resource cache for images */
    Tcl_Obj *baseImage; 	/* Name of default image */
    Ttk_StateMap imageMap;	/* State-based lookup table for images */
    Tcl_Obj *stickyObj;	 	/* Stickiness specification, NWSE */
    Tcl_Obj *borderObj;		/* Border specification */
    Tcl_Obj *paddingObj;	/* Padding specification */
d223 1
a223 1
    unsigned sticky;
d226 5
d236 2
a237 1
    Tcl_DecrRefCount(imageData->baseImage);
d239 1
a239 3
    if (imageData->stickyObj)	{ Tcl_DecrRefCount(imageData->stickyObj); }
    if (imageData->borderObj)	{ Tcl_DecrRefCount(imageData->borderObj); }
    if (imageData->paddingObj)	{ Tcl_DecrRefCount(imageData->paddingObj); }
d243 1
a243 24
static Tk_OptionSpec ImageOptionSpecs[] =
{
    { TK_OPTION_STRING, "-sticky", "sticky", "Sticky",
	"nswe", Tk_Offset(ImageData,stickyObj), -1,
	0,0,0 },
    { TK_OPTION_STRING, "-border", "border", "Border",
	"0", Tk_Offset(ImageData,borderObj), -1,
	0,0,0 },
    { TK_OPTION_STRING, "-padding", "padding", "Padding",
	NULL, Tk_Offset(ImageData,paddingObj), -1,
	TK_OPTION_NULL_OK,0,0 },
    { TK_OPTION_STRING, "-map", "map", "Map",
	"", Tk_Offset(ImageData,imageMap), -1,
	0,0,0 },
    { TK_OPTION_INT, "-width", "width", "Width",
	"-1", -1, Tk_Offset(ImageData, minWidth),
	0, 0, 0},
    { TK_OPTION_INT, "-height", "height", "Height",
	"-1", -1, Tk_Offset(ImageData, minHeight),
	0, 0, 0},
    { TK_OPTION_END }
};

static void ImageElementGeometry(
d248 1
a248 1
    Tk_Image image = Ttk_UseImage(imageData->cache,tkwin,imageData->baseImage);
d270 1
a270 2
    Tcl_Obj *imageObj = 0;
    Tk_Image image;
d274 1
d276 4
a279 1
	imageObj = Ttk_StateMapLookup(NULL, imageData->imageMap, state);
d281 2
a282 2
    if (!imageObj) {
	imageObj = imageData->baseImage;
d284 3
a286 1
    image = Ttk_UseImage(imageData->cache, tkwin, imageObj);
d304 1
a304 1
    ImageElementGeometry,
d319 8
a326 5
    Tk_OptionTable imageOptionTable =
	Tk_CreateOptionTable(interp, ImageOptionSpecs);
    ImageData *imageData;

    imageData = (ImageData*)ckalloc(sizeof(*imageData));
d333 7
a339 3
    imageData->cache = Ttk_GetResourceCache(interp);
    imageData->imageMap = imageData->stickyObj
	= imageData->borderObj = imageData->paddingObj = 0;
d341 1
a341 1
    imageData->sticky = TTK_FILL_BOTH;	/* ??? Is this sensible */
d343 4
d348 2
a349 9
    /* Can't use Tk_InitOptions() here, since we don't have a Tk_Window
     */
    if (TCL_OK != Tk_SetOptions(interp, (ClientData)imageData,
	    imageOptionTable, objc-1, objv+1,
	    NULL/*tkwin*/, NULL/*savedOptions*/, NULL/*mask*/))
    {
	ckfree((ClientData)imageData);
	return TCL_ERROR;
    }
d351 6
a356 1
    imageData->baseImage = Tcl_DuplicateObj(objv[0]);
d358 7
a364 5
    if (imageData->borderObj && Ttk_GetBorderFromObj(
		interp, imageData->borderObj, &imageData->border) != TCL_OK)
    {
	goto error;
    }
d366 2
a367 1
    imageData->padding = imageData->border;
d369 25
a393 10
    if (imageData->paddingObj && Ttk_GetBorderFromObj(
		interp, imageData->paddingObj, &imageData->padding) != TCL_OK)
    {
	goto error;
    }

    if (imageData->stickyObj && Ttk_GetStickyFromObj(
		interp, imageData->stickyObj, &imageData->sticky) != TCL_OK)
    {
	goto error;
d396 2
a397 2
    if (!Ttk_RegisterElement(interp, theme,
				elementName, &ImageElementSpec, imageData))
d414 2
a415 1
    return Ttk_RegisterElementFactory(interp, "image", Ttk_CreateImageElement, NULL);
@


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: ttkImage.c,v 1.1 2006/10/31 01:42:26 hobbs Exp $
d112 4
a115 12
    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);
    }
@


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: image.c,v 1.5 2006/09/20 23:57:41 jenglish Exp $
d205 1
a205 1
    NullElementOptions,
d286 2
a287 1
void Ttk_ImageInit(Tcl_Interp *interp)
d289 1
a289 1
    Ttk_RegisterElementFactory(interp, "image", Ttk_CreateImageElement, NULL);
@

