summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorcsaba <csaba>2023-11-10 20:28:59 (GMT)
committercsaba <csaba>2023-11-10 20:28:59 (GMT)
commit3c2b81f90f8bb785d3f364558c578685d85943fd (patch)
tree79eda50b8057917ae166ab5bc1c1cb377f365df8 /win
parente057ae9cc33c7b8c75c853c562b8da55f20529f9 (diff)
downloadtk-3c2b81f90f8bb785d3f364558c578685d85943fd.zip
tk-3c2b81f90f8bb785d3f364558c578685d85943fd.tar.gz
tk-3c2b81f90f8bb785d3f364558c578685d85943fd.tar.bz2
Extended the man page for ttk::notebook; updated ttkWinTheme.c and ttkWinXPTheme.c.
Diffstat (limited to 'win')
-rw-r--r--win/ttkWinTheme.c19
-rw-r--r--win/ttkWinXPTheme.c66
2 files changed, 30 insertions, 55 deletions
diff --git a/win/ttkWinTheme.c b/win/ttkWinTheme.c
index 0f2f732..0c1c651 100644
--- a/win/ttkWinTheme.c
+++ b/win/ttkWinTheme.c
@@ -786,24 +786,6 @@ static void TabElementDraw(
Display *disp = Tk_Display(tkwin);
int borderWidth = 1;
- /*
- * Correct the members of b if needed.
- */
- switch (nbTabsStickBit) {
- default:
- case TTK_STICK_S:
- break;
- case TTK_STICK_N:
- b.y -= 2;
- break;
- case TTK_STICK_E:
- b.width += 2;
- break;
- case TTK_STICK_W:
- b.x -= 2; b.width +=2;
- break;
- }
-
if (state & TTK_STATE_SELECTED) {
/*
* Draw slightly outside of the allocated parcel,
@@ -821,7 +803,6 @@ static void TabElementDraw(
b.width += 2;
break;
case TTK_STICK_W:
- b.width += 2; b.x -= 2;
break;
}
}
diff --git a/win/ttkWinXPTheme.c b/win/ttkWinXPTheme.c
index 75866ce..03bbc48 100644
--- a/win/ttkWinXPTheme.c
+++ b/win/ttkWinXPTheme.c
@@ -767,6 +767,7 @@ static void TabElementDraw(
{
ElementData *elementData = (ElementData *)clientData;
int partId = elementData->info->partId;
+ int isSelected = (state & TTK_STATE_SELECTED);
int stateId = Ttk_StateTableLookup(elementData->info->statemap, state);
/*
@@ -777,13 +778,13 @@ static void TabElementDraw(
case TTK_STICK_S:
break;
case TTK_STICK_N:
- b.y -= 4;
+ b.y -= isSelected ? 0 : 1; b.height -= isSelected ? 1 : 0;
break;
case TTK_STICK_E:
- b.width += 3;
+ b.width -= isSelected ? 1 : 0;
break;
case TTK_STICK_W:
- b.x -= 5; b.width += 5;
+ b.x -= isSelected ? 3 : 4; b.width += isSelected ? 1 : 2;
break;
}
@@ -792,9 +793,11 @@ static void TabElementDraw(
if (!InitElementData(elementData, tkwin, d))
return;
- if (state & TTK_STATE_USER1)
- partId = TABP_TABITEMLEFTEDGE;
if (nbTabsStickBit == TTK_STICK_S) {
+ if (state & TTK_STATE_USER1) {
+ partId = TABP_TABITEMLEFTEDGE;
+ }
+
/*
* Draw the border and fill into rc
*/
@@ -810,37 +813,28 @@ static void TabElementDraw(
elementData->hTheme, elementData->hDC, partId, stateId, &rc2, &rc);
}
- if (state & TTK_STATE_SELECTED) {
- /*
- * Draw a flat border at 3 edges
- */
- switch (nbTabsStickBit) {
- default:
- case TTK_STICK_S:
- break;
- case TTK_STICK_N:
- elementData->procs->DrawThemeEdge(
- elementData->hTheme, elementData->hDC, partId, stateId, &rc,
- BDR_RAISEDINNER, BF_FLAT|BF_LEFT|BF_RIGHT|BF_BOTTOM, NULL);
- break;
- case TTK_STICK_E:
- elementData->procs->DrawThemeEdge(
- elementData->hTheme, elementData->hDC, partId, stateId, &rc,
- BDR_RAISEDINNER, BF_FLAT|BF_LEFT|BF_TOP|BF_BOTTOM, NULL);
- break;
- case TTK_STICK_W:
- elementData->procs->DrawThemeEdge(
- elementData->hTheme, elementData->hDC, partId, stateId, &rc,
- BDR_RAISEDINNER, BF_FLAT|BF_TOP|BF_RIGHT|BF_BOTTOM, NULL);
- break;
- }
- } else if (nbTabsStickBit != TTK_STICK_S) {
- /*
- * Draw a flat border at all 4 edges
- */
- elementData->procs->DrawThemeEdge(
- elementData->hTheme, elementData->hDC, partId, stateId, &rc,
- BDR_RAISEDINNER, BF_FLAT|BF_RECT, NULL);
+ /*
+ * Draw a flat border at 3 edges
+ */
+ switch (nbTabsStickBit) {
+ default:
+ case TTK_STICK_S:
+ break;
+ case TTK_STICK_N:
+ elementData->procs->DrawThemeEdge(
+ elementData->hTheme, elementData->hDC, partId, stateId, &rc,
+ BDR_RAISEDINNER, BF_FLAT|BF_LEFT|BF_RIGHT|BF_BOTTOM, NULL);
+ break;
+ case TTK_STICK_E:
+ elementData->procs->DrawThemeEdge(
+ elementData->hTheme, elementData->hDC, partId, stateId, &rc,
+ BDR_RAISEDINNER, BF_FLAT|BF_LEFT|BF_TOP|BF_BOTTOM, NULL);
+ break;
+ case TTK_STICK_W:
+ elementData->procs->DrawThemeEdge(
+ elementData->hTheme, elementData->hDC, partId, stateId, &rc,
+ BDR_RAISEDINNER, BF_FLAT|BF_TOP|BF_RIGHT|BF_BOTTOM, NULL);
+ break;
}
FreeElementData(elementData);