summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tkInt.h2
-rw-r--r--generic/ttk/ttkClamTheme.c16
-rw-r--r--generic/ttk/ttkElements.c15
-rw-r--r--generic/ttk/ttkNotebook.c21
-rw-r--r--win/ttkWinTheme.c15
-rw-r--r--win/ttkWinXPTheme.c15
6 files changed, 65 insertions, 19 deletions
diff --git a/generic/tkInt.h b/generic/tkInt.h
index e31bc1b..0742563 100644
--- a/generic/tkInt.h
+++ b/generic/tkInt.h
@@ -693,6 +693,8 @@ typedef struct TkMainInfo {
/* Saved Tcl [update] command, used to restore
* Tcl's version of [update] after Tk is shut
* down */
+ unsigned int ttkNbTabsStickBit;
+ /* Information used by ttk::notebook. */
} TkMainInfo;
/*
diff --git a/generic/ttk/ttkClamTheme.c b/generic/ttk/ttkClamTheme.c
index 9042770..1081c4b 100644
--- a/generic/ttk/ttkClamTheme.c
+++ b/generic/ttk/ttkClamTheme.c
@@ -850,12 +850,12 @@ static Ttk_ElementOptionSpec NotebookElementOptions[] = {
{ NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
-extern Ttk_PositionSpec nbTabsStickBit; /* see ttkNotebook.c */
-
static void TabElementSize(
void *dummy, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
+ Ttk_PositionSpec nbTabsStickBit = TTK_STICK_S;
+ TkMainInfo *mainInfoPtr = ((TkWindow *) tkwin)->mainPtr;
int borderWidth = 2;
(void)dummy;
(void)elementRecord;
@@ -863,6 +863,10 @@ static void TabElementSize(
(void)widthPtr;
(void)heightPtr;
+ if (mainInfoPtr != NULL) {
+ nbTabsStickBit = (Ttk_PositionSpec) mainInfoPtr->ttkNbTabsStickBit;
+ }
+
*paddingPtr = Ttk_UniformPadding((short)borderWidth);
switch (nbTabsStickBit) {
default:
@@ -885,15 +889,21 @@ static void TabElementDraw(
void *dummy, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned int state)
{
+ Ttk_PositionSpec nbTabsStickBit = TTK_STICK_S;
+ TkMainInfo *mainInfoPtr = ((TkWindow *) tkwin)->mainPtr;
+ int borderWidth = 2, delta = 0;
NotebookElement *tab = (NotebookElement *)elementRecord;
Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, tab->backgroundObj);
Display *display = Tk_Display(tkwin);
- int borderWidth = 2, delta = 0;
int x1, y1, x2, y2;
GC gc;
const int w = WIN32_XDRAWLINE_HACK;
(void)dummy;
+ if (mainInfoPtr != NULL) {
+ nbTabsStickBit = (Ttk_PositionSpec) mainInfoPtr->ttkNbTabsStickBit;
+ }
+
if (state & TTK_STATE_SELECTED) {
delta = borderWidth;
}
diff --git a/generic/ttk/ttkElements.c b/generic/ttk/ttkElements.c
index 61b73ce..2520ced 100644
--- a/generic/ttk/ttkElements.c
+++ b/generic/ttk/ttkElements.c
@@ -1106,17 +1106,22 @@ static Ttk_ElementOptionSpec TabElementOptions[] = {
{0,0,0,0}
};
-extern Ttk_PositionSpec nbTabsStickBit; /* see ttkNotebook.c */
-
static void TabElementSize(
void *clientData, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
TabElement *tab = (TabElement *)elementRecord;
int borderWidth = 1;
+ Ttk_PositionSpec nbTabsStickBit = TTK_STICK_S;
+ TkMainInfo *mainInfoPtr = ((TkWindow *) tkwin)->mainPtr;
Tk_GetPixelsFromObj(0, tkwin, tab->borderWidthObj, &borderWidth);
*paddingPtr = Ttk_UniformPadding((short)borderWidth);
+
+ if (mainInfoPtr != NULL) {
+ nbTabsStickBit = (Ttk_PositionSpec) mainInfoPtr->ttkNbTabsStickBit;
+ }
+
switch (nbTabsStickBit) {
default:
case TTK_STICK_S:
@@ -1138,6 +1143,8 @@ static void TabElementDraw(
void *clientData, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned int state)
{
+ Ttk_PositionSpec nbTabsStickBit = TTK_STICK_S;
+ TkMainInfo *mainInfoPtr = ((TkWindow *) tkwin)->mainPtr;
TabElement *tab = (TabElement *)elementRecord;
Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, tab->backgroundObj);
XPoint pts[6];
@@ -1145,6 +1152,10 @@ static void TabElementDraw(
Display *disp = Tk_Display(tkwin);
int borderWidth = 1;
+ if (mainInfoPtr != NULL) {
+ nbTabsStickBit = (Ttk_PositionSpec) mainInfoPtr->ttkNbTabsStickBit;
+ }
+
if (state & TTK_STATE_SELECTED) {
/*
* Draw slightly outside of the allocated parcel,
diff --git a/generic/ttk/ttkNotebook.c b/generic/ttk/ttkNotebook.c
index 02a5546..600eca9 100644
--- a/generic/ttk/ttkNotebook.c
+++ b/generic/ttk/ttkNotebook.c
@@ -136,14 +136,11 @@ typedef struct
Ttk_Padding padding; /* External padding */
} NotebookStyle;
-/* Global variable to be set from within NotebookStyleOptions() to one
- * of the values TTK_STICK_S, TTK_STICK_N, TTK_STICK_E, or TTK_STICK_W:
- */
-Ttk_PositionSpec nbTabsStickBit;
-
-static void NotebookStyleOptions(Notebook *nb, NotebookStyle *nbstyle)
+static void NotebookStyleOptions(
+ Notebook *nb, NotebookStyle *nbstyle, Tk_Window tkwin)
{
Tcl_Obj *objPtr;
+ TkMainInfo *mainInfoPtr = ((TkWindow *) tkwin)->mainPtr;
nbstyle->tabPosition = TTK_PACK_TOP | TTK_STICK_W;
if ((objPtr = Ttk_QueryOption(nb->core.layout, "-tabposition", 0)) != 0) {
@@ -165,9 +162,12 @@ static void NotebookStyleOptions(Notebook *nb, NotebookStyle *nbstyle)
TtkGetLabelAnchorFromObj(NULL, objPtr, &nbstyle->tabPlacement);
}
- /* Save the stick bit in the global variable nbTabsStickBit
+ /* Save the stick bit for later. One of the values
+ * TTK_STICK_S, TTK_STICK_N, TTK_STICK_E, or TTK_STICK_W:
*/
- nbTabsStickBit = (nbstyle->tabPlacement & 0x0f);
+ if (mainInfoPtr != NULL) {
+ mainInfoPtr->ttkNbTabsStickBit = (nbstyle->tabPlacement & 0x0f);
+ }
/* Compute tabOrient as function of tabPlacement:
*/
@@ -395,6 +395,7 @@ static void TabrowSize(
static int NotebookSize(void *clientData, int *widthPtr, int *heightPtr)
{
Notebook *nb = (Notebook *)clientData;
+ Tk_Window nbwin = nb->core.tkwin;
NotebookStyle nbstyle;
Ttk_Padding padding;
Ttk_Element clientNode = Ttk_FindElement(nb->core.layout, "client");
@@ -403,7 +404,7 @@ static int NotebookSize(void *clientData, int *widthPtr, int *heightPtr)
tabrowWidth = 0, tabrowHeight = 0;
int i;
- NotebookStyleOptions(nb, &nbstyle);
+ NotebookStyleOptions(nb, &nbstyle, nbwin);
/* Compute max requested size of all content windows:
*/
@@ -553,7 +554,7 @@ static void NotebookDoLayout(void *recordPtr)
NotebookStyle nbstyle;
int currentIndex = nb->notebook.currentIndex;
- NotebookStyleOptions(nb, &nbstyle);
+ NotebookStyleOptions(nb, &nbstyle, nbwin);
/* Notebook internal padding:
*/
diff --git a/win/ttkWinTheme.c b/win/ttkWinTheme.c
index 46be6f0..e797206 100644
--- a/win/ttkWinTheme.c
+++ b/win/ttkWinTheme.c
@@ -658,17 +658,22 @@ static const Ttk_ElementOptionSpec TabElementOptions[] = {
{0,TK_OPTION_BOOLEAN,0,0}
};
-extern Ttk_PositionSpec nbTabsStickBit; /* see ttkNotebook.c */
-
static void TabElementSize(
void *clientData, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
TabElement *tab = (TabElement *)elementRecord;
int borderWidth = 1;
+ Ttk_PositionSpec nbTabsStickBit = TTK_STICK_S;
+ TkMainInfo *mainInfoPtr = ((TkWindow *) tkwin)->mainPtr;
Tk_GetPixelsFromObj(0, tkwin, tab->borderWidthObj, &borderWidth);
*paddingPtr = Ttk_UniformPadding((short)borderWidth);
+
+ if (mainInfoPtr != NULL) {
+ nbTabsStickBit = (Ttk_PositionSpec) mainInfoPtr->ttkNbTabsStickBit;
+ }
+
switch (nbTabsStickBit) {
default:
case TTK_STICK_S:
@@ -690,6 +695,8 @@ static void TabElementDraw(
void *clientData, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned int state)
{
+ Ttk_PositionSpec nbTabsStickBit = TTK_STICK_S;
+ TkMainInfo *mainInfoPtr = ((TkWindow *) tkwin)->mainPtr;
TabElement *tab = (TabElement *)elementRecord;
Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, tab->backgroundObj);
XPoint pts[6];
@@ -697,6 +704,10 @@ static void TabElementDraw(
Display *disp = Tk_Display(tkwin);
int borderWidth = 1;
+ if (mainInfoPtr != NULL) {
+ nbTabsStickBit = (Ttk_PositionSpec) mainInfoPtr->ttkNbTabsStickBit;
+ }
+
if (state & TTK_STATE_SELECTED) {
/*
* Draw slightly outside of the allocated parcel,
diff --git a/win/ttkWinXPTheme.c b/win/ttkWinXPTheme.c
index cfa6bf4..3593c9a 100644
--- a/win/ttkWinXPTheme.c
+++ b/win/ttkWinXPTheme.c
@@ -728,12 +728,17 @@ static Ttk_ElementSpec PbarElementSpec =
* we can use the same statemap no matter what the partId.
*/
-extern Ttk_PositionSpec nbTabsStickBit; /* see ttkNotebook.c */
-
static void TabElementSize(
void *clientData, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
+ Ttk_PositionSpec nbTabsStickBit = TTK_STICK_S;
+ TkMainInfo *mainInfoPtr = ((TkWindow *) tkwin)->mainPtr;
+
+ if (mainInfoPtr != NULL) {
+ nbTabsStickBit = (Ttk_PositionSpec) mainInfoPtr->ttkNbTabsStickBit;
+ }
+
GenericElementSize(clientData, elementRecord, tkwin,
widthPtr, heightPtr, paddingPtr);
@@ -759,11 +764,17 @@ static void TabElementDraw(
void *clientData, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned int state)
{
+ Ttk_PositionSpec nbTabsStickBit = TTK_STICK_S;
+ TkMainInfo *mainInfoPtr = ((TkWindow *) tkwin)->mainPtr;
ElementData *elementData = (ElementData *)clientData;
int partId = elementData->info->partId;
int isSelected = (state & TTK_STATE_SELECTED);
int stateId = Ttk_StateTableLookup(elementData->info->statemap, state);
+ if (mainInfoPtr != NULL) {
+ nbTabsStickBit = (Ttk_PositionSpec) mainInfoPtr->ttkNbTabsStickBit;
+ }
+
/*
* Correct the members of b if needed
*/