summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorjenglish <jenglish@flightlab.com>2009-02-08 19:35:35 (GMT)
committerjenglish <jenglish@flightlab.com>2009-02-08 19:35:35 (GMT)
commita7f3e6b8652f5d9ea2c4db8a47c14033cb559466 (patch)
treeb77850fad5f37f79d05730f2d09bec514b78f07c /generic
parent76e883da5646c90946512d237df48377778d63cc (diff)
downloadtk-a7f3e6b8652f5d9ea2c4db8a47c14033cb559466.zip
tk-a7f3e6b8652f5d9ea2c4db8a47c14033cb559466.tar.gz
tk-a7f3e6b8652f5d9ea2c4db8a47c14033cb559466.tar.bz2
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.
Diffstat (limited to 'generic')
-rw-r--r--generic/ttk/ttk.decls4
-rw-r--r--generic/ttk/ttkCache.c27
-rw-r--r--generic/ttk/ttkDecls.h6
-rw-r--r--generic/ttk/ttkEntry.c15
-rw-r--r--generic/ttk/ttkLayout.c95
-rw-r--r--generic/ttk/ttkNotebook.c16
-rw-r--r--generic/ttk/ttkProgress.c27
-rw-r--r--generic/ttk/ttkScale.c24
-rw-r--r--generic/ttk/ttkScrollbar.c10
-rw-r--r--generic/ttk/ttkSquare.c12
-rw-r--r--generic/ttk/ttkTheme.c210
-rw-r--r--generic/ttk/ttkTheme.h29
-rw-r--r--generic/ttk/ttkThemeInt.h10
-rw-r--r--generic/ttk/ttkTrack.c40
-rw-r--r--generic/ttk/ttkTreeview.c25
-rw-r--r--generic/ttk/ttkWidget.c10
16 files changed, 283 insertions, 277 deletions
diff --git a/generic/ttk/ttk.decls b/generic/ttk/ttk.decls
index 2b2fe5f..db244ce 100644
--- a/generic/ttk/ttk.decls
+++ b/generic/ttk/ttk.decls
@@ -1,5 +1,5 @@
#
-# $Id: ttk.decls,v 1.3 2008/10/22 20:56:43 nijtmans Exp $
+# $Id: ttk.decls,v 1.4 2009/02/08 19:35:35 jenglish Exp $
#
library ttk
@@ -34,7 +34,7 @@ declare 5 current {
}
declare 6 current {
- Ttk_ElementImpl Ttk_RegisterElement(
+ Ttk_ElementClass *Ttk_RegisterElement(
Tcl_Interp *interp,
Ttk_Theme theme,
const char *elementName,
diff --git a/generic/ttk/ttkCache.c b/generic/ttk/ttkCache.c
index 0d558d4..8bb54ec 100644
--- a/generic/ttk/ttkCache.c
+++ b/generic/ttk/ttkCache.c
@@ -1,6 +1,6 @@
/*
- * $Id: ttkCache.c,v 1.2 2009/01/28 20:47:49 nijtmans Exp $
- * Ttk theme engine, resource cache.
+ * $Id: ttkCache.c,v 1.3 2009/02/08 19:35:35 jenglish Exp $
+ * Theme engine resource cache.
*
* Copyright (c) 2004, Joe English
*
@@ -77,7 +77,7 @@ static void Ttk_ClearCache(Ttk_ResourceCache cache)
*/
entryPtr = Tcl_FirstHashEntry(&cache->fontTable, &search);
while (entryPtr != NULL) {
- Tcl_Obj *fontObj = (Tcl_Obj*)Tcl_GetHashValue(entryPtr);
+ Tcl_Obj *fontObj = Tcl_GetHashValue(entryPtr);
if (fontObj) {
Tk_FreeFontFromObj(cache->tkwin, fontObj);
Tcl_DecrRefCount(fontObj);
@@ -92,7 +92,7 @@ static void Ttk_ClearCache(Ttk_ResourceCache cache)
*/
entryPtr = Tcl_FirstHashEntry(&cache->colorTable, &search);
while (entryPtr != NULL) {
- Tcl_Obj *colorObj = (Tcl_Obj*)Tcl_GetHashValue(entryPtr);
+ Tcl_Obj *colorObj = Tcl_GetHashValue(entryPtr);
if (colorObj) {
Tk_FreeColorFromObj(cache->tkwin, colorObj);
Tcl_DecrRefCount(colorObj);
@@ -107,7 +107,7 @@ static void Ttk_ClearCache(Ttk_ResourceCache cache)
*/
entryPtr = Tcl_FirstHashEntry(&cache->borderTable, &search);
while (entryPtr != NULL) {
- Tcl_Obj *borderObj = (Tcl_Obj*)Tcl_GetHashValue(entryPtr);
+ Tcl_Obj *borderObj = Tcl_GetHashValue(entryPtr);
if (borderObj) {
Tk_Free3DBorderFromObj(cache->tkwin, borderObj);
Tcl_DecrRefCount(borderObj);
@@ -122,7 +122,7 @@ static void Ttk_ClearCache(Ttk_ResourceCache cache)
*/
entryPtr = Tcl_FirstHashEntry(&cache->imageTable, &search);
while (entryPtr != NULL) {
- Tk_Image image = (Tk_Image)Tcl_GetHashValue(entryPtr);
+ Tk_Image image = Tcl_GetHashValue(entryPtr);
if (image) {
Tk_FreeImage(image);
}
@@ -155,7 +155,7 @@ void Ttk_FreeResourceCache(Ttk_ResourceCache cache)
*/
entryPtr = Tcl_FirstHashEntry(&cache->namedColors, &search);
while (entryPtr != NULL) {
- Tcl_Obj *colorNameObj = (Tcl_Obj*)Tcl_GetHashValue(entryPtr);
+ Tcl_Obj *colorNameObj = Tcl_GetHashValue(entryPtr);
Tcl_DecrRefCount(colorNameObj);
entryPtr = Tcl_NextHashEntry(&search);
}
@@ -170,7 +170,7 @@ void Ttk_FreeResourceCache(Ttk_ResourceCache cache)
*/
static void CacheWinEventHandler(ClientData clientData, XEvent *eventPtr)
{
- Ttk_ResourceCache cache = (Ttk_ResourceCache)clientData;
+ Ttk_ResourceCache cache = clientData;
if (eventPtr->type != DestroyNotify) {
return;
@@ -192,7 +192,7 @@ static void InitCacheWindow(Ttk_ResourceCache cache, Tk_Window tkwin)
if (cache->tkwin == NULL) {
cache->tkwin = tkwin;
Tk_CreateEventHandler(tkwin, StructureNotifyMask,
- CacheWinEventHandler, (ClientData)cache);
+ CacheWinEventHandler, cache);
}
}
@@ -200,7 +200,6 @@ static void InitCacheWindow(Ttk_ResourceCache cache, Tk_Window tkwin)
* Ttk_RegisterNamedColor --
* Specify an RGB triplet as a named color.
* Overrides any previous named color specification.
- *
*/
void Ttk_RegisterNamedColor(
Ttk_ResourceCache cache,
@@ -219,7 +218,7 @@ void Ttk_RegisterNamedColor(
entryPtr = Tcl_CreateHashEntry(&cache->namedColors, colorName, &newEntry);
if (!newEntry) {
- Tcl_Obj *oldColor = (Tcl_Obj*)Tcl_GetHashValue(entryPtr);
+ Tcl_Obj *oldColor = Tcl_GetHashValue(entryPtr);
Tcl_DecrRefCount(oldColor);
}
@@ -237,7 +236,7 @@ static Tcl_Obj *CheckNamedColor(Ttk_ResourceCache cache, Tcl_Obj *objPtr)
Tcl_HashEntry *entryPtr =
Tcl_FindHashEntry(&cache->namedColors, Tcl_GetString(objPtr));
if (entryPtr) { /* Use named color instead */
- objPtr = (Tcl_Obj *)Tcl_GetHashValue(entryPtr);
+ objPtr = Tcl_GetHashValue(entryPtr);
}
return objPtr;
}
@@ -260,7 +259,7 @@ static Tcl_Obj *Ttk_Use(
Tcl_Obj *cacheObj;
if (!newEntry) {
- return (Tcl_Obj*)Tcl_GetHashValue(entryPtr);
+ return Tcl_GetHashValue(entryPtr);
}
cacheObj = Tcl_DuplicateObj(objPtr);
@@ -336,7 +335,7 @@ Tk_Image Ttk_UseImage(Ttk_ResourceCache cache, Tk_Window tkwin, Tcl_Obj *objPtr)
InitCacheWindow(cache, tkwin);
if (!newEntry) {
- return (Tk_Image)Tcl_GetHashValue(entryPtr);
+ return Tcl_GetHashValue(entryPtr);
}
image = Tk_GetImage(cache->interp, tkwin, imageName, NullImageChanged,0);
diff --git a/generic/ttk/ttkDecls.h b/generic/ttk/ttkDecls.h
index 1bdec8e..8b64432 100644
--- a/generic/ttk/ttkDecls.h
+++ b/generic/ttk/ttkDecls.h
@@ -1,5 +1,5 @@
/*
- * $Id: ttkDecls.h,v 1.7 2008/10/22 20:56:43 nijtmans Exp $
+ * $Id: ttkDecls.h,v 1.8 2009/02/08 19:35:35 jenglish Exp $
*
* This file is (mostly) automatically generated from ttk.decls.
*/
@@ -50,7 +50,7 @@ TTKAPI int Ttk_RegisterElementSpec (Ttk_Theme theme,
Ttk_ElementSpec * elementSpec,
void * clientData);
/* 6 */
-TTKAPI Ttk_ElementImpl Ttk_RegisterElement (Tcl_Interp * interp,
+TTKAPI Ttk_ElementClass * Ttk_RegisterElement (Tcl_Interp * interp,
Ttk_Theme theme, const char * elementName,
Ttk_ElementSpec * elementSpec,
void * clientData);
@@ -147,7 +147,7 @@ typedef struct TtkStubs {
Ttk_Theme (*ttk_CreateTheme) (Tcl_Interp * interp, const char * name, Ttk_Theme parent); /* 3 */
void (*ttk_RegisterCleanup) (Tcl_Interp * interp, void * deleteData, Ttk_CleanupProc * cleanupProc); /* 4 */
int (*ttk_RegisterElementSpec) (Ttk_Theme theme, const char * elementName, Ttk_ElementSpec * elementSpec, void * clientData); /* 5 */
- Ttk_ElementImpl (*ttk_RegisterElement) (Tcl_Interp * interp, Ttk_Theme theme, const char * elementName, Ttk_ElementSpec * elementSpec, void * clientData); /* 6 */
+ Ttk_ElementClass * (*ttk_RegisterElement) (Tcl_Interp * interp, Ttk_Theme theme, const char * elementName, Ttk_ElementSpec * elementSpec, void * clientData); /* 6 */
int (*ttk_RegisterElementFactory) (Tcl_Interp * interp, const char * name, Ttk_ElementFactory factoryProc, void * clientData); /* 7 */
void (*ttk_RegisterLayout) (Ttk_Theme theme, const char * className, Ttk_LayoutSpec layoutSpec); /* 8 */
void (*reserved9)(void);
diff --git a/generic/ttk/ttkEntry.c b/generic/ttk/ttkEntry.c
index 801b63c..95c596f 100644
--- a/generic/ttk/ttkEntry.c
+++ b/generic/ttk/ttkEntry.c
@@ -1,5 +1,5 @@
/*
- * $Id: ttkEntry.c,v 1.16 2008/12/15 17:51:31 das Exp $
+ * $Id: ttkEntry.c,v 1.17 2009/02/08 19:35:35 jenglish Exp $
*
* DERIVED FROM: tk/generic/tkEntry.c r1.35.
*
@@ -1052,17 +1052,6 @@ static int EntryPostConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
* +++ Layout and display.
*/
-/* EntryTextArea --
- * Return bounding box of entry display ("owner-draw") area.
- */
-static Ttk_Box
-EntryTextArea(Entry *entryPtr)
-{
- WidgetCore *corePtr = &entryPtr->core;
- Ttk_LayoutNode *node = Ttk_LayoutFindNode(corePtr->layout, "textarea");
- return node ? Ttk_LayoutNodeParcel(node) : Ttk_WinBox(corePtr->tkwin);
-}
-
/* EntryCharPosition --
* Return the X coordinate of the specified character index.
* Precondition: textLayout and layoutX up-to-date.
@@ -1096,7 +1085,7 @@ EntryDoLayout(void *recordPtr)
Ttk_Box textarea;
Ttk_PlaceLayout(corePtr->layout,corePtr->state,Ttk_WinBox(corePtr->tkwin));
- textarea = EntryTextArea(entryPtr);
+ textarea = Ttk_ClientRegion(corePtr->layout, "textarea");
/* Center the text vertically within the available parcel:
*/
diff --git a/generic/ttk/ttkLayout.c b/generic/ttk/ttkLayout.c
index 8107683..7eaf927 100644
--- a/generic/ttk/ttkLayout.c
+++ b/generic/ttk/ttkLayout.c
@@ -5,7 +5,7 @@
*
* Copyright (c) 2003 Joe English. Freely redistributable.
*
- * $Id: ttkLayout.c,v 1.14 2009/01/28 20:47:49 nijtmans Exp $
+ * $Id: ttkLayout.c,v 1.15 2009/02/08 19:35:35 jenglish Exp $
*/
#include <string.h>
@@ -512,21 +512,24 @@ Tcl_Obj *Ttk_NewStickyObj(Ttk_Sticky sticky)
/*------------------------------------------------------------------------
* +++ Layout nodes.
*/
+
+typedef struct Ttk_LayoutNode_ Ttk_LayoutNode;
struct Ttk_LayoutNode_
{
unsigned flags; /* Packing and sticky flags */
- Ttk_ElementImpl element; /* Element implementation */
+ Ttk_ElementClass *eclass; /* Class record */
Ttk_State state; /* Current state */
Ttk_Box parcel; /* allocated parcel */
Ttk_LayoutNode *next, *child;
};
-static Ttk_LayoutNode *Ttk_NewLayoutNode(unsigned flags, Ttk_ElementImpl element)
+static Ttk_LayoutNode *Ttk_NewLayoutNode(
+ unsigned flags, Ttk_ElementClass *elementClass)
{
- Ttk_LayoutNode *node = (Ttk_LayoutNode*)ckalloc(sizeof(Ttk_LayoutNode));
+ Ttk_LayoutNode *node = (Ttk_LayoutNode*)ckalloc(sizeof(*node));
node->flags = flags;
- node->element = element;
+ node->eclass = elementClass;
node->state = 0u;
node->next = node->child = 0;
/* parcel uninitialized */
@@ -580,8 +583,8 @@ void Ttk_FreeLayoutTemplate(Ttk_LayoutTemplate op)
static Ttk_LayoutNode *
Ttk_InstantiateLayout(Ttk_Theme theme, Ttk_TemplateNode *op)
{
- Ttk_ElementImpl elementImpl = Ttk_GetElement(theme, op->name);
- Ttk_LayoutNode *node = Ttk_NewLayoutNode(op->flags, elementImpl);
+ Ttk_ElementClass *elementClass = Ttk_GetElement(theme, op->name);
+ Ttk_LayoutNode *node = Ttk_NewLayoutNode(op->flags, elementClass);
if (op->next) {
node->next = Ttk_InstantiateLayout(theme,op->next);
@@ -870,7 +873,7 @@ Ttk_Layout Ttk_CreateLayout(
Ttk_Style style = Ttk_GetStyle(themePtr, styleName);
Ttk_LayoutTemplate layoutTemplate =
Ttk_FindLayoutTemplate(themePtr,styleName);
- Ttk_ElementImpl bgelement = Ttk_GetElement(themePtr, "background");
+ Ttk_ElementClass *bgelement = Ttk_GetElement(themePtr, "background");
Ttk_LayoutNode *bgnode;
if (!layoutTemplate) {
@@ -968,7 +971,7 @@ static void Ttk_NodeSize(
int elementWidth, elementHeight, subWidth, subHeight;
Ttk_Padding elementPadding;
- Ttk_ElementSize(node->element,
+ Ttk_ElementSize(node->eclass,
layout->style, layout->recordPtr,layout->optionTable, layout->tkwin,
state|node->state,
&elementWidth, &elementHeight, &elementPadding);
@@ -1018,7 +1021,7 @@ Ttk_Padding Ttk_LayoutNodeInternalPadding(
{
int unused;
Ttk_Padding padding;
- Ttk_ElementSize(node->element,
+ Ttk_ElementSize(node->eclass,
layout->style, layout->recordPtr, layout->optionTable, layout->tkwin,
0/*state*/, &unused, &unused, &padding);
return padding;
@@ -1112,7 +1115,7 @@ static void Ttk_DrawNodeList(
Ttk_DrawNodeList(layout, substate, node->child, d);
Ttk_DrawElement(
- node->element,
+ node->eclass,
layout->style,layout->recordPtr,layout->optionTable,layout->tkwin,
d, node->parcel, state | node->state);
@@ -1131,20 +1134,18 @@ void Ttk_DrawLayout(Ttk_Layout layout, Ttk_State state, Drawable d)
*/
/*
- * Ttk_LayoutIdentify --
- * Find the layout node at the specified x,y coordinate.
+ * Ttk_IdentifyElement --
+ * Find the element at the specified x,y coordinate.
*/
-static Ttk_LayoutNode *
-Ttk_LayoutNodeIdentify(Ttk_LayoutNode *node, int x, int y)
+static Ttk_Element IdentifyNode(Ttk_Element node, int x, int y)
{
- Ttk_LayoutNode *closest = NULL;
+ Ttk_Element closest = NULL;
for (; node; node = node->next) {
if (Ttk_BoxContains(node->parcel, x, y)) {
closest = node;
if (node->child && !(node->flags & TTK_UNIT)) {
- Ttk_LayoutNode *childNode =
- Ttk_LayoutNodeIdentify(node->child, x,y);
+ Ttk_Element childNode = IdentifyNode(node->child, x,y);
if (childNode) {
closest = childNode;
}
@@ -1154,9 +1155,9 @@ Ttk_LayoutNodeIdentify(Ttk_LayoutNode *node, int x, int y)
return closest;
}
-Ttk_LayoutNode *Ttk_LayoutIdentify(Ttk_Layout layout, int x, int y)
+Ttk_Element Ttk_IdentifyElement(Ttk_Layout layout, int x, int y)
{
- return Ttk_LayoutNodeIdentify(layout->root, x, y);
+ return IdentifyNode(layout->root, x, y);
}
/*
@@ -1173,19 +1174,18 @@ static const char *tail(const char *elementName)
}
/*
- * Ttk_LayoutFindNode --
- * Look up a layout node by name.
+ * Ttk_FindElement --
+ * Look up an element by name
*/
-static Ttk_LayoutNode *
-Ttk_LayoutNodeFind(Ttk_LayoutNode *node, const char *nodeName)
+static Ttk_Element
+FindNode(Ttk_Element node, const char *nodeName)
{
for (; node ; node = node->next) {
- if (!strcmp(tail(Ttk_LayoutNodeName(node)), nodeName))
+ if (!strcmp(tail(Ttk_ElementName(node)), nodeName))
return node;
if (node->child) {
- Ttk_LayoutNode *childNode =
- Ttk_LayoutNodeFind(node->child, nodeName);
+ Ttk_Element childNode = FindNode(node->child, nodeName);
if (childNode)
return childNode;
}
@@ -1193,22 +1193,48 @@ Ttk_LayoutNodeFind(Ttk_LayoutNode *node, const char *nodeName)
return 0;
}
-Ttk_LayoutNode *Ttk_LayoutFindNode(Ttk_Layout layout, const char *nodeName)
+Ttk_Element Ttk_FindElement(Ttk_Layout layout, const char *nodeName)
+{
+ return FindNode(layout->root, nodeName);
+}
+
+/*
+ * Ttk_ClientRegion --
+ * Find the internal parcel of a named element within a given layout.
+ * If the element is not present, use the entire window.
+ */
+Ttk_Box Ttk_ClientRegion(Ttk_Layout layout, const char *elementName)
{
- return Ttk_LayoutNodeFind(layout->root, nodeName);
+ Ttk_Element element = Ttk_FindElement(layout, elementName);
+ return element
+ ? Ttk_LayoutNodeInternalParcel(layout, element)
+ : Ttk_WinBox(layout->tkwin)
+ ;
}
-const char *Ttk_LayoutNodeName(Ttk_LayoutNode *node)
+/*
+ * Ttk_ElementName --
+ * Return the name (class name) of the element.
+ */
+const char *Ttk_ElementName(Ttk_Element node)
{
- return Ttk_ElementName(node->element);
+ return Ttk_ElementClassName(node->eclass);
}
-Ttk_Box Ttk_LayoutNodeParcel(Ttk_LayoutNode *node)
+/*
+ * Ttk_ElementParcel --
+ * Return the element's current parcel.
+ */
+Ttk_Box Ttk_ElementParcel(Ttk_Element node)
{
return node->parcel;
}
-void Ttk_PlaceLayoutNode(Ttk_Layout layout, Ttk_LayoutNode *node, Ttk_Box b)
+/*
+ * Ttk_PlaceElement --
+ * Explicitly specify an element's parcel.
+ */
+void Ttk_PlaceElement(Ttk_Layout layout, Ttk_Element node, Ttk_Box b)
{
node->parcel = b;
if (node->child) {
@@ -1217,6 +1243,9 @@ void Ttk_PlaceLayoutNode(Ttk_Layout layout, Ttk_LayoutNode *node, Ttk_Box b)
}
}
+/*
+ * Ttk_ChangeElementState --
+ */
void Ttk_ChangeElementState(Ttk_LayoutNode *node,unsigned set,unsigned clr)
{
node->state = (node->state | set) & ~clr;
diff --git a/generic/ttk/ttkNotebook.c b/generic/ttk/ttkNotebook.c
index 08fd236..43a7b7c 100644
--- a/generic/ttk/ttkNotebook.c
+++ b/generic/ttk/ttkNotebook.c
@@ -1,4 +1,4 @@
-/* $Id: ttkNotebook.c,v 1.17 2009/01/11 08:40:19 jenglish Exp $
+/* $Id: ttkNotebook.c,v 1.18 2009/02/08 19:35:35 jenglish Exp $
* Copyright (c) 2004, Joe English
*/
@@ -367,7 +367,7 @@ static int NotebookSize(void *clientData, int *widthPtr, int *heightPtr)
Notebook *nb = clientData;
NotebookStyle nbstyle;
Ttk_Padding padding;
- Ttk_LayoutNode *clientNode = Ttk_LayoutFindNode(nb->core.layout, "client");
+ Ttk_Element clientNode = Ttk_FindElement(nb->core.layout, "client");
int clientWidth = 0, clientHeight = 0,
reqWidth = 0, reqHeight = 0,
tabrowWidth = 0, tabrowHeight = 0;
@@ -501,7 +501,7 @@ static void NotebookDoLayout(void *recordPtr)
Tk_Window nbwin = nb->core.tkwin;
Ttk_Box cavity = Ttk_WinBox(nbwin);
int tabrowWidth = 0, tabrowHeight = 0;
- Ttk_LayoutNode *clientNode = Ttk_LayoutFindNode(nb->core.layout, "client");
+ Ttk_Element clientNode = Ttk_FindElement(nb->core.layout, "client");
Ttk_Box tabrowBox;
NotebookStyle nbstyle;
@@ -533,7 +533,7 @@ static void NotebookDoLayout(void *recordPtr)
/* Layout for client area frame:
*/
if (clientNode) {
- Ttk_PlaceLayoutNode(nb->core.layout, clientNode, cavity);
+ Ttk_PlaceElement(nb->core.layout, clientNode, cavity);
cavity = Ttk_LayoutNodeInternalParcel(nb->core.layout, clientNode);
}
@@ -1025,7 +1025,7 @@ static int NotebookIdentifyCommand(
Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr)
{
Notebook *nb = recordPtr;
- Ttk_LayoutNode *node = NULL;
+ Ttk_Element element = NULL;
int x, y, tabIndex;
if (objc != 4) {
@@ -1048,11 +1048,11 @@ static int NotebookIdentifyCommand(
Ttk_RebindSublayout(tabLayout, tab);
Ttk_PlaceLayout(tabLayout, state, tab->parcel);
- node = Ttk_LayoutIdentify(tabLayout, x, y);
+ element = Ttk_IdentifyElement(tabLayout, x, y);
}
- if (node) {
- const char *elementName = Ttk_LayoutNodeName(node);
+ if (element) {
+ const char *elementName = Ttk_ElementName(element);
Tcl_SetObjResult(interp,Tcl_NewStringObj(elementName,-1));
}
diff --git a/generic/ttk/ttkProgress.c b/generic/ttk/ttkProgress.c
index 2c6ff65..9b64a27 100644
--- a/generic/ttk/ttkProgress.c
+++ b/generic/ttk/ttkProgress.c
@@ -1,4 +1,4 @@
-/* $Id: ttkProgress.c,v 1.7 2008/11/09 23:53:09 jenglish Exp $
+/* $Id: ttkProgress.c,v 1.8 2009/02/08 19:35:35 jenglish Exp $
*
* Copyright (c) Joe English, Pat Thoyts, Michael Kirkham
*
@@ -291,7 +291,7 @@ static int ProgressbarSize(void *recordPtr, int *widthPtr, int *heightPtr)
static void ProgressbarDeterminateLayout(
Progressbar *pb,
- Ttk_LayoutNode *pbarNode,
+ Ttk_Element pbar,
Ttk_Box parcel,
double fraction,
Ttk_Orient orient)
@@ -306,17 +306,17 @@ static void ProgressbarDeterminateLayout(
parcel.y += (parcel.height - newHeight);
parcel.height = newHeight;
}
- Ttk_PlaceLayoutNode(pb->core.layout, pbarNode, parcel);
+ Ttk_PlaceElement(pb->core.layout, pbar, parcel);
}
static void ProgressbarIndeterminateLayout(
Progressbar *pb,
- Ttk_LayoutNode *pbarNode,
+ Ttk_Element pbar,
Ttk_Box parcel,
double fraction,
Ttk_Orient orient)
{
- Ttk_Box pbarBox = Ttk_LayoutNodeParcel(pbarNode);
+ Ttk_Box pbarBox = Ttk_ElementParcel(pbar);
fraction = fmod(fabs(fraction), 2.0);
if (fraction > 1.0) {
@@ -328,18 +328,16 @@ static void ProgressbarIndeterminateLayout(
} else {
pbarBox.y = parcel.y + (int)(fraction * (parcel.height-pbarBox.height));
}
- Ttk_PlaceLayoutNode(pb->core.layout, pbarNode, pbarBox);
+ Ttk_PlaceElement(pb->core.layout, pbar, pbarBox);
}
static void ProgressbarDoLayout(void *recordPtr)
{
Progressbar *pb = recordPtr;
WidgetCore *corePtr = &pb->core;
- Ttk_LayoutNode *pbarNode = Ttk_LayoutFindNode(corePtr->layout, "pbar");
- Ttk_LayoutNode *troughNode = Ttk_LayoutFindNode(corePtr->layout, "trough");
+ Ttk_Element pbar = Ttk_FindElement(corePtr->layout, "pbar");
double value = 0.0, maximum = 100.0;
int orient = TTK_ORIENT_HORIZONTAL;
- Ttk_Box parcel = Ttk_WinBox(corePtr->tkwin);
Ttk_PlaceLayout(corePtr->layout,corePtr->state,Ttk_WinBox(corePtr->tkwin));
@@ -350,19 +348,16 @@ static void ProgressbarDoLayout(void *recordPtr)
Tcl_GetDoubleFromObj(NULL, pb->progress.maximumObj, &maximum);
Ttk_GetOrientFromObj(NULL, pb->progress.orientObj, &orient);
- if (pbarNode) {
+ if (pbar) {
double fraction = value / maximum;
-
- if (troughNode) {
- parcel = Ttk_LayoutNodeInternalParcel(corePtr->layout, troughNode);
- }
+ Ttk_Box parcel = Ttk_ClientRegion(corePtr->layout, "trough");
if (pb->progress.mode == TTK_PROGRESSBAR_DETERMINATE) {
ProgressbarDeterminateLayout(
- pb, pbarNode, parcel, fraction, orient);
+ pb, pbar, parcel, fraction, orient);
} else {
ProgressbarIndeterminateLayout(
- pb, pbarNode, parcel, fraction, orient);
+ pb, pbar, parcel, fraction, orient);
}
}
}
diff --git a/generic/ttk/ttkScale.c b/generic/ttk/ttkScale.c
index bf1f1ea..6645dc0 100644
--- a/generic/ttk/ttkScale.c
+++ b/generic/ttk/ttkScale.c
@@ -1,4 +1,4 @@
-/* $Id: ttkScale.c,v 1.9 2008/11/09 23:53:09 jenglish Exp $
+/* $Id: ttkScale.c,v 1.10 2009/02/08 19:35:35 jenglish Exp $
* Copyright (C) 2004 Pat Thoyts <patthoyts@users.sourceforge.net>
*
* ttk::scale widget.
@@ -187,15 +187,7 @@ ScaleGetLayout(Tcl_Interp *interp, Ttk_Theme theme, void *recordPtr)
*/
static Ttk_Box TroughBox(Scale *scalePtr)
{
- WidgetCore *corePtr = &scalePtr->core;
- Ttk_LayoutNode *node = Ttk_LayoutFindNode(corePtr->layout, "trough");
-
- if (node) {
- return Ttk_LayoutNodeInternalParcel(corePtr->layout, node);
- } else {
- return Ttk_MakeBox(
- 0,0, Tk_Width(corePtr->tkwin), Tk_Height(corePtr->tkwin));
- }
+ return Ttk_ClientRegion(scalePtr->core.layout, "trough");
}
/*
@@ -206,13 +198,13 @@ static Ttk_Box TroughBox(Scale *scalePtr)
static Ttk_Box TroughRange(Scale *scalePtr)
{
Ttk_Box troughBox = TroughBox(scalePtr);
- Ttk_LayoutNode *slider=Ttk_LayoutFindNode(scalePtr->core.layout,"slider");
+ Ttk_Element slider = Ttk_FindElement(scalePtr->core.layout,"slider");
/*
* If this is a scale widget, adjust range for slider:
*/
if (slider) {
- Ttk_Box sliderBox = Ttk_LayoutNodeParcel(slider);
+ Ttk_Box sliderBox = Ttk_ElementParcel(slider);
if (scalePtr->scale.orient == TTK_ORIENT_HORIZONTAL) {
troughBox.x += sliderBox.width / 2;
troughBox.width -= sliderBox.width;
@@ -376,16 +368,16 @@ ScaleCoordsCommand(
static void ScaleDoLayout(void *clientData)
{
WidgetCore *corePtr = clientData;
- Ttk_LayoutNode *sliderNode = Ttk_LayoutFindNode(corePtr->layout, "slider");
+ Ttk_Element slider = Ttk_FindElement(corePtr->layout, "slider");
Ttk_PlaceLayout(corePtr->layout,corePtr->state,Ttk_WinBox(corePtr->tkwin));
/* Adjust the slider position:
*/
- if (sliderNode) {
+ if (slider) {
Scale *scalePtr = clientData;
Ttk_Box troughBox = TroughBox(scalePtr);
- Ttk_Box sliderBox = Ttk_LayoutNodeParcel(sliderNode);
+ Ttk_Box sliderBox = Ttk_ElementParcel(slider);
double value = 0.0;
double fraction;
int range;
@@ -400,7 +392,7 @@ static void ScaleDoLayout(void *clientData)
range = troughBox.height - sliderBox.height;
sliderBox.y += (int)(fraction * range);
}
- Ttk_PlaceLayoutNode(corePtr->layout, sliderNode, sliderBox);
+ Ttk_PlaceElement(corePtr->layout, slider, sliderBox);
}
}
diff --git a/generic/ttk/ttkScrollbar.c b/generic/ttk/ttkScrollbar.c
index 36e3701..e7c0bf0 100644
--- a/generic/ttk/ttkScrollbar.c
+++ b/generic/ttk/ttkScrollbar.c
@@ -1,4 +1,4 @@
-/* $Id: ttkScrollbar.c,v 1.9 2008/11/09 23:53:09 jenglish Exp $
+/* $Id: ttkScrollbar.c,v 1.10 2009/02/08 19:35:35 jenglish Exp $
* Copyright (c) 2003, Joe English
*
* ttk::scrollbar widget.
@@ -78,7 +78,7 @@ static void ScrollbarDoLayout(void *recordPtr)
{
Scrollbar *sb = recordPtr;
WidgetCore *corePtr = &sb->core;
- Ttk_LayoutNode *thumb;
+ Ttk_Element thumb;
Ttk_Box thumbBox;
int thumbWidth, thumbHeight;
double first, last, size;
@@ -92,11 +92,11 @@ static void ScrollbarDoLayout(void *recordPtr)
/*
* Locate thumb element, extract parcel and requested minimum size:
*/
- thumb = Ttk_LayoutFindNode(corePtr->layout, "thumb");
+ thumb = Ttk_FindElement(corePtr->layout, "thumb");
if (!thumb) /* Something has gone wrong -- bail */
return;
- sb->scrollbar.troughBox = thumbBox = Ttk_LayoutNodeParcel(thumb);
+ sb->scrollbar.troughBox = thumbBox = Ttk_ElementParcel(thumb);
Ttk_LayoutNodeReqSize(
corePtr->layout, thumb, &thumbWidth,&thumbHeight);
@@ -118,7 +118,7 @@ static void ScrollbarDoLayout(void *recordPtr)
thumbBox.width = (int)(size * last) + minSize - (int)(size * first);
}
sb->scrollbar.minSize = minSize;
- Ttk_PlaceLayoutNode(corePtr->layout, thumb, thumbBox);
+ Ttk_PlaceElement(corePtr->layout, thumb, thumbBox);
}
/*------------------------------------------------------------------------
diff --git a/generic/ttk/ttkSquare.c b/generic/ttk/ttkSquare.c
index b5ff73b..2b2ac59 100644
--- a/generic/ttk/ttkSquare.c
+++ b/generic/ttk/ttkSquare.c
@@ -2,14 +2,14 @@
*
* Minimal sample ttk widget.
*
- * $Id: ttkSquare.c,v 1.6 2007/12/13 15:26:26 dgp Exp $
+ * $Id: ttkSquare.c,v 1.7 2009/02/08 19:35:35 jenglish Exp $
*/
#include <tk.h>
#include "ttkTheme.h"
#include "ttkWidget.h"
-#ifdef TTK_SQUARE_WIDGET
+#if defined(TTK_SQUARE_WIDGET) || 1
#ifndef DEFAULT_BORDERWIDTH
#define DEFAULT_BORDERWIDTH "2"
@@ -100,9 +100,9 @@ SquareDoLayout(void *clientData)
{
WidgetCore *corePtr = (WidgetCore *)clientData;
Ttk_Box winBox;
- Ttk_LayoutNode *squareNode;
+ Ttk_Element squareNode;
- squareNode = Ttk_LayoutFindNode(corePtr->layout, "square");
+ squareNode = Ttk_FindElement(corePtr->layout, "square");
winBox = Ttk_WinBox(corePtr->tkwin);
Ttk_PlaceLayout(corePtr->layout, corePtr->state, winBox);
@@ -116,12 +116,12 @@ SquareDoLayout(void *clientData)
Tk_Anchor anchor = TK_ANCHOR_CENTER;
Ttk_Box b;
- b = Ttk_LayoutNodeParcel(squareNode);
+ b = Ttk_ElementParcel(squareNode);
if (squarePtr->square.anchorObj != NULL)
Tk_GetAnchorFromObj(NULL, squarePtr->square.anchorObj, &anchor);
b = Ttk_AnchorBox(winBox, b.width, b.height, anchor);
- Ttk_PlaceLayoutNode(corePtr->layout, squareNode, b);
+ Ttk_PlaceElement(corePtr->layout, squareNode, b);
}
}
diff --git a/generic/ttk/ttkTheme.c b/generic/ttk/ttkTheme.c
index 1bcee83..9787b4b 100644
--- a/generic/ttk/ttkTheme.c
+++ b/generic/ttk/ttkTheme.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * $Id: ttkTheme.c,v 1.17 2009/01/28 20:47:49 nijtmans Exp $
+ * $Id: ttkTheme.c,v 1.18 2009/02/08 19:35:35 jenglish Exp $
*/
#include <stdlib.h>
@@ -61,7 +61,7 @@ static void FreeStyle(Style *stylePtr)
entryPtr = Tcl_FirstHashEntry(&stylePtr->settingsTable, &search);
while (entryPtr != NULL) {
- Ttk_StateMap stateMap = (Ttk_StateMap)Tcl_GetHashValue(entryPtr);
+ Ttk_StateMap stateMap = Tcl_GetHashValue(entryPtr);
Tcl_DecrRefCount(stateMap);
entryPtr = Tcl_NextHashEntry(&search);
}
@@ -69,7 +69,7 @@ static void FreeStyle(Style *stylePtr)
entryPtr = Tcl_FirstHashEntry(&stylePtr->defaultsTable, &search);
while (entryPtr != NULL) {
- Tcl_Obj *defaultValue = (Ttk_StateMap)Tcl_GetHashValue(entryPtr);
+ Tcl_Obj *defaultValue = Tcl_GetHashValue(entryPtr);
Tcl_DecrRefCount(defaultValue);
entryPtr = Tcl_NextHashEntry(&search);
}
@@ -77,7 +77,7 @@ static void FreeStyle(Style *stylePtr)
Ttk_FreeLayoutTemplate(stylePtr->layoutTemplate);
- ckfree((char*)stylePtr);
+ ckfree((ClientData)stylePtr);
}
/*
@@ -108,7 +108,7 @@ Tcl_Obj *Ttk_StyleDefault(Ttk_Style style, const char *optionName)
Tcl_HashEntry *entryPtr =
Tcl_FindHashEntry(&style->defaultsTable, optionName);
if (entryPtr)
- return (Tcl_Obj *)Tcl_GetHashValue(entryPtr);
+ return Tcl_GetHashValue(entryPtr);
style= style->parentStyle;
}
return 0;
@@ -120,8 +120,7 @@ Tcl_Obj *Ttk_StyleDefault(Ttk_Style style, const char *optionName)
typedef const Tk_OptionSpec **OptionMap;
/* array of Tk_OptionSpecs mapping widget options to element options */
-typedef struct Ttk_ElementImpl_ /* Element implementation */
-{
+struct Ttk_ElementClass_ {
const char *name; /* Points to hash table key */
Ttk_ElementSpec *specPtr; /* Template provided during registration. */
void *clientData; /* Client data passed in at registration time */
@@ -129,7 +128,7 @@ typedef struct Ttk_ElementImpl_ /* Element implementation */
int nResources; /* #Element options */
Tcl_Obj **defaultValues; /* Array of option default values */
Tcl_HashTable optMapCache; /* Map: Tk_OptionTable * -> OptionMap */
-} ElementImpl;
+};
/* TTKGetOptionSpec --
* Look up a Tk_OptionSpec by name from a Tk_OptionTable,
@@ -180,14 +179,14 @@ static const Tk_OptionSpec *TTKGetOptionSpec(
* Construct the mapping from element options to widget options.
*/
static OptionMap
-BuildOptionMap(ElementImpl *elementImpl, Tk_OptionTable optionTable)
+BuildOptionMap(Ttk_ElementClass *elementClass, Tk_OptionTable optionTable)
{
OptionMap optionMap = (OptionMap)ckalloc(
- sizeof(const Tk_OptionSpec) * elementImpl->nResources);
+ sizeof(const Tk_OptionSpec) * elementClass->nResources);
int i;
- for (i = 0; i < elementImpl->nResources; ++i) {
- Ttk_ElementOptionSpec *e = elementImpl->specPtr->options+i;
+ for (i = 0; i < elementClass->nResources; ++i) {
+ Ttk_ElementOptionSpec *e = elementClass->specPtr->options+i;
optionMap[i] = TTKGetOptionSpec(e->optionName, optionTable, e->type);
}
@@ -199,71 +198,72 @@ BuildOptionMap(ElementImpl *elementImpl, Tk_OptionTable optionTable)
* for the specified element, creating it if necessary.
*/
static OptionMap
-GetOptionMap(ElementImpl *elementImpl, Tk_OptionTable optionTable)
+GetOptionMap(Ttk_ElementClass *elementClass, Tk_OptionTable optionTable)
{
OptionMap optionMap;
int isNew;
Tcl_HashEntry *entryPtr = Tcl_CreateHashEntry(
- &elementImpl->optMapCache, (ClientData)optionTable, &isNew);
+ &elementClass->optMapCache, (void*)optionTable, &isNew);
if (isNew) {
- optionMap = BuildOptionMap(elementImpl, optionTable);
+ optionMap = BuildOptionMap(elementClass, optionTable);
Tcl_SetHashValue(entryPtr, optionMap);
} else {
- optionMap = (OptionMap)(Tcl_GetHashValue(entryPtr));
+ optionMap = Tcl_GetHashValue(entryPtr);
}
return optionMap;
}
/*
- * NewElementImpl --
- * Allocate and initialize an element implementation record
+ * NewElementClass --
+ * Allocate and initialize an element class record
* from the specified element specification.
*/
-static ElementImpl *
-NewElementImpl(const char *name, Ttk_ElementSpec *specPtr,void *clientData)
+static Ttk_ElementClass *
+NewElementClass(const char *name, Ttk_ElementSpec *specPtr,void *clientData)
{
- ElementImpl *elementImpl = (ElementImpl*)ckalloc(sizeof(ElementImpl));
+ Ttk_ElementClass *elementClass =
+ (Ttk_ElementClass*)ckalloc(sizeof(Ttk_ElementClass));
int i;
- elementImpl->name = name;
- elementImpl->specPtr = specPtr;
- elementImpl->clientData = clientData;
- elementImpl->elementRecord = ckalloc(specPtr->elementSize);
+ elementClass->name = name;
+ elementClass->specPtr = specPtr;
+ elementClass->clientData = clientData;
+ elementClass->elementRecord = ckalloc(specPtr->elementSize);
/* Count #element resources:
*/
for (i = 0; specPtr->options[i].optionName != 0; ++i)
continue;
- elementImpl->nResources = i;
+ elementClass->nResources = i;
/* Initialize default values:
*/
- elementImpl->defaultValues = (Tcl_Obj**)
- ckalloc(elementImpl->nResources * sizeof(Tcl_Obj *));
- for (i=0; i < elementImpl->nResources; ++i) {
+ elementClass->defaultValues = (Tcl_Obj**)
+ ckalloc(elementClass->nResources * sizeof(Tcl_Obj *));
+ for (i=0; i < elementClass->nResources; ++i) {
const char *defaultValue = specPtr->options[i].defaultValue;
if (defaultValue) {
- elementImpl->defaultValues[i] = Tcl_NewStringObj(defaultValue,-1);
- Tcl_IncrRefCount(elementImpl->defaultValues[i]);
+ elementClass->defaultValues[i] = Tcl_NewStringObj(defaultValue,-1);
+ Tcl_IncrRefCount(elementClass->defaultValues[i]);
} else {
- elementImpl->defaultValues[i] = 0;
+ elementClass->defaultValues[i] = 0;
}
}
/* Initialize option map cache:
*/
- Tcl_InitHashTable(&elementImpl->optMapCache, TCL_ONE_WORD_KEYS);
+ Tcl_InitHashTable(&elementClass->optMapCache, TCL_ONE_WORD_KEYS);
- return elementImpl;
+ return elementClass;
}
/*
- * FreeElementImpl --
- * Release resources associated with an element implementation record.
+ * FreeElementClass --
+ * Release resources associated with an element class record.
*/
-static void FreeElementImpl(ElementImpl *elementImpl)
+static void FreeElementClass(Ttk_ElementClass *elementClass)
{
Tcl_HashSearch search;
Tcl_HashEntry *entryPtr;
@@ -272,25 +272,25 @@ static void FreeElementImpl(ElementImpl *elementImpl)
/*
* Free default values:
*/
- for (i = 0; i < elementImpl->nResources; ++i) {
- if (elementImpl->defaultValues[i]) {
- Tcl_DecrRefCount(elementImpl->defaultValues[i]);
+ for (i = 0; i < elementClass->nResources; ++i) {
+ if (elementClass->defaultValues[i]) {
+ Tcl_DecrRefCount(elementClass->defaultValues[i]);
}
}
- ckfree((ClientData)elementImpl->defaultValues);
+ ckfree((ClientData)elementClass->defaultValues);
/*
* Free option map cache:
*/
- entryPtr = Tcl_FirstHashEntry(&elementImpl->optMapCache, &search);
+ entryPtr = Tcl_FirstHashEntry(&elementClass->optMapCache, &search);
while (entryPtr != NULL) {
ckfree(Tcl_GetHashValue(entryPtr));
entryPtr = Tcl_NextHashEntry(&search);
}
- Tcl_DeleteHashTable(&elementImpl->optMapCache);
+ Tcl_DeleteHashTable(&elementClass->optMapCache);
- ckfree(elementImpl->elementRecord);
- ckfree((ClientData)elementImpl);
+ ckfree(elementClass->elementRecord);
+ ckfree((ClientData)elementClass);
}
/*------------------------------------------------------------------------
@@ -303,7 +303,7 @@ static int ThemeEnabled(Ttk_Theme theme, void *clientData) { return 1; }
typedef struct Ttk_Theme_
{
Ttk_Theme parentPtr; /* Parent theme. */
- Tcl_HashTable elementTable; /* Map element names to ElementImpls */
+ Tcl_HashTable elementTable; /* Map element names to class records */
Tcl_HashTable styleTable; /* Map style names to Styles */
Ttk_Style rootStyle; /* "." style, root of chain */
Ttk_ThemeEnabledProc *enabledProc; /* Function called by SetTheme */
@@ -343,12 +343,12 @@ static void FreeTheme(Theme *themePtr)
Tcl_HashEntry *entryPtr;
/*
- * Free associated ElementImpl's
+ * Free element table:
*/
entryPtr = Tcl_FirstHashEntry(&themePtr->elementTable, &search);
while (entryPtr != NULL) {
- ElementImpl *elementImpl = (ElementImpl *)Tcl_GetHashValue(entryPtr);
- FreeElementImpl(elementImpl);
+ Ttk_ElementClass *elementClass = Tcl_GetHashValue(entryPtr);
+ FreeElementClass(elementClass);
entryPtr = Tcl_NextHashEntry(&search);
}
Tcl_DeleteHashTable(&themePtr->elementTable);
@@ -358,7 +358,7 @@ static void FreeTheme(Theme *themePtr)
*/
entryPtr = Tcl_FirstHashEntry(&themePtr->styleTable, &search);
while (entryPtr != NULL) {
- Style *stylePtr = (Style*)Tcl_GetHashValue(entryPtr);
+ Style *stylePtr = Tcl_GetHashValue(entryPtr);
FreeStyle(stylePtr);
entryPtr = Tcl_NextHashEntry(&search);
}
@@ -367,7 +367,7 @@ static void FreeTheme(Theme *themePtr)
/*
* Free theme record:
*/
- ckfree((char *)themePtr);
+ ckfree((ClientData)themePtr);
return;
}
@@ -411,10 +411,9 @@ static void ThemeChangedProc(ClientData); /* Forward */
*/
static void Ttk_StylePkgFree(ClientData clientData, Tcl_Interp *interp)
{
- StylePackageData *pkgPtr = (StylePackageData *)clientData;
+ StylePackageData *pkgPtr = clientData;
Tcl_HashSearch search;
Tcl_HashEntry *entryPtr;
- Theme *themePtr;
Cleanup *cleanup;
/*
@@ -429,7 +428,7 @@ static void Ttk_StylePkgFree(ClientData clientData, Tcl_Interp *interp)
*/
entryPtr = Tcl_FirstHashEntry(&pkgPtr->themeTable, &search);
while (entryPtr != NULL) {
- themePtr = (Theme *) Tcl_GetHashValue(entryPtr);
+ Theme *themePtr = Tcl_GetHashValue(entryPtr);
FreeTheme(themePtr);
entryPtr = Tcl_NextHashEntry(&search);
}
@@ -461,7 +460,7 @@ static void Ttk_StylePkgFree(ClientData clientData, Tcl_Interp *interp)
cleanup = next;
}
- ckfree((char*)pkgPtr);
+ ckfree((ClientData)pkgPtr);
}
/*
@@ -510,7 +509,7 @@ void Ttk_RegisterCleanup(
static void ThemeChangedProc(ClientData clientData)
{
static char ThemeChangedScript[] = "ttk::ThemeChanged";
- StylePackageData *pkgPtr = (StylePackageData *)clientData;
+ StylePackageData *pkgPtr = clientData;
if (Tcl_GlobalEval(pkgPtr->interp, ThemeChangedScript) != TCL_OK) {
Tcl_BackgroundError(pkgPtr->interp);
@@ -568,7 +567,6 @@ Ttk_CreateTheme(
return themePtr;
}
-
/*
* Ttk_SetThemeEnabledProc --
* Sets a procedure that is used to check that this theme is available.
@@ -601,7 +599,7 @@ static Ttk_Theme LookupTheme(
return NULL;
}
- return (Ttk_Theme)Tcl_GetHashValue(entryPtr);
+ return Tcl_GetHashValue(entryPtr);
}
/*
@@ -714,7 +712,7 @@ Ttk_Style Ttk_GetStyle(Ttk_Theme themePtr, const char *styleName)
Tcl_SetHashValue(entryPtr, stylePtr);
return stylePtr;
}
- return (Style*)Tcl_GetHashValue(entryPtr);
+ return Tcl_GetHashValue(entryPtr);
}
/* FindLayoutTemplate --
@@ -745,12 +743,12 @@ const char *Ttk_StyleName(Ttk_Style stylePtr)
/*
* Ttk_GetElement --
- * Look up an element implementation by name in a given theme.
+ * Look up an element class by name in a given theme.
* If not found, try generic element names in this theme, then
* repeat the lookups in the parent theme.
* If not found, return the null element.
*/
-Ttk_ElementImpl Ttk_GetElement(Ttk_Theme themePtr, const char *elementName)
+Ttk_ElementClass *Ttk_GetElement(Ttk_Theme themePtr, const char *elementName)
{
Tcl_HashEntry *entryPtr;
const char *dot = elementName;
@@ -760,7 +758,7 @@ Ttk_ElementImpl Ttk_GetElement(Ttk_Theme themePtr, const char *elementName)
*/
entryPtr = Tcl_FindHashEntry(&themePtr->elementTable, elementName);
if (entryPtr) {
- return (Ttk_ElementImpl)Tcl_GetHashValue(entryPtr);
+ return Tcl_GetHashValue(entryPtr);
}
/*
@@ -771,7 +769,7 @@ Ttk_ElementImpl Ttk_GetElement(Ttk_Theme themePtr, const char *elementName)
entryPtr = Tcl_FindHashEntry(&themePtr->elementTable, dot);
}
if (entryPtr) {
- return (ElementImpl *)Tcl_GetHashValue(entryPtr);
+ return Tcl_GetHashValue(entryPtr);
}
/*
@@ -787,12 +785,12 @@ Ttk_ElementImpl Ttk_GetElement(Ttk_Theme themePtr, const char *elementName)
*/
entryPtr = Tcl_FindHashEntry(&themePtr->elementTable, "");
/* ASSERT: entryPtr != 0 */
- return (Ttk_ElementImpl)Tcl_GetHashValue(entryPtr);
+ return Tcl_GetHashValue(entryPtr);
}
-const char *Ttk_ElementName(ElementImpl *elementImpl)
+const char *Ttk_ElementClassName(Ttk_ElementClass *elementClass)
{
- return elementImpl->name;
+ return elementClass->name;
}
/*
@@ -821,7 +819,6 @@ int Ttk_RegisterElementFactory(
return TCL_OK;
}
-
/* Ttk_CloneElement -- element factory procedure.
* (style element create $name) "from" $theme ?$element?
*/
@@ -831,7 +828,7 @@ static int Ttk_CloneElement(
int objc, Tcl_Obj *const objv[])
{
Ttk_Theme fromTheme;
- ElementImpl *fromElement;
+ Ttk_ElementClass *fromElement;
if (objc <= 0 || objc > 2) {
Tcl_WrongNumArgs(interp, 0, objv, "theme ?element?");
@@ -867,14 +864,14 @@ static int Ttk_CloneElement(
* if interp is non-NULL.
*/
-Ttk_ElementImpl Ttk_RegisterElement(
+Ttk_ElementClass *Ttk_RegisterElement(
Tcl_Interp *interp, /* Where to leave error messages */
Ttk_Theme theme, /* Style engine providing the implementation. */
const char *name, /* Name of new element */
Ttk_ElementSpec *specPtr, /* Static template information */
void *clientData) /* application-specific data */
{
- ElementImpl *elementImpl;
+ Ttk_ElementClass *elementClass;
Tcl_HashEntry *entryPtr;
int newEntry;
@@ -899,10 +896,10 @@ Ttk_ElementImpl Ttk_RegisterElement(
}
name = Tcl_GetHashKey(&theme->elementTable, entryPtr);
- elementImpl = NewElementImpl(name, specPtr, clientData);
- Tcl_SetHashValue(entryPtr, elementImpl);
+ elementClass = NewElementClass(name, specPtr, clientData);
+ Tcl_SetHashValue(entryPtr, elementClass);
- return elementImpl;
+ return elementClass;
}
/* Ttk_RegisterElementSpec (deprecated) --
@@ -971,18 +968,18 @@ static int AllocateResource(
static
int InitializeElementRecord(
- ElementImpl *element, /* Element instance to initialize */
+ Ttk_ElementClass *eclass, /* Element instance to initialize */
Ttk_Style style, /* Style table */
char *widgetRecord, /* Source of widget option values */
Tk_OptionTable optionTable, /* Option table describing widget record */
Tk_Window tkwin, /* Corresponding window */
Ttk_State state) /* Widget or element state */
{
- char *elementRecord = element->elementRecord;
- OptionMap optionMap = GetOptionMap(element,optionTable);
- int nResources = element->nResources;
+ char *elementRecord = eclass->elementRecord;
+ OptionMap optionMap = GetOptionMap(eclass,optionTable);
+ int nResources = eclass->nResources;
Ttk_ResourceCache cache = style->cache;
- Ttk_ElementOptionSpec *elementOption = element->specPtr->options;
+ Ttk_ElementOptionSpec *elementOption = eclass->specPtr->options;
int i;
for (i=0; i<nResources; ++i, ++elementOption) {
@@ -991,7 +988,7 @@ int InitializeElementRecord(
const char *optionName = elementOption->optionName;
Tcl_Obj *dynamicSetting = Ttk_StyleMap(style, optionName, state);
Tcl_Obj *widgetValue = 0;
- Tcl_Obj *elementDefault = element->defaultValues[i];
+ Tcl_Obj *elementDefault = eclass->defaultValues[i];
if (optionMap[i]) {
widgetValue = *(Tcl_Obj **)
@@ -1065,7 +1062,7 @@ Tcl_Obj *Ttk_QueryStyle(
void
Ttk_ElementSize(
- ElementImpl *element, /* Element to query */
+ Ttk_ElementClass *eclass, /* Element to query */
Ttk_Style style, /* Style settings */
char *recordPtr, /* The widget record. */
Tk_OptionTable optionTable, /* Description of widget record */
@@ -1078,10 +1075,13 @@ Ttk_ElementSize(
paddingPtr->left = paddingPtr->right = paddingPtr->top = paddingPtr->bottom
= *widthPtr = *heightPtr = 0;
- if (!InitializeElementRecord(element, style, recordPtr, optionTable, tkwin, state))
+ if (!InitializeElementRecord(
+ eclass, style, recordPtr, optionTable, tkwin, state))
+ {
return;
- element->specPtr->size(
- element->clientData, element->elementRecord,
+ }
+ eclass->specPtr->size(
+ eclass->clientData, eclass->elementRecord,
tkwin, widthPtr, heightPtr, paddingPtr);
}
@@ -1092,7 +1092,7 @@ Ttk_ElementSize(
void
Ttk_DrawElement(
- ElementImpl *element, /* Element instance */
+ Ttk_ElementClass *eclass, /* Element instance */
Ttk_Style style, /* Style settings */
char *recordPtr, /* The widget record. */
Tk_OptionTable optionTable, /* Description of option table */
@@ -1103,10 +1103,13 @@ Ttk_DrawElement(
{
if (b.width <= 0 || b.height <= 0)
return;
- if (!InitializeElementRecord(element, style, recordPtr, optionTable, tkwin, state))
+ if (!InitializeElementRecord(
+ eclass, style, recordPtr, optionTable, tkwin, state))
+ {
return;
- element->specPtr->draw(
- element->clientData, element->elementRecord,
+ }
+ eclass->specPtr->draw(
+ eclass->clientData, eclass->elementRecord,
tkwin, d, b, state);
}
@@ -1151,7 +1154,7 @@ static Tcl_Obj* HashTableToDict(Tcl_HashTable *ht)
while (entryPtr != NULL) {
Tcl_Obj *nameObj = Tcl_NewStringObj(Tcl_GetHashKey(ht, entryPtr),-1);
- Tcl_Obj *valueObj = (Tcl_Obj*)Tcl_GetHashValue(entryPtr);
+ Tcl_Obj *valueObj = Tcl_GetHashValue(entryPtr);
Tcl_ListObjAppendElement(NULL, result, nameObj);
Tcl_ListObjAppendElement(NULL, result, valueObj);
entryPtr = Tcl_NextHashEntry(&search);
@@ -1172,7 +1175,7 @@ StyleMapCmd(
int objc, /* Number of arguments */
Tcl_Obj *const objv[]) /* Argument objects */
{
- StylePackageData *pkgPtr = (StylePackageData *)clientData;
+ StylePackageData *pkgPtr = clientData;
Ttk_Theme theme = pkgPtr->currentTheme;
const char *styleName;
Style *stylePtr;
@@ -1236,7 +1239,7 @@ usage:
static int StyleConfigureCmd(
ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- StylePackageData *pkgPtr = (StylePackageData *)clientData;
+ StylePackageData *pkgPtr = clientData;
Ttk_Theme theme = pkgPtr->currentTheme;
const char *styleName;
Style *stylePtr;
@@ -1333,7 +1336,7 @@ static int StyleLookupCmd(
static int StyleThemeCurrentCmd(
ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[])
{
- StylePackageData *pkgPtr = (StylePackageData *)clientData;
+ StylePackageData *pkgPtr = clientData;
Tcl_HashSearch search;
Tcl_HashEntry *entryPtr = NULL;
const char *name = NULL;
@@ -1345,7 +1348,7 @@ static int StyleThemeCurrentCmd(
entryPtr = Tcl_FirstHashEntry(&pkgPtr->themeTable, &search);
while (entryPtr != NULL) {
- Theme *ptr = (Theme *)Tcl_GetHashValue(entryPtr);
+ Theme *ptr = Tcl_GetHashValue(entryPtr);
if (ptr == pkgPtr->currentTheme) {
name = Tcl_GetHashKey(&pkgPtr->themeTable, entryPtr);
break;
@@ -1368,7 +1371,7 @@ static int StyleThemeCurrentCmd(
static int StyleThemeCreateCmd(
ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- StylePackageData *pkgPtr = (StylePackageData *)clientData;
+ StylePackageData *pkgPtr = clientData;
static const char *optStrings[] =
{ "-parent", "-settings", NULL };
enum { OP_PARENT, OP_SETTINGS };
@@ -1448,7 +1451,7 @@ StyleThemeSettingsCmd(
int objc, /* Number of arguments */
Tcl_Obj *const objv[]) /* Argument objects */
{
- StylePackageData *pkgPtr = (StylePackageData *)clientData;
+ StylePackageData *pkgPtr = clientData;
Ttk_Theme oldTheme = pkgPtr->currentTheme;
Ttk_Theme newTheme;
int status;
@@ -1474,7 +1477,7 @@ StyleThemeSettingsCmd(
static int StyleElementCreateCmd(
ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- StylePackageData *pkgPtr = (StylePackageData *)clientData;
+ StylePackageData *pkgPtr = clientData;
Ttk_Theme theme = pkgPtr->currentTheme;
const char *elementName, *factoryName;
Tcl_HashEntry *entryPtr;
@@ -1494,7 +1497,7 @@ static int StyleElementCreateCmd(
return TCL_ERROR;
}
- recPtr = (FactoryRec *)Tcl_GetHashValue(entryPtr);
+ recPtr = Tcl_GetHashValue(entryPtr);
return recPtr->factory(interp, recPtr->clientData,
theme, elementName, objc - 5, objv + 5);
@@ -1506,7 +1509,7 @@ static int StyleElementCreateCmd(
static int StyleElementNamesCmd(
ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- StylePackageData *pkgPtr = (StylePackageData *)clientData;
+ StylePackageData *pkgPtr = clientData;
Ttk_Theme theme = pkgPtr->currentTheme;
if (objc != 3) {
@@ -1525,7 +1528,7 @@ static int StyleElementOptionsCmd(
StylePackageData *pkgPtr = clientData;
Ttk_Theme theme = pkgPtr->currentTheme;
const char *elementName;
- ElementImpl *elementImpl;
+ Ttk_ElementClass *elementClass;
if (objc != 4) {
Tcl_WrongNumArgs(interp, 3, objv, "element");
@@ -1533,9 +1536,9 @@ static int StyleElementOptionsCmd(
}
elementName = Tcl_GetString(objv[3]);
- elementImpl = Ttk_GetElement(theme, elementName);
- if (elementImpl) {
- Ttk_ElementSpec *specPtr = elementImpl->specPtr;
+ elementClass = Ttk_GetElement(theme, elementName);
+ if (elementClass) {
+ Ttk_ElementSpec *specPtr = elementClass->specPtr;
Ttk_ElementOptionSpec *option = specPtr->options;
Tcl_Obj *result = Tcl_NewListObj(0,0);
@@ -1558,7 +1561,7 @@ static int StyleElementOptionsCmd(
static int StyleLayoutCmd(
ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
- StylePackageData *pkgPtr = (StylePackageData *)clientData;
+ StylePackageData *pkgPtr = clientData;
Ttk_Theme theme = pkgPtr->currentTheme;
const char *layoutName;
Ttk_LayoutTemplate layoutTemplate;
@@ -1725,8 +1728,7 @@ void Ttk_StylePkgInit(Tcl_Interp *interp)
/*
* Register commands:
*/
- Tcl_CreateObjCommand(interp, "::ttk::style", StyleObjCmd,
- (ClientData)pkgPtr, 0);
+ Tcl_CreateObjCommand(interp, "::ttk::style", StyleObjCmd, pkgPtr, 0);
nsPtr = Tcl_FindNamespace(interp, "::ttk", (Tcl_Namespace *) NULL,
TCL_LEAVE_ERR_MSG);
diff --git a/generic/ttk/ttkTheme.h b/generic/ttk/ttkTheme.h
index 01a1571..1f7840f 100644
--- a/generic/ttk/ttkTheme.h
+++ b/generic/ttk/ttkTheme.h
@@ -1,4 +1,4 @@
-/* $Id: ttkTheme.h,v 1.16 2008/12/03 18:44:49 jenglish Exp $
+/* $Id: ttkTheme.h,v 1.17 2009/02/08 19:35:35 jenglish Exp $
* Copyright (c) 2003 Joe English. Freely redistributable.
*
* Declarations for Tk theme engine.
@@ -202,9 +202,9 @@ TTKAPI Ttk_Box Ttk_PositionBox(Ttk_Box *cavity, int w, int h, Ttk_PositionSpec);
MODULE_SCOPE void Ttk_StylePkgInit(Tcl_Interp *);
typedef struct Ttk_Theme_ *Ttk_Theme;
-typedef struct Ttk_ElementImpl_ *Ttk_ElementImpl;
+typedef struct Ttk_ElementClass_ Ttk_ElementClass;
typedef struct Ttk_Layout_ *Ttk_Layout;
-typedef struct Ttk_LayoutNode_ Ttk_LayoutNode;
+typedef struct Ttk_LayoutNode_ *Ttk_Element;
typedef struct Ttk_Style_ *Ttk_Style;
TTKAPI Ttk_Theme Ttk_GetTheme(Tcl_Interp *interp, const char *name);
@@ -252,7 +252,7 @@ typedef struct Ttk_ElementSpec {
Ttk_ElementDrawProc *draw; /* Draw the element */
} Ttk_ElementSpec;
-TTKAPI Ttk_ElementImpl Ttk_RegisterElement(
+TTKAPI Ttk_ElementClass *Ttk_RegisterElement(
Tcl_Interp *interp, Ttk_Theme theme, const char *elementName,
Ttk_ElementSpec *, void *clientData);
@@ -328,17 +328,20 @@ MODULE_SCOPE void Ttk_DrawLayout(Ttk_Layout, Ttk_State, Drawable);
MODULE_SCOPE void Ttk_RebindSublayout(Ttk_Layout, void *recordPtr);
-MODULE_SCOPE Ttk_LayoutNode *Ttk_LayoutIdentify(Ttk_Layout, int x, int y);
-MODULE_SCOPE Ttk_LayoutNode *Ttk_LayoutFindNode(Ttk_Layout, const char *nodeName);
+MODULE_SCOPE Ttk_Element Ttk_IdentifyElement(Ttk_Layout, int x, int y);
+MODULE_SCOPE Ttk_Element Ttk_FindElement(Ttk_Layout, const char *nodeName);
-MODULE_SCOPE const char *Ttk_LayoutNodeName(Ttk_LayoutNode *);
-MODULE_SCOPE Ttk_Box Ttk_LayoutNodeParcel(Ttk_LayoutNode *);
-MODULE_SCOPE Ttk_Box Ttk_LayoutNodeInternalParcel(Ttk_Layout,Ttk_LayoutNode *);
-MODULE_SCOPE Ttk_Padding Ttk_LayoutNodeInternalPadding(Ttk_Layout,Ttk_LayoutNode *);
-MODULE_SCOPE void Ttk_LayoutNodeReqSize(Ttk_Layout, Ttk_LayoutNode *, int *w, int *h);
+MODULE_SCOPE const char *Ttk_ElementName(Ttk_Element);
+MODULE_SCOPE Ttk_Box Ttk_ElementParcel(Ttk_Element);
-MODULE_SCOPE void Ttk_PlaceLayoutNode(Ttk_Layout,Ttk_LayoutNode *, Ttk_Box);
-MODULE_SCOPE void Ttk_ChangeElementState(Ttk_LayoutNode *,unsigned set,unsigned clr);
+MODULE_SCOPE Ttk_Box Ttk_ClientRegion(Ttk_Layout, const char *elementName);
+
+MODULE_SCOPE Ttk_Box Ttk_LayoutNodeInternalParcel(Ttk_Layout,Ttk_Element);
+MODULE_SCOPE Ttk_Padding Ttk_LayoutNodeInternalPadding(Ttk_Layout,Ttk_Element);
+MODULE_SCOPE void Ttk_LayoutNodeReqSize(Ttk_Layout, Ttk_Element, int *w, int *h);
+
+MODULE_SCOPE void Ttk_PlaceElement(Ttk_Layout, Ttk_Element, Ttk_Box);
+MODULE_SCOPE void Ttk_ChangeElementState(Ttk_Element,unsigned set,unsigned clr);
MODULE_SCOPE Tcl_Obj *Ttk_QueryOption(Ttk_Layout, const char *, Ttk_State);
diff --git a/generic/ttk/ttkThemeInt.h b/generic/ttk/ttkThemeInt.h
index 1f61b73..ff3cd7c 100644
--- a/generic/ttk/ttkThemeInt.h
+++ b/generic/ttk/ttkThemeInt.h
@@ -1,5 +1,5 @@
/*
- * $Id: ttkThemeInt.h,v 1.6 2008/05/23 20:20:05 jenglish Exp $
+ * $Id: ttkThemeInt.h,v 1.7 2009/02/08 19:35:35 jenglish Exp $
*
* Theme engine: private definitions.
*
@@ -13,15 +13,15 @@
typedef struct Ttk_TemplateNode_ Ttk_TemplateNode, *Ttk_LayoutTemplate;
-MODULE_SCOPE Ttk_ElementImpl Ttk_GetElement(Ttk_Theme theme, const char *name);
-MODULE_SCOPE const char *Ttk_ElementName(Ttk_ElementImpl);
+MODULE_SCOPE Ttk_ElementClass *Ttk_GetElement(Ttk_Theme, const char *name);
+MODULE_SCOPE const char *Ttk_ElementClassName(Ttk_ElementClass *);
MODULE_SCOPE void Ttk_ElementSize(
- Ttk_ElementImpl element, Ttk_Style, char *recordPtr, Tk_OptionTable,
+ Ttk_ElementClass *, Ttk_Style, char *recordPtr, Tk_OptionTable,
Tk_Window tkwin, Ttk_State state,
int *widthPtr, int *heightPtr, Ttk_Padding*);
MODULE_SCOPE void Ttk_DrawElement(
- Ttk_ElementImpl element, Ttk_Style, char *recordPtr, Tk_OptionTable,
+ Ttk_ElementClass *, Ttk_Style, char *recordPtr, Tk_OptionTable,
Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state);
MODULE_SCOPE Tcl_Obj *Ttk_QueryStyle(
diff --git a/generic/ttk/ttkTrack.c b/generic/ttk/ttkTrack.c
index d6e89fa..42144d8 100644
--- a/generic/ttk/ttkTrack.c
+++ b/generic/ttk/ttkTrack.c
@@ -1,4 +1,4 @@
-/* $Id: ttkTrack.c,v 1.4 2007/12/13 15:26:26 dgp Exp $
+/* $Id: ttkTrack.c,v 1.5 2009/02/08 19:35:35 jenglish Exp $
* Copyright (c) 2004, Joe English
*
* TtkTrackElementState() -- helper routine for widgets
@@ -30,8 +30,8 @@
typedef struct
{
WidgetCore *corePtr; /* Widget to track */
- Ttk_LayoutNode *activeElement; /* element under the mouse cursor */
- Ttk_LayoutNode *pressedElement; /* currently pressed element */
+ Ttk_Element activeElement; /* element under the mouse cursor */
+ Ttk_Element pressedElement; /* currently pressed element */
} ElementStateTracker;
/*
@@ -42,9 +42,9 @@ typedef struct
* The active element has TTK_STATE_ACTIVE set _unless_
* another element is 'pressed'
*/
-static void ActivateElement(ElementStateTracker *es, Ttk_LayoutNode *node)
+static void ActivateElement(ElementStateTracker *es, Ttk_Element element)
{
- if (es->activeElement == node) {
+ if (es->activeElement == element) {
/* No change */
return;
}
@@ -54,14 +54,14 @@ static void ActivateElement(ElementStateTracker *es, Ttk_LayoutNode *node)
/* Deactivate old element */
Ttk_ChangeElementState(es->activeElement, 0,TTK_STATE_ACTIVE);
}
- if (node) {
+ if (element) {
/* Activate new element */
- Ttk_ChangeElementState(node, TTK_STATE_ACTIVE,0);
+ Ttk_ChangeElementState(element, TTK_STATE_ACTIVE,0);
}
TtkRedisplayWidget(es->corePtr);
}
- es->activeElement = node;
+ es->activeElement = element;
}
/* ReleaseElement --
@@ -87,18 +87,18 @@ static void ReleaseElement(ElementStateTracker *es)
/* PressElement --
* Presses the specified element.
*/
-static void PressElement(ElementStateTracker *es, Ttk_LayoutNode *node)
+static void PressElement(ElementStateTracker *es, Ttk_Element element)
{
if (es->pressedElement) {
ReleaseElement(es);
}
- if (node) {
+ if (element) {
Ttk_ChangeElementState(
- node, TTK_STATE_PRESSED|TTK_STATE_ACTIVE, 0);
+ element, TTK_STATE_PRESSED|TTK_STATE_ACTIVE, 0);
}
- es->pressedElement = node;
+ es->pressedElement = element;
TtkRedisplayWidget(es->corePtr);
}
@@ -119,14 +119,14 @@ static void
ElementStateEventProc(ClientData clientData, XEvent *ev)
{
ElementStateTracker *es = (ElementStateTracker *)clientData;
- Ttk_LayoutNode *node;
+ Ttk_Element element;
switch (ev->type)
{
case MotionNotify :
- node = Ttk_LayoutIdentify(
+ element = Ttk_IdentifyElement(
es->corePtr->layout,ev->xmotion.x,ev->xmotion.y);
- ActivateElement(es, node);
+ ActivateElement(es, element);
break;
case LeaveNotify:
ActivateElement(es, 0);
@@ -134,15 +134,15 @@ ElementStateEventProc(ClientData clientData, XEvent *ev)
PressElement(es, 0);
break;
case EnterNotify:
- node = Ttk_LayoutIdentify(
+ element = Ttk_IdentifyElement(
es->corePtr->layout,ev->xcrossing.x,ev->xcrossing.y);
- ActivateElement(es, node);
+ ActivateElement(es, element);
break;
case ButtonPress:
- node = Ttk_LayoutIdentify(
+ element = Ttk_IdentifyElement(
es->corePtr->layout, ev->xbutton.x, ev->xbutton.y);
- if (node)
- PressElement(es, node);
+ if (element)
+ PressElement(es, element);
break;
case ButtonRelease:
ReleaseElement(es);
diff --git a/generic/ttk/ttkTreeview.c b/generic/ttk/ttkTreeview.c
index ba4ac4a..0be29fb 100644
--- a/generic/ttk/ttkTreeview.c
+++ b/generic/ttk/ttkTreeview.c
@@ -1,4 +1,4 @@
-/* $Id: ttkTreeview.c,v 1.31 2008/12/27 18:54:56 jenglish Exp $
+/* $Id: ttkTreeview.c,v 1.32 2009/02/08 19:35:35 jenglish Exp $
* Copyright (c) 2004, Joe English
*
* ttk::treeview widget implementation.
@@ -590,7 +590,7 @@ static TreeItem *FindItem(
Tcl_AppendResult(interp, "Item ", itemName, " not found", NULL);
return 0;
}
- return (TreeItem*)Tcl_GetHashValue(entryPtr);
+ return Tcl_GetHashValue(entryPtr);
}
/* + GetItemListFromObj --
@@ -1575,11 +1575,11 @@ static Ttk_Layout TreeviewGetLayout(
&& GetSublayout(interp, themePtr, treeLayout, ".Item",
tv->tree.tagOptionTable, &tv->tree.itemLayout)
&& GetSublayout(interp, themePtr, treeLayout, ".Cell",
- tv->tree.tagOptionTable, &tv->tree.cellLayout) /*@@@HERE*/
+ tv->tree.tagOptionTable, &tv->tree.cellLayout)
&& GetSublayout(interp, themePtr, treeLayout, ".Heading",
tv->tree.headingOptionTable, &tv->tree.headingLayout)
&& GetSublayout(interp, themePtr, treeLayout, ".Row",
- tv->tree.tagOptionTable, &tv->tree.rowLayout) /*@@@HERE*/
+ tv->tree.tagOptionTable, &tv->tree.rowLayout)
)) {
return 0;
}
@@ -1615,15 +1615,12 @@ static Ttk_Layout TreeviewGetLayout(
static void TreeviewDoLayout(void *clientData)
{
Treeview *tv = clientData;
- Ttk_LayoutNode *clientNode = Ttk_LayoutFindNode(tv->core.layout,"treearea");
int visibleRows;
/* ASSERT: SLACKINVARIANT */
Ttk_PlaceLayout(tv->core.layout,tv->core.state,Ttk_WinBox(tv->core.tkwin));
- tv->tree.treeArea = clientNode
- ? Ttk_LayoutNodeInternalParcel(tv->core.layout,clientNode)
- : Ttk_WinBox(tv->core.tkwin) ;
+ tv->tree.treeArea = Ttk_ClientRegion(tv->core.layout, "treearea");
ResizeColumns(tv, tv->tree.treeArea.width);
/* ASSERT: SLACKINVARIANT */
@@ -2219,17 +2216,17 @@ static int TreeviewHorribleIdentify(
Ttk_Layout layout = tv->tree.itemLayout;
Ttk_Box itemBox;
DisplayItem displayItem;
- Ttk_LayoutNode *element;
+ Ttk_Element element;
BoundingBox(tv, item, NULL, &itemBox);
PrepareItem(tv, item, &displayItem); /*@@@ FIX: -text, etc*/
Ttk_RebindSublayout(layout, &displayItem);
Ttk_PlaceLayout(layout, ItemState(tv,item), itemBox);
- element = Ttk_LayoutIdentify(layout, x, y);
+ element = Ttk_IdentifyElement(layout, x, y);
if (element) {
what = "item";
- detail = Ttk_LayoutNodeName(element);
+ detail = Ttk_ElementName(element);
} else {
what = "row";
}
@@ -2314,7 +2311,7 @@ static int TreeviewIdentifyCommand(
{
Ttk_Layout layout = 0;
DisplayItem displayItem;
- Ttk_LayoutNode *element;
+ Ttk_Element element;
switch (region) {
case REGION_NOTHING:
@@ -2339,10 +2336,10 @@ static int TreeviewIdentifyCommand(
PrepareItem(tv, item, &displayItem); /*@@@ FIX: fill in -text,etc */
Ttk_RebindSublayout(layout, &displayItem);
Ttk_PlaceLayout(layout, ItemState(tv,item), bbox);
- element = Ttk_LayoutIdentify(layout, x, y);
+ element = Ttk_IdentifyElement(layout, x, y);
if (element) {
- const char *elementName = Ttk_LayoutNodeName(element);
+ const char *elementName = Ttk_ElementName(element);
Tcl_SetObjResult(interp, Tcl_NewStringObj(elementName, -1));
}
break;
diff --git a/generic/ttk/ttkWidget.c b/generic/ttk/ttkWidget.c
index 820d3d8..a21125f 100644
--- a/generic/ttk/ttkWidget.c
+++ b/generic/ttk/ttkWidget.c
@@ -1,4 +1,4 @@
-/* $Id: ttkWidget.c,v 1.20 2008/12/03 18:44:50 jenglish Exp $
+/* $Id: ttkWidget.c,v 1.21 2009/02/08 19:35:35 jenglish Exp $
* Copyright (c) 2003, Joe English
*
* Core widget utilities.
@@ -775,7 +775,7 @@ int TtkWidgetIdentifyCommand(
Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr)
{
WidgetCore *corePtr = recordPtr;
- Ttk_LayoutNode *node;
+ Ttk_Element element;
int x, y;
if (objc != 4) {
@@ -787,9 +787,9 @@ int TtkWidgetIdentifyCommand(
|| Tcl_GetIntFromObj(interp, objv[3], &y) != TCL_OK)
return TCL_ERROR;
- node = Ttk_LayoutIdentify(corePtr->layout, x, y);
- if (node) {
- const char *elementName = Ttk_LayoutNodeName(node);
+ element = Ttk_IdentifyElement(corePtr->layout, x, y);
+ if (element) {
+ const char *elementName = Ttk_ElementName(element);
Tcl_SetObjResult(interp,Tcl_NewStringObj(elementName,-1));
}