1 /** \file   mousedrv.h
2  * \brief   Mouse handling for native GTK3 UI - header
3  *
4  * \author  Marco van den Heuvel <blackystardust68@yahoo.com>
5  */
6 
7 /* This file is part of VICE, the Versatile Commodore Emulator.
8  * See README for copyright notice.
9  *
10  *  This program is free software; you can redistribute it and/or modify
11  *  it under the terms of the GNU General Public License as published by
12  *  the Free Software Foundation; either version 2 of the License, or
13  *  (at your option) any later version.
14  *
15  *  This program is distributed in the hope that it will be useful,
16  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  *  GNU General Public License for more details.
19  *
20  *  You should have received a copy of the GNU General Public License
21  *  along with this program; if not, write to the Free Software
22  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23  *
24  */
25 
26 #ifndef VICE_MOUSEDRV_H
27 #define VICE_MOUSEDRV_H
28 
29 #include "types.h"
30 
31 #include "mouse.h"
32 
33 /** \brief Register callbacks for mouse button presses.
34  *  \param funcs The callbacks to register.
35  *  \return Zero on success, nonzero on failure. */
36 int mousedrv_resources_init(mouse_func_t *funcs);
37 
38 /** \brief Register and parse mouse-related command-line options.
39  *  \return Zero on success, nonzero on failure. */
40 int mousedrv_cmdline_options_init(void);
41 
42 /** \brief Initialize the mouse-handling subsystem. */
43 void mousedrv_init(void);
44 
45 /** \brief Called by the emulation core to announce the mouse has been
46  *         enabled or disabled. */
47 void mousedrv_mouse_changed(void);
48 
49 /** \brief Returns the current mouse X value.
50  *
51  *  This is a running total of mouse movements and does not
52  *  necessarily correspond to any particular screen position.
53  *
54  *  \return The current X value, in the range 0-65536.
55  */
56 int mousedrv_get_x(void);
57 
58 /** \brief Returns the current mouse Y value.
59  *
60  *  This is a running total of mouse movements and does not
61  *  necessarily correspond to any particular screen position.
62  *
63  *  \return The current Y value, in the range 0-65536.
64  */
65 int mousedrv_get_y(void);
66 
67 /** \brief Returns the last time the mouse position changed.
68  *
69  *  \note A button press or release is not a change.
70  *
71  *  \return The current X value, in the range 0-65536.
72  */
73 unsigned long mousedrv_get_timestamp(void);
74 
75 /** \brief Called by the UI event handler to announce the user has
76  *         pressed or released a button.
77  *  \param bnumber Which button was pressed or released.
78  *  \param state   Nonzero if button was pressed, zero if it was released.
79  */
80 void mouse_button(int bnumber, int state);
81 
82 /** \brief Called by the UI event handler to announce that the mouse
83  *         has moved.
84  *  \param dx Amount the mouse moved in the X direction
85  *  \param dy Amount the mouse moved in the Y direction
86  *  \todo  Determine what the actual units here are.
87  */
88 void mouse_move(float dx, float dy);
89 
90 #endif
91