1/*
2 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 *    notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 *    notice, this list of conditions and the following disclaimer in the
11 *    documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23 * THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#ifndef WAKView_h
27#define WAKView_h
28
29#if TARGET_OS_IPHONE
30
31#import "WAKResponder.h"
32#import <Foundation/Foundation.h>
33#import <CoreGraphics/CoreGraphics.h>
34
35#ifndef NSRect
36#define NSRect CGRect
37#endif
38#define NSPoint CGPoint
39#define NSSize CGSize
40
41extern NSString *WAKViewFrameSizeDidChangeNotification;
42extern NSString *WAKViewDidScrollNotification;
43
44@class WAKWindow;
45
46@interface WAKView : WAKResponder
47
48+ (WAKView *)focusView;
49
50- (id)initWithFrame:(CGRect)rect;
51
52- (WAKWindow *)window;
53
54- (NSRect)bounds;
55- (NSRect)frame;
56
57- (void)setFrame:(NSRect)frameRect;
58- (void)setFrameOrigin:(NSPoint)newOrigin;
59- (void)setFrameSize:(NSSize)newSize;
60- (void)setBoundsOrigin:(NSPoint)newOrigin;
61- (void)setBoundsSize:(NSSize)size;
62- (void)frameSizeChanged;
63
64- (NSArray *)subviews;
65- (WAKView *)superview;
66- (void)addSubview:(WAKView *)subview;
67- (void)willRemoveSubview:(WAKView *)subview;
68- (void)removeFromSuperview;
69- (BOOL)isDescendantOf:(WAKView *)aView;
70- (BOOL)isHiddenOrHasHiddenAncestor;
71- (WAKView *)lastScrollableAncestor;
72
73- (void)viewDidMoveToWindow;
74
75- (void)lockFocus;
76- (void)unlockFocus;
77
78- (void)setNeedsDisplay:(BOOL)flag;
79- (void)setNeedsDisplayInRect:(CGRect)invalidRect;
80- (BOOL)needsDisplay;
81- (void)display;
82- (void)displayIfNeeded;
83- (void)displayRect:(NSRect)rect;
84- (void)displayRectIgnoringOpacity:(NSRect)rect;
85- (void)displayRectIgnoringOpacity:(NSRect)rect inContext:(CGContextRef)context;
86- (void)drawRect:(CGRect)rect;
87- (void)viewWillDraw;
88
89- (WAKView *)hitTest:(NSPoint)point;
90- (NSPoint)convertPoint:(NSPoint)point fromView:(WAKView *)aView;
91- (NSPoint)convertPoint:(NSPoint)point toView:(WAKView *)aView;
92- (NSSize)convertSize:(NSSize)size toView:(WAKView *)aView;
93- (NSRect)convertRect:(NSRect)rect fromView:(WAKView *)aView;
94- (NSRect)convertRect:(NSRect)rect toView:(WAKView *)aView;
95
96- (BOOL)needsPanelToBecomeKey;
97
98- (BOOL)scrollRectToVisible:(NSRect)aRect;
99- (void)scrollPoint:(NSPoint)aPoint;
100- (NSRect)visibleRect;
101
102- (void)setHidden:(BOOL)flag;
103
104- (void)setNextKeyView:(WAKView *)aView;
105- (WAKView *)nextKeyView;
106- (WAKView *)nextValidKeyView;
107- (WAKView *)previousKeyView;
108- (WAKView *)previousValidKeyView;
109
110- (void)invalidateGState;
111- (void)releaseGState;
112
113- (void)setAutoresizingMask:(unsigned int)mask;
114- (unsigned int)autoresizingMask;
115- (BOOL)inLiveResize;
116
117- (BOOL)mouse:(NSPoint)aPoint inRect:(NSRect)aRect;
118
119- (void)setNeedsLayout:(BOOL)flag;
120- (void)layout;
121- (void)layoutIfNeeded;
122
123- (void)setScale:(float)scale;
124- (float)scale;
125
126- (void)_setDrawsOwnDescendants:(BOOL)draw;
127
128- (void)_appendDescriptionToString:(NSMutableString *)info atLevel:(int)level;
129
130+ (void)_setInterpolationQuality:(int)quality;
131
132@end
133
134#endif // TARGET_OS_IPHONE
135
136#endif // WAKView_h
137