Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(401)

Side by Side Diff: chrome/browser/cocoa/base_view.h

Issue 2973004: [Mac]Implement ViewID support. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Turns out that, it's not a good solution. Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/app/nibs/Toolbar.xib ('k') | chrome/browser/cocoa/base_view.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_COCOA_BASE_VIEW_H_ 5 #ifndef CHROME_BROWSER_COCOA_BASE_VIEW_H_
6 #define CHROME_BROWSER_COCOA_BASE_VIEW_H_ 6 #define CHROME_BROWSER_COCOA_BASE_VIEW_H_
7 7
8 #import <Cocoa/Cocoa.h> 8 #import <Cocoa/Cocoa.h>
9 9
10 #include "base/scoped_nsobject.h" 10 #include "base/scoped_nsobject.h"
11 #include "chrome/browser/view_ids.h"
11 #include "gfx/rect.h" 12 #include "gfx/rect.h"
12 13
13 // A view that provides common functionality that many views will need: 14 // A view that provides common functionality that many views will need:
14 // - Automatic registration for mouse-moved events. 15 // - Automatic registration for mouse-moved events.
15 // - Funneling of mouse and key events to two methods 16 // - Funneling of mouse and key events to two methods
16 // - Coordinate conversion utilities 17 // - Coordinate conversion utilities
18 // - ViewID support.
19 //
20 // We use NSView's tag property for ViewID support, BaseView class overrides
21 // the tag method to return its ViewID value. So do not use the tag property
22 // for other purpose in subclasses.
17 23
18 @interface BaseView : NSView { 24 @interface BaseView : NSView {
19 @private 25 @private
20 NSTrackingArea *trackingArea_; 26 NSTrackingArea *trackingArea_;
21 BOOL dragging_; 27 BOOL dragging_;
22 scoped_nsobject<NSEvent> pendingExitEvent_; 28 scoped_nsobject<NSEvent> pendingExitEvent_;
29 ViewID viewID_;
23 } 30 }
24 31
32 @property(assign, nonatomic) ViewID viewID;
33
25 - (id)initWithFrame:(NSRect)frame; 34 - (id)initWithFrame:(NSRect)frame;
26 35
27 // Override these methods in a subclass. 36 // Override these methods in a subclass.
28 - (void)mouseEvent:(NSEvent *)theEvent; 37 - (void)mouseEvent:(NSEvent *)theEvent;
29 - (void)keyEvent:(NSEvent *)theEvent; 38 - (void)keyEvent:(NSEvent *)theEvent;
30 39
31 // Useful rect conversions (doing coordinate flipping) 40 // Useful rect conversions (doing coordinate flipping)
32 - (gfx::Rect)NSRectToRect:(NSRect)rect; 41 - (gfx::Rect)NSRectToRect:(NSRect)rect;
33 - (NSRect)RectToNSRect:(gfx::Rect)rect; 42 - (NSRect)RectToNSRect:(gfx::Rect)rect;
34 43
35 @end 44 @end
36 45
37 #endif // CHROME_BROWSER_COCOA_BASE_VIEW_H_ 46 #endif // CHROME_BROWSER_COCOA_BASE_VIEW_H_
OLDNEW
« no previous file with comments | « chrome/app/nibs/Toolbar.xib ('k') | chrome/browser/cocoa/base_view.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698