summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjenglish <jenglish@flightlab.com>2007-11-19 01:49:06 (GMT)
committerjenglish <jenglish@flightlab.com>2007-11-19 01:49:06 (GMT)
commit71bbd202de89a16773415860b57412a343fbb6f1 (patch)
tree27a7b6807b173726a57b78fdb076795bad391812
parentaa5ebe3414405d7b4ad1a8271f395866e8a65f79 (diff)
downloadtk-71bbd202de89a16773415860b57412a343fbb6f1.zip
tk-71bbd202de89a16773415860b57412a343fbb6f1.tar.gz
tk-71bbd202de89a16773415860b57412a343fbb6f1.tar.bz2
* generic/ttk/ttkElements.c, macosx/ttkMacOSXTheme.c:
Add "fill" element: like "background" but only erases parcel. * generic/ttk/ttkFrame.c: Use fill element in Labelframe Label sublayout. Also improved default labelmargins for -labelanchor w*, e*. * generic/ttk/ttkLabel.c: no longer need Labelframe hack. * library/ttk/aquaTheme.tcl: ImageTextElement no longer needed. TextElement no longer needs '-background' option.
-rw-r--r--ChangeLog13
-rw-r--r--generic/ttk/ttkElements.c156
-rw-r--r--generic/ttk/ttkFrame.c15
-rw-r--r--generic/ttk/ttkLabel.c72
-rw-r--r--library/ttk/aquaTheme.tcl8
-rw-r--r--macosx/ttkMacOSXTheme.c52
6 files changed, 134 insertions, 182 deletions
diff --git a/ChangeLog b/ChangeLog
index f87091b..9d815d4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
2007-11-18 Joe English <jenglish@users.sourceforge.net>
+ * generic/ttk/ttkElements.c, macosx/ttkMacOSXTheme.c:
+ Add "fill" element: like "background" but only erases parcel.
+
+ * generic/ttk/ttkFrame.c: Use fill element in Labelframe Label
+ sublayout. Also improved default labelmargins for -labelanchor w*, e*.
+
+ * generic/ttk/ttkLabel.c: no longer need Labelframe hack.
+
+ * library/ttk/aquaTheme.tcl: ImageTextElement no longer needed.
+ TextElement no longer needs '-background' option.
+
+2007-11-18 Joe English <jenglish@users.sourceforge.net>
+
* generic/ttk/ttkFrame.c: Use sublayout for ttk::labelframe labels
instead of single element.
diff --git a/generic/ttk/ttkElements.c b/generic/ttk/ttkElements.c
index 0c5ea72..09a37b3 100644
--- a/generic/ttk/ttkElements.c
+++ b/generic/ttk/ttkElements.c
@@ -1,4 +1,4 @@
-/* $Id: ttkElements.c,v 1.8 2007/11/08 01:40:25 jenglish Exp $
+/* $Id: ttkElements.c,v 1.9 2007/11/19 01:49:06 jenglish Exp $
*
* Copyright (c) 2003, Joe English
*
@@ -38,8 +38,7 @@ TtkNullElementDraw(
{
}
-/* public */ Ttk_ElementSpec ttkNullElementSpec =
-{
+/* public */ Ttk_ElementSpec ttkNullElementSpec = {
TK_STYLE_VERSION_2,
sizeof(NullElement),
TtkNullElementOptions,
@@ -48,10 +47,10 @@ TtkNullElementDraw(
};
/*----------------------------------------------------------------------
- * +++ Background element.
+ * +++ Background and fill elements.
*
- * This element simply clears the entire widget area
- * with the background color. (NB: ignores parcel).
+ * The fill element fills its parcel with the background color.
+ * The background element ignores the parcel, and fills the entire window.
*
* Ttk_GetLayout() automatically includes a background element.
*/
@@ -60,20 +59,13 @@ typedef struct {
Tcl_Obj *backgroundObj;
} BackgroundElement;
-static Ttk_ElementOptionSpec BackgroundElementOptions[] =
-{
+static Ttk_ElementOptionSpec BackgroundElementOptions[] = {
{ "-background", TK_OPTION_BORDER,
Tk_Offset(BackgroundElement,backgroundObj), DEFAULT_BACKGROUND },
{NULL}
};
-static void BackgroundElementSize(
- void *clientData, void *elementRecord, Tk_Window tkwin,
- int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
-{
-}
-
-static void BackgroundElementDraw(
+static void FillElementDraw(
void *clientData, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned int state)
{
@@ -82,15 +74,31 @@ static void BackgroundElementDraw(
XFillRectangle(Tk_Display(tkwin), d,
Tk_3DBorderGC(tkwin, backgroundPtr, TK_3D_FLAT_GC),
- 0,0, Tk_Width(tkwin), Tk_Height(tkwin));
+ b.x, b.y, b.width, b.height);
}
-static Ttk_ElementSpec BackgroundElementSpec =
+static void BackgroundElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
{
+ FillElementDraw(
+ clientData, elementRecord, tkwin,
+ d, Ttk_WinBox(tkwin), state);
+}
+
+static Ttk_ElementSpec FillElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(BackgroundElement),
+ BackgroundElementOptions,
+ TtkNullElementSize,
+ FillElementDraw
+};
+
+static Ttk_ElementSpec BackgroundElementSpec = {
TK_STYLE_VERSION_2,
sizeof(BackgroundElement),
BackgroundElementOptions,
- BackgroundElementSize,
+ TtkNullElementSize,
BackgroundElementDraw
};
@@ -104,8 +112,7 @@ typedef struct {
Tcl_Obj *reliefObj;
} BorderElement;
-static Ttk_ElementOptionSpec BorderElementOptions[] =
-{
+static Ttk_ElementOptionSpec BorderElementOptions[] = {
{ "-background", TK_OPTION_BORDER,
Tk_Offset(BorderElement,borderObj), DEFAULT_BACKGROUND },
{ "-borderwidth", TK_OPTION_PIXELS,
@@ -143,8 +150,7 @@ static void BorderElementDraw(
}
}
-static Ttk_ElementSpec BorderElementSpec =
-{
+static Ttk_ElementSpec BorderElementSpec = {
TK_STYLE_VERSION_2,
sizeof(BorderElement),
BorderElementOptions,
@@ -192,8 +198,7 @@ static void FieldElementDraw(
b.x, b.y, b.width, b.height, borderWidth, TK_RELIEF_SUNKEN);
}
-static Ttk_ElementSpec FieldElementSpec =
-{
+static Ttk_ElementSpec FieldElementSpec = {
TK_STYLE_VERSION_2,
sizeof(FieldElement),
FieldElementOptions,
@@ -218,8 +223,7 @@ typedef struct {
Tcl_Obj *shiftreliefObj;
} PaddingElement;
-static Ttk_ElementOptionSpec PaddingElementOptions[] =
-{
+static Ttk_ElementOptionSpec PaddingElementOptions[] = {
{ "-padding", TK_OPTION_STRING,
Tk_Offset(PaddingElement,paddingObj), "0" },
{ "-relief", TK_OPTION_RELIEF,
@@ -244,20 +248,12 @@ static void PaddingElementSize(
*paddingPtr = Ttk_RelievePadding(pad, relief, shiftRelief);
}
-static void PaddingElementDraw(
- void *clientData, void *elementRecord, Tk_Window tkwin,
- Drawable d, Ttk_Box b, unsigned int state)
-{
- /* No-op */
-}
-
-static Ttk_ElementSpec PaddingElementSpec =
-{
+static Ttk_ElementSpec PaddingElementSpec = {
TK_STYLE_VERSION_2,
sizeof(PaddingElement),
PaddingElementOptions,
PaddingElementSize,
- PaddingElementDraw
+ TtkNullElementDraw
};
/*----------------------------------------------------------------------
@@ -325,8 +321,7 @@ static void FocusElementDraw(
}
}
-static Ttk_ElementSpec FocusElementSpec =
-{
+static Ttk_ElementSpec FocusElementSpec = {
TK_STYLE_VERSION_2,
sizeof(FocusElement),
FocusElementOptions,
@@ -341,14 +336,12 @@ static Ttk_ElementSpec FocusElementSpec =
* the general separator checks the "-orient" option.
*/
-typedef struct
-{
+typedef struct {
Tcl_Obj *orientObj;
Tcl_Obj *borderObj;
} SeparatorElement;
-static Ttk_ElementOptionSpec SeparatorElementOptions[] =
-{
+static Ttk_ElementOptionSpec SeparatorElementOptions[] = {
{ "-orient", TK_OPTION_ANY,
Tk_Offset(SeparatorElement, orientObj), "horizontal" },
{ "-background", TK_OPTION_BORDER,
@@ -408,8 +401,7 @@ static void GeneralSeparatorElementDraw(
}
}
-static Ttk_ElementSpec HorizontalSeparatorElementSpec =
-{
+static Ttk_ElementSpec HorizontalSeparatorElementSpec = {
TK_STYLE_VERSION_2,
sizeof(SeparatorElement),
SeparatorElementOptions,
@@ -417,8 +409,7 @@ static Ttk_ElementSpec HorizontalSeparatorElementSpec =
HorizontalSeparatorElementDraw
};
-static Ttk_ElementSpec VerticalSeparatorElementSpec =
-{
+static Ttk_ElementSpec VerticalSeparatorElementSpec = {
TK_STYLE_VERSION_2,
sizeof(SeparatorElement),
SeparatorElementOptions,
@@ -426,8 +417,7 @@ static Ttk_ElementSpec VerticalSeparatorElementSpec =
HorizontalSeparatorElementDraw
};
-static Ttk_ElementSpec SeparatorElementSpec =
-{
+static Ttk_ElementSpec SeparatorElementSpec = {
TK_STYLE_VERSION_2,
sizeof(SeparatorElement),
SeparatorElementOptions,
@@ -439,8 +429,7 @@ static Ttk_ElementSpec SeparatorElementSpec =
* +++ Sizegrip: lower-right corner grip handle for resizing window.
*/
-typedef struct
-{
+typedef struct {
Tcl_Obj *backgroundObj;
} SizegripElement;
@@ -496,8 +485,7 @@ static Ttk_ElementSpec SizegripElementSpec = {
* style; use "altTheme" for the newer, nicer version.
*/
-typedef struct
-{
+typedef struct {
Tcl_Obj *backgroundObj;
Tcl_Obj *reliefObj;
Tcl_Obj *colorObj;
@@ -506,8 +494,7 @@ typedef struct
Tcl_Obj *borderWidthObj;
} IndicatorElement;
-static Ttk_ElementOptionSpec IndicatorElementOptions[] =
-{
+static Ttk_ElementOptionSpec IndicatorElementOptions[] = {
{ "-background", TK_OPTION_BORDER,
Tk_Offset(IndicatorElement,backgroundObj), DEFAULT_BACKGROUND },
{ "-indicatorcolor", TK_OPTION_BORDER,
@@ -617,8 +604,7 @@ static void DiamondIndicatorElementDraw(
Tk_Draw3DPolygon(tkwin,d,border,points,4,borderWidth,relief);
}
-static Ttk_ElementSpec CheckbuttonIndicatorElementSpec =
-{
+static Ttk_ElementSpec CheckbuttonIndicatorElementSpec = {
TK_STYLE_VERSION_2,
sizeof(IndicatorElement),
IndicatorElementOptions,
@@ -626,8 +612,7 @@ static Ttk_ElementSpec CheckbuttonIndicatorElementSpec =
SquareIndicatorElementDraw
};
-static Ttk_ElementSpec RadiobuttonIndicatorElementSpec =
-{
+static Ttk_ElementSpec RadiobuttonIndicatorElementSpec = {
TK_STYLE_VERSION_2,
sizeof(IndicatorElement),
IndicatorElementOptions,
@@ -655,8 +640,7 @@ typedef struct {
Tcl_Obj *marginObj;
} MenuIndicatorElement;
-static Ttk_ElementOptionSpec MenuIndicatorElementOptions[] =
-{
+static Ttk_ElementOptionSpec MenuIndicatorElementOptions[] = {
{ "-background", TK_OPTION_BORDER,
Tk_Offset(MenuIndicatorElement,backgroundObj), DEFAULT_BACKGROUND },
{ "-indicatorwidth", TK_OPTION_PIXELS,
@@ -701,8 +685,7 @@ static void MenuIndicatorElementDraw(
borderWidth, TK_RELIEF_RAISED);
}
-static Ttk_ElementSpec MenuIndicatorElementSpec =
-{
+static Ttk_ElementSpec MenuIndicatorElementSpec = {
TK_STYLE_VERSION_2,
sizeof(MenuIndicatorElement),
MenuIndicatorElementOptions,
@@ -718,8 +701,7 @@ static Ttk_ElementSpec MenuIndicatorElementSpec =
*/
static int ArrowElements[] = { ARROW_UP, ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT };
-typedef struct
-{
+typedef struct {
Tcl_Obj *borderObj;
Tcl_Obj *borderWidthObj;
Tcl_Obj *reliefObj;
@@ -727,8 +709,7 @@ typedef struct
Tcl_Obj *colorObj;
} ArrowElement;
-static Ttk_ElementOptionSpec ArrowElementOptions[] =
-{
+static Ttk_ElementOptionSpec ArrowElementOptions[] = {
{ "-background", TK_OPTION_BORDER,
Tk_Offset(ArrowElement,borderObj), DEFAULT_BACKGROUND },
{ "-relief",TK_OPTION_RELIEF,
@@ -779,8 +760,7 @@ static void ArrowElementDraw(
Ttk_PadBox(b, ArrowMargins), direction);
}
-static Ttk_ElementSpec ArrowElementSpec =
-{
+static Ttk_ElementSpec ArrowElementSpec = {
TK_STYLE_VERSION_2,
sizeof(ArrowElement),
ArrowElementOptions,
@@ -794,15 +774,13 @@ static Ttk_ElementSpec ArrowElementSpec =
* Used in scrollbars and scales in place of "border".
*/
-typedef struct
-{
+typedef struct {
Tcl_Obj *colorObj;
Tcl_Obj *borderWidthObj;
Tcl_Obj *reliefObj;
} TroughElement;
-static Ttk_ElementOptionSpec TroughElementOptions[] =
-{
+static Ttk_ElementOptionSpec TroughElementOptions[] = {
{ "-borderwidth", TK_OPTION_PIXELS,
Tk_Offset(TroughElement,borderWidthObj), DEFAULT_BORDERWIDTH },
{ "-troughcolor", TK_OPTION_BORDER,
@@ -839,8 +817,7 @@ static void TroughElementDraw(
borderWidth, relief);
}
-static Ttk_ElementSpec TroughElementSpec =
-{
+static Ttk_ElementSpec TroughElementSpec = {
TK_STYLE_VERSION_2,
sizeof(TroughElement),
TroughElementOptions,
@@ -855,8 +832,7 @@ static Ttk_ElementSpec TroughElementSpec =
* Used in scrollbars.
*/
-typedef struct
-{
+typedef struct {
Tcl_Obj *orientObj;
Tcl_Obj *thicknessObj;
Tcl_Obj *reliefObj;
@@ -864,8 +840,7 @@ typedef struct
Tcl_Obj *borderWidthObj;
} ThumbElement;
-static Ttk_ElementOptionSpec ThumbElementOptions[] =
-{
+static Ttk_ElementOptionSpec ThumbElementOptions[] = {
{ "-orient", TK_OPTION_ANY,
Tk_Offset(ThumbElement, orientObj), "horizontal" },
{ "-width", TK_OPTION_PIXELS,
@@ -912,8 +887,7 @@ static void ThumbElementDraw(
borderWidth, relief);
}
-static Ttk_ElementSpec ThumbElementSpec =
-{
+static Ttk_ElementSpec ThumbElementSpec = {
TK_STYLE_VERSION_2,
sizeof(ThumbElement),
ThumbElementOptions,
@@ -928,8 +902,7 @@ static Ttk_ElementSpec ThumbElementSpec =
* This is the moving part of the scale widget. Drawn as a raised box.
*/
-typedef struct
-{
+typedef struct {
Tcl_Obj *orientObj; /* orientation of overall slider */
Tcl_Obj *lengthObj; /* slider length */
Tcl_Obj *thicknessObj; /* slider thickness */
@@ -938,8 +911,7 @@ typedef struct
Tcl_Obj *borderWidthObj; /* the size of the border */
} SliderElement;
-static Ttk_ElementOptionSpec SliderElementOptions[] =
-{
+static Ttk_ElementOptionSpec SliderElementOptions[] = {
{ "-sliderlength", TK_OPTION_PIXELS, Tk_Offset(SliderElement,lengthObj),
"30" },
{ "-sliderthickness",TK_OPTION_PIXELS,Tk_Offset(SliderElement,thicknessObj),
@@ -1021,8 +993,7 @@ static void SliderElementDraw(
}
}
-static Ttk_ElementSpec SliderElementSpec =
-{
+static Ttk_ElementSpec SliderElementSpec = {
TK_STYLE_VERSION_2,
sizeof(SliderElement),
SliderElementOptions,
@@ -1042,8 +1013,7 @@ static Ttk_ElementSpec SliderElementSpec =
#define DEFAULT_PBAR_THICKNESS "15"
#define DEFAULT_PBAR_LENGTH "30"
-typedef struct
-{
+typedef struct {
Tcl_Obj *orientObj; /* widget orientation */
Tcl_Obj *thicknessObj; /* the height/width of the bar */
Tcl_Obj *lengthObj; /* default width/height of the bar */
@@ -1052,8 +1022,7 @@ typedef struct
Tcl_Obj *borderWidthObj; /* thickness of the border */
} PbarElement;
-static Ttk_ElementOptionSpec PbarElementOptions[] =
-{
+static Ttk_ElementOptionSpec PbarElementOptions[] = {
{ "-orient", TK_OPTION_ANY, Tk_Offset(PbarElement,orientObj),
"horizontal" },
{ "-thickness", TK_OPTION_PIXELS, Tk_Offset(PbarElement,thicknessObj),
@@ -1197,8 +1166,7 @@ static void TabElementDraw(
}
-static Ttk_ElementSpec TabElementSpec =
-{
+static Ttk_ElementSpec TabElementSpec = {
TK_STYLE_VERSION_2,
sizeof(TabElement),
TabElementOptions,
@@ -1237,8 +1205,7 @@ static void ClientElementSize(
*paddingPtr = Ttk_UniformPadding((short)borderWidth);
}
-static Ttk_ElementSpec ClientElementSpec =
-{
+static Ttk_ElementSpec ClientElementSpec = {
TK_STYLE_VERSION_2,
sizeof(ClientElement),
ClientElementOptions,
@@ -1262,6 +1229,7 @@ void TtkElements_Init(Tcl_Interp *interp)
Ttk_RegisterElement(interp, theme, "background",
&BackgroundElementSpec,NULL);
+ Ttk_RegisterElement(interp, theme, "fill", &FillElementSpec, NULL);
Ttk_RegisterElement(interp, theme, "border", &BorderElementSpec, NULL);
Ttk_RegisterElement(interp, theme, "field", &FieldElementSpec, NULL);
Ttk_RegisterElement(interp, theme, "focus", &FocusElementSpec, NULL);
diff --git a/generic/ttk/ttkFrame.c b/generic/ttk/ttkFrame.c
index 700288f..58a114f 100644
--- a/generic/ttk/ttkFrame.c
+++ b/generic/ttk/ttkFrame.c
@@ -1,4 +1,4 @@
-/* $Id: ttkFrame.c,v 1.8 2007/11/18 19:20:25 jenglish Exp $
+/* $Id: ttkFrame.c,v 1.9 2007/11/19 01:49:07 jenglish Exp $
* Copyright (c) 2004, Joe English
*
* ttk::frame and ttk::labelframe widgets.
@@ -288,8 +288,6 @@ static void LabelframeStyleOptions(Labelframe *lf, LabelframeStyle *style)
style->borderWidth = DEFAULT_BORDERWIDTH;
style->padding = Ttk_UniformPadding(0);
style->labelAnchor = TTK_PACK_TOP | TTK_STICK_W;
- style->labelMargins =
- Ttk_MakePadding(DEFAULT_LABELINSET,0,DEFAULT_LABELINSET,0);
style->labelOutside = 0;
if ((objPtr = Ttk_QueryOption(layout, "-borderwidth", 0)) != NULL) {
@@ -303,6 +301,14 @@ static void LabelframeStyleOptions(Labelframe *lf, LabelframeStyle *style)
}
if ((objPtr = Ttk_QueryOption(layout,"-labelmargins", 0)) != NULL) {
Ttk_GetBorderFromObj(NULL, objPtr, &style->labelMargins);
+ } else {
+ if (style->labelAnchor & (TTK_PACK_TOP|TTK_PACK_BOTTOM)) {
+ style->labelMargins =
+ Ttk_MakePadding(DEFAULT_LABELINSET,0,DEFAULT_LABELINSET,0);
+ } else {
+ style->labelMargins =
+ Ttk_MakePadding(0,DEFAULT_LABELINSET,0,DEFAULT_LABELINSET);
+ }
}
if ((objPtr = Ttk_QueryOption(layout,"-labeloutside", 0)) != NULL) {
Tcl_GetBooleanFromObj(NULL, objPtr, &style->labelOutside);
@@ -615,7 +621,8 @@ TTK_BEGIN_LAYOUT(LabelframeLayout)
TTK_END_LAYOUT
TTK_BEGIN_LAYOUT(LabelSublayout)
- TTK_NODE("Labelframe.text", TTK_FILL_BOTH)
+ TTK_GROUP("Label.fill", TTK_FILL_BOTH,
+ TTK_NODE("Label.text", TTK_FILL_BOTH))
TTK_END_LAYOUT
/* ======================================================================
diff --git a/generic/ttk/ttkLabel.c b/generic/ttk/ttkLabel.c
index 18c4f99..1b92c5f 100644
--- a/generic/ttk/ttkLabel.c
+++ b/generic/ttk/ttkLabel.c
@@ -1,4 +1,4 @@
-/* $Id: ttkLabel.c,v 1.9 2007/11/18 19:20:26 jenglish Exp $
+/* $Id: ttkLabel.c,v 1.10 2007/11/19 01:49:07 jenglish Exp $
*
* text, image, and label elements.
*
@@ -11,8 +11,7 @@
#include <tk.h>
#include "ttkTheme.h"
-/*
- *----------------------------------------------------------------------
+/*----------------------------------------------------------------------
* +++ Text element.
*
* This element displays a textual label in the foreground color.
@@ -21,15 +20,13 @@
* is present and >= 0.
*/
-typedef struct
-{
+typedef struct {
/*
* Element options:
*/
Tcl_Obj *textObj;
Tcl_Obj *fontObj;
Tcl_Obj *foregroundObj;
- Tcl_Obj *backgroundObj;
Tcl_Obj *underlineObj;
Tcl_Obj *widthObj;
Tcl_Obj *anchorObj;
@@ -51,16 +48,13 @@ typedef struct
/* Text element options table.
* NB: Keep in sync with label element option table.
*/
-static Ttk_ElementOptionSpec TextElementOptions[] =
-{
+static Ttk_ElementOptionSpec TextElementOptions[] = {
{ "-text", TK_OPTION_STRING,
Tk_Offset(TextElement,textObj), "" },
{ "-font", TK_OPTION_FONT,
Tk_Offset(TextElement,fontObj), DEFAULT_FONT },
{ "-foreground", TK_OPTION_COLOR,
Tk_Offset(TextElement,foregroundObj), "black" },
- { "-background", TK_OPTION_BORDER,
- Tk_Offset(TextElement,backgroundObj), DEFAULT_BACKGROUND },
{ "-underline", TK_OPTION_INT,
Tk_Offset(TextElement,underlineObj), "-1"},
{ "-width", TK_OPTION_INT,
@@ -209,8 +203,7 @@ static void TextElementDraw(
}
}
-static Ttk_ElementSpec TextElementSpec =
-{
+static Ttk_ElementSpec TextElementSpec = {
TK_STYLE_VERSION_2,
sizeof(TextElement),
TextElementOptions,
@@ -218,44 +211,12 @@ static Ttk_ElementSpec TextElementSpec =
TextElementDraw
};
-/*
- * ImageTextElement --
- * Same as TextElement, but erases the background area first.
- */
-static void ImageTextElementDraw(
- void *clientData, void *elementRecord, Tk_Window tkwin,
- Drawable d, Ttk_Box b, Ttk_State state)
-{
- TextElement *text = elementRecord;
- Tk_3DBorder bd = Tk_Get3DBorderFromObj(tkwin,text->backgroundObj);
-
- if (!TextSetup(text, tkwin))
- return;
-
- XFillRectangle(Tk_Display(tkwin), d,
- Tk_3DBorderGC(tkwin, bd, TK_3D_FLAT_GC), b.x, b.y, b.width, b.height);
-
- TextDraw(text, tkwin, d, b);
- TextCleanup(text);
-}
-
-static Ttk_ElementSpec ImageTextElementSpec =
-{
- TK_STYLE_VERSION_2,
- sizeof(TextElement),
- TextElementOptions,
- TextElementSize,
- ImageTextElementDraw
-};
-
-/*
- *----------------------------------------------------------------------
+/*----------------------------------------------------------------------
* +++ Image element.
* Draws an image.
*/
-typedef struct
-{
+typedef struct {
Tcl_Obj *imageObj;
Tcl_Obj *stippleObj; /* For TTK_STATE_DISABLED */
Tcl_Obj *backgroundObj; /* " " */
@@ -268,8 +229,7 @@ typedef struct
/* ===> NB: Keep in sync with label element option table. <===
*/
-static Ttk_ElementOptionSpec ImageElementOptions[] =
-{
+static Ttk_ElementOptionSpec ImageElementOptions[] = {
{ "-image", TK_OPTION_STRING,
Tk_Offset(ImageElement,imageObj), "" },
{ "-stipple", TK_OPTION_STRING, /* Really: TK_OPTION_BITMAP */
@@ -393,8 +353,7 @@ static void ImageElementDraw(
}
}
-static Ttk_ElementSpec ImageElementSpec =
-{
+static Ttk_ElementSpec ImageElementSpec = {
TK_STYLE_VERSION_2,
sizeof(ImageElement),
ImageElementOptions,
@@ -433,8 +392,7 @@ static Ttk_ElementSpec ImageElementSpec =
* Here, padding is handled by a different element.
*/
-typedef struct
-{
+typedef struct {
/*
* Element options:
*/
@@ -451,8 +409,7 @@ typedef struct
int totalWidth, totalHeight;
} LabelElement;
-static Ttk_ElementOptionSpec LabelElementOptions[] =
-{
+static Ttk_ElementOptionSpec LabelElementOptions[] = {
{ "-compound", TK_OPTION_ANY,
Tk_Offset(LabelElement,compoundObj), "none" },
{ "-space", TK_OPTION_PIXELS,
@@ -467,8 +424,6 @@ static Ttk_ElementOptionSpec LabelElementOptions[] =
Tk_Offset(LabelElement,text.fontObj), DEFAULT_FONT },
{ "-foreground", TK_OPTION_COLOR,
Tk_Offset(LabelElement,text.foregroundObj), "black" },
- { "-background", TK_OPTION_BORDER,
- Tk_Offset(LabelElement,text.backgroundObj), DEFAULT_BACKGROUND },
{ "-underline", TK_OPTION_INT,
Tk_Offset(LabelElement,text.underlineObj), "-1"},
{ "-width", TK_OPTION_INT,
@@ -687,8 +642,7 @@ static void LabelElementDraw(
LabelCleanup(l);
}
-static Ttk_ElementSpec LabelElementSpec =
-{
+static Ttk_ElementSpec LabelElementSpec = {
TK_STYLE_VERSION_2,
sizeof(LabelElement),
LabelElementOptions,
@@ -708,7 +662,5 @@ void TtkLabel_Init(Tcl_Interp *interp)
Ttk_RegisterElement(interp, theme, "text", &TextElementSpec, NULL);
Ttk_RegisterElement(interp, theme, "image", &ImageElementSpec, NULL);
Ttk_RegisterElement(interp, theme, "label", &LabelElementSpec, NULL);
- Ttk_RegisterElement(interp, theme, "Labelframe.text", /* @@@ */
- &ImageTextElementSpec,NULL);
}
diff --git a/library/ttk/aquaTheme.tcl b/library/ttk/aquaTheme.tcl
index bf34746..e25b2bf 100644
--- a/library/ttk/aquaTheme.tcl
+++ b/library/ttk/aquaTheme.tcl
@@ -1,5 +1,5 @@
#
-# $Id: aquaTheme.tcl,v 1.9 2007/11/18 19:20:26 jenglish Exp $
+# $Id: aquaTheme.tcl,v 1.10 2007/11/19 01:49:07 jenglish Exp $
#
# Aqua theme (OSX native look and feel)
#
@@ -50,12 +50,6 @@ namespace eval ttk::theme::aqua {
# Enable animation for ttk::progressbar widget:
ttk::style configure TProgressbar -period 100 -maxphase 255
- # Modify the the default Labelframe layout to use generic text element
- # instead of Labelframe.text; the latter erases the window background
- # (@@@ this still isn't right... want to fill with background pattern)
- #
- ttk::style layout TLabelframe.Label { text }
-
# For Aqua, labelframe labels should appear outside the border,
# with a 14 pixel inset and 4 pixels spacing between border and label
# (ref: Apple Human Interface Guidelines / Controls / Grouping Controls)
diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c
index c85a4b7..310cf52 100644
--- a/macosx/ttkMacOSXTheme.c
+++ b/macosx/ttkMacOSXTheme.c
@@ -27,7 +27,7 @@
* top-level window, not to the Tk_Window. BoxToRect()
* accounts for this.
*
- * RCS: @(#) $Id: ttkMacOSXTheme.c,v 1.17 2007/11/18 17:00:29 jenglish Exp $
+ * RCS: @(#) $Id: ttkMacOSXTheme.c,v 1.18 2007/11/19 01:49:07 jenglish Exp $
*/
#include "tkMacOSXPrivate.h"
@@ -48,7 +48,7 @@
* need to do this the hard way in Tile:
*/
#define BEGIN_DRAWING(d) { \
- CGrafPtr saveWorld; GDHandle saveDevice; \
+ CGrafPtr saveWorld; GDHandle saveDevice; \
GetGWorld(&saveWorld, &saveDevice); \
SetGWorld(TkMacOSXGetDrawablePort(d), 0); \
TkMacOSXSetUpClippingRgn(d);
@@ -762,7 +762,7 @@ static Ttk_ElementSpec SizegripElementSpec = {
};
/*----------------------------------------------------------------------
- * +++ Background element.
+ * +++ Background and fill elements.
*
* This isn't quite right: In Aqua, the correct background for
* a control depends on what kind of container it belongs to,
@@ -773,11 +773,11 @@ static Ttk_ElementSpec SizegripElementSpec = {
* off-screen graphics port this leads to alignment glitches.
*/
-static void BackgroundElementDraw(
+static void FillElementDraw(
void *clientData, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, Ttk_State state)
{
- Rect bounds = BoxToRect(d, Ttk_WinBox(tkwin));
+ Rect bounds = BoxToRect(d, b);
ThemeBrush brush = (state & TTK_STATE_BACKGROUND)
? kThemeBrushModelessDialogBackgroundInactive
: kThemeBrushModelessDialogBackgroundActive;
@@ -789,6 +789,23 @@ static void BackgroundElementDraw(
END_DRAWING
}
+static void BackgroundElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
+{
+ FillElementDraw(
+ clientData, elementRecord, tkwin,
+ d, Ttk_WinBox(tkwin), state);
+}
+
+static Ttk_ElementSpec FillElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(NullElement),
+ TtkNullElementOptions,
+ TtkNullElementSize,
+ FillElementDraw
+};
+
static Ttk_ElementSpec BackgroundElementSpec = {
TK_STYLE_VERSION_2,
sizeof(NullElement),
@@ -995,26 +1012,27 @@ static int AquaTheme_Init(Tcl_Interp *interp)
/*
* Elements:
*/
- Ttk_RegisterElementSpec(themePtr,"background",&BackgroundElementSpec,0);
- Ttk_RegisterElementSpec(themePtr,"Toolbar.background",
- &ToolbarBackgroundElementSpec, 0);
+ Ttk_RegisterElementSpec(themePtr, "background", &BackgroundElementSpec, 0);
+ Ttk_RegisterElementSpec(themePtr, "fill", &FillElementSpec, 0);
+ Ttk_RegisterElementSpec(themePtr, "Toolbar.background",
+ &ToolbarBackgroundElementSpec, 0);
Ttk_RegisterElementSpec(themePtr, "Button.button",
- &ButtonElementSpec, &PushButtonParms);
+ &ButtonElementSpec, &PushButtonParms);
Ttk_RegisterElementSpec(themePtr, "Checkbutton.button",
- &ButtonElementSpec, &CheckBoxParms);
+ &ButtonElementSpec, &CheckBoxParms);
Ttk_RegisterElementSpec(themePtr, "Radiobutton.button",
- &ButtonElementSpec, &RadioButtonParms);
+ &ButtonElementSpec, &RadioButtonParms);
Ttk_RegisterElementSpec(themePtr, "Toolbutton.border",
- &ButtonElementSpec, &BevelButtonParms);
+ &ButtonElementSpec, &BevelButtonParms);
Ttk_RegisterElementSpec(themePtr, "Menubutton.button",
- &ButtonElementSpec, &PopupButtonParms);
+ &ButtonElementSpec, &PopupButtonParms);
Ttk_RegisterElementSpec(themePtr, "Combobox.button",
- &ComboboxElementSpec, 0);
+ &ComboboxElementSpec, 0);
Ttk_RegisterElementSpec(themePtr, "Treeitem.indicator",
- &DisclosureElementSpec, &DisclosureParms);
+ &DisclosureElementSpec, &DisclosureParms);
Ttk_RegisterElementSpec(themePtr, "Treeheading.cell",
- &TreeHeaderElementSpec, &ListHeaderParms);
+ &TreeHeaderElementSpec, &ListHeaderParms);
Ttk_RegisterElementSpec(themePtr, "Notebook.tab", &TabElementSpec, 0);
Ttk_RegisterElementSpec(themePtr, "Notebook.client", &PaneElementSpec, 0);
@@ -1035,7 +1053,7 @@ static int AquaTheme_Init(Tcl_Interp *interp)
* we do all the drawing in the ".track" element and leave the .pbar out.
*/
Ttk_RegisterElementSpec(themePtr,"Scale.trough",
- &TrackElementSpec, &ScaleData);
+ &TrackElementSpec, &ScaleData);
Ttk_RegisterElementSpec(themePtr,"Scale.slider",&SliderElementSpec,0);
Ttk_RegisterElementSpec(themePtr,"Progressbar.track", &PbarElementSpec, 0);