2015-08-16 21:46:18 -05:00
|
|
|
// 6 january 2015
|
|
|
|
#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
|
|
|
|
#import <Cocoa/Cocoa.h>
|
|
|
|
#import "../ui.h"
|
|
|
|
#import "../ui_darwin.h"
|
2015-10-16 17:31:14 -05:00
|
|
|
#import "../common/uipriv.h"
|
2015-08-16 21:46:18 -05:00
|
|
|
|
2016-01-02 08:22:24 -06:00
|
|
|
#if __has_feature(objc_arc)
|
|
|
|
#error Sorry, libui cannot be compiled with ARC.
|
|
|
|
#endif
|
|
|
|
|
2015-08-16 21:46:18 -05:00
|
|
|
#define toNSString(str) [NSString stringWithUTF8String:(str)]
|
|
|
|
#define fromNSString(str) [(str) UTF8String]
|
|
|
|
|
|
|
|
// menu.m
|
|
|
|
@interface menuManager : NSObject {
|
2016-01-07 13:41:20 -06:00
|
|
|
struct mapTable *items;
|
2015-08-16 21:46:18 -05:00
|
|
|
BOOL hasQuit;
|
|
|
|
BOOL hasPreferences;
|
|
|
|
BOOL hasAbout;
|
|
|
|
}
|
|
|
|
@property (strong) NSMenuItem *quitItem;
|
|
|
|
@property (strong) NSMenuItem *preferencesItem;
|
|
|
|
@property (strong) NSMenuItem *aboutItem;
|
|
|
|
// NSMenuValidation is only informal
|
|
|
|
- (BOOL)validateMenuItem:(NSMenuItem *)item;
|
|
|
|
- (NSMenu *)makeMenubar;
|
|
|
|
@end
|
|
|
|
extern void finalizeMenus(void);
|
|
|
|
extern void uninitMenus(void);
|
|
|
|
|
|
|
|
// init.m
|
|
|
|
@interface applicationClass : NSApplication
|
|
|
|
@end
|
|
|
|
// this is needed because NSApp is of type id, confusing clang
|
|
|
|
#define realNSApp() ((applicationClass *) NSApp)
|
|
|
|
@interface appDelegate : NSObject <NSApplicationDelegate>
|
|
|
|
@property (strong) menuManager *menuManager;
|
|
|
|
@end
|
|
|
|
#define appDelegate() ((appDelegate *) [realNSApp() delegate])
|
|
|
|
|
|
|
|
// util.m
|
|
|
|
extern void disableAutocorrect(NSTextView *);
|
|
|
|
|
|
|
|
// entry.m
|
2015-08-16 22:44:23 -05:00
|
|
|
extern void finishNewTextField(NSTextField *, BOOL);
|
2015-08-21 19:14:50 -05:00
|
|
|
extern NSTextField *newEditableTextField(void);
|
2015-08-16 21:46:18 -05:00
|
|
|
|
|
|
|
// window.m
|
|
|
|
extern uiWindow *windowFromNSWindow(NSWindow *);
|
|
|
|
|
|
|
|
// alloc.m
|
2015-08-17 11:57:45 -05:00
|
|
|
extern NSMutableArray *delegates;
|
2015-08-16 21:46:18 -05:00
|
|
|
extern void initAlloc(void);
|
|
|
|
extern void uninitAlloc(void);
|
|
|
|
|
2015-08-16 22:08:00 -05:00
|
|
|
// autolayout.m
|
|
|
|
extern void addConstraint(NSView *, NSString *, NSDictionary *, NSDictionary *);
|
|
|
|
extern NSLayoutPriority horzHuggingPri(NSView *);
|
|
|
|
extern NSLayoutPriority vertHuggingPri(NSView *);
|
|
|
|
extern void setHuggingPri(NSView *, NSLayoutPriority, NSLayoutConstraintOrientation);
|
|
|
|
extern void layoutSingleView(NSView *, NSView *, int);
|
|
|
|
extern NSSize fittingAlignmentSize(NSView *);
|
2015-08-16 21:46:18 -05:00
|
|
|
|
2015-08-17 00:03:53 -05:00
|
|
|
// map.m
|
2016-01-07 13:41:20 -06:00
|
|
|
extern struct mapTable *newMap(void);
|
|
|
|
extern void mapDestroy(struct mapTable *m);
|
|
|
|
extern void *mapGet(struct mapTable *m, void *key);
|
|
|
|
extern void mapSet(struct mapTable *m, void *key, void *value);
|
|
|
|
extern void mapDelete(struct mapTable *m, void *key);
|
2015-10-09 11:33:45 -05:00
|
|
|
|
|
|
|
// area.m
|
|
|
|
extern int sendAreaEvents(NSEvent *);
|
|
|
|
|
|
|
|
// areaevents.m
|
|
|
|
extern BOOL fromKeycode(unsigned short keycode, uiAreaKeyEvent *ke);
|
|
|
|
extern BOOL keycodeModifier(unsigned short keycode, uiModifiers *mod);
|
|
|
|
|
|
|
|
// draw.m
|
2016-01-08 12:51:39 -06:00
|
|
|
extern uiDrawContext *newContext(CGContextRef, CGFloat);
|
2015-10-09 11:33:45 -05:00
|
|
|
extern void freeContext(uiDrawContext *);
|
2016-01-12 00:12:35 -06:00
|
|
|
|
|
|
|
// drawtext.m
|
|
|
|
extern void doDrawText(CGContextRef c, CGFloat cheight, double x, double y, uiDrawTextLayout *layout);
|
2016-04-14 13:01:33 -05:00
|
|
|
|
|
|
|
// fontbutton.m
|
|
|
|
extern BOOL fontButtonInhibitSendAction(SEL sel, id from, id to);
|
|
|
|
extern BOOL fontButtonOverrideTargetForAction(SEL sel, id from, id to, id *override);
|