diff options
author | csaba <csaba> | 2023-11-09 13:37:40 (GMT) |
---|---|---|
committer | csaba <csaba> | 2023-11-09 13:37:40 (GMT) |
commit | e057ae9cc33c7b8c75c853c562b8da55f20529f9 (patch) | |
tree | 65ef6522fc2ba6816e7d8d1a7c6399bd694e4755 /generic | |
parent | 0f9d84dc207433e3ad8b0cd31781441fb4335872 (diff) | |
download | tk-e057ae9cc33c7b8c75c853c562b8da55f20529f9.zip tk-e057ae9cc33c7b8c75c853c562b8da55f20529f9.tar.gz tk-e057ae9cc33c7b8c75c853c562b8da55f20529f9.tar.bz2 |
My previous checkin committed the wrong version of ttkNotebook.c -- corrected.
Diffstat (limited to 'generic')
-rw-r--r-- | generic/ttk/ttkNotebook.c | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/generic/ttk/ttkNotebook.c b/generic/ttk/ttkNotebook.c index c9b63ff..7bb3683 100644 --- a/generic/ttk/ttkNotebook.c +++ b/generic/ttk/ttkNotebook.c @@ -519,6 +519,23 @@ static void PlaceTabs( } } +/* + * NotebookPlaceContent -- + * Set the position and size of a child widget + * based on the current client area and content window options: + */ +static void NotebookPlaceContent(Notebook* nb, Tcl_Size index) +{ + Tab* tab = (Tab*)Ttk_ContentData(nb->notebook.mgr, index); + Tk_Window window = Ttk_ContentWindow(nb->notebook.mgr, index); + Ttk_Box box = + Ttk_StickBox(Ttk_PadBox(nb->notebook.clientArea, tab->padding), + Tk_ReqWidth(window), Tk_ReqHeight(window), tab->sticky); + + Ttk_PlaceContent(nb->notebook.mgr, index, + box.x, box.y, box.width, box.height); +} + /* NotebookDoLayout -- * Computes notebook layout and places tabs. * @@ -534,6 +551,7 @@ static void NotebookDoLayout(void *recordPtr) Ttk_Element clientNode = Ttk_FindElement(nb->core.layout, "client"); Ttk_Box tabrowBox; NotebookStyle nbstyle; + Tcl_Size currentIndex = nb->notebook.currentIndex; NotebookStyleOptions(nb, &nbstyle); @@ -573,24 +591,12 @@ static void NotebookDoLayout(void *recordPtr) if (cavity.height <= 0) cavity.height = 1; if (cavity.width <= 0) cavity.width = 1; - nb->notebook.clientArea = cavity; -} - -/* - * NotebookPlaceContent -- - * Set the position and size of a child widget - * based on the current client area and content window options: - */ -static void NotebookPlaceContent(Notebook *nb, Tcl_Size index) -{ - Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index); - Tk_Window window = Ttk_ContentWindow(nb->notebook.mgr, index); - Ttk_Box box = - Ttk_StickBox(Ttk_PadBox(nb->notebook.clientArea, tab->padding), - Tk_ReqWidth(window), Tk_ReqHeight(window),tab->sticky); - - Ttk_PlaceContent(nb->notebook.mgr, index, - box.x, box.y, box.width, box.height); + if (!TtkBoxEqual(nb->notebook.clientArea, cavity)) { + nb->notebook.clientArea = cavity; + if (currentIndex >= 0) { + NotebookPlaceContent(nb, currentIndex); + } + } } /* NotebookPlaceContents -- |