AmendHub

Download

jcs

/

wallops

/

focusable.h

 

(View History)

jcs   focusable: Import newer version again Latest amendment: 44 on 2023-01-07

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 bool visible;
25 void *cookie;
26 bool modal;
27 short (*wait_type)(struct focusable *focusable);
28 void (*idle)(struct focusable *focusable, EventRecord *event);
29 void (*update)(struct focusable *focusable, EventRecord *event);
30 void (*key_down)(struct focusable *focusable, EventRecord *event);
31 void (*mouse_down)(struct focusable *focusable, EventRecord *event);
32 void (*resize)(struct focusable *focusable, EventRecord *event);
33 bool (*menu)(struct focusable *focusable, short menu, short item);
34 void (*suspend)(struct focusable *focusable, EventRecord *event);
35 void (*resume)(struct focusable *focusable, EventRecord *event);
36 bool (*close)(struct focusable *focusable);
37 bool (*quit)(struct focusable *focusable);
38 void (*atexit)(struct focusable *focusable);
39 };
40 extern struct focusable **focusables;
41 extern short nfocusables;
42
43 struct focusable * focusable_find(GrafPtr win);
44 struct focusable * focusable_focused(void);
45 void focusable_add(struct focusable *focusable);
46 bool focusable_show(struct focusable *focusable);
47 bool focusable_close(struct focusable *focusable);
48 void focusable_hide(struct focusable *focusable);
49 bool focusables_quit(void);
50
51 #endif