2014-07-08 15:47:28 -05:00
|
|
|
/* 8 july 2014 */
|
|
|
|
|
|
|
|
/* cgo will include this file multiple times */
|
|
|
|
#ifndef __GO_UI_OBJC_DARWIN_H__
|
|
|
|
#define __GO_UI_OBJC_DARWIN_H__
|
|
|
|
|
2014-07-20 20:22:10 -05:00
|
|
|
#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
|
|
|
|
|
2014-07-08 15:47:28 -05:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <objc/message.h>
|
|
|
|
#include <objc/objc.h>
|
|
|
|
#include <objc/runtime.h>
|
|
|
|
|
2014-08-09 20:34:56 -05:00
|
|
|
/* 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;
|
|
|
|
};
|
|
|
|
|
2014-07-08 15:47:28 -05:00
|
|
|
/* uitask_darwin.m */
|
|
|
|
extern id getAppDelegate(void); /* used by the other .m files */
|
2014-08-10 21:24:08 -05:00
|
|
|
extern void uiinit(char **);
|
2014-07-08 15:47:28 -05:00
|
|
|
extern void uimsgloop(void);
|
2014-07-13 20:31:13 -05:00
|
|
|
extern void uistop(void);
|
2014-08-19 12:09:26 -05:00
|
|
|
extern void beginModal(void);
|
|
|
|
extern void endModal(void);
|
2014-07-08 15:47:28 -05:00
|
|
|
extern void issue(void *);
|
|
|
|
|
|
|
|
/* window_darwin.m */
|
|
|
|
extern id newWindow(intptr_t, intptr_t);
|
2014-07-08 16:43:50 -05:00
|
|
|
extern void windowSetDelegate(id, void *);
|
2014-08-04 16:28:53 -05:00
|
|
|
extern void windowSetContentView(id, id);
|
2014-07-08 15:47:28 -05:00
|
|
|
extern const char *windowTitle(id);
|
|
|
|
extern void windowSetTitle(id, const char *);
|
|
|
|
extern void windowShow(id);
|
|
|
|
extern void windowHide(id);
|
|
|
|
extern void windowClose(id);
|
2014-07-25 22:11:41 -05:00
|
|
|
extern id windowContentView(id);
|
2014-07-23 16:09:08 -05:00
|
|
|
extern void windowRedraw(id);
|
2014-07-08 15:47:28 -05:00
|
|
|
|
2014-07-30 11:50:45 -05:00
|
|
|
/* basicctrls_darwin.m */
|
2014-08-25 15:07:35 -05:00
|
|
|
#define textfieldWidth (96) /* according to Interface Builder */
|
2014-07-22 22:32:32 -05:00
|
|
|
extern id newButton(void);
|
2014-07-17 11:02:39 -05:00
|
|
|
extern void buttonSetDelegate(id, void *);
|
2014-07-16 12:25:09 -05:00
|
|
|
extern const char *buttonText(id);
|
|
|
|
extern void buttonSetText(id, char *);
|
2014-07-22 22:32:32 -05:00
|
|
|
extern id newCheckbox(void);
|
2014-08-03 19:08:25 -05:00
|
|
|
extern void checkboxSetDelegate(id, void *);
|
2014-07-22 22:32:32 -05:00
|
|
|
extern BOOL checkboxChecked(id);
|
|
|
|
extern void checkboxSetChecked(id, BOOL);
|
2014-08-22 21:32:31 -05:00
|
|
|
extern id finishNewTextField(id, BOOL);
|
2014-07-26 08:20:33 -05:00
|
|
|
extern id newTextField(void);
|
|
|
|
extern id newPasswordField(void);
|
2014-08-20 14:26:48 -05:00
|
|
|
extern void textfieldSetDelegate(id, void *);
|
2014-08-27 12:17:31 -05:00
|
|
|
extern const char *textfieldText(id);
|
|
|
|
extern void textfieldSetText(id, char *);
|
2014-08-20 16:08:47 -05:00
|
|
|
extern id textfieldOpenInvalidPopover(id, char *);
|
|
|
|
extern void textfieldCloseInvalidPopover(id);
|
2014-07-29 12:48:31 -05:00
|
|
|
extern id newLabel(void);
|
2014-08-15 23:37:38 -05:00
|
|
|
extern id newGroup(id);
|
|
|
|
extern const char *groupText(id);
|
|
|
|
extern void groupSetText(id, char *);
|
2014-10-24 15:38:23 -05:00
|
|
|
extern id newTextbox(void);
|
2014-10-24 15:11:53 -05:00
|
|
|
extern char *textboxText(id);
|
|
|
|
extern void textboxSetText(id, char *);
|
2014-07-16 12:25:09 -05:00
|
|
|
|
2014-08-04 16:46:08 -05:00
|
|
|
/* container_darwin.m */
|
|
|
|
extern id newContainerView(void *);
|
2014-07-17 10:24:58 -05:00
|
|
|
extern void moveControl(id, intptr_t, intptr_t, intptr_t, intptr_t);
|
2014-10-18 16:03:07 -05:00
|
|
|
extern struct xrect containerBounds(id);
|
2014-07-17 10:24:58 -05:00
|
|
|
|
2014-08-02 21:35:58 -05:00
|
|
|
/* tab_darwin.m */
|
2014-08-04 16:07:06 -05:00
|
|
|
extern id newTab(void);
|
2014-08-04 16:03:07 -05:00
|
|
|
extern void tabAppend(id, char *, id);
|
2014-08-09 20:34:56 -05:00
|
|
|
extern struct xsize tabPreferredSize(id);
|
2014-07-25 22:11:41 -05:00
|
|
|
|
2014-07-29 09:32:49 -05:00
|
|
|
/* table_darwin.m */
|
2014-08-16 20:49:43 -05:00
|
|
|
enum {
|
|
|
|
colTypeText,
|
|
|
|
colTypeImage,
|
2014-08-17 09:13:28 -05:00
|
|
|
colTypeCheckbox,
|
2014-08-16 20:49:43 -05:00
|
|
|
};
|
2014-07-29 09:32:49 -05:00
|
|
|
extern id newTable(void);
|
2014-08-17 09:13:28 -05:00
|
|
|
extern void tableAppendColumn(id, intptr_t, char *, int, BOOL);
|
2014-07-29 09:32:49 -05:00
|
|
|
extern void tableUpdate(id);
|
2014-07-29 09:54:52 -05:00
|
|
|
extern void tableMakeDataSource(id, void *);
|
2014-08-10 14:56:59 -05:00
|
|
|
extern struct xsize tablePreferredSize(id);
|
2014-08-18 09:41:58 -05:00
|
|
|
extern intptr_t tableSelected(id);
|
|
|
|
extern void tableSelect(id, intptr_t);
|
2014-07-29 09:32:49 -05:00
|
|
|
|
2014-07-30 11:50:45 -05:00
|
|
|
/* control_darwin.m */
|
2014-08-10 12:28:15 -05:00
|
|
|
extern void parent(id, id);
|
|
|
|
extern void controlSetHidden(id, BOOL);
|
|
|
|
extern void setStandardControlFont(id);
|
|
|
|
extern void setSmallControlFont(id);
|
2014-08-09 20:34:56 -05:00
|
|
|
extern struct xsize controlPreferredSize(id);
|
2014-08-10 13:37:34 -05:00
|
|
|
extern id newScrollView(id, BOOL);
|
2014-08-01 22:16:43 -05:00
|
|
|
extern struct xalignment alignmentInfo(id, struct xrect);
|
2014-08-11 10:36:32 -05:00
|
|
|
extern struct xalignment alignmentInfoFrame(id);
|
2014-08-01 22:16:43 -05:00
|
|
|
|
2014-08-05 13:33:25 -05:00
|
|
|
/* area_darwin.h */
|
2014-08-05 13:40:08 -05:00
|
|
|
extern Class getAreaClass(void);
|
2014-08-05 13:33:25 -05:00
|
|
|
extern id newArea(void *);
|
2014-08-10 12:19:42 -05:00
|
|
|
extern BOOL drawImage(void *, intptr_t, intptr_t, intptr_t, intptr_t, intptr_t);
|
2014-08-11 10:52:10 -05:00
|
|
|
extern const uintptr_t cNSShiftKeyMask;
|
|
|
|
extern const uintptr_t cNSControlKeyMask;
|
|
|
|
extern const uintptr_t cNSAlternateKeyMask;
|
|
|
|
extern const uintptr_t cNSCommandKeyMask;
|
2014-08-05 13:33:25 -05:00
|
|
|
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);
|
2014-08-21 12:17:35 -05:00
|
|
|
extern void areaRepaint(id, struct xrect);
|
2014-08-09 20:27:28 -05:00
|
|
|
extern void areaRepaintAll(id);
|
2014-08-23 18:29:17 -05:00
|
|
|
extern void areaTextFieldOpen(id, id, intptr_t, intptr_t);
|
|
|
|
extern void areaSetTextField(id, id);
|
|
|
|
extern void areaEndTextFieldEditing(id, id);
|
|
|
|
|
2014-08-05 13:33:25 -05:00
|
|
|
|
2014-08-10 23:17:21 -05:00
|
|
|
/* common_darwin.m */
|
|
|
|
extern void disableAutocorrect(id);
|
|
|
|
|
2014-08-16 20:49:43 -05:00
|
|
|
/* imagerep_darwin.m */
|
|
|
|
extern id toImageListImage(void *, intptr_t, intptr_t, intptr_t);
|
|
|
|
|
2014-08-19 11:44:42 -05:00
|
|
|
/* dialog_darwin.m */
|
2014-08-26 14:26:19 -05:00
|
|
|
extern void openFile(id, void *);
|
2014-08-19 11:44:42 -05:00
|
|
|
|
2014-08-26 21:41:25 -05:00
|
|
|
/* warningpopover_darwin.m */
|
|
|
|
extern id newWarningPopover(char *);
|
2014-08-27 11:11:55 -05:00
|
|
|
extern void warningPopoverShow(id, id);
|
2014-08-26 21:41:25 -05:00
|
|
|
|
2014-10-29 11:12:00 -05:00
|
|
|
/* spinbox_darwin.m */
|
2014-10-30 13:35:31 -05:00
|
|
|
extern id newSpinbox(void *, intmax_t, intmax_t);
|
2014-10-29 19:34:41 -05:00
|
|
|
extern id spinboxTextField(id);
|
|
|
|
extern id spinboxStepper(id);
|
2014-10-30 13:35:31 -05:00
|
|
|
extern intmax_t spinboxValue(id);
|
|
|
|
extern void spinboxSetValue(id, intmax_t);
|
2014-10-29 11:12:00 -05:00
|
|
|
|
2014-07-08 15:47:28 -05:00
|
|
|
#endif
|