summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
Diffstat (limited to 'win')
-rw-r--r--win/ttkWinMonitor.c6
-rw-r--r--win/ttkWinTheme.c34
-rw-r--r--win/ttkWinXPTheme.c50
3 files changed, 74 insertions, 16 deletions
diff --git a/win/ttkWinMonitor.c b/win/ttkWinMonitor.c
index 2753518..0f28d48 100644
--- a/win/ttkWinMonitor.c
+++ b/win/ttkWinMonitor.c
@@ -1,4 +1,4 @@
-/* $Id: ttkWinMonitor.c,v 1.16 2007/12/13 15:28:56 dgp Exp $
+/* $Id: ttkWinMonitor.c,v 1.16.2.1 2010/08/26 02:06:10 hobbs Exp $
*/
#ifdef _MSC_VER
@@ -75,8 +75,8 @@ CreateThemeMonitorWindow(HINSTANCE hinst, Tcl_Interp *interp)
{
WNDCLASSEX wc;
HWND hwnd = NULL;
- CHAR title[32] = "TtkMonitorWindow";
- CHAR name[32] = "TtkMonitorClass";
+ TCHAR title[32] = TEXT("TtkMonitorWindow");
+ TCHAR name[32] = TEXT("TtkMonitorClass");
wc.cbSize = sizeof(WNDCLASSEX);
wc.style = CS_HREDRAW | CS_VREDRAW;
diff --git a/win/ttkWinTheme.c b/win/ttkWinTheme.c
index 749fe3f..0137408 100644
--- a/win/ttkWinTheme.c
+++ b/win/ttkWinTheme.c
@@ -1,6 +1,6 @@
/* winTheme.c - Copyright (C) 2004 Pat Thoyts <patthoyts@users.sf.net>
*
- * $Id: ttkWinTheme.c,v 1.13 2008/01/08 17:01:00 jenglish Exp $
+ * $Id: ttkWinTheme.c,v 1.13.2.1 2010/08/26 02:06:10 hobbs Exp $
*/
#ifdef _MSC_VER
@@ -104,10 +104,12 @@ typedef struct {
Ttk_Padding margins; /* additional placement padding */
} FrameControlElementData;
-#define _FIXEDSIZE 0x8000
+#define _FIXEDSIZE 0x80000000L
+#define _HALFMETRIC 0x40000000L
#define FIXEDSIZE(id) (id|_FIXEDSIZE)
+#define HALFMETRIC(id) (id|_HALFMETRIC)
#define GETMETRIC(m) \
- ((m) & _FIXEDSIZE ? (m) & ~_FIXEDSIZE : GetSystemMetrics(m))
+ ((m) & _FIXEDSIZE ? (int)((m) & ~_FIXEDSIZE) : GetSystemMetrics((m)&0x0fffffff))
static FrameControlElementData FrameControlElements[] = {
{ "Checkbutton.indicator",
@@ -131,6 +133,12 @@ static FrameControlElementData FrameControlElements[] = {
{ "sizegrip",
DFC_SCROLL, DFCS_SCROLLSIZEGRIP, SM_CXVSCROLL, SM_CYHSCROLL,
arrow_statemap, {0,0,0,0} },
+ { "Spinbox.uparrow",
+ DFC_SCROLL, DFCS_SCROLLUP, SM_CXVSCROLL, HALFMETRIC(SM_CYVSCROLL),
+ arrow_statemap, {0,0,0,0} },
+ { "Spinbox.downarrow",
+ DFC_SCROLL, DFCS_SCROLLDOWN, SM_CXVSCROLL, HALFMETRIC(SM_CYVSCROLL),
+ arrow_statemap, {0,0,0,0} },
{ 0,0,0,0,0,0, {0,0,0,0} }
};
@@ -142,8 +150,12 @@ static void FrameControlElementSize(
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
FrameControlElementData *p = clientData;
- *widthPtr = GETMETRIC(p->cxId) + Ttk_PaddingWidth(p->margins);
- *heightPtr = GETMETRIC(p->cyId) + Ttk_PaddingHeight(p->margins);
+ int cx = GETMETRIC(p->cxId);
+ int cy = GETMETRIC(p->cyId);
+ if (p->cxId & _HALFMETRIC) cx /= 2;
+ if (p->cyId & _HALFMETRIC) cy /= 2;
+ *widthPtr = cx + Ttk_PaddingWidth(p->margins);
+ *heightPtr = cy + Ttk_PaddingHeight(p->margins);
}
static void FrameControlElementDraw(
@@ -179,7 +191,7 @@ typedef struct {
static Ttk_ElementOptionSpec BorderElementOptions[] = {
{ "-relief",TK_OPTION_RELIEF,Tk_Offset(BorderElement,reliefObj), "flat" },
- {NULL}
+ {NULL, 0, 0, NULL}
};
static void BorderElementSize(
@@ -230,7 +242,7 @@ typedef struct {
static Ttk_ElementOptionSpec FieldElementOptions[] = {
{ "-fieldbackground", TK_OPTION_BORDER,
Tk_Offset(FieldElement,backgroundObj), "white" },
- {NULL}
+ { NULL, 0, 0, NULL }
};
static void FieldElementSize(
@@ -285,7 +297,7 @@ static Ttk_ElementOptionSpec ButtonBorderElementOptions[] = {
Tk_Offset(ButtonBorderElement,highlightColorObj), "black" },
{ "-default", TK_OPTION_ANY,
Tk_Offset(ButtonBorderElement,defaultStateObj), "disabled" },
- {NULL}
+ {NULL, 0, 0, NULL}
};
static void ButtonBorderElementSize(
@@ -409,7 +421,7 @@ typedef struct {
static Ttk_ElementOptionSpec FillFocusElementOptions[] = {
{ "-focusfill", TK_OPTION_COLOR,
Tk_Offset(FillFocusElement,fillColorObj), "white" },
- { NULL }
+ {NULL, 0, 0, NULL}
};
/* @@@ FIX THIS */
@@ -533,7 +545,7 @@ typedef struct {
static Ttk_ElementOptionSpec ThumbElementOptions[] = {
{ "-orient", TK_OPTION_ANY,Tk_Offset(ThumbElement,orientObj),"horizontal"},
- { NULL }
+ { NULL, 0, 0, NULL }
};
static void ThumbElementSize(
@@ -590,7 +602,7 @@ typedef struct {
static Ttk_ElementOptionSpec SliderElementOptions[] = {
{ "-orient", TK_OPTION_ANY, Tk_Offset(SliderElement,orientObj),
"horizontal" },
- { NULL }
+ { NULL, 0, 0, NULL }
};
static void SliderElementSize(
diff --git a/win/ttkWinXPTheme.c b/win/ttkWinXPTheme.c
index 5502206..c4a921e 100644
--- a/win/ttkWinXPTheme.c
+++ b/win/ttkWinXPTheme.c
@@ -1,5 +1,5 @@
/*
- * $Id: ttkWinXPTheme.c,v 1.18.2.2 2009/12/03 23:58:35 patthoyts Exp $
+ * $Id: ttkWinXPTheme.c,v 1.18.2.3 2010/08/26 02:06:10 hobbs Exp $
*
* Tk theme engine which uses the Windows XP "Visual Styles" API
* Adapted from Georgios Petasis' XP theme patch.
@@ -101,7 +101,7 @@ LoadXPThemeProcs(HINSTANCE *phlib)
* if we are running at least on Windows XP.
*/
HINSTANCE handle;
- *phlib = handle = LoadLibrary("uxtheme.dll");
+ *phlib = handle = LoadLibrary(TEXT("uxtheme.dll"));
if (handle != 0)
{
/*
@@ -321,6 +321,14 @@ static Ttk_StateTable rightarrow_statemap[] =
{ ABS_RIGHTNORMAL, 0, 0 }
};
+static Ttk_StateTable spinbutton_statemap[] =
+{
+ { DNS_DISABLED, TTK_STATE_DISABLED, 0 },
+ { DNS_PRESSED, TTK_STATE_PRESSED, 0 },
+ { DNS_HOT, TTK_STATE_ACTIVE, 0 },
+ { DNS_NORMAL, 0, 0 },
+};
+
/*
* Trackbar thumb: (Tk: "scale slider")
*/
@@ -591,6 +599,36 @@ static Ttk_ElementSpec GenericSizedElementSpec = {
};
/*----------------------------------------------------------------------
+ * +++ Spinbox arrow element.
+ * These are half-height scrollbar buttons.
+ */
+
+static void
+SpinboxArrowElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ ElementData *elementData = clientData;
+
+ if (!InitElementData(elementData, tkwin, 0))
+ return;
+
+ GenericSizedElementSize(clientData, elementRecord, tkwin,
+ widthPtr, heightPtr, paddingPtr);
+
+ /* force the arrow button height to half size */
+ *heightPtr /= 2;
+}
+
+static Ttk_ElementSpec SpinboxArrowElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(NullElement),
+ TtkNullElementOptions,
+ SpinboxArrowElementSize,
+ GenericElementDraw
+};
+
+/*----------------------------------------------------------------------
* +++ Scrollbar thumb element.
* Same as a GenericElement, but don't draw in the disabled state.
*/
@@ -979,6 +1017,14 @@ static ElementInfo ElementInfoTable[] = {
HP_HEADERITEM, header_statemap, PAD(4,0,4,0),0 },
{ "sizegrip", &GenericElementSpec, L"STATUS",
SP_GRIPPER, null_statemap, NOPAD,0 },
+ { "Spinbox.field", &GenericElementSpec, L"EDIT",
+ EP_EDITTEXT, edittext_statemap, PAD(1, 1, 1, 1), 0 },
+ { "Spinbox.uparrow", &SpinboxArrowElementSpec, L"SPIN",
+ SPNP_UP, spinbutton_statemap, NOPAD,
+ PAD_MARGINS | ((SM_CXVSCROLL << 8) | SM_CYVSCROLL) },
+ { "Spinbox.downarrow", &SpinboxArrowElementSpec, L"SPIN",
+ SPNP_DOWN, spinbutton_statemap, NOPAD,
+ PAD_MARGINS | ((SM_CXVSCROLL << 8) | SM_CYVSCROLL) },
#if BROKEN_TEXT_ELEMENT
{ "Labelframe.text", &TextElementSpec, L"BUTTON",