forked from andlabs/ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathobjc_darwin.h
166 lines (144 loc) · 4.64 KB
/
objc_darwin.h
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
/* 8 july 2014 */
/* cgo will include this file multiple times */
#ifndef __GO_UI_OBJC_DARWIN_H__
#define __GO_UI_OBJC_DARWIN_H__
#define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_7
#define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_X_VERSION_10_7
#include <stdlib.h>
#include <stdint.h>
#include <objc/message.h>
#include <objc/objc.h>
#include <objc/runtime.h>
/* Objective-C -> Go types for max safety */
struct xsize {
intptr_t width;
intptr_t height;
};
struct xrect {
intptr_t x;
intptr_t y;
intptr_t width;
intptr_t height;
};
struct xalignment {
struct xrect rect;
intptr_t baseline;
};
struct xpoint {
intptr_t x;
intptr_t y;
};
/* uitask_darwin.m */
extern id getAppDelegate(void); /* used by the other .m files */
extern void uiinit(char **);
extern void uimsgloop(void);
extern void uistop(void);
extern void beginModal(void);
extern void endModal(void);
extern void issue(void *);
/* window_darwin.m */
extern id newWindow(intptr_t, intptr_t);
extern void windowSetDelegate(id, void *);
extern void windowSetContentView(id, id);
extern const char *windowTitle(id);
extern void windowSetTitle(id, const char *);
extern void windowShow(id);
extern void windowHide(id);
extern void windowClose(id);
extern id windowContentView(id);
extern void windowRedraw(id);
/* basicctrls_darwin.m */
#define textfieldWidth (96) /* according to Interface Builder */
extern id newButton(void);
extern void buttonSetDelegate(id, void *);
extern const char *buttonText(id);
extern void buttonSetText(id, char *);
extern id newCheckbox(void);
extern void checkboxSetDelegate(id, void *);
extern BOOL checkboxChecked(id);
extern void checkboxSetChecked(id, BOOL);
extern id finishNewTextField(id, BOOL);
extern id newTextField(void);
extern id newPasswordField(void);
extern void textfieldSetDelegate(id, void *);
extern const char *textfieldText(id);
extern void textfieldSetText(id, char *);
extern id textfieldOpenInvalidPopover(id, char *);
extern void textfieldCloseInvalidPopover(id);
extern BOOL textfieldEditable(id);
extern void textfieldSetEditable(id, BOOL);
extern id newLabel(void);
extern id newGroup(id);
extern const char *groupText(id);
extern void groupSetText(id, char *);
extern id newTextbox(void);
extern char *textboxText(id);
extern void textboxSetText(id, char *);
extern id newProgressBar(void);
extern intmax_t progressbarPercent(id);
extern void progressbarSetPercent(id, intmax_t);
/* container_darwin.m */
extern id newContainerView(void *);
extern void moveControl(id, intptr_t, intptr_t, intptr_t, intptr_t);
extern struct xrect containerBounds(id);
/* tab_darwin.m */
extern id newTab(void);
extern void tabAppend(id, char *, id);
extern struct xsize tabPreferredSize(id);
/* table_darwin.m */
enum {
colTypeText,
colTypeImage,
colTypeCheckbox,
};
extern id newTable(void);
extern void tableAppendColumn(id, intptr_t, char *, int, BOOL);
extern void tableUpdate(id);
extern void tableMakeDataSource(id, void *);
extern struct xsize tablePreferredSize(id);
extern intptr_t tableSelected(id);
extern void tableSelect(id, intptr_t);
/* control_darwin.m */
extern void parent(id, id);
extern void controlSetHidden(id, BOOL);
extern void setStandardControlFont(id);
extern void setSmallControlFont(id);
extern struct xsize controlPreferredSize(id);
extern id newScrollView(id, BOOL);
extern struct xalignment alignmentInfo(id, struct xrect);
extern struct xalignment alignmentInfoFrame(id);
/* area_darwin.h */
extern Class getAreaClass(void);
extern id newArea(void *);
extern BOOL drawImage(void *, intptr_t, intptr_t, intptr_t, intptr_t, intptr_t);
extern const uintptr_t cNSShiftKeyMask;
extern const uintptr_t cNSControlKeyMask;
extern const uintptr_t cNSAlternateKeyMask;
extern const uintptr_t cNSCommandKeyMask;
extern uintptr_t modifierFlags(id);
extern struct xpoint getTranslatedEventPoint(id, id);
extern intptr_t buttonNumber(id);
extern intptr_t clickCount(id);
extern uintptr_t pressedMouseButtons(void);
extern uintptr_t keyCode(id);
extern void areaRepaint(id, struct xrect);
extern void areaRepaintAll(id);
extern void areaTextFieldOpen(id, id, intptr_t, intptr_t);
extern void areaSetTextField(id, id);
extern void areaEndTextFieldEditing(id, id);
/* common_darwin.m */
extern void disableAutocorrect(id);
/* image_darwin.m */
extern id toTableImage(void *, intptr_t, intptr_t, intptr_t);
/* dialog_darwin.m */
extern void openFile(id, void *);
/* warningpopover_darwin.m */
extern id newWarningPopover(char *);
extern void warningPopoverShow(id, id);
/* spinbox_darwin.m */
extern id newSpinbox(void *, intmax_t, intmax_t);
extern id spinboxTextField(id);
extern id spinboxStepper(id);
extern intmax_t spinboxValue(id);
extern void spinboxSetValue(id, intmax_t);
#endif