OLD | NEW |
1 // Copyright (c) 2010 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_PREVIEWABLE_CONTENTS_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_COCOA_PREVIEWABLE_CONTENTS_CONTROLLER_H_ |
6 #define CHROME_BROWSER_COCOA_PREVIEWABLE_CONTENTS_CONTROLLER_H_ | 6 #define CHROME_BROWSER_COCOA_PREVIEWABLE_CONTENTS_CONTROLLER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #import <Cocoa/Cocoa.h> | 9 #import <Cocoa/Cocoa.h> |
10 | 10 |
11 class TabContents; | 11 class TabContents; |
12 | 12 |
13 // PreviewableContentsController manages the display of up to two tab contents | 13 // PreviewableContentsController manages the display of up to two tab contents |
14 // views. It is primarily for use with Instant results. This class supports | 14 // views. It is primarily for use with Instant results. This class supports |
15 // the notion of an "active" view vs. a "preview" tab contents view. | 15 // the notion of an "active" view vs. a "preview" tab contents view. |
16 // | 16 // |
17 // The "active" view is a container view that can be retrieved using | 17 // The "active" view is a container view that can be retrieved using |
18 // |-activeContainer|. Its contents are meant to be managed by an external | 18 // |-activeContainer|. Its contents are meant to be managed by an external |
19 // class. | 19 // class. |
20 // | 20 // |
21 // The "preview" can be set using |-showPreview:| and |-hidePreview|. When a | 21 // The "preview" can be set using |-showPreview:| and |-hidePreview|. When a |
22 // preview is set, the active view is hidden (but stays in the view hierarchy). | 22 // preview is set, the active view is hidden (but stays in the view hierarchy). |
23 // When the preview is removed, the active view is reshown. | 23 // When the preview is removed, the active view is reshown. |
24 @interface PreviewableContentsController : NSViewController { | 24 @interface PreviewableContentsController : NSViewController { |
25 @private | 25 @private |
26 // Container view for the "active" contents. | 26 // Container view for the "active" contents. |
27 IBOutlet NSView* activeContainer_; | 27 IBOutlet NSView* activeContainer_; |
28 | 28 |
29 // The close preview button. | |
30 IBOutlet NSButton* closeButton_; | |
31 | |
32 // The preview TabContents. Will be NULL if no preview is currently showing. | 29 // The preview TabContents. Will be NULL if no preview is currently showing. |
33 TabContents* previewContents_; // weak | 30 TabContents* previewContents_; // weak |
34 } | 31 } |
35 | 32 |
36 @property(readonly, nonatomic) NSView* activeContainer; | 33 @property(readonly, nonatomic) NSView* activeContainer; |
37 | 34 |
38 // Sets the current preview and installs its TabContentsView into the view | 35 // Sets the current preview and installs its TabContentsView into the view |
39 // hierarchy. Hides the active view. |preview| must not be NULL. | 36 // hierarchy. Hides the active view. |preview| must not be NULL. |
40 - (void)showPreview:(TabContents*)preview; | 37 - (void)showPreview:(TabContents*)preview; |
41 | 38 |
42 // Closes the current preview and shows the active view. | 39 // Closes the current preview and shows the active view. |
43 - (void)hidePreview; | 40 - (void)hidePreview; |
44 | 41 |
45 // Returns YES if the preview contents is currently showing. | 42 // Returns YES if the preview contents is currently showing. |
46 - (BOOL)isShowingPreview; | 43 - (BOOL)isShowingPreview; |
47 | 44 |
48 // Simply calls |-hidePreview|. Convenience method for use by the close button. | |
49 - (IBAction)closePreview:(id)sender; | |
50 | |
51 @end | 45 @end |
52 | 46 |
53 #endif // CHROME_BROWSER_COCOA_PREVIEWABLE_CONTENTS_CONTROLLER_H_ | 47 #endif // CHROME_BROWSER_COCOA_PREVIEWABLE_CONTENTS_CONTROLLER_H_ |
OLD | NEW |