diff options
author | pspjuth <peter.spjuth@gmail.com> | 2022-01-17 23:52:11 (GMT) |
---|---|---|
committer | pspjuth <peter.spjuth@gmail.com> | 2022-01-17 23:52:11 (GMT) |
commit | e4b52ee8e3ccec179ea60cb899204070f05b1eb0 (patch) | |
tree | aeb117e38bb7133f15bf1dbd4b7110eecd61671a | |
parent | 10f0ce7168a2e07a07e355f302470e22d856cfa2 (diff) | |
download | tk-e4b52ee8e3ccec179ea60cb899204070f05b1eb0.zip tk-e4b52ee8e3ccec179ea60cb899204070f05b1eb0.tar.gz tk-e4b52ee8e3ccec179ea60cb899204070f05b1eb0.tar.bz2 |
Use TCL_INDEX_NONE in new code. Like [1c6ef075]
-rw-r--r-- | generic/ttk/ttkTreeview.c | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/generic/ttk/ttkTreeview.c b/generic/ttk/ttkTreeview.c index e8fdec1..2e7158c 100644 --- a/generic/ttk/ttkTreeview.c +++ b/generic/ttk/ttkTreeview.c @@ -80,10 +80,10 @@ static const Tk_OptionSpec ItemOptionSpecs[] = { "", offsetof(TreeItem,textObj), TCL_INDEX_NONE, 0,0,0 }, {TK_OPTION_INT, "-height", "height", "Height", - "1", -1, offsetof(TreeItem,height), + "1", TCL_INDEX_NONE, offsetof(TreeItem,height), 0,0,0 }, {TK_OPTION_BOOLEAN, "-hidden", "hidden", "Hidden", - "0", -1, offsetof(TreeItem,hidden), + "0", TCL_INDEX_NONE, offsetof(TreeItem,hidden), 0,0,0 }, {TK_OPTION_STRING, "-image", "image", "Image", NULL, offsetof(TreeItem,imageObj), TCL_INDEX_NONE, @@ -118,7 +118,7 @@ static TreeItem *NewItem(void) item->entryPtr = 0; item->parent = item->children = item->next = item->prev = NULL; - item->state = 0ul; + item->state = 0ul; item->textObj = NULL; item->imageObj = NULL; item->valuesObj = NULL; @@ -521,7 +521,7 @@ static const Tk_OptionSpec TreeviewOptionSpecs[] = { "extended", offsetof(Treeview,tree.selectModeObj), TCL_INDEX_NONE, 0, (void *)SelectModeStrings, 0 }, {TK_OPTION_STRING_TABLE, "-selecttype", "selectType", "SelectType", - "item", offsetof(Treeview,tree.selectTypeObj), -1, + "item", offsetof(Treeview,tree.selectTypeObj), TCL_INDEX_NONE, 0,(ClientData)SelectTypeStrings,0 }, {TK_OPTION_PIXELS, "-height", "height", "Height", @@ -531,13 +531,13 @@ static const Tk_OptionSpec TreeviewOptionSpecs[] = { NULL, offsetof(Treeview,tree.paddingObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_INT, "-titlecolumns", "titlecolumns", "Titlecolumns", - DEF_TITLECOLUMNS, -1, offsetof(Treeview,tree.nTitleColumns), + DEF_TITLECOLUMNS, TCL_INDEX_NONE, offsetof(Treeview,tree.nTitleColumns), 0,0,GEOMETRY_CHANGED}, {TK_OPTION_INT, "-titleitems", "titleitems", "Titleitems", - DEF_TITLEITEMS, -1, offsetof(Treeview,tree.nTitleItems), + DEF_TITLEITEMS, TCL_INDEX_NONE, offsetof(Treeview,tree.nTitleItems), 0,0,GEOMETRY_CHANGED}, {TK_OPTION_BOOLEAN, "-striped", "striped", "Striped", - DEF_STRIPED, -1, offsetof(Treeview,tree.striped), + DEF_STRIPED, TCL_INDEX_NONE, offsetof(Treeview,tree.striped), 0,0,GEOMETRY_CHANGED}, {TK_OPTION_STRING, "-xscrollcommand", "xScrollCommand", "ScrollCommand", @@ -566,17 +566,20 @@ static void foreachHashEntry(Tcl_HashTable *ht, HashEntryIterator func) } } -static void CellSelectionClear(Treeview *tv) +static void CellSelectionClearCB(void *clientData) { - TreeItem *item; - for (item = tv->tree.root; item; item = NextPreorder(item)) { - if (item->selObj != NULL) { - Tcl_DecrRefCount(item->selObj); - item->selObj = NULL; - } + TreeItem *item = (TreeItem *) clientData; + if (item->selObj != NULL) { + Tcl_DecrRefCount(item->selObj); + item->selObj = NULL; } } +static void CellSelectionClear(Treeview *tv) +{ + foreachHashEntry(&tv->tree.items, CellSelectionClearCB); +} + /* + unshareObj(objPtr) -- * Ensure that a Tcl_Obj * has refcount 1 -- either return objPtr * itself, or a duplicated copy. @@ -2188,7 +2191,7 @@ static void DrawCells( * Draw an item (row background, tree label, and cells). */ static void DrawItem( - Treeview *tv, TreeItem *item, Drawable d, int depth) + Treeview *tv, TreeItem *item, Drawable d, int depth) { Ttk_Style style = Ttk_LayoutStyle(tv->core.layout); Ttk_State state = ItemState(tv, item); |