Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / ui / base / cocoa / nsview_additions.h
blob62043b2ab06e35d95613194d796875b7e6a8f354
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef UI_BASE_COCOA_NSVIEW_ADDITIONS_H_
6 #define UI_BASE_COCOA_NSVIEW_ADDITIONS_H_
8 #import <Cocoa/Cocoa.h>
10 @interface NSView (ChromeAdditions)
12 // Returns the line width that will generate a 1 pixel wide line.
13 - (CGFloat)cr_lineWidth;
15 // Checks if the mouse is currently in this view.
16 - (BOOL)cr_isMouseInView;
18 // Returns YES if this view is below |otherView|.
19 - (BOOL)cr_isBelowView:(NSView*)otherView;
21 // Returns YES if this view is aobve |otherView|.
22 - (BOOL)cr_isAboveView:(NSView*)otherView;
24 // Ensures that the z-order of |subview| is correct relative to |otherView|.
25 - (void)cr_ensureSubview:(NSView*)subview
26 isPositioned:(NSWindowOrderingMode)place
27 relativeTo:(NSView *)otherView;
29 // Return best color for keyboard focus ring.
30 - (NSColor*)cr_keyboardFocusIndicatorColor;
32 // Invoke |block| on this view and all descendants.
33 - (void)cr_recursivelyInvokeBlock:(void (^)(id view))block;
35 // Set needsDisplay for this view and all descendants.
36 - (void)cr_recursivelySetNeedsDisplay:(BOOL)flag;
38 // Draw using ancestorView's drawRect function into this view's rect. Do any
39 // required translating or flipping to transform between the two coordinate
40 // systems, and optionally clip to the ancestor view's bounds.
41 - (void)cr_drawUsingAncestor:(NSView*)ancestorView inRect:(NSRect)dirtyRect
42 clippedToAncestorBounds:(BOOL)clipToAncestorBounds;
44 // Same as cr_drawUsingAncestor:inRect:clippedToAncestorBounds: except always
45 // clips to the ancestor view's bounds.
46 - (void)cr_drawUsingAncestor:(NSView*)ancestorView inRect:(NSRect)dirtyRect;
48 // Used by ancestorView in the above draw call, to look up the child view that
49 // it is actually drawing to.
50 - (NSView*)cr_viewBeingDrawnTo;
52 @end
54 #endif // UI_BASE_COCOA_NSVIEW_ADDITIONS_H_