AmendHub

Download

jcs

/

detritus

/

focusable.h

 

(View History)

jcs   focusable: Add mouse_move callback Latest amendment: 50 on 2024-11-21

1 /*
2 * Copyright (c) 2021-2022 joshua stein <jcs@jcs.org>
3 *
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17 #ifndef __FOCUSABLE_H__
18 #define __FOCUSABLE_H__
19
20 #include "util.h"
21
22 struct focusable {
23 WindowPtr win;
24 short id;
25 bool visible;
26 void *cookie;
27 bool modal;
28 short (*wait_type)(struct focusable *focusable);
29 void (*idle)(struct focusable *focusable, EventRecord *event);
30 void (*update)(struct focusable *focusable, EventRecord *event);
31 void (*key_down)(struct focusable *focusable, EventRecord *event);
32 void (*mouse_down)(struct focusable *focusable, EventRecord *event);
33 void (*mouse_move)(struct focusable *focusable, EventRecord *event);
34 void (*resize)(struct focusable *focusable, EventRecord *event);
35 bool (*menu)(struct focusable *focusable, short menu, short item);
36 void (*update_menu)(struct focusable *focusable);
37 void (*suspend)(struct focusable *focusable, EventRecord *event);
38 void (*resume)(struct focusable *focusable, EventRecord *event);
39 bool (*close)(struct focusable *focusable);
40 bool (*quit)(struct focusable *focusable);
41 void (*atexit)(struct focusable *focusable);
42 };
43 extern struct focusable **focusables;
44 extern short nfocusables;
45
46 struct focusable * focusable_find(GrafPtr win);
47 struct focusable * focusable_focused(void);
48 void focusable_add(struct focusable *focusable);
49 bool focusable_show(struct focusable *focusable);
50 bool focusable_close(struct focusable *focusable);
51 void focusable_hide(struct focusable *focusable);
52 bool focusables_quit(void);
53
54 #endif