AmendHub

Download

jcs

/

wikipedia

/

focusable.h

 

(View History)

jcs   focusable: Provide focusables_atexit to be called with _atexit() Latest amendment: 7 on 2022-08-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 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 bool (*menu)(struct focusable *focusable, short menu, short item);
33 void (*suspend)(struct focusable *focusable, EventRecord *event);
34 void (*resume)(struct focusable *focusable, EventRecord *event);
35 bool (*close)(struct focusable *focusable);
36 void (*atexit)(struct focusable *focusable);
37 };
38 extern struct focusable **focusables;
39 extern short nfocusables;
40
41 struct focusable * focusable_find(GrafPtr win);
42 struct focusable * focusable_focused(void);
43 void focusable_add(struct focusable *focusable);
44 bool focusable_show(struct focusable *focusable);
45 bool focusable_close(struct focusable *focusable);
46 void focusable_hide(struct focusable *focusable);
47 bool focusables_quit(void);
48 void focusables_atexit(void);
49
50 #endif