feat: expose more NSView methods
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
IB_DESIGNABLE
|
||||
@interface DrawSeparator : NSView
|
||||
@property (assign) BOOL invert;
|
||||
+ (instancetype)withSize:(NSSize)size;
|
||||
@end
|
||||
|
||||
|
||||
|
||||
@@ -5,6 +5,10 @@
|
||||
|
||||
|
||||
@implementation DrawSeparator
|
||||
+ (instancetype)withSize:(NSSize)size {
|
||||
return [[super alloc] initWithFrame:CGRectMake(0, 0, size.width, size.height)];
|
||||
}
|
||||
|
||||
- (void)drawRect:(NSRect)r {
|
||||
NSColor *color = [NSColor darkGrayColor];
|
||||
NSColor *transparent = [color colorWithAlphaComponent:0.0];
|
||||
|
||||
@@ -61,7 +61,10 @@ static inline CGFloat NSMaxWidth(NSView *a, NSView *b) { return Max(NSWidth(a.fr
|
||||
- (instancetype)placeIn:(NSView*)parent xRight:(CGFloat)x y:(CGFloat)y;
|
||||
- (instancetype)placeIn:(NSView*)parent xRight:(CGFloat)x yTop:(CGFloat)y;
|
||||
// Modify existing UI elements
|
||||
- (instancetype)alignTop;
|
||||
- (instancetype)alignRight;
|
||||
- (instancetype)sizableWidthAndHeight;
|
||||
- (instancetype)sizableWidth;
|
||||
- (instancetype)sizeToRight:(CGFloat)rightPadding;
|
||||
- (instancetype)sizeWidthToFit;
|
||||
- (instancetype)tooltip:(NSString*)tt;
|
||||
|
||||
@@ -269,6 +269,9 @@
|
||||
/// Modify @c .autoresizingMask; Add @c NSViewWidthSizable @c | @c NSViewHeightSizable flags
|
||||
- (instancetype)sizableWidthAndHeight { self.autoresizingMask |= NSViewWidthSizable | NSViewHeightSizable; return self; }
|
||||
|
||||
/// Modify @c .autoresizingMask; Add @c NSViewWidthSizable flags
|
||||
- (instancetype)sizableWidth { self.autoresizingMask |= NSViewWidthSizable; return self; }
|
||||
|
||||
/// Extend frame in its @c superview and stick to right with padding. Adds @c NSViewWidthSizable to @c autoresizingMask
|
||||
- (instancetype)sizeToRight:(CGFloat)rightPadding {
|
||||
SetFrameWidth(self, NSWidth(self.superview.frame) - NSMinX(self.frame) - rightPadding + self.alignmentRectInsets.right);
|
||||
|
||||
Reference in New Issue
Block a user