diff engine/core/video/cursor.h @ 255:51cc05d862f2

Merged editor_rewrite branch to trunk. This contains changes that may break compatibility against existing clients. For a list of changes that may affect your client, see: http://wiki.fifengine.de/Changes_to_pychan_and_FIFE_in_editor_rewrite_branch
author cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
date Mon, 08 Jun 2009 16:00:02 +0000
parents 90005975cdbb
children a8bb57884723
line wrap: on
line diff
--- a/engine/core/video/cursor.h	Wed Jun 03 19:29:52 2009 +0000
+++ b/engine/core/video/cursor.h	Mon Jun 08 16:00:02 2009 +0000
@@ -31,6 +31,8 @@
 // First block: files included from the FIFE root src directory
 // Second block: files included from the same folder
 
+struct SDL_Cursor;
+
 namespace FIFE {
 
 	class ImagePool;
@@ -49,7 +51,34 @@
 		CURSOR_IMAGE,
 		CURSOR_ANIMATION
 	};
-	
+
+	/** Defines some common native cursors between platforms.
+	  * In addition to these, you can use the values in:
+	  * Windows: http://msdn.microsoft.com/en-us/library/ms648391(VS.85).aspx
+	  * X11: http://fife.pastebin.com/f5b89dd6b
+	  */
+	enum NativeCursor {
+		// Start on 1000000 to avoid id-clashes with X11 and windows
+		NC_ARROW = 1000000, // Standard arrow
+		NC_IBEAM,			// I-beam for text selection
+		NC_WAIT,			// Hourglass
+		NC_CROSS,			// Crosshair
+		NC_UPARROW,			// Vertical arrow
+		NC_RESIZENW,		// Cursor for resize in northwest corner
+		NC_RESIZESE,		// 
+		NC_RESIZESW,		// 
+		NC_RESIZENE,		// 
+		NC_RESIZEE,			// 
+		NC_RESIZEW,			// 
+		NC_RESIZEN,			// 
+		NC_RESIZES,			// 
+		NC_RESIZEALL,		// Four-pointed arrow pointing north, south, east, and west
+		NC_NO,				// Slashed circle
+		NC_HAND,			// Hand. Common for links, etc.
+		NC_APPSTARTING,		// Standard arrow and small hourglass
+		NC_HELP				// Arrow and question mark
+	};
+
 	/**  Cursor class manages mouse cursor handling
 	 */
 	class Cursor {
@@ -68,7 +97,7 @@
 
 		/** Sets the current mouse cursor type and possible pool value
 		 * @param ctype cursor type
-		 * @param cursor_id pool id for the cursor (either image or animation)
+		 * @param cursor_id Pool id to image or animation. For native cursors, this is the resource id to native cursor, or one of the values in NativeCursor
 		 */
 		void set(MouseCursorType ctype, unsigned int cursor_id=0);
 			
@@ -94,13 +123,29 @@
 		/** Gets the current mouse cursor pool id
 		 */
 		unsigned int getDragId() const { return m_drag_id; }
-		
+
+	protected:
+		/** Sets the cursor to a native type.
+		  * @param cursor_id Resource id to native cursor, or one of the values in NativeCursor
+		  */
+		void setNativeCursor(unsigned int cursor_id);
+
+		/** To get some consistancy between platforms, this function checks
+		  * if cursor_id matches any of the values in NativeCursor, and
+		  * returns the resource ID specific to the running platform.
+		  * If no match is found, cursor_id is returned.
+		  *
+		  * @param One of the values in NativeCursor
+		  */
+		unsigned int getNativeId(unsigned int cursor_id);
 	
 	private:
 		unsigned int m_cursor_id;
 		unsigned int m_drag_id;
 		MouseCursorType m_cursor_type;
 		MouseCursorType m_drag_type;
+
+		SDL_Cursor* m_native_cursor;
 		
 		RenderBackend* m_renderbackend;
 		ImagePool* m_imgpool;