OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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. |
| 4 |
| 5 #ifndef IOS_CHROME_BROWSER_UI_CONTEXTUAL_SEARCH_CONTEXTUAL_SEARCH_HIGHLIGHTER_VI
EW_H_ |
| 6 #define IOS_CHROME_BROWSER_UI_CONTEXTUAL_SEARCH_CONTEXTUAL_SEARCH_HIGHLIGHTER_VI
EW_H_ |
| 7 |
| 8 #import <UIKit/UIKit.h> |
| 9 |
| 10 @protocol ContextualSearchHighlighterDelegate |
| 11 |
| 12 // Redraw the highlight rects. This method does not change which text is |
| 13 // highlighted but updates the highlighting in case the text has moved. |
| 14 - (void)updateHighlight; |
| 15 |
| 16 @end |
| 17 |
| 18 // A view containing semitransparent rects to highlight searched terms. |
| 19 @interface ContextualSearchHighlighterView : UIView |
| 20 |
| 21 // Designated initializer. |
| 22 // |owner updateHighlight| will be called when the view size change. |
| 23 - (instancetype)initWithFrame:(CGRect)frame |
| 24 delegate:(id<ContextualSearchHighlighterDelegate>)delegate |
| 25 NS_DESIGNATED_INITIALIZER; |
| 26 |
| 27 - (instancetype)initWithFrame:(CGRect)frame NS_UNAVAILABLE; |
| 28 - (instancetype)initWithCoder:(NSCoder*)aDecoder NS_UNAVAILABLE; |
| 29 |
| 30 // Creates the highlights in |rect|. |offset| is vertically applied to all |
| 31 // rects. |scroll| is store to compute the delta scroll on subsequent calls to |
| 32 // |setScroll|. |
| 33 - (void)highlightRects:(NSArray*)rects |
| 34 withOffset:(CGFloat)offset |
| 35 zoom:(CGFloat)zoom |
| 36 scroll:(CGPoint)scroll; |
| 37 |
| 38 // Offset all highlighted rects by the delta between |scroll| and the previous |
| 39 // value of |scroll|. |
| 40 - (void)setScroll:(CGPoint)scroll zoom:(CGFloat)zoom offset:(CGFloat)offset; |
| 41 |
| 42 - (CGRect)boundingRect; |
| 43 |
| 44 @end |
| 45 |
| 46 #endif // IOS_CHROME_BROWSER_UI_CONTEXTUAL_SEARCH_CONTEXTUAL_SEARCH_HIGHLIGHTER
_VIEW_H_ |
OLD | NEW |