Index: intern/ghost/GHOST_Types.h =================================================================== --- intern/ghost/GHOST_Types.h (revision 20762) +++ intern/ghost/GHOST_Types.h (working copy) @@ -166,6 +166,7 @@ GHOST_kStandardCursorCycle, GHOST_kStandardCursorSpray, GHOST_kStandardCursorWait, + GHOST_kStandardCursorHand, GHOST_kStandardCursorText, GHOST_kStandardCursorCrosshair, GHOST_kStandardCursorUpDown, Index: intern/ghost/intern/GHOST_WindowCarbon.cpp =================================================================== --- intern/ghost/intern/GHOST_WindowCarbon.cpp (revision 20762) +++ intern/ghost/intern/GHOST_WindowCarbon.cpp (working copy) @@ -616,6 +616,7 @@ GCMAP( GHOST_kStandardCursorCycle, kThemeArrowCursor); GCMAP( GHOST_kStandardCursorSpray, kThemeArrowCursor); GCMAP( GHOST_kStandardCursorWait, kThemeWatchCursor); + GCMAP( GHOST_kStandardCursorHand, kThemePointingHandCursor); GCMAP( GHOST_kStandardCursorText, kThemeIBeamCursor); GCMAP( GHOST_kStandardCursorCrosshair, kThemeCrossCursor); GCMAP( GHOST_kStandardCursorUpDown, kThemeClosedHandCursor); Index: intern/ghost/intern/GHOST_WindowWin32.cpp =================================================================== --- intern/ghost/intern/GHOST_WindowWin32.cpp (revision 20762) +++ intern/ghost/intern/GHOST_WindowWin32.cpp (working copy) @@ -597,6 +597,7 @@ case GHOST_kStandardCursorCycle: id = IDC_NO; break; // Slashed circle case GHOST_kStandardCursorSpray: id = IDC_SIZEALL; break; // Four-pointed arrow pointing north, south, east, and west case GHOST_kStandardCursorWait: id = IDC_WAIT; break; // Hourglass + case GHOST_kStandardCursorHand: id = IDC_HAND; break; // Hand Cursor case GHOST_kStandardCursorText: id = IDC_IBEAM; break; // I-beam case GHOST_kStandardCursorCrosshair: id = IDC_CROSS; break; // Crosshair case GHOST_kStandardCursorUpDown: id = IDC_SIZENS; break; // Double-pointed arrow pointing north and south Index: intern/ghost/intern/GHOST_WindowX11.cpp =================================================================== --- intern/ghost/intern/GHOST_WindowX11.cpp (revision 20762) +++ intern/ghost/intern/GHOST_WindowX11.cpp (working copy) @@ -937,6 +937,7 @@ GtoX(GHOST_kStandardCursorCycle, XC_exchange); break; GtoX(GHOST_kStandardCursorSpray, XC_spraycan); break; GtoX(GHOST_kStandardCursorWait, XC_watch); break; + GtoX{GHOST_kStandardCursorHand, XC_hand1); break; GtoX(GHOST_kStandardCursorText, XC_xterm); break; GtoX(GHOST_kStandardCursorCrosshair, XC_crosshair); break; GtoX(GHOST_kStandardCursorUpDown, XC_sb_v_double_arrow); break; Index: source/blender/include/BIF_graphics.h =================================================================== --- source/blender/include/BIF_graphics.h (revision 20762) +++ source/blender/include/BIF_graphics.h (working copy) @@ -38,7 +38,8 @@ enum { CURSOR_VPAINT, CURSOR_FACESEL, - CURSOR_WAIT, + CURSOR_WAIT, + CURSOR_HAND, CURSOR_EDIT, CURSOR_X_MOVE, CURSOR_Y_MOVE, Index: source/blender/include/BIF_screen.h =================================================================== --- source/blender/include/BIF_screen.h (revision 20762) +++ source/blender/include/BIF_screen.h (working copy) @@ -64,6 +64,7 @@ void init_screen_cursors(void); void set_timecursor(int nr); void waitcursor(int val); +void handcursor(int val); void wich_cursor(struct ScrArea *sa); void setcursor_space(int spacetype, short cur); void set_g_activearea(struct ScrArea *sa); Index: source/blender/python/api2_2x/doc/Window.py =================================================================== --- source/blender/python/api2_2x/doc/Window.py (revision 20762) +++ source/blender/python/api2_2x/doc/Window.py (working copy) @@ -224,6 +224,66 @@ @param pivot: constant - Window.PivotTypes """ +def HandCursor (bool): + """ + Set cursor to pointing hand or back to normal mode. + @type bool: int (bool) + @param bool: if nonzero the cursor is set to pointing hand mode, otherwise + to normal mode. + @note: when the script finishes execution, the cursor is set to normal by + Blender itself. + + Example: + import Blender + from Blender.BGL import * + from Blender import Draw + from Blender import Window + + text = "Hand Cursor (click to quit)" + len = Draw.GetStringWidth(text) + + #draws the gui + def gui(): + glClear(GL_COLOR_BUFFER_BIT) # clear the color buffer + glColor3f(0.5,0.5,0.0) # button color + glRecti(30, 50, 60+len, 67) # drawing the button + glColor3f(1,1,1) # setting the text color + glRasterPos2i(40,55) # move the drawing cursor + Draw.Text(text) # draw the text + + # event handler + def ev(evt, val): + if evt == Draw.ESCKEY: + Draw.Exit() # Esc quits the script + elif not val: return + elif evt == Draw.MOUSEX or evt == Draw.MOUSEY: # mouse movement + x,y = Window.GetMouseCoords() # get the mouse coords + if isButton(x,y) == 1: # is here our button + Window.HandCursor(1) # if it is then set the hand cursor + elif evt == Draw.LEFTMOUSE: # mouse left click + x,y = Window.GetMouseCoords() # get the mouse coords + if isButton(x,y) == 1: # is here our button + Draw.Exit() # if it is, then quit + + #evaluate if the x,y cordinates belong to our button + def isButton(x,y): + global len + id = Blender.Window.GetAreaID() # id of our script window + dic = Blender.Window.GetScreenInfo(-1,'total') # get the info of the windows + for win in dic: + if win['id'] == id: # this is our window + winx = win['vertices'][0] # x position of our script window + winy = win['vertices'][1] # y position of our script window + # is the mouse inside the button area? + if x>=(winx+30) and x<=(winx+len+60) and y>=(winy+78) and y<=(winy+96): + return 1 + else: + return 0 + return 0 # to make sure there is a return value + + Draw.Register(gui, ev, None) + """ + def WaitCursor (bool): """ Set cursor to wait or back to normal mode. Index: source/blender/python/api2_2x/Window.c =================================================================== --- source/blender/python/api2_2x/Window.c (revision 20762) +++ source/blender/python/api2_2x/Window.c (working copy) @@ -85,6 +85,7 @@ static PyObject *M_Window_GetCursorPos( PyObject * self ); static PyObject *M_Window_SetCursorPos( PyObject * self, PyObject * args ); static PyObject *M_Window_WaitCursor( PyObject * self, PyObject * args ); +static PyObject *M_Window_HandCursor( PyObject * self, PyObject * args ); static PyObject *M_Window_GetViewVector( PyObject * self ); static PyObject *M_Window_GetActiveLayer( PyObject * self ); static PyObject *M_Window_SetActiveLayer( PyObject * self, PyObject * args ); @@ -174,6 +175,9 @@ static char M_Window_WaitCursor_doc[] = "(bool) - Set cursor to wait mode (nonzero bool) or normal mode (0)."; +static char M_Window_HandCursor_doc[] = + "(bool) - Set cursor to hand mode (nonzero bool) or normal mode (0)."; + static char M_Window_GetViewVector_doc[] = "() - Get the current 3d view vector as a list of three floats [x,y,z]."; @@ -338,6 +342,8 @@ M_Window_SetCursorPos_doc}, {"WaitCursor", M_Window_WaitCursor, METH_VARARGS, M_Window_WaitCursor_doc}, + {"HandCursor", M_Window_HandCursor, METH_VARARGS, + M_Window_HandCursor_doc}, {"GetViewVector", ( PyCFunction ) M_Window_GetViewVector, METH_NOARGS, M_Window_GetViewVector_doc}, {"GetActiveLayer", ( PyCFunction ) M_Window_GetActiveLayer, METH_NOARGS, @@ -726,6 +732,19 @@ Py_RETURN_NONE; } +static PyObject *M_Window_HandCursor( PyObject * self, PyObject * args ) +{ + int bool; + + if( !PyArg_ParseTuple( args, "i", &bool ) ) + return EXPP_ReturnPyObjError( PyExc_TypeError, + "expected bool (0 or 1) or nothing as argument" ); + + handcursor( bool ); /* nonzero bool sets, zero unsets */ + + Py_RETURN_NONE; +} + static PyObject *M_Window_WaitCursor( PyObject * self, PyObject * args ) { int bool; Index: source/blender/src/editscreen.c =================================================================== --- source/blender/src/editscreen.c (revision 20762) +++ source/blender/src/editscreen.c (working copy) @@ -159,6 +159,17 @@ } } +void handcursor(int val) +{ + if(G.curscreen) { + if(val) { + set_cursor(CURSOR_HAND); + } else { + screen_set_cursor(G.curscreen); + } + } +} + void waitcursor(int val) { if(G.curscreen) { Index: source/blender/src/ghostwinlay.c =================================================================== --- source/blender/src/ghostwinlay.c (revision 20762) +++ source/blender/src/ghostwinlay.c (working copy) @@ -211,6 +211,7 @@ case CURSOR_VPAINT: return GHOST_kStandardCursorRightArrow; case CURSOR_FACESEL: return GHOST_kStandardCursorRightArrow; case CURSOR_WAIT: return GHOST_kStandardCursorWait; + case CURSOR_HAND: return GHOST_kStandardCursorHand; case CURSOR_EDIT: return GHOST_kStandardCursorCrosshair; case CURSOR_HELP: #ifdef __APPLE__