include/SDL_mouse.h
changeset 1895 c121d94672cb
parent 1358 c71e05b4dc2e
child 2242 313112f9ac5c
     1.1 --- a/include/SDL_mouse.h	Thu Jul 06 18:01:37 2006 +0000
     1.2 +++ b/include/SDL_mouse.h	Mon Jul 10 21:04:37 2006 +0000
     1.3 @@ -20,7 +20,11 @@
     1.4      slouken@libsdl.org
     1.5  */
     1.6  
     1.7 -/* Include file for SDL mouse event handling */
     1.8 +/**
     1.9 + * \file SDL_mouse.h
    1.10 + *
    1.11 + * Include file for SDL mouse event handling
    1.12 + */
    1.13  
    1.14  #ifndef _SDL_mouse_h
    1.15  #define _SDL_mouse_h
    1.16 @@ -32,43 +36,116 @@
    1.17  #include "begin_code.h"
    1.18  /* Set up for C function definitions, even when using C++ */
    1.19  #ifdef __cplusplus
    1.20 +/* *INDENT-OFF* */
    1.21  extern "C" {
    1.22 +/* *INDENT-ON* */
    1.23  #endif
    1.24  
    1.25 -typedef struct WMcursor WMcursor;	/* Implementation dependent */
    1.26 -typedef struct SDL_Cursor {
    1.27 -	SDL_Rect area;			/* The area of the mouse cursor */
    1.28 -	Sint16 hot_x, hot_y;		/* The "tip" of the cursor */
    1.29 -	Uint8 *data;			/* B/W cursor data */
    1.30 -	Uint8 *mask;			/* B/W cursor mask */
    1.31 -	Uint8 *save[2];			/* Place to save cursor area */
    1.32 -	WMcursor *wm_cursor;		/* Window-manager cursor */
    1.33 -} SDL_Cursor;
    1.34 +typedef struct SDL_Cursor SDL_Cursor;   /* Implementation dependent */
    1.35  
    1.36  /* Function prototypes */
    1.37 -/*
    1.38 - * Retrieve the current state of the mouse.
    1.39 +
    1.40 +/**
    1.41 + * \fn int SDL_GetNumMice(void)
    1.42 + *
    1.43 + * \brief Get the number of mouse input devices available.
    1.44 + *
    1.45 + * \sa SDL_SelectMouse()
    1.46 + */
    1.47 +extern DECLSPEC int SDLCALL SDL_GetNumMice(void);
    1.48 +
    1.49 +/**
    1.50 + * \fn int SDL_SelectMouse(int index)
    1.51 + *
    1.52 + * \brief Set the index of the currently selected mouse.
    1.53 + *
    1.54 + * \return The index of the previously selected mouse.
    1.55 + *
    1.56 + * \note You can query the currently selected mouse by passing an index of -1.
    1.57 + *
    1.58 + * \sa SDL_GetNumMice()
    1.59 + */
    1.60 +extern DECLSPEC int SDLCALL SDL_SelectMouse(int index);
    1.61 +
    1.62 +/**
    1.63 + * \fn SDL_WindowID SDL_GetMouseFocusWindow(void)
    1.64 + *
    1.65 + * \brief Get the window which currently has focus for the currently selected mouse.
    1.66 + */
    1.67 +extern DECLSPEC SDL_WindowID SDLCALL SDL_GetMouseFocusWindow(void);
    1.68 +
    1.69 +/**
    1.70 + * \fn int SDL_SetRelativeMouseMode(SDL_bool enabled)
    1.71 + *
    1.72 + * \brief Set relative mouse mode for the currently selected mouse.
    1.73 + *
    1.74 + * \param enabled Whether or not to enable relative mode
    1.75 + *
    1.76 + * \return 0 on success, or -1 if relative mode is not supported.
    1.77 + *
    1.78 + * While the mouse is in relative mode, the cursor is hidden, and the
    1.79 + * driver will try to report continuous motion in the current window.
    1.80 + * Only relative motion events will be delivered, the mouse position
    1.81 + * will not change.
    1.82 + *
    1.83 + * \note This function will flush any pending mouse motion.
    1.84 + *
    1.85 + * \sa SDL_GetRelativeMouseMode()
    1.86 + */
    1.87 +extern DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(SDL_bool enabled);
    1.88 +
    1.89 +/**
    1.90 + * \fn SDL_bool SDL_GetRelativeMouseMode()
    1.91 + *
    1.92 + * \brief Query whether relative mouse mode is enabled for the currently selected mouse.
    1.93 + *
    1.94 + * \sa SDL_SetRelativeMouseMode()
    1.95 + */
    1.96 +extern DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode();
    1.97 +
    1.98 +/**
    1.99 + * \fn Uint8 SDL_GetMouseState(int *x, int *y)
   1.100 + *
   1.101 + * \brief Retrieve the current state of the currently selected mouse.
   1.102 + *
   1.103   * The current button state is returned as a button bitmask, which can
   1.104   * be tested using the SDL_BUTTON(X) macros, and x and y are set to the
   1.105 - * current mouse cursor position.  You can pass NULL for either x or y.
   1.106 + * mouse cursor position relative to the focus window for the currently
   1.107 + * selected mouse.  You can pass NULL for either x or y.
   1.108   */
   1.109  extern DECLSPEC Uint8 SDLCALL SDL_GetMouseState(int *x, int *y);
   1.110  
   1.111 -/*
   1.112 - * Retrieve the current state of the mouse.
   1.113 +/**
   1.114 + * \fn Uint8 SDL_GetRelativeMouseState(int *x, int *y)
   1.115 + *
   1.116 + * \brief Retrieve the state of the currently selected mouse.
   1.117 + *
   1.118   * The current button state is returned as a button bitmask, which can
   1.119   * be tested using the SDL_BUTTON(X) macros, and x and y are set to the
   1.120   * mouse deltas since the last call to SDL_GetRelativeMouseState().
   1.121   */
   1.122  extern DECLSPEC Uint8 SDLCALL SDL_GetRelativeMouseState(int *x, int *y);
   1.123  
   1.124 -/*
   1.125 - * Set the position of the mouse cursor (generates a mouse motion event)
   1.126 +/**
   1.127 + * \fn void SDL_WarpMouseInWindow(SDL_WindowID windowID, int x, int y)
   1.128 + *
   1.129 + * \brief Moves the currently selected mouse to the given position within the window.
   1.130 + *
   1.131 + * \param windowID The window to move the mouse into, or 0 for the current mouse focus
   1.132 + * \param x The x coordinate within the window
   1.133 + * \param y The y coordinate within the window
   1.134 + *
   1.135 + * \note This function generates a mouse motion event
   1.136   */
   1.137 -extern DECLSPEC void SDLCALL SDL_WarpMouse(Uint16 x, Uint16 y);
   1.138 +extern DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_WindowID windowID,
   1.139 +                                                   int x, int y);
   1.140  
   1.141 -/*
   1.142 - * Create a cursor using the specified data and mask (in MSB format).
   1.143 +/**
   1.144 + * \fn SDL_Cursor *SDL_CreateCursor (const Uint8 * data, const Uint8 * mask, int w, int h, int hot_x, int hot_y)
   1.145 + *
   1.146 + * \brief Create a cursor for the currently selected mouse, using the
   1.147 + *        specified bitmap data and mask (in MSB format).
   1.148 + *
   1.149   * The cursor width must be a multiple of 8 bits.
   1.150   *
   1.151   * The cursor is created in black and white according to the following:
   1.152 @@ -78,34 +155,46 @@
   1.153   *  0     0       Transparent
   1.154   *  1     0       Inverted color if possible, black if not.
   1.155   *
   1.156 - * Cursors created with this function must be freed with SDL_FreeCursor().
   1.157 + * \sa SDL_FreeCursor()
   1.158   */
   1.159 -extern DECLSPEC SDL_Cursor * SDLCALL SDL_CreateCursor
   1.160 -		(Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y);
   1.161 +extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateCursor(const Uint8 * data,
   1.162 +                                                     const Uint8 * mask,
   1.163 +                                                     int w, int h, int hot_x,
   1.164 +                                                     int hot_y);
   1.165  
   1.166 -/*
   1.167 - * Set the currently active cursor to the specified one.
   1.168 - * If the cursor is currently visible, the change will be immediately 
   1.169 - * represented on the display.
   1.170 +/**
   1.171 + * \fn void SDL_SetCursor(SDL_Cursor * cursor)
   1.172 + *
   1.173 + * \brief Set the active cursor for the currently selected mouse.
   1.174 + *
   1.175 + * \note The cursor must have been created for the selected mouse.
   1.176   */
   1.177 -extern DECLSPEC void SDLCALL SDL_SetCursor(SDL_Cursor *cursor);
   1.178 +extern DECLSPEC void SDLCALL SDL_SetCursor(SDL_Cursor * cursor);
   1.179  
   1.180 -/*
   1.181 - * Returns the currently active cursor.
   1.182 +/**
   1.183 + * \fn SDL_Cursor *SDL_GetCursor(void)
   1.184 + *
   1.185 + * \brief Return the active cursor for the currently selected mouse.
   1.186   */
   1.187 -extern DECLSPEC SDL_Cursor * SDLCALL SDL_GetCursor(void);
   1.188 +extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetCursor(void);
   1.189  
   1.190 -/*
   1.191 - * Deallocates a cursor created with SDL_CreateCursor().
   1.192 +/**
   1.193 + * \fn void SDL_FreeCursor(SDL_Cursor * cursor)
   1.194 + *
   1.195 + * \brief Frees a cursor created with SDL_CreateCursor().
   1.196 + *
   1.197 + * \sa SDL_CreateCursor()
   1.198   */
   1.199 -extern DECLSPEC void SDLCALL SDL_FreeCursor(SDL_Cursor *cursor);
   1.200 +extern DECLSPEC void SDLCALL SDL_FreeCursor(SDL_Cursor * cursor);
   1.201  
   1.202 -/*
   1.203 - * Toggle whether or not the cursor is shown on the screen.
   1.204 - * The cursor start off displayed, but can be turned off.
   1.205 - * SDL_ShowCursor() returns 1 if the cursor was being displayed
   1.206 - * before the call, or 0 if it was not.  You can query the current
   1.207 - * state by passing a 'toggle' value of -1.
   1.208 +/**
   1.209 + * \fn int SDL_ShowCursor(int toggle)
   1.210 + *
   1.211 + * \brief Toggle whether or not the cursor is shown for the currently selected mouse.
   1.212 + *
   1.213 + * \param toggle 1 to show the cursor, 0 to hide it, -1 to query the current state.
   1.214 + *
   1.215 + * \return 1 if the cursor is shown, or 0 if the cursor is hidden.
   1.216   */
   1.217  extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle);
   1.218  
   1.219 @@ -113,15 +202,11 @@
   1.220     Button 1:	Left mouse button
   1.221     Button 2:	Middle mouse button
   1.222     Button 3:	Right mouse button
   1.223 -   Button 4:	Mouse wheel up	 (may also be a real button)
   1.224 -   Button 5:	Mouse wheel down (may also be a real button)
   1.225   */
   1.226  #define SDL_BUTTON(X)		(1 << ((X)-1))
   1.227  #define SDL_BUTTON_LEFT		1
   1.228  #define SDL_BUTTON_MIDDLE	2
   1.229  #define SDL_BUTTON_RIGHT	3
   1.230 -#define SDL_BUTTON_WHEELUP	4
   1.231 -#define SDL_BUTTON_WHEELDOWN	5
   1.232  #define SDL_BUTTON_LMASK	SDL_BUTTON(SDL_BUTTON_LEFT)
   1.233  #define SDL_BUTTON_MMASK	SDL_BUTTON(SDL_BUTTON_MIDDLE)
   1.234  #define SDL_BUTTON_RMASK	SDL_BUTTON(SDL_BUTTON_RIGHT)
   1.235 @@ -129,8 +214,12 @@
   1.236  
   1.237  /* Ends C function definitions when using C++ */
   1.238  #ifdef __cplusplus
   1.239 +/* *INDENT-OFF* */
   1.240  }
   1.241 +/* *INDENT-ON* */
   1.242  #endif
   1.243  #include "close_code.h"
   1.244  
   1.245  #endif /* _SDL_mouse_h */
   1.246 +
   1.247 +/* vi: set ts=4 sw=4 expandtab: */