OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 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 CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_SHEET_CONT
ROLLER_H_ |
| 6 #define CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_SHEET_CONT
ROLLER_H_ |
| 7 |
| 8 #import <Cocoa/Cocoa.h> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/memory/scoped_vector.h" |
| 12 #include "base/memory/scoped_nsobject.h" |
| 13 |
| 14 // This class can be used to implement tab modal sheets. Each tab can have |
| 15 // a single sheet and only the active tab's sheet will be visible. |
| 16 @interface ConstrainedWindowSheetController : NSObject <NSAnimationDelegate> { |
| 17 @private |
| 18 scoped_nsobject<NSMutableArray> sheets_; |
| 19 scoped_nsobject<NSWindow> parentWindow_; |
| 20 scoped_nsobject<NSView> activeView_; |
| 21 } |
| 22 |
| 23 // Returns a sheet controller for |parentWindow|. If a sheet controller does not |
| 24 // exist yet then one will be created. |
| 25 + (ConstrainedWindowSheetController*) |
| 26 controllerForParentWindow:(NSWindow*)parentWindow; |
| 27 |
| 28 // Find a controller that's managing the given sheet. If no such controller |
| 29 // exists then nil is returned. |
| 30 + (ConstrainedWindowSheetController*)controllerForSheet:(NSWindow*)sheet; |
| 31 |
| 32 // Shows the given sheet over |parentView|. If |parentView| is not the active |
| 33 // view then the sheet is not shown until the |parentView| becomes active. |
| 34 - (void)showSheet:(NSWindow*)sheet |
| 35 forParentView:(NSView*)parentView; |
| 36 |
| 37 // Closes the given sheet. If the parent view of the sheet is currently active |
| 38 // then an asynchronous animation will be run and the sheet will be closed |
| 39 // at the end of the animation. |
| 40 - (void)closeSheet:(NSWindow*)sheet; |
| 41 |
| 42 // Make |parentView| the current active view. If |parentView| has an attached |
| 43 // sheet then the sheet is made visible. |
| 44 - (void)parentViewDidBecomeActive:(NSView*)parentView; |
| 45 |
| 46 // Gets the number of sheets attached to the controller's window. |
| 47 - (int)sheetCount; |
| 48 |
| 49 // Testing only API. End any pending animation for the given sheet. |
| 50 - (void)endAnimationForSheet:(NSWindow*)sheet; |
| 51 |
| 52 @end |
| 53 |
| 54 #endif // CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_SHEET_C
ONTROLLER_H_ |
OLD | NEW |