我想制作一个与此类似的NSPopover:
所以我想覆盖图纸。
不幸的是我没有在Apple文档中找到任何内容。 但是,我确实使用类转储找到了以下私有类:
@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
,它也是私有的,并覆盖
+ (Class)frameViewClassForStyleMask:(unsigned long long)arg1;
我无法将其子类化,因为它是私有的.. 有没有办法绕过这个?
或者还有其他方法吗?