summaryrefslogtreecommitdiffstats
path: root/win/ttkWinXPTheme.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2024-05-10 10:29:55 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2024-05-10 10:29:55 (GMT)
commitdac0d44e8ac09f7ff824c1ff952201122b60245e (patch)
tree51e1ecc4829a564ef487c9cd3b864a526884b47f /win/ttkWinXPTheme.c
parent794c5c6783a20e8c42ee94337edb9e02eb06662a (diff)
downloadtk-dac0d44e8ac09f7ff824c1ff952201122b60245e.zip
tk-dac0d44e8ac09f7ff824c1ff952201122b60245e.tar.gz
tk-dac0d44e8ac09f7ff824c1ff952201122b60245e.tar.bz2
More usage of Tk_GetPixelsFromObj() and TCL_UNUSED(), all backported from Tk 8.7.
More TCL_UNUSED
Diffstat (limited to 'win/ttkWinXPTheme.c')
-rw-r--r--win/ttkWinXPTheme.c70
1 files changed, 45 insertions, 25 deletions
diff --git a/win/ttkWinXPTheme.c b/win/ttkWinXPTheme.c
index a12220e..179bf0e 100644
--- a/win/ttkWinXPTheme.c
+++ b/win/ttkWinXPTheme.c
@@ -17,7 +17,7 @@
#define WINVER 0x0501 /* Requires Windows XP APIs */
-#include <tkWinInt.h>
+#include "tkWinInt.h"
#ifndef HAVE_UXTHEME_H
/* Stub for platforms that lack the XP theme API headers: */
int TtkXPTheme_Init(Tcl_Interp *interp, HWND hwnd) { return TCL_OK; }
@@ -148,12 +148,13 @@ XPThemeDeleteProc(void *clientData)
}
static int
-XPThemeEnabled(Ttk_Theme theme, void *clientData)
+XPThemeEnabled(
+ TCL_UNUSED(Ttk_Theme),
+ void *clientData)
{
XPThemeData *themeData = (XPThemeData *)clientData;
int active = themeData->procs->IsThemeActive();
int themed = themeData->procs->IsAppThemed();
- (void)theme;
return (active && themed);
}
@@ -500,13 +501,16 @@ FreeElementData(ElementData *elementData)
*/
static void GenericElementSize(
- void *clientData, void *elementRecord, Tk_Window tkwin,
- int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+ void *clientData,
+ TCL_UNUSED(void *), /* elementRecord */
+ Tk_Window tkwin,
+ int *widthPtr,
+ int *heightPtr,
+ Ttk_Padding *paddingPtr)
{
ElementData *elementData = (ElementData *)clientData;
HRESULT result;
SIZE size;
- (void)elementRecord;
if (!InitElementData(elementData, tkwin, 0))
return;
@@ -537,12 +541,15 @@ static void GenericElementSize(
}
static void GenericElementDraw(
- void *clientData, void *elementRecord, Tk_Window tkwin,
- Drawable d, Ttk_Box b, unsigned int state)
+ void *clientData,
+ TCL_UNUSED(void *), /* elementRecord */
+ Tk_Window tkwin,
+ Drawable d,
+ Ttk_Box b,
+ Ttk_State state)
{
ElementData *elementData = (ElementData *)clientData;
RECT rc;
- (void)elementRecord;
if (!InitElementData(elementData, tkwin, d)) {
return;
@@ -648,13 +655,16 @@ static Ttk_ElementSpec SpinboxArrowElementSpec = {
*/
static void ThumbElementDraw(
- void *clientData, void *elementRecord, Tk_Window tkwin,
- Drawable d, Ttk_Box b, unsigned int state)
+ void *clientData,
+ TCL_UNUSED(void *), /* elementRecord */
+ Tk_Window tkwin,
+ Drawable d,
+ Ttk_Box b,
+ Ttk_State state)
{
ElementData *elementData = (ElementData *)clientData;
unsigned stateId = Ttk_StateTableLookup(elementData->info->statemap, state);
RECT rc = BoxToRect(b);
- (void)elementRecord;
/*
* Don't draw the thumb if we are disabled.
@@ -729,8 +739,12 @@ static Ttk_ElementSpec PbarElementSpec =
*/
static void TabElementSize(
- 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)
{
Ttk_PositionSpec nbTabsStickBit = TTK_STICK_S;
TkMainInfo *mainInfoPtr = ((TkWindow *) tkwin)->mainPtr;
@@ -761,8 +775,12 @@ static void TabElementSize(
}
static void TabElementDraw(
- void *clientData, void *elementRecord, Tk_Window tkwin,
- Drawable d, Ttk_Box b, unsigned int state)
+ void *clientData,
+ TCL_UNUSED(void *), /* elementRecord */
+ Tk_Window tkwin,
+ Drawable d,
+ Ttk_Box b,
+ Ttk_State state)
{
Ttk_PositionSpec nbTabsStickBit = TTK_STICK_S;
TkMainInfo *mainInfoPtr = ((TkWindow *) tkwin)->mainPtr;
@@ -887,7 +905,7 @@ static Ttk_StateTable tvpglyph_statemap[] =
static void TreeIndicatorElementDraw(
void *clientData, void *elementRecord, Tk_Window tkwin,
- Drawable d, Ttk_Box b, unsigned int state)
+ Drawable d, Ttk_Box b, Ttk_State state)
{
if (!(state & TTK_STATE_LEAF)) {
GenericElementDraw(clientData,elementRecord,tkwin,d,b,state);
@@ -971,8 +989,8 @@ static void TextElementSize(
}
static void TextElementDraw(
- ClientData 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, Ttk_State state)
{
TextElement *element = elementRecord;
ElementData *elementData = clientData;
@@ -1222,7 +1240,7 @@ Ttk_CreateVsapiElement(
{
XPThemeData *themeData = (XPThemeData *)clientData;
ElementInfo *elementPtr = NULL;
- ClientData elementData;
+ void *elementData;
LPCWSTR className;
int partId = 0;
Ttk_StateTable *stateTable;
@@ -1256,7 +1274,8 @@ Ttk_CreateVsapiElement(
/* flags or padding */
if (objc > 3) {
- int i = 3, option = 0;
+ int i = 3;
+ int option = 0;
for (i = 3; i < objc; i += 2) {
int tmp = 0;
if (i == objc -1) {
@@ -1266,8 +1285,8 @@ Ttk_CreateVsapiElement(
Tcl_SetErrorCode(interp, "TTK", "VSAPI", "MISSING", NULL);
goto retErr;
}
- if (Tcl_GetIndexFromObjStruct(interp, objv[i], optionStrings,
- sizeof(char *), "option", 0, &option) != TCL_OK)
+ if (Tcl_GetIndexFromObj(interp, objv[i], optionStrings,
+ "option", 0, &option) != TCL_OK)
goto retErr;
switch (option) {
case O_PADDING:
@@ -1323,7 +1342,8 @@ Ttk_CreateVsapiElement(
/* convert a statemap into a state table */
if (objc > 2) {
Tcl_Obj **specs;
- int n,j,count, status = TCL_OK;
+ int n, j, count;
+ int status = TCL_OK;
if (Tcl_ListObjGetElements(interp, objv[2], &count, &specs) != TCL_OK)
goto retErr;
/* we over-allocate to ensure there is a terminating entry */
@@ -1434,7 +1454,7 @@ MODULE_SCOPE int TtkXPTheme_Init(Tcl_Interp *interp, HWND hwnd)
* New elements:
*/
for (infoPtr = ElementInfoTable; infoPtr->elementName != 0; ++infoPtr) {
- ClientData clientData = NewElementData(procs, infoPtr);
+ void *clientData = NewElementData(procs, infoPtr);
Ttk_RegisterElementSpec(
themePtr, infoPtr->elementName, infoPtr->elementSpec, clientData);
Ttk_RegisterCleanup(interp, clientData, DestroyElementData);