1 /* ---------------------------------------------------------------------- *
2  * mouse.h
3  * This file is part of lincity.
4  * Lincity is copyright (c) I J Peters 1995-1997, (c) Greg Sharp 1997-2001.
5  * ---------------------------------------------------------------------- */
6 #ifndef __mouse_h__
7 #define __mouse_h__
8 
9 #include "cliglobs.h"
10 
11 #define NUM_BUTTONS 3
12 
13 #define LC_MOUSE_LEFTBUTTON	1
14 #define LC_MOUSE_MIDDLEBUTTON	2
15 #define LC_MOUSE_RIGHTBUTTON	3
16 
17 /* Mouse event flags */
18 #define LC_MOUSE_RELEASE        0x10
19 #define LC_MOUSE_PRESS          0x20
20 
21 /* Public interface variables and structures */
22 
23 /* Mouse registry stuff.  */
24 
25 struct mouse_handle_struct
26 {
27     Rect * r;
28     void (* handler)(int, int, int);
29     struct mouse_handle_struct * prev;
30     struct mouse_handle_struct * next;
31 };
32 
33 typedef struct mouse_handle_struct Mouse_Handle;
34 
35 /*
36 mappoint_[xy] are non-zero if the button was pressed inside the main window.
37 x and y are pixel coordinates.
38 r_* are values for when the button was released.
39 */
40 struct mouse_button_struct {
41   int mappoint_x, mappoint_y;
42   int x, y;
43   int r_mappoint_x, r_mappoint_y;
44   int r_x, r_y;
45   int pressed;
46 };
47 
48 /* Public functions */
49 
50 void mouse_setup (void);
51 void init_mouse_registry();
52 int mouse_handle_click(int x, int y, int button);
53 
54 Mouse_Handle * mouse_register(Rect * r, void (*handler)(int, int, int));
55 void mouse_unregister(Mouse_Handle * mhandle);
56 
57 void cs_mouse_handler (int enc_button, int dx, int dy);
58 
59 void cs_mouse_handler (int, int, int);
60 void move_mouse (int, int);
61 void do_mouse_main_win (int, int, int);
62 
63 void drag_screen (void);
64 
65 /* Private functions */
66 int cmp(int, int);
67 
68 /* WCK: These were in lin-city.h */
69 
70 void no_credit_build_msg (int selected_type);
71 void hide_mouse (void);
72 void redraw_mouse (void);
73 void draw_square_mouse (int, int, int);
74 void hide_square_mouse (void);
75 void redraw_square_mouse (void);
76 void draw_normal_mouse (int, int);
77 void hide_normal_mouse (void);
78 void redraw_normal_mouse (void);
79 void do_mouse_select_buttons (int, int, int);
80 void do_select_button (int, int);
81 void highlight_select_button (int);
82 void unhighlight_select_button (int);
83 void do_mouse_other_buttons (int, int, int);
84 void bulldoze_area (int, int);
85 void fire_area (int, int);
86 void do_market_cb_mouse (int, int);
87 void do_port_cb_mouse (int, int);
88 int is_real_river (int, int);
89 void select_pause (void);
90 void select_fast (void);
91 void select_medium (void);
92 void select_slow (void);
93 void choose_residence (void);
94 void do_multi_transport (int, int, int);
95 int mt_draw (int, int, int); /* wcoreyk */
96 void draw_module_cost (int grp);
97 
98 
99 
100 
101 #endif
102 
103