HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RE_Cursor.h
Go to the documentation of this file.
1 #ifndef __RE_Cursor__
2 #define __RE_Cursor__
3 
4 #include "RE_API.h"
5 #include "RE_IDType.h"
6 
7 #include <UT/UT_Rect.h>
8 #include <UT/UT_UniquePtr.h>
9 #include <UT/UT_StringHolder.h>
10 #include <UT/UT_Vector2.h>
11 
12 #define RE_CURSOR_DEFAULT "iris"
13 
14 
15 #define RE_CURSOR_I_AM_BUSY "busy"
16 #define RE_CURSOR_I_AM_INTERRUPTABLE "interruptable"
17 #define RE_CURSOR_ARROW_RIGHT "arrowRight"
18 #define RE_CURSOR_ARROW_UP "arrowUp"
19 #define RE_CURSOR_ARROW_LEFT "arrowLeft"
20 #define RE_CURSOR_ARROW_DOWN "arrowDown"
21 #define RE_CURSOR_ARROW_ALL "arrowAll"
22 #define RE_CURSOR_ARROW_ALL_D "arrowAllDiagonal"
23 #define RE_CURSOR_ARROW_UP_DOWN "arrowUpDown"
24 #define RE_CURSOR_ARROW_LEFT_RIGHT "arrowLeftRight"
25 #define RE_CURSOR_ARROW_D1 "arrowD1"
26 #define RE_CURSOR_ARROW_D2 "arrowD2"
27 
28 #define RE_CURSOR_ARROW_NE "arrowNE"
29 #define RE_CURSOR_ARROW_NW "arrowNW"
30 #define RE_CURSOR_ARROW_SE "arrowSE"
31 #define RE_CURSOR_ARROW_SW "arrowSW"
32 
33 #define RE_CURSOR_ARROW_NWSE "arrowNWSE"
34 #define RE_CURSOR_ARROW_SWNE "arrowSWNE"
35 
36 #define RE_CURSOR_ARROW_KEYLOCK "arrowKeyLock"
37 
38 #define RE_CURSOR_CROSS "cross"
39 #define RE_CURSOR_CUT "cut"
40 #define RE_CURSOR_ARROW "arrow"
41 // WARNING: The following cursor (RE_CURSOR_IRIS) is hardcoded in
42 // BM_OpState.h
43 #define RE_CURSOR_IRIS "iris"
44 #define RE_CURSOR_X "X"
45 
46 #define RE_CORNER_BL "cornerBL"
47 #define RE_CORNER_BR "cornerBR"
48 #define RE_CORNER_TL "cornerTL"
49 #define RE_CORNER_TR "cornerTR"
50 
51 #define RE_CURSOR_DRAGDROP_ON "dragdropOn"
52 #define RE_CURSOR_DRAGDROP_OFF "dragdropOff"
53 
54 #define RE_CURSOR_HAND "hand"
55 #define RE_CURSOR_HAND_POINT "handpoint"
56 #define RE_CURSOR_QUESTION "question"
57 #define RE_CURSOR_SELECT_IRIS "select"
58 #define RE_CURSOR_TEXT "ibeam"
59 
60 // This is not used anywhere and the 'smallBusy.cursor'
61 // file is corrupt.
62 // #define RE_CURSOR_HOUR_GLASS "smallBusy"
63 
64 // Selection cursors
65 #define RE_CURSOR_SELECT_PREFIX "select_"
66 #define RE_CURSOR_SELECT_WHITE_REPLACE "select_white_replace"
67 #define RE_CURSOR_SELECT_WHITE_ADD "select_white_add"
68 #define RE_CURSOR_SELECT_WHITE_REMOVE "select_white_remove"
69 #define RE_CURSOR_SELECT_WHITE_TOGGLE "select_white_toggle"
70 #define RE_CURSOR_SELECT_BLACK_REPLACE "select_black_replace"
71 #define RE_CURSOR_SELECT_BLACK_ADD "select_black_add"
72 #define RE_CURSOR_SELECT_BLACK_REMOVE "select_black_remove"
73 #define RE_CURSOR_SELECT_BLACK_TOGGLE "select_black_toggle"
74 #define RE_CURSOR_SELECT_LASER_REPLACE "select_laser_replace"
75 #define RE_CURSOR_SELECT_LASER_ADD "select_laser_add"
76 #define RE_CURSOR_SELECT_LASER_REMOVE "select_laser_remove"
77 #define RE_CURSOR_SELECT_LASER_TOGGLE "select_laser_toggle"
78 
79 // Handle locate cursors
80 #define RE_CURSOR_HANDLE_LOCATE "handle_locate"
81 #define RE_CURSOR_HANDLE_LOCATE_X "handle_locate_x"
82 #define RE_CURSOR_HANDLE_LOCATE_Y "handle_locate_y"
83 #define RE_CURSOR_HANDLE_LOCATE_Z "handle_locate_z"
84 #define RE_CURSOR_HANDLE_LOCATE_XY "handle_locate_xy"
85 #define RE_CURSOR_HANDLE_LOCATE_YZ "handle_locate_yz"
86 #define RE_CURSOR_HANDLE_LOCATE_XZ "handle_locate_xz"
87 #define RE_CURSOR_HANDLE_LOCATE_XYZ "handle_locate_xyz"
88 #define RE_CURSOR_HANDLE_LOCATE_U "handle_locate_u"
89 #define RE_CURSOR_HANDLE_LOCATE_V "handle_locate_v"
90 #define RE_CURSOR_HANDLE_LOCATE_W "handle_locate_w"
91 #define RE_CURSOR_HANDLE_LOCATE_UV "handle_locate_uv"
92 
93 class RE_Server;
94 class QCursor;
95 
97 {
98 public:
99  RE_Cursor(const char *name);
100 
101  ~RE_Cursor();
102 
103  RE_IDType getDeviceId();
104 
105  // Return a rectangle enclosing the cursor, in relative device coordinates,
106  // where 0,0 is the origin.
107  UT_DimRect getCursorRect() const { return myRect; }
108 
109  const char *getName() const { return myName.c_str(); }
110 
111  /// Return the current mouse position in Houdini's UI coordinate system.
112  static void position(int &x, int &y);
113 
114 private:
115  void loadCursor_();
116  void loadSVGCursor_(const char *filename, int x, int y);
117  void loadOldCursor_(const char *filename);
118  void computeBoundingBox_();
119 
120 
121  UT_StringHolder myName;
122 
123  /// The Qt cursor object create for this cursor
124  UT_UniquePtr<QCursor> myQtCursor;
125 
126 #ifdef WIN32
127  /// The default cursor size on Windows
128  UT_Vector2i mySysCursorSize;
129 #endif
130 
131  /// The cursor rect
132  UT_DimRect myRect;
133 };
134 #endif
void * RE_IDType
Definition: RE_IDType.h:20
#define RE_API
Definition: RE_API.h:10
GLint y
Definition: glcorearb.h:102
const char * getName() const
Definition: RE_Cursor.h:109
GLuint const GLchar * name
Definition: glcorearb.h:785
GLint GLenum GLint x
Definition: glcorearb.h:408
UT_DimRect getCursorRect() const
Definition: RE_Cursor.h:107