2015-07-31 21:33:49 -05:00
|
|
|
// 31 july 2015
|
|
|
|
#import <Cocoa/Cocoa.h>
|
2015-07-31 22:06:29 -05:00
|
|
|
#import <stdint.h>
|
|
|
|
|
2015-08-02 10:25:39 -05:00
|
|
|
typedef struct tAutoLayoutParams tAutoLayoutParams;
|
|
|
|
|
2015-08-02 17:43:50 -05:00
|
|
|
// TODO stretchy across both dimensions
|
|
|
|
// for a vertical box, the horizontal width should be variable
|
2015-08-02 10:25:39 -05:00
|
|
|
struct tAutoLayoutParams {
|
|
|
|
NSMutableArray *horz;
|
2015-08-02 12:57:59 -05:00
|
|
|
NSMutableArray *horzAttachLeft;
|
|
|
|
NSMutableArray *horzAttachRight;
|
2015-08-02 14:03:30 -05:00
|
|
|
BOOL horzFirst;
|
|
|
|
BOOL horzLast;
|
2015-08-02 10:25:39 -05:00
|
|
|
NSMutableArray *vert;
|
2015-08-02 12:57:59 -05:00
|
|
|
NSMutableArray *vertAttachTop;
|
|
|
|
NSMutableArray *vertAttachBottom;
|
2015-08-02 14:03:30 -05:00
|
|
|
BOOL vertFirst;
|
|
|
|
BOOL vertLast;
|
2015-08-02 10:25:39 -05:00
|
|
|
NSMutableDictionary *views;
|
|
|
|
uintmax_t n;
|
2015-08-02 17:54:33 -05:00
|
|
|
BOOL horzStretchy;
|
|
|
|
BOOL horzFirstStretchy;
|
|
|
|
uintmax_t horzStretchyTo;
|
|
|
|
BOOL vertStretchy;
|
|
|
|
BOOL vertFirstStretchy;
|
|
|
|
uintmax_t vertStretchyTo;
|
2015-08-02 10:25:39 -05:00
|
|
|
};
|
|
|
|
|
2015-07-31 22:06:29 -05:00
|
|
|
@protocol tControl
|
|
|
|
@required
|
2015-08-02 17:16:44 -05:00
|
|
|
- (void)tSetParent:(id<tControl>)p addToView:(NSView *)v relayout:(BOOL)relayout;
|
2015-08-02 10:25:39 -05:00
|
|
|
- (void)tFillAutoLayout:(tAutoLayoutParams *)p;
|
2015-08-01 21:13:41 -05:00
|
|
|
- (void)tRelayout;
|
2015-07-31 22:06:29 -05:00
|
|
|
@end
|
|
|
|
|
2015-08-01 14:21:03 -05:00
|
|
|
@interface tWindow : NSObject<tControl>
|
2015-08-01 13:22:45 -05:00
|
|
|
- (void)tSetControl:(id<tControl>)cc;
|
2015-08-01 14:44:06 -05:00
|
|
|
- (void)tSetMargined:(BOOL)m;
|
2015-08-01 14:21:03 -05:00
|
|
|
- (void)tShow;
|
2015-08-01 11:43:54 -05:00
|
|
|
@end
|
|
|
|
|
2015-08-01 13:22:45 -05:00
|
|
|
@interface tBox : NSObject<tControl>
|
|
|
|
- (id)tInitVertical:(BOOL)vert;
|
|
|
|
- (void)tAddControl:(id<tControl>)c stretchy:(BOOL)s;
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface tButton : NSObject<tControl>
|
|
|
|
- (id)tInitWithText:(NSString *)text;
|
|
|
|
@end
|
|
|
|
|
2015-08-01 16:19:45 -05:00
|
|
|
@interface tSpinbox : NSObject<tControl>
|
|
|
|
@end
|
|
|
|
|
2015-07-31 22:06:29 -05:00
|
|
|
extern NSString *tAutoLayoutKey(uintmax_t);
|