From 0f9d84dc207433e3ad8b0cd31781441fb4335872 Mon Sep 17 00:00:00 2001 From: csaba Date: Thu, 9 Nov 2023 12:42:45 +0000 Subject: A few more adjustments, mainly for the Windows themes. --- generic/ttk/ttkNotebook.c | 48 +++++++++++++++++++++-------------------------- win/ttkWinTheme.c | 6 +++--- win/ttkWinXPTheme.c | 6 +++--- 3 files changed, 27 insertions(+), 33 deletions(-) diff --git a/generic/ttk/ttkNotebook.c b/generic/ttk/ttkNotebook.c index 8417820..c9b63ff 100644 --- a/generic/ttk/ttkNotebook.c +++ b/generic/ttk/ttkNotebook.c @@ -519,23 +519,6 @@ 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. * @@ -551,7 +534,6 @@ 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); @@ -591,12 +573,24 @@ static void NotebookDoLayout(void *recordPtr) if (cavity.height <= 0) cavity.height = 1; if (cavity.width <= 0) cavity.width = 1; - if (!TtkBoxEqual(nb->notebook.clientArea, cavity)) { - nb->notebook.clientArea = cavity; - if (currentIndex >= 0) { - NotebookPlaceContent(nb, currentIndex); - } - } + 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); } /* NotebookPlaceContents -- @@ -1424,9 +1418,9 @@ TTK_END_LAYOUT TTK_BEGIN_LAYOUT(TabLayout) TTK_GROUP("Notebook.tab", TTK_FILL_BOTH, - TTK_GROUP("Notebook.padding", TTK_FILL_BOTH, - TTK_GROUP("Notebook.focus", TTK_FILL_BOTH, - TTK_NODE("Notebook.label", TTK_FILL_BOTH)))) + TTK_GROUP("Notebook.padding", TTK_PACK_TOP|TTK_FILL_BOTH, + TTK_GROUP("Notebook.focus", TTK_PACK_TOP|TTK_FILL_BOTH, + TTK_NODE("Notebook.label", TTK_PACK_TOP)))) TTK_END_LAYOUT /*------------------------------------------------------------------------ diff --git a/win/ttkWinTheme.c b/win/ttkWinTheme.c index 8def5e1..0f2f732 100644 --- a/win/ttkWinTheme.c +++ b/win/ttkWinTheme.c @@ -787,7 +787,7 @@ static void TabElementDraw( int borderWidth = 1; /* - * Correct the coordinates of b if needed. + * Correct the members of b if needed. */ switch (nbTabsStickBit) { default: @@ -797,10 +797,10 @@ static void TabElementDraw( b.y -= 2; break; case TTK_STICK_E: - b.x += 2; + b.width += 2; break; case TTK_STICK_W: - b.x -= 2; + b.x -= 2; b.width +=2; break; } diff --git a/win/ttkWinXPTheme.c b/win/ttkWinXPTheme.c index 14f62bf..75866ce 100644 --- a/win/ttkWinXPTheme.c +++ b/win/ttkWinXPTheme.c @@ -770,7 +770,7 @@ static void TabElementDraw( int stateId = Ttk_StateTableLookup(elementData->info->statemap, state); /* - * Correct the coordinates of b if needed + * Correct the members of b if needed */ switch (nbTabsStickBit) { default: @@ -780,10 +780,10 @@ static void TabElementDraw( b.y -= 4; break; case TTK_STICK_E: - b.x += 3; + b.width += 3; break; case TTK_STICK_W: - b.x -= 5; + b.x -= 5; b.width += 5; break; } -- cgit v0.12