summaryrefslogtreecommitdiffstats
path: root/win/tkWinCursor.c
diff options
context:
space:
mode:
Diffstat (limited to 'win/tkWinCursor.c')
-rw-r--r--win/tkWinCursor.c90
1 files changed, 52 insertions, 38 deletions
diff --git a/win/tkWinCursor.c b/win/tkWinCursor.c
index 4a0f11a..dee3419 100644
--- a/win/tkWinCursor.c
+++ b/win/tkWinCursor.c
@@ -1,19 +1,19 @@
-/*
+/*
* tkWinCursor.c --
*
* This file contains Win32 specific cursor related routines.
*
* Copyright (c) 1995 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkWinInt.h"
/*
- * The following data structure contains the system specific data
- * necessary to control Windows cursors.
+ * The following data structure contains the system specific data necessary to
+ * control Windows cursors.
*/
typedef struct {
@@ -23,16 +23,20 @@ typedef struct {
} TkWinCursor;
/*
- * The HAND cursor is only present when WINVER >= 0x0500. If this is
- * not available at runtime, it will default to the unix-style cursor.
+ * The HAND cursor is only present when WINVER >= 0x0500. If this is not
+ * available at runtime, it will default to the unix-style cursor.
*/
+
#ifndef IDC_HAND
#define IDC_HAND MAKEINTRESOURCE(32649)
#endif
+#ifndef IDC_HELP
+#define IDC_HELP MAKEINTRESOURCE(32651)
+#endif
/*
- * The table below is used to map from the name of a predefined cursor
- * to its resource identifier.
+ * The table below is used to map from the name of a predefined cursor to its
+ * resource identifier.
*/
static struct CursorName {
@@ -59,6 +63,7 @@ static struct CursorName {
{"watch", IDC_WAIT},
{"xterm", IDC_IBEAM},
{"hand2", IDC_HAND},
+ {"question_arrow", IDC_HELP},
{NULL, 0}
};
@@ -74,10 +79,10 @@ static struct CursorName {
*
* TkGetCursorByName --
*
- * Retrieve a system cursor by name.
+ * Retrieve a system cursor by name.
*
* Results:
- * Returns a new cursor, or NULL on errors.
+ * Returns a new cursor, or NULL on errors.
*
* Side effects:
* Allocates a new cursor.
@@ -86,11 +91,11 @@ static struct CursorName {
*/
TkCursor *
-TkGetCursorByName(interp, tkwin, string)
- Tcl_Interp *interp; /* Interpreter to use for error reporting. */
- Tk_Window tkwin; /* Window in which cursor will be used. */
- Tk_Uid string; /* Description of cursor. See manual entry
- * for details on legal syntax. */
+TkGetCursorByName(
+ Tcl_Interp *interp, /* Interpreter to use for error reporting. */
+ Tk_Window tkwin, /* Window in which cursor will be used. */
+ Tk_Uid string) /* Description of cursor. See manual entry for
+ * details on legal syntax. */
{
struct CursorName *namePtr;
TkWinCursor *cursorPtr;
@@ -116,8 +121,8 @@ TkGetCursorByName(interp, tkwin, string)
if (argv[0][0] == '@') {
/*
- * Check for system cursor of type @<filename>, where only
- * the name is allowed. This accepts any of:
+ * Check for system cursor of type @<filename>, where only the name is
+ * allowed. This accepts any of:
* -cursor @/winnt/cursors/globe.ani
* -cursor @C:/Winnt/cursors/E_arrow.cur
* -cursor {@C:/Program\ Files/Cursors/bart.ani}
@@ -127,7 +132,7 @@ TkGetCursorByName(interp, tkwin, string)
if (Tcl_IsSafe(interp)) {
Tcl_AppendResult(interp, "can't get cursor from a file in",
- " a safe interpreter", (char *) NULL);
+ " a safe interpreter", NULL);
ckfree((char *) argv);
ckfree((char *) cursorPtr);
return NULL;
@@ -137,6 +142,7 @@ TkGetCursorByName(interp, tkwin, string)
/*
* Check for the cursor in the system cursor set.
*/
+
for (namePtr = cursorNames; namePtr->name != NULL; namePtr++) {
if (strcmp(namePtr->name, argv[0]) == 0) {
cursorPtr->winCursor = LoadCursor(NULL, namePtr->id);
@@ -146,9 +152,10 @@ TkGetCursorByName(interp, tkwin, string)
if (cursorPtr->winCursor == NULL) {
/*
- * Hmm, it is not in the system cursor set. Check to see
- * if it is one of our application resources.
+ * Hmm, it is not in the system cursor set. Check to see if it is
+ * one of our application resources.
*/
+
cursorPtr->winCursor = LoadCursor(Tk_GetHINSTANCE(), argv[0]);
} else {
cursorPtr->system = 1;
@@ -159,8 +166,7 @@ TkGetCursorByName(interp, tkwin, string)
ckfree((char *) cursorPtr);
badCursorSpec:
ckfree((char *) argv);
- Tcl_AppendResult(interp, "bad cursor spec \"", string, "\"",
- (char *) NULL);
+ Tcl_AppendResult(interp, "bad cursor spec \"", string, "\"", NULL);
return NULL;
} else {
ckfree((char *) argv);
@@ -185,15 +191,14 @@ TkGetCursorByName(interp, tkwin, string)
*/
TkCursor *
-TkCreateCursorFromData(tkwin, source, mask, width, height, xHot, yHot,
- fgColor, bgColor)
- Tk_Window tkwin; /* Window in which cursor will be used. */
- CONST char *source; /* Bitmap data for cursor shape. */
- CONST char *mask; /* Bitmap data for cursor mask. */
- int width, height; /* Dimensions of cursor. */
- int xHot, yHot; /* Location of hot-spot in cursor. */
- XColor fgColor; /* Foreground color for cursor. */
- XColor bgColor; /* Background color for cursor. */
+TkCreateCursorFromData(
+ Tk_Window tkwin, /* Window in which cursor will be used. */
+ CONST char *source, /* Bitmap data for cursor shape. */
+ CONST char *mask, /* Bitmap data for cursor mask. */
+ int width, int height, /* Dimensions of cursor. */
+ int xHot, int yHot, /* Location of hot-spot in cursor. */
+ XColor fgColor, /* Foreground color for cursor. */
+ XColor bgColor) /* Background color for cursor. */
{
return NULL;
}
@@ -216,9 +221,10 @@ TkCreateCursorFromData(tkwin, source, mask, width, height, xHot, yHot,
*/
void
-TkpFreeCursor(cursorPtr)
- TkCursor *cursorPtr;
+TkpFreeCursor(
+ TkCursor *cursorPtr)
{
+ /* TkWinCursor *winCursorPtr = (TkWinCursor *) cursorPtr; */
}
/*
@@ -226,8 +232,8 @@ TkpFreeCursor(cursorPtr)
*
* TkpSetCursor --
*
- * Set the global cursor. If the cursor is None, then use the
- * default Tk cursor.
+ * Set the global cursor. If the cursor is None, then use the default Tk
+ * cursor.
*
* Results:
* None.
@@ -239,8 +245,8 @@ TkpFreeCursor(cursorPtr)
*/
void
-TkpSetCursor(cursor)
- TkpCursor cursor;
+TkpSetCursor(
+ TkpCursor cursor)
{
HCURSOR hcursor;
TkWinCursor *winCursor = (TkWinCursor *) cursor;
@@ -255,3 +261,11 @@ TkpSetCursor(cursor)
SetCursor(hcursor);
}
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */