OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_COCOA_WINDOW_SIZE_AUTOSAVER_H_ | |
6 #define CHROME_BROWSER_COCOA_WINDOW_SIZE_AUTOSAVER_H_ | |
7 | |
8 class PrefService; | |
9 @class NSWindow; | |
10 | |
11 enum WindowSizeAutosaverState { | |
12 | |
13 // Autosave only the window's bottom-right corner. | |
14 kSaveWindowPos, | |
15 | |
16 // Autosave the whole window rect, i.e. both position and size. | |
17 kSaveWindowRect, | |
18 }; | |
19 | |
20 // WindowSizeAutosaver is a helper class that makes it easy to let windows | |
21 // autoremember their position or position and size in a PrefService object. | |
22 // To use this, add a |scoped_nsobject<WindowSizeAutosaver>| to your window | |
23 // controller and initialize it in the window controller's init method, passing | |
24 // a window and an autosave name. The autosaver will register for "window moved" | |
25 // and "window resized" notifications and write the current window state to the | |
26 // prefs service every time they fire. The window's size is automatically | |
27 // restored when the autosaver's |initWithWindow:...| method is called. | |
Robert Sesek
2010/01/19 21:51:12
Maybe add a note about not having "Visible on laun
| |
28 @interface WindowSizeAutosaver : NSObject { | |
29 NSWindow* window_; // weak | |
30 PrefService* prefService_; // weak | |
31 const wchar_t* path_; | |
32 WindowSizeAutosaverState state_; | |
33 } | |
34 | |
35 - (id)initWithWindow:(NSWindow*)window | |
36 prefService:(PrefService*)prefs | |
37 path:(const wchar_t*)path | |
38 state:(WindowSizeAutosaverState)state; | |
39 @end | |
40 | |
41 #endif // CHROME_BROWSER_COCOA_WINDOW_SIZE_AUTOSAVER_H_ | |
42 | |
OLD | NEW |