summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorjenglish <jenglish@flightlab.com>2007-04-10 18:05:48 (GMT)
committerjenglish <jenglish@flightlab.com>2007-04-10 18:05:48 (GMT)
commit3176b2f07414a59ba25f79a33186cd04f4e86b8a (patch)
tree43117ad0fdaaff30acbd77d3176ce968b66f2356 /win
parentf479296307f674dc9267c506a41d3a0d7f4b92ef (diff)
downloadtk-3176b2f07414a59ba25f79a33186cd04f4e86b8a.zip
tk-3176b2f07414a59ba25f79a33186cd04f4e86b8a.tar.gz
tk-3176b2f07414a59ba25f79a33186cd04f4e86b8a.tar.bz2
Re-sync with Tile codebase so patches can flow back and forth.
Diffstat (limited to 'win')
-rw-r--r--win/ttkWinMonitor.c40
-rw-r--r--win/ttkWinXPTheme.c123
2 files changed, 53 insertions, 110 deletions
diff --git a/win/ttkWinMonitor.c b/win/ttkWinMonitor.c
index 2f28e71..3dc2cad 100644
--- a/win/ttkWinMonitor.c
+++ b/win/ttkWinMonitor.c
@@ -1,4 +1,4 @@
-/* $Id: ttkWinMonitor.c,v 1.8 2007/02/22 13:56:35 dkf Exp $
+/* $Id: ttkWinMonitor.c,v 1.9 2007/04/10 18:05:48 jenglish Exp $
*/
#ifdef _MSC_VER
@@ -74,15 +74,13 @@ static void RegisterSystemColors(Tcl_Interp *interp)
}
static HWND
-CreateThemeMonitorWindow(
- HINSTANCE hinst,
- Tcl_Interp *interp)
+CreateThemeMonitorWindow(HINSTANCE hinst, Tcl_Interp *interp)
{
WNDCLASSEX wc;
- HWND hwnd = NULL;
- CHAR title[32] = "TtkMonitorWindow";
- CHAR name[32] = "TtkMonitorClass";
-
+ HWND hwnd = NULL;
+ CHAR title[32] = "TtkMonitorWindow";
+ CHAR name[32] = "TtkMonitorClass";
+
wc.cbSize = sizeof(WNDCLASSEX);
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = (WNDPROC)WndProc;
@@ -95,11 +93,11 @@ CreateThemeMonitorWindow(
wc.hbrBackground = (HBRUSH)COLOR_WINDOW;
wc.lpszMenuName = name;
wc.lpszClassName = name;
-
+
if (RegisterClassEx(&wc)) {
- hwnd = CreateWindow(name, title, WS_OVERLAPPEDWINDOW,
- CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
- NULL, NULL, hinst, NULL );
+ hwnd = CreateWindow( name, title, WS_OVERLAPPEDWINDOW,
+ CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
+ NULL, NULL, hinst, NULL );
#ifdef _WIN64
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG)interp);
#else
@@ -111,20 +109,15 @@ CreateThemeMonitorWindow(
return hwnd;
}
-static void
-DestroyThemeMonitorWindow(
- void *clientData)
+static void
+DestroyThemeMonitorWindow(void *clientData)
{
HWND hwnd = (HWND)clientData;
DestroyWindow(hwnd);
}
static LRESULT WINAPI
-WndProc(
- HWND hwnd,
- UINT msg,
- WPARAM wp,
- LPARAM lp)
+WndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
{
#ifdef _WIN64
Tcl_Interp *interp = (Tcl_Interp *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
@@ -164,12 +157,10 @@ WndProc(
MODULE_SCOPE int TtkWinTheme_Init(Tcl_Interp *, HWND hwnd);
MODULE_SCOPE int TtkXPTheme_Init(Tcl_Interp *, HWND hwnd);
-MODULE_SCOPE int
-Ttk_WinPlatformInit(
- Tcl_Interp *interp)
+MODULE_SCOPE int Ttk_WinPlatformInit(Tcl_Interp *interp)
{
HWND hwnd;
-
+
hwnd = CreateThemeMonitorWindow(Tk_GetHINSTANCE(), interp);
Ttk_RegisterCleanup(interp, (ClientData)hwnd, DestroyThemeMonitorWindow);
@@ -178,3 +169,4 @@ Ttk_WinPlatformInit(
return TCL_OK;
}
+
diff --git a/win/ttkWinXPTheme.c b/win/ttkWinXPTheme.c
index 723b7d7..6e4ebe9 100644
--- a/win/ttkWinXPTheme.c
+++ b/win/ttkWinXPTheme.c
@@ -1,5 +1,5 @@
/*
- * $Id: ttkWinXPTheme.c,v 1.9 2007/02/22 13:56:35 dkf Exp $
+ * $Id: ttkWinXPTheme.c,v 1.10 2007/04/10 18:05:48 jenglish Exp $
*
* Tk theme engine which uses the Windows XP "Visual Styles" API
* Adapted from Georgios Petasis' XP theme patch.
@@ -88,8 +88,7 @@ typedef struct
*/
static XPThemeProcs *
-LoadXPThemeProcs(
- HINSTANCE *phlib)
+LoadXPThemeProcs(HINSTANCE *phlib)
{
OSVERSIONINFO os;
@@ -146,8 +145,7 @@ LoadXPThemeProcs(
*/
static void
-XPThemeDeleteProc(
- void *clientData)
+XPThemeDeleteProc(void *clientData)
{
XPThemeData *themeData = clientData;
FreeLibrary(themeData->hlibrary);
@@ -155,9 +153,7 @@ XPThemeDeleteProc(
}
static int
-XPThemeEnabled(
- Ttk_Theme theme,
- void *clientData)
+XPThemeEnabled(Ttk_Theme theme, void *clientData)
{
XPThemeData *themeData = clientData;
int active = themeData->procs->IsThemeActive();
@@ -170,8 +166,7 @@ XPThemeEnabled(
* Helper routine. Returns a RECT data structure.
*/
static RECT
-BoxToRect(
- Ttk_Box b)
+BoxToRect(Ttk_Box b)
{
RECT rc;
rc.top = b.y;
@@ -411,9 +406,7 @@ typedef struct
} ElementData;
static ElementData *
-NewElementData(
- XPThemeProcs *procs,
- ElementInfo *info)
+NewElementData(XPThemeProcs *procs, ElementInfo *info)
{
ElementData *elementData = (ElementData*)ckalloc(sizeof(ElementData));
@@ -424,9 +417,7 @@ NewElementData(
return elementData;
}
-static void
-DestroyElementData(
- void *elementData)
+static void DestroyElementData(void *elementData)
{
ckfree(elementData);
}
@@ -443,10 +434,7 @@ DestroyElementData(
*/
static int
-InitElementData(
- ElementData *elementData,
- Tk_Window tkwin,
- Drawable d)
+InitElementData(ElementData *elementData, Tk_Window tkwin, Drawable d)
{
Window win = Tk_WindowId(tkwin);
@@ -472,8 +460,7 @@ InitElementData(
}
static void
-FreeElementData(
- ElementData *elementData)
+FreeElementData(ElementData *elementData)
{
elementData->procs->CloseThemeData(elementData->hTheme);
if (elementData->drawable != 0) {
@@ -484,19 +471,15 @@ FreeElementData(
/*----------------------------------------------------------------------
* +++ Generic element implementation.
- *
+ *
* Used for elements which are handled entirely by the XP Theme API,
* such as radiobutton and checkbutton indicators, scrollbar arrows, etc.
*/
static void
GenericElementGeometry(
- void *clientData,
- void *elementRecord,
- Tk_Window tkwin,
- int *widthPtr,
- int *heightPtr,
- Ttk_Padding *paddingPtr)
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
ElementData *elementData = clientData;
HRESULT result;
@@ -528,12 +511,8 @@ GenericElementGeometry(
static void
GenericElementDraw(
- void *clientData,
- void *elementRecord,
- Tk_Window tkwin,
- Drawable d,
- Ttk_Box b,
- unsigned int state)
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
{
ElementData *elementData = clientData;
RECT rc;
@@ -574,12 +553,8 @@ static Ttk_ElementSpec GenericElementSpec =
static void
ThumbElementDraw(
- void *clientData,
- void *elementRecord,
- Tk_Window tkwin,
- Drawable d,
- Ttk_Box b,
- unsigned int state)
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
{
ElementData *elementData = clientData;
unsigned stateId = Ttk_StateTableLookup(elementData->info->statemap, state);
@@ -613,17 +588,12 @@ static Ttk_ElementSpec ThumbElementSpec =
/*----------------------------------------------------------------------
* +++ Progress bar element.
* Increases the requested length of PP_CHUNK and PP_CHUNKVERT parts
- * so that indeterminate progress bars show 3 bars instead of 1.
+ * so that indeterminate progress bars show 3 bars instead of 1.
*/
-static void
-PbarElementGeometry(
- void *clientData,
- void *elementRecord,
- Tk_Window tkwin,
- int *widthPtr,
- int *heightPtr,
- Ttk_Padding *paddingPtr)
+static void PbarElementGeometry(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
ElementData *elementData = clientData;
int nBars = 3;
@@ -651,25 +621,19 @@ static Ttk_ElementSpec PbarElementSpec =
* +++ Notebook tab element.
* Same as generic element, with additional logic to select
* proper iPartID for the leftmost tab.
- *
- * Notes: TABP_TABITEMRIGHTEDGE (or TABP_TOPTABITEMRIGHTEDGE,
+ *
+ * Notes: TABP_TABITEMRIGHTEDGE (or TABP_TOPTABITEMRIGHTEDGE,
* which appears to be identical) should be used if the
* tab is exactly at the right edge of the notebook, but
* not if it's simply the rightmost tab. This information
* is not available.
*
- * The TIS_* and TILES_* definitions are identical, so
+ * The TIS_* and TILES_* definitions are identical, so
* we can use the same statemap no matter what the partId.
*/
-
-static void
-TabElementDraw(
- void *clientData,
- void *elementRecord,
- Tk_Window tkwin,
- Drawable d,
- Ttk_Box b,
- unsigned int state)
+static void TabElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
{
ElementData *elementData = clientData;
int partId = elementData->info->partId;
@@ -703,7 +667,7 @@ static Ttk_ElementSpec TabElementSpec =
#define TTK_STATE_OPEN TTK_STATE_USER1
#define TTK_STATE_LEAF TTK_STATE_USER2
-static Ttk_StateTable header_statemap[] =
+static Ttk_StateTable header_statemap[] =
{
{ HIS_PRESSED, TTK_STATE_PRESSED, 0 },
{ HIS_HOT, TTK_STATE_ACTIVE, 0 },
@@ -716,14 +680,9 @@ static Ttk_StateTable tvpglyph_statemap[] =
{ GLPS_CLOSED, 0,0 },
};
-static void
-TreeIndicatorElementDraw(
- void *clientData,
- void *elementRecord,
- Tk_Window tkwin,
- Drawable d,
- Ttk_Box b,
- unsigned int state)
+static void TreeIndicatorElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
{
if (!(state & TTK_STATE_LEAF)) {
GenericElementDraw(clientData,elementRecord,tkwin,d,b,state);
@@ -745,11 +704,11 @@ static Ttk_ElementSpec TreeIndicatorElementSpec =
*----------------------------------------------------------------------
* Text element (does not work yet).
*
- * According to "Using Windows XP Visual Styles", we need to select
+ * According to "Using Windows XP Visual Styles", we need to select
* a font into the DC before calling DrawThemeText().
* There's just no easy way to get an HFONT out of a Tk_Font.
* Maybe GetThemeFont() would work?
- *
+ *
*/
typedef struct
@@ -769,12 +728,8 @@ static Ttk_ElementOptionSpec TextElementOptions[] =
static void
TextElementGeometry(
- void *clientData,
- void *elementRecord,
- Tk_Window tkwin,
- int *widthPtr,
- int *heightPtr,
- Ttk_Padding *paddingPtr)
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
TextElement *element = elementRecord;
ElementData *elementData = clientData;
@@ -805,14 +760,10 @@ TextElementGeometry(
FreeElementData(elementData);
}
-static void
+static void
TextElementDraw(
- ClientData clientData,
- void *elementRecord,
- Tk_Window tkwin,
- Drawable d,
- Ttk_Box b,
- unsigned int state)
+ ClientData clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
{
TextElement *element = elementRecord;
ElementData *elementData = clientData;