include/SDL_video.h
changeset 8935 9d2f0236322b
parent 8931 44d8a2f4b431
child 8937 e5caf226926d
equal deleted inserted replaced
8934:57fe4bf1b84b 8935:9d2f0236322b
   789 extern DECLSPEC int SDLCALL SDL_GetWindowGammaRamp(SDL_Window * window,
   789 extern DECLSPEC int SDLCALL SDL_GetWindowGammaRamp(SDL_Window * window,
   790                                                    Uint16 * red,
   790                                                    Uint16 * red,
   791                                                    Uint16 * green,
   791                                                    Uint16 * green,
   792                                                    Uint16 * blue);
   792                                                    Uint16 * blue);
   793 
   793 
   794 /**
   794 typedef enum
   795  *  \brief Define regions of a window that can be used to drag it.
   795 {
   796  *
   796     SDL_HITTEST_NORMAL,  /**< Region is normal. No special properties. */
   797  *  Normally windows are dragged by decorations provided by the system
   797     SDL_HITTEST_DRAGGABLE,  /**< Region can drag entire window. */
   798  *  window manager (usually, a title bar), but for some apps, it makes sense
   798     /* !!! FIXME: resize enums here. */
   799  *  to drag them from somewhere else inside the window itself; for example,
   799 } SDL_HitTestResult;
   800  *  one might have a borderless window that wants to be draggable from any
   800 
   801  *  part, or simulate its own title bar, etc.
   801 typedef SDL_HitTestResult (SDLCALL *SDL_HitTest)(SDL_Window *win,
   802  *
   802                                                  const SDL_Point *area,
   803  *  This method designates pieces of a given window as "drag areas," which
   803                                                  void *data);
   804  *  will move the window when the user drags with his mouse, as if she had
   804 
   805  *  used the titlebar.
   805 /**
   806  *
   806  *  \brief Provide a callback that decides if a window region has special properties.
   807  *  You may specify multiple drag areas, disconnected or overlapping. This
   807  *
   808  *  function accepts an array of rectangles. Each call to this function will
   808  *  Normally windows are dragged and resized by decorations provided by the
   809  *  replace any previously-defined drag areas. To disable drag areas on a
   809  *  system window manager (a title bar, borders, etc), but for some apps, it
   810  *  window, call this function with a NULL array of zero elements.
   810  *  makes sense to drag them from somewhere else inside the window itself; for
   811  *
   811  *  example, one might have a borderless window that wants to be draggable
   812  *  Drag areas do not automatically resize. If your window changes dimensions
   812  *  from any part, or simulate its own title bar, etc.
   813  *  you should plan to re-call this function with new drag areas if
   813  *
   814  *  appropriate.
   814  *  This function lets the app provide a callback that designates pieces of
       
   815  *  a given window as special. This callback is run during event processing
       
   816  *  if we need to tell the OS to treat a region of the window specially; the
       
   817  *  use of this callback is known as "hit testing."
   815  *
   818  *
   816  *  Mouse input may not be delivered to your application if it is within
   819  *  Mouse input may not be delivered to your application if it is within
   817  *  a drag area; the OS will often apply that input to moving the window and
   820  *  a special area; the OS will often apply that input to moving the window or
   818  *  not deliver it to the application.
   821  *  resizing the window and not deliver it to the application.
       
   822  *
       
   823  *  Specifying NULL for a callback disables hit-testing. Hit-testing is
       
   824  *  disabled by default.
   819  *
   825  *
   820  *  Platforms that don't support this functionality will return -1
   826  *  Platforms that don't support this functionality will return -1
   821  *  unconditionally, even if you're attempting to disable drag areas.
   827  *  unconditionally, even if you're attempting to disable hit-testing.
   822  *
   828  *
   823  *  \param window The window to set drag areas on.
   829  *  Your callback may fire at any time.
   824  *  \param areas An array of SDL_Rects containing num_areas elements.
   830  *
   825  *  \param num_areas The number of elements in the areas parameter.
   831  *  \param window The window to set hit-testing on.
       
   832  *  \param callback The callback to call when doing a hit-test.
       
   833  *  \param callback_data An app-defined void pointer passed to the callback.
   826  *  \return 0 on success, -1 on error (including unsupported).
   834  *  \return 0 on success, -1 on error (including unsupported).
   827  */
   835  */
   828 extern DECLSPEC int SDLCALL SDL_SetWindowDragAreas(SDL_Window * window,
   836 extern DECLSPEC int SDLCALL SDL_SetWindowHitTest(SDL_Window * window,
   829                                                    const SDL_Rect *areas,
   837                                                  SDL_HitTest callback,
   830                                                    int num_areas);
   838                                                  void *callback_data);
   831 
   839 
   832 /**
   840 /**
   833  *  \brief Destroy a window.
   841  *  \brief Destroy a window.
   834  */
   842  */
   835 extern DECLSPEC void SDLCALL SDL_DestroyWindow(SDL_Window * window);
   843 extern DECLSPEC void SDLCALL SDL_DestroyWindow(SDL_Window * window);