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 VIEWS_WINDOW_WINDOW_WIN_H_ | 5 #ifndef VIEWS_WINDOW_WINDOW_WIN_H_ |
6 #define VIEWS_WINDOW_WINDOW_WIN_H_ | 6 #define VIEWS_WINDOW_WINDOW_WIN_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "views/widget/widget_win.h" | 9 #include "views/widget/widget_win.h" |
10 #include "views/window/window.h" | 10 #include "views/window/window.h" |
11 | 11 |
12 namespace gfx { | 12 namespace gfx { |
| 13 class Font; |
13 class Point; | 14 class Point; |
14 class Size; | 15 class Size; |
15 }; | 16 }; |
16 | 17 |
17 namespace views { | 18 namespace views { |
18 | 19 |
| 20 namespace internal { |
| 21 // This is exposed only for testing |
| 22 |
| 23 // Adjusts the value of |child_rect| if necessary to ensure that it is |
| 24 // completely visible within |parent_rect|. |
| 25 void EnsureRectIsVisibleInRect(const gfx::Rect& parent_rect, |
| 26 gfx::Rect* child_rect, |
| 27 int padding); |
| 28 |
| 29 } // namespace internal |
| 30 |
19 class Client; | 31 class Client; |
20 class WindowDelegate; | 32 class WindowDelegate; |
21 | 33 |
22 /////////////////////////////////////////////////////////////////////////////// | 34 /////////////////////////////////////////////////////////////////////////////// |
23 // | 35 // |
24 // WindowWin | 36 // WindowWin |
25 // | 37 // |
26 // A WindowWin is a WidgetWin that has a caption and a border. The frame is | 38 // A WindowWin is a WidgetWin that has a caption and a border. The frame is |
27 // rendered by the operating system. | 39 // rendered by the operating system. |
28 // | 40 // |
29 /////////////////////////////////////////////////////////////////////////////// | 41 /////////////////////////////////////////////////////////////////////////////// |
30 class WindowWin : public WidgetWin, | 42 class WindowWin : public WidgetWin, |
31 public Window { | 43 public Window { |
32 public: | 44 public: |
33 virtual ~WindowWin(); | 45 virtual ~WindowWin(); |
34 | 46 |
35 // Show the window with the specified show command. | 47 // Show the window with the specified show command. |
36 void Show(int show_state); | 48 void Show(int show_state); |
37 | 49 |
38 // Retrieve the show state of the window. This is one of the SW_SHOW* flags | 50 // Retrieve the show state of the window. This is one of the SW_SHOW* flags |
39 // passed into Windows' ShowWindow method. For normal windows this defaults | 51 // passed into Windows' ShowWindow method. For normal windows this defaults |
40 // to SW_SHOWNORMAL, however windows (e.g. the main window) can override this | 52 // to SW_SHOWNORMAL, however windows (e.g. the main window) can override this |
41 // method to provide different values (e.g. retrieve the user's specified | 53 // method to provide different values (e.g. retrieve the user's specified |
42 // show state from the shortcut starutp info). | 54 // show state from the shortcut starutp info). |
43 virtual int GetShowState() const; | 55 virtual int GetShowState() const; |
44 | 56 |
45 // Executes the specified SC_command. | 57 // Executes the specified SC_command. |
46 void ExecuteSystemMenuCommand(int command); | 58 void ExecuteSystemMenuCommand(int command); |
47 | 59 |
48 // Called when the frame type could possibly be changing (theme change or | |
49 // DWM composition change). | |
50 void FrameTypeChanged(); | |
51 | |
52 // Accessors and setters for various properties. | 60 // Accessors and setters for various properties. |
53 HWND owning_window() const { return owning_hwnd_; } | 61 HWND owning_window() const { return owning_hwnd_; } |
54 void set_focus_on_creation(bool focus_on_creation) { | 62 void set_focus_on_creation(bool focus_on_creation) { |
55 focus_on_creation_ = focus_on_creation; | 63 focus_on_creation_ = focus_on_creation; |
56 } | 64 } |
57 | 65 |
58 // Overridden from Window: | 66 // Overridden from Window: |
59 virtual gfx::Rect GetBounds() const; | 67 virtual gfx::Rect GetBounds() const; |
60 virtual gfx::Rect GetNormalBounds() const; | 68 virtual gfx::Rect GetNormalBounds() const; |
61 virtual void SetBounds(const gfx::Rect& bounds, | 69 virtual void SetBounds(const gfx::Rect& bounds, |
(...skipping 20 matching lines...) Expand all Loading... |
82 virtual void UpdateWindowTitle(); | 90 virtual void UpdateWindowTitle(); |
83 virtual void UpdateWindowIcon(); | 91 virtual void UpdateWindowIcon(); |
84 virtual void SetIsAlwaysOnTop(bool always_on_top); | 92 virtual void SetIsAlwaysOnTop(bool always_on_top); |
85 virtual NonClientFrameView* CreateFrameViewForWindow(); | 93 virtual NonClientFrameView* CreateFrameViewForWindow(); |
86 virtual void UpdateFrameAfterFrameChange(); | 94 virtual void UpdateFrameAfterFrameChange(); |
87 virtual WindowDelegate* GetDelegate() const; | 95 virtual WindowDelegate* GetDelegate() const; |
88 virtual NonClientView* GetNonClientView() const; | 96 virtual NonClientView* GetNonClientView() const; |
89 virtual ClientView* GetClientView() const; | 97 virtual ClientView* GetClientView() const; |
90 virtual gfx::NativeWindow GetNativeWindow() const; | 98 virtual gfx::NativeWindow GetNativeWindow() const; |
91 virtual bool ShouldUseNativeFrame() const; | 99 virtual bool ShouldUseNativeFrame() const; |
| 100 virtual void FrameTypeChanged(); |
| 101 |
| 102 // Returns the system set window title font. |
| 103 static gfx::Font GetWindowTitleFont(); |
92 | 104 |
93 protected: | 105 protected: |
94 friend Window; | 106 friend Window; |
95 | 107 |
96 // Constructs the WindowWin. |window_delegate| cannot be NULL. | 108 // Constructs the WindowWin. |window_delegate| cannot be NULL. |
97 explicit WindowWin(WindowDelegate* window_delegate); | 109 explicit WindowWin(WindowDelegate* window_delegate); |
98 | 110 |
99 // Create the Window. | 111 // Create the Window. |
100 // If parent is NULL, this WindowWin is top level on the desktop. | 112 // If parent is NULL, this WindowWin is top level on the desktop. |
101 // If |bounds| is empty, the view is queried for its preferred size and | 113 // If |bounds| is empty, the view is queried for its preferred size and |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 // The window styles before we modified them for the drag frame appearance. | 316 // The window styles before we modified them for the drag frame appearance. |
305 DWORD drag_frame_saved_window_style_; | 317 DWORD drag_frame_saved_window_style_; |
306 DWORD drag_frame_saved_window_ex_style_; | 318 DWORD drag_frame_saved_window_ex_style_; |
307 | 319 |
308 DISALLOW_COPY_AND_ASSIGN(WindowWin); | 320 DISALLOW_COPY_AND_ASSIGN(WindowWin); |
309 }; | 321 }; |
310 | 322 |
311 } // namespace views | 323 } // namespace views |
312 | 324 |
313 #endif // VIEWS_WINDOW_WINDOW_WIN_H_ | 325 #endif // VIEWS_WINDOW_WINDOW_WIN_H_ |
OLD | NEW |