summaryrefslogtreecommitdiffstats
path: root/win/tkWinButton.c
diff options
context:
space:
mode:
Diffstat (limited to 'win/tkWinButton.c')
-rw-r--r--win/tkWinButton.c34
1 files changed, 16 insertions, 18 deletions
diff --git a/win/tkWinButton.c b/win/tkWinButton.c
index 4ed7574..b18a28b 100644
--- a/win/tkWinButton.c
+++ b/win/tkWinButton.c
@@ -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: tkWinButton.c,v 1.34.2.3 2010/03/12 13:02:36 nijtmans Exp $
+ * RCS: @(#) $Id: tkWinButton.c,v 1.42 2010/11/29 09:07:12 nijtmans Exp $
*/
#define OEMRESOURCE
@@ -88,10 +88,11 @@ static void InitBoxes(void);
* The class procedure table for the button widgets.
*/
-Tk_ClassProcs tkpButtonProcs = {
+const Tk_ClassProcs tkpButtonProcs = {
sizeof(Tk_ClassProcs), /* size */
TkButtonWorldChanged, /* worldChangedProc */
CreateProc, /* createProc */
+ NULL /* modalProc */
};
@@ -132,7 +133,7 @@ InitBoxes(void)
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- hrsrc = FindResource(module, "buttons", RT_BITMAP);
+ hrsrc = FindResource(module, TEXT("buttons"), RT_BITMAP);
if (hrsrc == NULL) {
Tcl_Panic("FindResource() failed for buttons bitmap resource, "
"resources in tk_base.rc must be linked into Tk dll or static executable");
@@ -149,7 +150,7 @@ InitBoxes(void)
&& !(tsdPtr->boxesPtr->biHeight % 2)) {
size = tsdPtr->boxesPtr->biSize + (1 << tsdPtr->boxesPtr->biBitCount)
* sizeof(RGBQUAD) + tsdPtr->boxesPtr->biSizeImage;
- newBitmap = (LPBITMAPINFOHEADER) ckalloc(size);
+ newBitmap = ckalloc(size);
memcpy(newBitmap, tsdPtr->boxesPtr, size);
tsdPtr->boxesPtr = newBitmap;
tsdPtr->boxWidth = tsdPtr->boxesPtr->biWidth / 4;
@@ -182,15 +183,12 @@ InitBoxes(void)
*/
void
-TkpButtonSetDefaults(
- Tk_OptionSpec *specPtr) /* Points to an array of option specs,
- * terminated by one with type
- * TK_OPTION_END. */
+TkpButtonSetDefaults()
{
int width = GetSystemMetrics(SM_CXEDGE);
- if (width > 0) {
- sprintf(tkDefButtonBorderWidth, "%d", width);
- }
+ if (width > 0) {
+ sprintf(tkDefButtonBorderWidth, "%d", width);
+ }
}
/*
@@ -215,7 +213,7 @@ TkpCreateButton(
{
WinButton *butPtr;
- butPtr = (WinButton *)ckalloc(sizeof(WinButton));
+ butPtr = ckalloc(sizeof(WinButton));
butPtr->hwnd = NULL;
return (TkButton *) butPtr;
}
@@ -245,15 +243,15 @@ CreateProc(
{
Window window;
HWND parent;
- char *class;
+ const TCHAR *class;
WinButton *butPtr = (WinButton *)instanceData;
parent = Tk_GetHWND(parentWin);
if (butPtr->info.type == TYPE_LABEL) {
- class = "STATIC";
+ class = TEXT("STATIC");
butPtr->style = SS_OWNERDRAW | WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS;
} else {
- class = "BUTTON";
+ class = TEXT("BUTTON");
butPtr->style = BS_OWNERDRAW | WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS;
}
butPtr->hwnd = CreateWindow(class, NULL, butPtr->style,
@@ -262,7 +260,7 @@ CreateProc(
SetWindowPos(butPtr->hwnd, HWND_TOP, 0, 0, 0, 0,
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
butPtr->oldProc = (WNDPROC)SetWindowLongPtr(butPtr->hwnd, GWLP_WNDPROC,
- (INT_PTR) ButtonProc);
+ (LONG_PTR) ButtonProc);
window = Tk_AttachHWND(tkwin, butPtr->hwnd);
return window;
@@ -292,7 +290,7 @@ TkpDestroyButton(
HWND hwnd = winButPtr->hwnd;
if (hwnd) {
- SetWindowLongPtr(hwnd, GWLP_WNDPROC, (INT_PTR) winButPtr->oldProc);
+ SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR) winButPtr->oldProc);
}
}
@@ -1278,7 +1276,7 @@ ButtonProc(
if (code != TCL_OK && code != TCL_CONTINUE
&& code != TCL_BREAK) {
Tcl_AddErrorInfo(interp, "\n (button invoke)");
- Tcl_BackgroundError(interp);
+ Tcl_BackgroundException(interp, code);
}
Tcl_Release((ClientData)interp);
}