summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog10
-rw-r--r--generic/tkFrame.c14
-rw-r--r--generic/tkInt.decls18
-rw-r--r--generic/tkIntDecls.h17
-rw-r--r--generic/tkStubInit.c5
-rw-r--r--mac/tkMacDraw.c31
-rw-r--r--macosx/tkMacOSXDraw.c93
-rw-r--r--unix/tkUnixDraw.c29
-rw-r--r--win/tkWinDraw.c29
9 files changed, 226 insertions, 20 deletions
diff --git a/ChangeLog b/ChangeLog
index 8a56d88..e3cfc38 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2005-07-27 Jeff Hobbs <jeffh@ActiveState.com>
+ * generic/tkFrame.c (DisplayFrame):
+ * generic/tkInt.decls: add TkpDrawFrame to allow for
+ * generic/tkIntDecls.h: platform-specific drawing into the frame/
+ * generic/tkStubInit.c: toplevel area. Currently only differs on
+ * generic/tkFrame.c: OS X (Aqua), which will draw a themed bg
+ * win/tkWinDraw.c: if tk::mac::useThemedToplevel == 1.
+ * unix/tkUnixDraw.c: Normal frames left alone until we can
+ * mac/tkMacDraw.c: better factor out frame drawing to be
+ * macosx/tkMacDraw.c: widget-specific.
+
* generic/tkInt.h: Swap TkUnsupported1Cmd for TkUnsupported1ObjCmd.
* generic/tkWindow.c: Ditto. (neil madden)
* macosx/tkMacOSXInt.h: Added TkMacOSXWindowClass decl
diff --git a/generic/tkFrame.c b/generic/tkFrame.c
index 6be4c48..d80446c 100644
--- a/generic/tkFrame.c
+++ b/generic/tkFrame.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkFrame.c,v 1.15.2.1 2003/07/16 23:17:38 pspjuth Exp $
+ * RCS: @(#) $Id: tkFrame.c,v 1.15.2.2 2005/07/28 04:57:37 hobbs Exp $
*/
#include "default.h"
@@ -1410,7 +1410,7 @@ DisplayFrame(clientData)
if (hlWidth != 0) {
GC fgGC, bgGC;
-
+
bgGC = Tk_GCForColor(framePtr->highlightBgColorPtr,
Tk_WindowId(tkwin));
if (framePtr->flags & GOT_FOCUS) {
@@ -1432,14 +1432,12 @@ DisplayFrame(clientData)
if (framePtr->type != TYPE_LABELFRAME) {
/*
- * There is no label so there is just a simple rectangle to draw.
+ * Pass to platform specific draw function. In general, it just
+ * draws a simple rectangle, but it may "theme" the background.
*/
noLabel:
- Tk_Fill3DRectangle(tkwin, Tk_WindowId(tkwin),
- framePtr->border, hlWidth, hlWidth,
- Tk_Width(tkwin) - 2 * hlWidth,
- Tk_Height(tkwin) - 2 * hlWidth,
+ TkpDrawFrame(tkwin, framePtr->border, hlWidth,
framePtr->borderWidth, framePtr->relief);
} else {
Labelframe *labelframePtr = (Labelframe *) framePtr;
@@ -1458,7 +1456,7 @@ DisplayFrame(clientData)
pixmap = Tk_GetPixmap(framePtr->display, Tk_WindowId(tkwin),
Tk_Width(tkwin), Tk_Height(tkwin), Tk_Depth(tkwin));
-
+
/*
* Clear the pixmap.
*/
diff --git a/generic/tkInt.decls b/generic/tkInt.decls
index 08d0919..2410c92 100644
--- a/generic/tkInt.decls
+++ b/generic/tkInt.decls
@@ -9,7 +9,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: tkInt.decls,v 1.33.2.3 2004/10/27 00:35:53 davygrvy Exp $
+# RCS: @(#) $Id: tkInt.decls,v 1.33.2.4 2005/07/28 04:57:38 hobbs Exp $
library tk
@@ -678,6 +678,22 @@ declare 149 generic {
Tk_OptionTable optionTable)
}
+# TIP#168 - 8.5+
+#declare 150 generic {
+# int TkMakeRawCurve (Tk_Canvas canvas,
+# double *pointPtr, int numPoints, int numSteps,
+# XPoint xPoints[], double dblPoints[])
+#}
+#declare 151 generic {
+# void TkMakeRawCurvePostscript (Tcl_Interp *interp,
+# Tk_Canvas canvas, double *pointPtr, int numPoints)
+#}
+
+declare 152 generic {
+ void TkpDrawFrame(Tk_Window tkwin, Tk_3DBorder border,
+ int highlightWidth, int borderWidth, int relief)
+}
+
##############################################################################
# Define the platform specific internal Tcl interface. These functions are
diff --git a/generic/tkIntDecls.h b/generic/tkIntDecls.h
index ac3093e..6635a35 100644
--- a/generic/tkIntDecls.h
+++ b/generic/tkIntDecls.h
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkIntDecls.h,v 1.22.2.1 2003/10/13 03:30:05 hobbs Exp $
+ * RCS: @(#) $Id: tkIntDecls.h,v 1.22.2.2 2005/07/28 04:57:38 hobbs Exp $
*/
#ifndef _TKINTDECLS
@@ -562,6 +562,12 @@ EXTERN Tk_Window TkToplevelWindowForCommand _ANSI_ARGS_((
/* 149 */
EXTERN CONST Tk_OptionSpec * TkGetOptionSpec _ANSI_ARGS_((CONST char * name,
Tk_OptionTable optionTable));
+/* Slot 150 is reserved */
+/* Slot 151 is reserved */
+/* 152 */
+EXTERN void TkpDrawFrame _ANSI_ARGS_((Tk_Window tkwin,
+ Tk_3DBorder border, int highlightWidth,
+ int borderWidth, int relief));
typedef struct TkIntStubs {
int magic;
@@ -838,6 +844,9 @@ typedef struct TkIntStubs {
void (*tkStylePkgFree) _ANSI_ARGS_((TkMainInfo * mainPtr)); /* 147 */
Tk_Window (*tkToplevelWindowForCommand) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * cmdName)); /* 148 */
CONST Tk_OptionSpec * (*tkGetOptionSpec) _ANSI_ARGS_((CONST char * name, Tk_OptionTable optionTable)); /* 149 */
+ void *reserved150;
+ void *reserved151;
+ void (*tkpDrawFrame) _ANSI_ARGS_((Tk_Window tkwin, Tk_3DBorder border, int highlightWidth, int borderWidth, int relief)); /* 152 */
} TkIntStubs;
#ifdef __cplusplus
@@ -1551,6 +1560,12 @@ extern TkIntStubs *tkIntStubsPtr;
#define TkGetOptionSpec \
(tkIntStubsPtr->tkGetOptionSpec) /* 149 */
#endif
+/* Slot 150 is reserved */
+/* Slot 151 is reserved */
+#ifndef TkpDrawFrame
+#define TkpDrawFrame \
+ (tkIntStubsPtr->tkpDrawFrame) /* 152 */
+#endif
#endif /* defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS) */
diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c
index c69c88f..495a509 100644
--- a/generic/tkStubInit.c
+++ b/generic/tkStubInit.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkStubInit.c,v 1.41.2.2 2004/09/23 00:56:14 mdejong Exp $
+ * RCS: @(#) $Id: tkStubInit.c,v 1.41.2.3 2005/07/28 04:57:38 hobbs Exp $
*/
#include "tkInt.h"
@@ -330,6 +330,9 @@ TkIntStubs tkIntStubs = {
TkStylePkgFree, /* 147 */
TkToplevelWindowForCommand, /* 148 */
TkGetOptionSpec, /* 149 */
+ NULL, /* 150 */
+ NULL, /* 151 */
+ TkpDrawFrame, /* 152 */
};
TkIntPlatStubs tkIntPlatStubs = {
diff --git a/mac/tkMacDraw.c b/mac/tkMacDraw.c
index f3af2fc..d534140 100644
--- a/mac/tkMacDraw.c
+++ b/mac/tkMacDraw.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacDraw.c,v 1.9 2002/04/08 09:04:43 das Exp $
+ * RCS: @(#) $Id: tkMacDraw.c,v 1.9.2.1 2005/07/28 04:57:38 hobbs Exp $
*/
#include "tkInt.h"
@@ -1156,7 +1156,7 @@ InvertByte(
/*
*----------------------------------------------------------------------
*
- * TkpDrawpHighlightBorder --
+ * TkpDrawHighlightBorder --
*
* This procedure draws a rectangular ring around the outside of
* a widget to indicate that it has received the input focus.
@@ -1194,3 +1194,30 @@ TkpDrawHighlightBorder (
}
}
}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpDrawFrame --
+ *
+ * This procedure draws the rectangular frame area.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Draws inside the tkwin area.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpDrawFrame (Tk_Window tkwin, Tk_3DBorder border,
+ int highlightWidth, int borderWidth, int relief)
+{
+ Tk_Fill3DRectangle(tkwin, Tk_WindowId(tkwin),
+ border, highlightWidth, highlightWidth,
+ Tk_Width(tkwin) - 2 * highlightWidth,
+ Tk_Height(tkwin) - 2 * highlightWidth,
+ borderWidth, relief);
+}
diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c
index 81d36aa..bea487b 100644
--- a/macosx/tkMacOSXDraw.c
+++ b/macosx/tkMacOSXDraw.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXDraw.c,v 1.2.2.5 2004/09/18 00:48:14 das Exp $
+ * RCS: @(#) $Id: tkMacOSXDraw.c,v 1.2.2.6 2005/07/28 04:57:38 hobbs Exp $
*/
#include "tclInt.h"
@@ -44,6 +44,9 @@ static PixPatHandle gPenPat = NULL;
static int useCGDrawing = 1;
static int tkMacOSXCGAntiAliasLimit = 1;
+static int useThemedToplevel = 0;
+static int useThemedFrame = 0;
+
/*
* Prototypes for functions used only in this file.
*/
@@ -62,7 +65,7 @@ TkMacOSXInitCGDrawing(interp, enable, limit)
int limit;
{
static Boolean initialized = FALSE;
-
+
if (!initialized) {
if (Tcl_CreateNamespace(interp, "::tk::mac", NULL, NULL) == NULL) {
Tcl_ResetResult(interp);
@@ -73,13 +76,25 @@ TkMacOSXInitCGDrawing(interp, enable, limit)
Tcl_ResetResult(interp);
}
useCGDrawing = enable;
-
+
if (Tcl_LinkVar(interp, "::tk::mac::CGAntialiasLimit",
(char *) &tkMacOSXCGAntiAliasLimit,
TCL_LINK_INT) != TCL_OK) {
Tcl_ResetResult(interp);
}
tkMacOSXCGAntiAliasLimit = limit;
+
+ /*
+ * Piggy-back the themed drawing var init here.
+ */
+ if (Tcl_LinkVar(interp, "::tk::mac::useThemedToplevel",
+ (char *) &useThemedToplevel, TCL_LINK_BOOLEAN) != TCL_OK) {
+ Tcl_ResetResult(interp);
+ }
+ if (Tcl_LinkVar(interp, "::tk::mac::useThemedFrame",
+ (char *) &useThemedFrame, TCL_LINK_BOOLEAN) != TCL_OK) {
+ Tcl_ResetResult(interp);
+ }
}
return TCL_OK;
}
@@ -188,7 +203,7 @@ XCopyArea(
RgnHandle clipRgn = (RgnHandle)
((TkpClipMask*)gc->clip_mask)->value.region;
- int xOffset, yOffset;
+ int xOffset = 0, yOffset = 0;
if (tmpRgn == NULL) {
tmpRgn = NewRgn();
}
@@ -1986,7 +2001,7 @@ InvertByte(
/*
*----------------------------------------------------------------------
*
- * TkpDrawpHighlightBorder --
+ * TkpDrawHighlightBorder --
*
* This procedure draws a rectangular ring around the outside of
* a widget to indicate that it has received the input focus.
@@ -2025,3 +2040,71 @@ TkpDrawHighlightBorder (
}
}
}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpDrawFrame --
+ *
+ * This procedure draws the rectangular frame area. If the user
+ * has request themeing, it draws with a the background theme.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Draws inside the tkwin area.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpDrawFrame (Tk_Window tkwin, Tk_3DBorder border,
+ int highlightWidth, int borderWidth, int relief)
+{
+ if (useThemedToplevel && Tk_IsTopLevel(tkwin)) {
+ /*
+ * Currently only support themed toplevels, until we can better
+ * factor this to handle individual windows (blanket theming of
+ * frames will work for very few UIs).
+ */
+ Rect bounds;
+ Point origin;
+ CGrafPtr saveWorld;
+ GDHandle saveDevice;
+ XGCValues gcValues;
+ GC gc;
+ Pixmap pixmap;
+ Display *display = Tk_Display(tkwin);
+
+ pixmap = Tk_GetPixmap(display, Tk_WindowId(tkwin),
+ Tk_Width(tkwin), Tk_Height(tkwin), Tk_Depth(tkwin));
+
+ gc = Tk_GetGC(tkwin, 0, &gcValues);
+ TkMacOSXWinBounds((TkWindow *) tkwin, &bounds);
+ origin.v = -bounds.top;
+ origin.h = -bounds.left;
+ bounds.top = bounds.left = 0;
+ bounds.right = Tk_Width(tkwin);
+ bounds.bottom = Tk_Height(tkwin);
+
+ GetGWorld(&saveWorld, &saveDevice);
+ SetGWorld(TkMacOSXGetDrawablePort(pixmap), 0);
+ ApplyThemeBackground(kThemeBackgroundWindowHeader, &bounds,
+ kThemeStateActive, 32 /* depth */, true /* inColor */);
+ QDSetPatternOrigin(origin);
+ EraseRect(&bounds);
+ SetGWorld(saveWorld, saveDevice);
+
+ XCopyArea(display, pixmap, Tk_WindowId(tkwin),
+ gc, 0, 0, bounds.right, bounds.bottom, 0, 0);
+ Tk_FreePixmap(display, pixmap);
+ Tk_FreeGC(display, gc);
+ } else {
+ Tk_Fill3DRectangle(tkwin, Tk_WindowId(tkwin),
+ border, highlightWidth, highlightWidth,
+ Tk_Width(tkwin) - 2 * highlightWidth,
+ Tk_Height(tkwin) - 2 * highlightWidth,
+ borderWidth, relief);
+ }
+}
diff --git a/unix/tkUnixDraw.c b/unix/tkUnixDraw.c
index 82576bf..46323af 100644
--- a/unix/tkUnixDraw.c
+++ b/unix/tkUnixDraw.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkUnixDraw.c,v 1.6 2000/07/20 21:38:28 ericm Exp $
+ * RCS: @(#) $Id: tkUnixDraw.c,v 1.6.8.1 2005/07/28 04:57:38 hobbs Exp $
*/
#include "tkPort.h"
@@ -209,3 +209,30 @@ TkpDrawHighlightBorder(tkwin, fgGC, bgGC, highlightWidth, drawable)
{
TkDrawInsetFocusHighlight(tkwin, fgGC, highlightWidth, drawable, 0);
}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpDrawFrame --
+ *
+ * This procedure draws the rectangular frame area.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Draws inside the tkwin area.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpDrawFrame (Tk_Window tkwin, Tk_3DBorder border,
+ int highlightWidth, int borderWidth, int relief)
+{
+ Tk_Fill3DRectangle(tkwin, Tk_WindowId(tkwin),
+ border, highlightWidth, highlightWidth,
+ Tk_Width(tkwin) - 2 * highlightWidth,
+ Tk_Height(tkwin) - 2 * highlightWidth,
+ borderWidth, relief);
+}
diff --git a/win/tkWinDraw.c b/win/tkWinDraw.c
index 21f0636..9366d6d 100644
--- a/win/tkWinDraw.c
+++ b/win/tkWinDraw.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWinDraw.c,v 1.12.2.1 2003/11/11 00:26:33 hobbs Exp $
+ * RCS: @(#) $Id: tkWinDraw.c,v 1.12.2.2 2005/07/28 04:57:38 hobbs Exp $
*/
#include "tkWinInt.h"
@@ -1356,3 +1356,30 @@ TkpDrawHighlightBorder(tkwin, fgGC, bgGC, highlightWidth, drawable)
{
TkDrawInsetFocusHighlight(tkwin, fgGC, highlightWidth, drawable, 0);
}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpDrawFrame --
+ *
+ * This procedure draws the rectangular frame area.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Draws inside the tkwin area.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpDrawFrame (Tk_Window tkwin, Tk_3DBorder border,
+ int highlightWidth, int borderWidth, int relief)
+{
+ Tk_Fill3DRectangle(tkwin, Tk_WindowId(tkwin),
+ border, highlightWidth, highlightWidth,
+ Tk_Width(tkwin) - 2 * highlightWidth,
+ Tk_Height(tkwin) - 2 * highlightWidth,
+ borderWidth, relief);
+}