objective-c - 改变 NSPopover 的外观?

标签 objective-c macos cocoa nspopover

我想制作一个与此类似的 NSPopover:

screenshot

所以我想覆盖绘图。

很遗憾,我没有在 Apple 文档中找到任何内容。 但是,我确实使用类转储找到了以下私有(private)类:

@interface NSPopoverFrame : NSView
{
    const void *_themeX;
    long long _popoverAppearance;
    NSImage *_dragImage;
    unsigned long long _anchorEdge;
    struct CGSize _anchorSize;
    CDStruct_3c058996 _contentInset;
    struct CGPoint _anchorPoint;
    unsigned long long _previousAnchorEdge;
    struct CGPoint _previousAnchorPoint;
    unsigned int _windowFilter;
    struct {
        unsigned int useDragWindowAppearance:1;
        unsigned int hasActiveShadow:1;
        unsigned int hasShadow:1;
        unsigned int invalidateShadow:1;
        unsigned int hasWindowBackgroundBlur:1;
        unsigned int shouldBlurBackground:1;
        unsigned int shouldInsetForAnchor:1;
        unsigned int doingSolidFillHack:1;
    } _flags;
}

+ (struct CGRect)contentRectForFrameRect:(struct CGRect)arg1 styleMask:(unsigned long long)arg2;
+ (struct CGRect)frameRectForContentRect:(struct CGRect)arg1 styleMask:(unsigned long long)arg2;
+ (struct CGRect)contentRectForFrameRect:(struct CGRect)arg1 appearance:(long long)arg2 anchorSize:(struct CGSize)arg3 contentInset:(CDStruct_3c058996)arg4;
+ (struct CGRect)frameRectForContentRect:(struct CGRect)arg1 appearance:(long long)arg2 anchorSize:(struct CGSize)arg3 contentInset:(CDStruct_3c058996)arg4;
@property struct CGPoint anchorPoint; // @synthesize anchorPoint=_anchorPoint;
@property long long popoverAppearance; // @synthesize popoverAppearance=_popoverAppearance;
@property CDStruct_3c058996 contentInset; // @synthesize contentInset=_contentInset;
@property struct CGSize anchorSize; // @synthesize anchorSize=_anchorSize;
@property unsigned long long anchorEdge; // @synthesize anchorEdge=_anchorEdge;
- (struct CGRect)titlebarRect;
- (BOOL)_hasActiveDragTypes;
- (void)draggingEnded:(id)arg1;
- (void)concludeDragOperation:(id)arg1;
- (BOOL)performDragOperation:(id)arg1;
- (void)draggingExited:(id)arg1;
- (unsigned long long)draggingEntered:(id)arg1;
- (void)_markAnchorRectAsNeedingDisplay;
- (void)setFrameSize:(struct CGSize)arg1;
- (BOOL)_isBorderView;
- (void)_drawFrameShadowAndFlushContext:(id)arg1;
- (void)tileAndSetWindowShape:(BOOL)arg1;
- (void)shapeWindow;
- (void)_setFrameNeedsDisplay:(BOOL)arg1;
- (id)opaqueAncestor;
- (BOOL)isOpaque;
- (struct CGRect)dragRectForFrameRect:(struct CGRect)arg1;
- (void)_resetDragMargins;
- (void)_clearDragMargins;
- (double)_distanceFromToolbarBaseToTitlebar;
- (void)_hideToolbarWithAnimation:(BOOL)arg1;
- (void)_showToolbarWithAnimation:(BOOL)arg1;
- (BOOL)_toolbarIsManagedByExternalWindow;
- (BOOL)_toolbarIsHidden;
- (BOOL)_toolbarIsShown;
- (BOOL)_toolbarIsInTransition;
- (BOOL)_canHaveToolbar;
- (id)zoomButton;
- (id)minimizeButton;
- (id)closeButton;
- (unsigned long long)styleMask;
- (id)title;
- (void)_windowChangedKeyState;
- (void)drawRect:(struct CGRect)arg1;
- (struct CGPoint)_adjustedForBoundsAnchorPoint:(struct CGPoint)arg1 anchorEdge:(unsigned long long)arg2;
- (id)_getPopoverIfAvailable;
- (void)drawBackgroundInRect:(struct CGRect)arg1 ofView:(id)arg2 anchorEdge:(unsigned long long)arg3 anchorPoint:(struct CGPoint)arg4;
- (void)_drawHUDPopoverAppearanceInRect:(struct CGRect)arg1 anchorEdge:(unsigned long long)arg2 anchorPoint:(struct CGPoint)arg3;
- (void)_drawMinimalPopoverAppearanceInRect:(struct CGRect)arg1 anchorEdge:(unsigned long long)arg2 anchorPoint:(struct CGPoint)arg3;
- (struct CGImage *)_imageMaskForPath:(struct CGPath *)arg1 anchorEdge:(unsigned long long)arg2 anchorPoint:(struct CGPoint)arg3;
- (struct CGPath *)_newMinimalAppearancePathInBounds:(struct CGRect)arg1 anchorEdge:(unsigned long long)arg2 anchorPoint:(struct CGPoint)arg3 topCapOnly:(BOOL)arg4 arrowOffset:(double)arg5;
- (struct CGPath *)_newMinimalAppearancePathInBounds:(struct CGRect)arg1 anchorEdge:(unsigned long long)arg2 arrowPosition:(double)arg3 topCapOnly:(BOOL)arg4 arrowOffset:(double)arg5;
- (void)_setHasDragWindowAppearance:(BOOL)arg1;
- (BOOL)_hasDragWindowAppearance;
- (void)_tileAndRedisplay:(BOOL)arg1;
- (struct CGRect)contentRectForFrameRect:(struct CGRect)arg1 styleMask:(unsigned long long)arg2;
- (struct CGRect)frameRectForContentRect:(struct CGRect)arg1 styleMask:(unsigned long long)arg2;
- (void)_setDragImage:(id)arg1;
- (id)_dragImage;
- (void)dealloc;
- (void)_windowTransformAnimationDidEnd:(id)arg1;
- (void)_windowTransformAnimationWillBegin:(id)arg1;
- (void)viewDidMoveToWindow;
- (void)_loadTheme;
- (void)viewWillDraw;
@property BOOL shouldBlurBackground;
- (void)_setWindowBackgroundBlurIfNeeded;
- (BOOL)_canHaveBlur;
- (void)_invalidateShadow;
@property BOOL shouldInsetForAnchor; // @dynamic shouldInsetForAnchor;
- (id)initWithCoder:(id)arg1;
- (id)initWithFrame:(struct CGRect)arg1 styleMask:(unsigned long long)arg2 owner:(id)arg3;
- (id)initWithFrame:(struct CGRect)arg1;
- (void)_commonPopoverInit;

@end

然后我可以子类化 _NSPopoverWindow,它也是私有(private)的,并覆盖

+ (Class)frameViewClassForStyleMask:(unsigned long long)arg1;

我不能继承它因为它是私有(private)的.. 有办法绕过这个吗?

或者还有其他方法吗?

最佳答案

我在 Github 上找到了这个很棒的存储库:

https://github.com/github/Rebel

完全符合我的要求。

关于objective-c - 改变 NSPopover 的外观?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13892566/

相关文章:

ios - 如何在 iOS 8 的模态视图 Controller 中强制纵向显示?

objective-c - iPhone 上的 Sqlite3 Amalgamation 行为不当 GANTRacker

objective-c - 在 Cocoa for osx 中使用正则表达式进行用户输入验证

swift - OS X 开发 : how to install a new font into the system

objective-c - 如何消除 <Class> 可能无法响应 <Selector> 的警告?

iphone - 如何使用 AVFoundation 为您的视频添加不同图像和不同 CMTime 的水印

objective-c - EXC_BAD_ACCESS 在 block 中使用 weakSelf 时

objective-c - CGEventTapCreate 的 kCG EventTap 选项默认不起作用

objective-c - 如何在自定义 NSView 上用 3 个手指(NSEvent)捕捉 1 次点击?

objective-c - performSelector 的返回值 :