]> git.saurik.com Git - iphone-api.git/blob - WebCore/WKView.h
Adding the WebCore headers (for Cydget).
[iphone-api.git] / WebCore / WKView.h
1 //
2 // WKView.h
3 //
4 // Copyright (C) 2005, 2006, 2007, 2008, Apple Inc. All rights reserved.
5 //
6
7 #import <CoreGraphics/CoreGraphics.h>
8 #import <CoreGraphics/CGSRegion.h>
9 #import <GraphicsServices/GSEvent.h>
10 #import "WKUtilities.h"
11
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15
16 enum {
17 NSViewNotSizable = 0,
18 NSViewMinXMargin = 1,
19 NSViewWidthSizable = 2,
20 NSViewMaxXMargin = 4,
21 NSViewMinYMargin = 8,
22 NSViewHeightSizable = 16,
23 NSViewMaxYMargin = 32
24 };
25
26 typedef enum {
27 WKViewNotificationViewDidMoveToWindow,
28 WKViewNotificationViewFrameSizeChanged,
29 WKViewNotificationViewDidScroll
30 } WKViewNotificationType;
31
32 typedef enum {
33 WKViewResponderAcceptsFirstResponder,
34 WKViewResponderBecomeFirstResponder,
35 WKViewResponderResignFirstResponder,
36 } WKViewResponderCallbackType;
37
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);
46
47 typedef struct _WKViewContext {
48 WKViewDrawCallback drawCallback;
49 void *drawUserInfo;
50 WKViewEventCallback eventCallback;
51 void *eventUserInfo;
52 WKViewNotificationCallback notificationCallback;
53 void *notificationUserInfo;
54 WKViewLayoutCallback layoutCallback;
55 void *layoutUserInfo;
56 WKViewResponderCallback responderCallback;
57 void *responderUserInfo;
58 WKViewHitTestCallback hitTestCallback;
59 void *hitTestUserInfo;
60 WKViewWillRemoveSubviewCallback willRemoveSubviewCallback;
61 WKViewInvalidateGStateCallback invalidateGStateCallback;
62 } WKViewContext;
63
64 struct WKView {
65 WKObject isa;
66
67 WKViewContext *context;
68
69 WKWindowRef window;
70
71 WKViewRef superview;
72 CFMutableArrayRef subviews;
73
74 CGPoint origin;
75 CGRect bounds;
76
77 unsigned int isHidden:1;
78
79 unsigned int autoresizingMask;
80
81 float scale;
82
83 bool drawsOwnDescendants;
84 };
85
86 WKViewRef WKViewGetFocusView (void);
87
88 extern WKClassInfo WKViewClassInfo;
89
90 WKViewRef WKViewCreateWithFrame (CGRect rect, WKViewContext *context);
91 void WKViewInitialize (WKViewRef view, CGRect rect, WKViewContext *context);
92
93 void WKViewSetViewContext (WKViewRef view, WKViewContext *context);
94 void WKViewGetViewContext (WKViewRef view, WKViewContext *context);
95
96 CGRect WKViewGetBounds (WKViewRef view);
97
98 void WKViewSetFrameOrigin (WKViewRef view, CGPoint newPoint);
99 void WKViewSetFrameSize (WKViewRef view, CGSize newSize);
100 void WKViewSetBoundsSize (WKViewRef view, CGSize newSize);
101
102 CGRect WKViewGetFrame (WKViewRef view);
103
104 void WKViewSetScale (WKViewRef view, float scale);
105 float WKViewGetScale (WKViewRef view);
106
107 WKWindowRef WKViewGetWindow (WKViewRef view);
108
109 CFArrayRef WKViewGetSubviews (WKViewRef view);
110
111 WKViewRef WKViewGetSuperview (WKViewRef view);
112
113 void WKViewAddSubview (WKViewRef view, WKViewRef subview);
114 void WKViewRemoveFromSuperview (WKViewRef view);
115
116 void WKViewSetNeedsDisplay (WKViewRef view);
117 void WKViewSetNeedsDisplayInRect (WKViewRef view, CGRect invalidRect);
118 void WKViewDisplay (WKViewRef view);
119 void WKViewDisplayRect (WKViewRef view, CGRect rectToDraw);
120
121 void WKViewLockFocus (WKViewRef view);
122 void WKViewUnlockFocus (WKViewRef view);
123
124 bool WKViewGetIsHidden (WKViewRef view);
125 void WKViewSetIsHidden (WKViewRef view, bool flag);
126
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);
131
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);
136
137 CGRect WKViewGetVisibleRect (WKViewRef view);
138
139 WKViewRef WKViewFirstChild (WKViewRef view);
140 WKViewRef WKViewNextSibling (WKViewRef view);
141 WKViewRef WKViewTraverseNext (WKViewRef view);
142
143 bool WKViewAcceptsFirstResponder (WKViewRef view);
144 bool WKViewBecomeFirstResponder (WKViewRef view);
145 bool WKViewResignFirstResponder (WKViewRef view);
146
147 unsigned int WKViewGetAutoresizingMask(WKViewRef view);
148 void WKViewSetAutoresizingMask (WKViewRef view, unsigned int mask);
149
150 WKViewRef WKViewHitTest(WKViewRef view, CGPoint superviewPoint);
151 void WKViewScrollToPoint(WKViewRef view, CGPoint point);
152 void WKViewScrollToRect(WKViewRef view, CGRect rect);
153
154 void WKViewLayout(WKViewRef view, bool force);
155
156 CGImageRef WKViewCreateImage(WKViewRef view);
157
158 #ifdef __cplusplus
159 }
160 #endif
161