summaryrefslogtreecommitdiff
path: root/numlib/ui.h
blob: a282c26e4e82cf4e5f38a6d63bdfbc8c1599d6ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63

#ifndef __UI_H__

/*
 * Do OS specific setup for using UI windows.
 * Include this only in file with main().
 *
 * Copyright 2014 Graeme W. Gill
 * All rights reserved.
 *
 * This material is licenced under the GNU AFFERO GENERAL PUBLIC LICENSE Version 3 :-
 * see the License.txt file for licencing details.
 *
 * Typically we need to set things up and then call the
 * "normal" main, called "uimain" in ArgyllCMS utils.
 */

/* Because linkers are dumb (they pass over a library containing main() */
/* and then complain that there is no entry point!), we force linking */
/* of libui if ui.h gets #included. */
extern int ui_initialized;		
static int *pui_initialized = &ui_initialized;

/* Call this if we decide we are actually going to display */
/* something in the GUI */
void ui_UsingGUI();

#ifdef UNIX
# ifdef __APPLE__

extern pthread_t ui_thid;		/* Thread ID of main thread running io run loop */
extern pthread_t ui_main_thid;	/* Thread ID of thread running application main() */

/* Run a function in the main thread and return when it is complete */
void ui_runInMainThreadAndWait(void *cntx, void (*function)(void *context));

/* We are about to change the UI */
void ui_aboutToWait();

/* Wait until we are sure our UI change is complete */
void ui_waitForEvents();

#ifndef __UI_C__
# define main uimain
#endif

#else	/* Linux etc. */

#endif	/* Linux etc. */
#endif	/* UNIX */

#ifdef NT

#ifdef NEVER 	/* Not practical - see ui.c for full explanation */
#ifndef __UI_C__
# define main uimain
#endif
#endif

#endif

#define __UI_H__
#endif /* __UI_H__ */