OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this |
2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
3 // LICENSE file. | 3 // LICENSE file. |
4 | 4 |
5 #ifndef VIEWS_WINDOW_WINDOW_H_ | 5 #ifndef VIEWS_WINDOW_WINDOW_H_ |
6 #define VIEWS_WINDOW_WINDOW_H_ | 6 #define VIEWS_WINDOW_WINDOW_H_ |
7 | 7 |
8 #include "base/gfx/native_widget_types.h" | 8 #include "base/gfx/native_widget_types.h" |
9 | 9 |
10 namespace gfx { | 10 namespace gfx { |
11 class Rect; | 11 class Rect; |
12 class Size; | 12 class Size; |
13 } | 13 } |
14 | 14 |
15 namespace views { | 15 namespace views { |
16 | 16 |
17 class ClientView; | 17 class ClientView; |
18 class NonClientFrameView; | 18 class NonClientFrameView; |
19 class NonClientView; | 19 class NonClientView; |
| 20 class Widget; |
20 class WindowDelegate; | 21 class WindowDelegate; |
21 | 22 |
22 // An interface implemented by an object that provides a top level window. | 23 // An interface implemented by an object that provides a top level window. |
23 class Window { | 24 class Window { |
24 public: | 25 public: |
25 virtual ~Window() {} | 26 virtual ~Window() {} |
26 | 27 |
27 // Creates an instance of an object implementing this interface. | 28 // Creates an instance of an object implementing this interface. |
28 // TODO(beng): create a version of this function that takes a NativeView, for | 29 // TODO(beng): create a version of this function that takes a NativeView, for |
29 // constrained windows. | 30 // constrained windows. |
30 static Window* CreateChromeWindow(gfx::NativeWindow parent, | 31 static Window* CreateChromeWindow(gfx::NativeWindow parent, |
31 const gfx::Rect& bounds, | 32 const gfx::Rect& bounds, |
32 WindowDelegate* window_delegate); | 33 WindowDelegate* window_delegate); |
33 | 34 |
34 // Returns the preferred size of the contents view of this window based on | 35 // Returns the preferred size of the contents view of this window based on |
35 // its localized size data. The width in cols is held in a localized string | 36 // its localized size data. The width in cols is held in a localized string |
36 // resource identified by |col_resource_id|, the height in the same fashion. | 37 // resource identified by |col_resource_id|, the height in the same fashion. |
37 // TODO(beng): This should eventually live somewhere else, probably closer to | 38 // TODO(beng): This should eventually live somewhere else, probably closer to |
38 // ClientView. | 39 // ClientView. |
39 static int GetLocalizedContentsWidth(int col_resource_id); | 40 static int GetLocalizedContentsWidth(int col_resource_id); |
40 static int GetLocalizedContentsHeight(int row_resource_id); | 41 static int GetLocalizedContentsHeight(int row_resource_id); |
41 static gfx::Size GetLocalizedContentsSize(int col_resource_id, | 42 static gfx::Size GetLocalizedContentsSize(int col_resource_id, |
42 int row_resource_id); | 43 int row_resource_id); |
43 | 44 |
44 // Closes all windows that aren't identified as "app windows" via | 45 // Closes all windows that aren't identified as "app windows" via |
45 // IsAppWindow. Called during application shutdown when the last "app window" | 46 // IsAppWindow. Called during application shutdown when the last "app window" |
46 // is closed. | 47 // is closed. |
47 static void CloseAllSecondaryWindows(); | 48 static void CloseAllSecondaryWindows(); |
48 | 49 |
| 50 // Used by |CloseAllSecondaryWindows|. If |widget|'s window is a secondary |
| 51 // window, the window is closed. If |widget| has no window, it is closed. |
| 52 // Does nothing if |widget| is null. |
| 53 static void CloseSecondaryWidget(Widget* widget); |
| 54 |
49 // Retrieves the window's bounds, including its frame. | 55 // Retrieves the window's bounds, including its frame. |
50 virtual gfx::Rect GetBounds() const = 0; | 56 virtual gfx::Rect GetBounds() const = 0; |
51 | 57 |
52 // Retrieves the restored bounds for the window. | 58 // Retrieves the restored bounds for the window. |
53 virtual gfx::Rect GetNormalBounds() const = 0; | 59 virtual gfx::Rect GetNormalBounds() const = 0; |
54 | 60 |
55 // Sets the Window's bounds. The window is inserted after |other_window| in | 61 // Sets the Window's bounds. The window is inserted after |other_window| in |
56 // the window Z-order. If this window is not yet visible, other_window's | 62 // the window Z-order. If this window is not yet visible, other_window's |
57 // monitor is used as the constraining rectangle, rather than this window's | 63 // monitor is used as the constraining rectangle, rather than this window's |
58 // monitor. | 64 // monitor. |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 // Whether we should be using a native frame. | 155 // Whether we should be using a native frame. |
150 virtual bool ShouldUseNativeFrame() const = 0; | 156 virtual bool ShouldUseNativeFrame() const = 0; |
151 | 157 |
152 // Tell the window that something caused the frame type to change. | 158 // Tell the window that something caused the frame type to change. |
153 virtual void FrameTypeChanged() = 0; | 159 virtual void FrameTypeChanged() = 0; |
154 }; | 160 }; |
155 | 161 |
156 } // namespace views | 162 } // namespace views |
157 | 163 |
158 #endif // #ifndef VIEWS_WINDOW_WINDOW_H_ | 164 #endif // #ifndef VIEWS_WINDOW_WINDOW_H_ |
OLD | NEW |