4 // Copyright (C) 2005, 2006, 2007, 2008, Apple Inc. All rights reserved.
7 #import <CoreGraphics/CoreGraphics.h>
8 #import <CoreGraphics/CGSRegion.h>
9 #import <GraphicsServices/GSEvent.h>
10 #import "WKUtilities.h"
19 NSViewWidthSizable
= 2,
22 NSViewHeightSizable
= 16,
27 WKViewNotificationViewDidMoveToWindow
,
28 WKViewNotificationViewFrameSizeChanged
,
29 WKViewNotificationViewDidScroll
30 } WKViewNotificationType
;
33 WKViewResponderAcceptsFirstResponder
,
34 WKViewResponderBecomeFirstResponder
,
35 WKViewResponderResignFirstResponder
,
36 } WKViewResponderCallbackType
;
38 typedef void (*WKViewDrawCallback
)(WKViewRef view
, CGRect dirtyRect
, void *userInfo
);
39 typedef bool (*WKViewEventCallback
)(WKViewRef view
, GSEventRef event
, void *userInfo
);
40 typedef void (*WKViewNotificationCallback
)(WKViewRef view
, WKViewNotificationType type
, void *userInfo
);
41 typedef void (*WKViewLayoutCallback
)(WKViewRef view
, void *userInfo
, bool force
);
42 typedef bool (*WKViewResponderCallback
)(WKViewRef view
, WKViewResponderCallbackType type
, void *userInfo
);
43 typedef WKViewRef (*WKViewHitTestCallback
)(WKViewRef view
, CGPoint point
, void *userInfo
);
44 typedef void (*WKViewWillRemoveSubviewCallback
)(WKViewRef view
, WKViewRef subview
);
45 typedef void (*WKViewInvalidateGStateCallback
)(WKViewRef view
);
47 typedef struct _WKViewContext
{
48 WKViewDrawCallback drawCallback
;
50 WKViewEventCallback eventCallback
;
52 WKViewNotificationCallback notificationCallback
;
53 void *notificationUserInfo
;
54 WKViewLayoutCallback layoutCallback
;
56 WKViewResponderCallback responderCallback
;
57 void *responderUserInfo
;
58 WKViewHitTestCallback hitTestCallback
;
59 void *hitTestUserInfo
;
60 WKViewWillRemoveSubviewCallback willRemoveSubviewCallback
;
61 WKViewInvalidateGStateCallback invalidateGStateCallback
;
67 WKViewContext
*context
;
72 CFMutableArrayRef subviews
;
77 unsigned int isHidden
:1;
79 unsigned int autoresizingMask
;
83 bool drawsOwnDescendants
;
86 WKViewRef
WKViewGetFocusView (void);
88 extern WKClassInfo WKViewClassInfo
;
90 WKViewRef
WKViewCreateWithFrame (CGRect rect
, WKViewContext
*context
);
91 void WKViewInitialize (WKViewRef view
, CGRect rect
, WKViewContext
*context
);
93 void WKViewSetViewContext (WKViewRef view
, WKViewContext
*context
);
94 void WKViewGetViewContext (WKViewRef view
, WKViewContext
*context
);
96 CGRect
WKViewGetBounds (WKViewRef view
);
98 void WKViewSetFrameOrigin (WKViewRef view
, CGPoint newPoint
);
99 void WKViewSetFrameSize (WKViewRef view
, CGSize newSize
);
100 void WKViewSetBoundsSize (WKViewRef view
, CGSize newSize
);
102 CGRect
WKViewGetFrame (WKViewRef view
);
104 void WKViewSetScale (WKViewRef view
, float scale
);
105 float WKViewGetScale (WKViewRef view
);
107 WKWindowRef
WKViewGetWindow (WKViewRef view
);
109 CFArrayRef
WKViewGetSubviews (WKViewRef view
);
111 WKViewRef
WKViewGetSuperview (WKViewRef view
);
113 void WKViewAddSubview (WKViewRef view
, WKViewRef subview
);
114 void WKViewRemoveFromSuperview (WKViewRef view
);
116 void WKViewSetNeedsDisplay (WKViewRef view
);
117 void WKViewSetNeedsDisplayInRect (WKViewRef view
, CGRect invalidRect
);
118 void WKViewDisplay (WKViewRef view
);
119 void WKViewDisplayRect (WKViewRef view
, CGRect rectToDraw
);
121 void WKViewLockFocus (WKViewRef view
);
122 void WKViewUnlockFocus (WKViewRef view
);
124 bool WKViewGetIsHidden (WKViewRef view
);
125 void WKViewSetIsHidden (WKViewRef view
, bool flag
);
127 CGPoint
WKViewConvertPointToSuperview (WKViewRef view
, CGPoint aPoint
);
128 CGPoint
WKViewConvertPointFromSuperview (WKViewRef view
, CGPoint aPoint
);
129 CGPoint
WKViewConvertPointToBase(WKViewRef view
, CGPoint aPoint
);
130 CGPoint
WKViewConvertPointFromBase(WKViewRef view
, CGPoint aPoint
);
132 CGRect
WKViewConvertRectToSuperview (WKViewRef view
, CGRect aRect
);
133 CGRect
WKViewConvertRectFromSuperview (WKViewRef view
, CGRect aRect
);
134 CGRect
WKViewConvertRectToBase (WKViewRef view
, CGRect r
);
135 CGRect
WKViewConvertRectFromBase (WKViewRef view
, CGRect aRect
);
137 CGRect
WKViewGetVisibleRect (WKViewRef view
);
139 WKViewRef
WKViewFirstChild (WKViewRef view
);
140 WKViewRef
WKViewNextSibling (WKViewRef view
);
141 WKViewRef
WKViewTraverseNext (WKViewRef view
);
143 bool WKViewAcceptsFirstResponder (WKViewRef view
);
144 bool WKViewBecomeFirstResponder (WKViewRef view
);
145 bool WKViewResignFirstResponder (WKViewRef view
);
147 unsigned int WKViewGetAutoresizingMask(WKViewRef view
);
148 void WKViewSetAutoresizingMask (WKViewRef view
, unsigned int mask
);
150 WKViewRef
WKViewHitTest(WKViewRef view
, CGPoint superviewPoint
);
151 void WKViewScrollToPoint(WKViewRef view
, CGPoint point
);
152 void WKViewScrollToRect(WKViewRef view
, CGRect rect
);
154 void WKViewLayout(WKViewRef view
, bool force
);
156 CGImageRef
WKViewCreateImage(WKViewRef view
);