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_FRAME_INFOBARS_INTERNAL_DISPLACED_WINDOW_MANAGER_H_ | |
6 #define CHROME_FRAME_INFOBARS_INTERNAL_DISPLACED_WINDOW_MANAGER_H_ | |
7 | |
8 #include <atlbase.h> | |
9 #include <atlcrack.h> | |
10 #include <atlwin.h> | |
11 | |
12 #include "base/basictypes.h" | |
13 #include "chrome_frame/infobars/internal/subclassing_window_with_delegate.h" | |
14 | |
15 // DisplacedWindowManager observes the HWND passed to Initialize and: | |
16 // 1) Intercepts NCCALCSIZE events allowing the client to modify the window's | |
17 // requested dimensions. | |
18 // 2) Allows the client to request a recalculation of the window's dimensions | |
19 // (resulting in a deferred callback as in [1]). | |
20 // 3) Is destroyed only when the window is destroyed. | |
21 class DisplacedWindowManager | |
22 : public SubclassingWindowWithDelegate<DisplacedWindowManager> { | |
23 public: | |
24 DisplacedWindowManager(); | |
25 | |
26 // Triggers an immediate re-evaluation of the dimensions of the displaced | |
27 // window. Delegate::AdjustDisplacedWindowDimensions will be called with the | |
28 // natural dimensions of the displaced window. | |
29 void UpdateLayout(); | |
30 | |
31 BEGIN_MSG_MAP_EX(DisplacedWindowManager) | |
32 MSG_WM_NCCALCSIZE(OnNcCalcSize) | |
33 CHAIN_MSG_MAP(SubclassingWindowWithDelegate<DisplacedWindowManager>) | |
34 END_MSG_MAP() | |
35 | |
36 private: | |
37 // The size of the displaced window is being calculated. Allow | |
38 // InfobarWindows to reserve a part of the space for themselves, if they are | |
39 // visible. | |
40 LRESULT OnNcCalcSize(BOOL calc_valid_rects, LPARAM lparam); | |
41 | |
42 DISALLOW_COPY_AND_ASSIGN(DisplacedWindowManager); | |
43 }; // class DisplacedWindowManager | |
44 | |
45 #endif // CHROME_FRAME_INFOBARS_INTERNAL_DISPLACED_WINDOW_MANAGER_H_ | |
OLD | NEW |