OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/native_window.h" | 10 #include "views/window/native_window.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 | 34 |
35 /////////////////////////////////////////////////////////////////////////////// | 35 /////////////////////////////////////////////////////////////////////////////// |
36 // | 36 // |
37 // WindowWin | 37 // WindowWin |
38 // | 38 // |
39 // A WindowWin is a WidgetWin that has a caption and a border. The frame is | 39 // A WindowWin is a WidgetWin that has a caption and a border. The frame is |
40 // rendered by the operating system. | 40 // rendered by the operating system. |
41 // | 41 // |
42 /////////////////////////////////////////////////////////////////////////////// | 42 /////////////////////////////////////////////////////////////////////////////// |
43 class WindowWin : public WidgetWin, | 43 class WindowWin : public WidgetWin, |
44 public NativeWindow, | 44 public NativeWindow { |
45 public Window { | |
46 public: | 45 public: |
47 WindowWin(); | 46 explicit WindowWin(internal::NativeWindowDelegate* delegate); |
48 virtual ~WindowWin(); | 47 virtual ~WindowWin(); |
49 | 48 |
50 // Show the window with the specified show command. | 49 // Show the window with the specified show command. |
51 void Show(int show_state); | 50 void Show(int show_state); |
52 | 51 |
53 // Accessors and setters for various properties. | 52 // Accessors and setters for various properties. |
54 void set_focus_on_creation(bool focus_on_creation) { | 53 void set_focus_on_creation(bool focus_on_creation) { |
55 focus_on_creation_ = focus_on_creation; | 54 focus_on_creation_ = focus_on_creation; |
56 } | 55 } |
57 | 56 |
58 // Hides the window if it hasn't already been force-hidden. The force hidden | 57 // Hides the window if it hasn't already been force-hidden. The force hidden |
59 // count is tracked, so calling multiple times is allowed, you just have to | 58 // count is tracked, so calling multiple times is allowed, you just have to |
60 // be sure to call PopForceHidden the same number of times. | 59 // be sure to call PopForceHidden the same number of times. |
61 void PushForceHidden(); | 60 void PushForceHidden(); |
62 | 61 |
63 // Decrements the force hidden count, showing the window if we have reached | 62 // Decrements the force hidden count, showing the window if we have reached |
64 // the top of the stack. See PushForceHidden. | 63 // the top of the stack. See PushForceHidden. |
65 void PopForceHidden(); | 64 void PopForceHidden(); |
66 | 65 |
67 // Returns the system set window title font. | 66 // Returns the system set window title font. |
68 static gfx::Font GetWindowTitleFont(); | 67 static gfx::Font GetWindowTitleFont(); |
69 | 68 |
| 69 // Overridden from NativeWindow: |
| 70 virtual Window* GetWindow() OVERRIDE; |
| 71 virtual const Window* GetWindow() const OVERRIDE; |
| 72 |
70 protected: | 73 protected: |
71 friend Window; | 74 friend Window; |
72 | 75 |
73 // Returns the insets of the client area relative to the non-client area of | 76 // Returns the insets of the client area relative to the non-client area of |
74 // the window. Override this function instead of OnNCCalcSize, which is | 77 // the window. Override this function instead of OnNCCalcSize, which is |
75 // crazily complicated. | 78 // crazily complicated. |
76 virtual gfx::Insets GetClientAreaInsets() const; | 79 virtual gfx::Insets GetClientAreaInsets() const; |
77 | 80 |
78 // Retrieve the show state of the window. This is one of the SW_SHOW* flags | 81 // Retrieve the show state of the window. This is one of the SW_SHOW* flags |
79 // passed into Windows' ShowWindow method. For normal windows this defaults | 82 // passed into Windows' ShowWindow method. For normal windows this defaults |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 LPARAM l_param) OVERRIDE; | 119 LPARAM l_param) OVERRIDE; |
117 virtual LRESULT OnNCUAHDrawFrame(UINT msg, | 120 virtual LRESULT OnNCUAHDrawFrame(UINT msg, |
118 WPARAM w_param, | 121 WPARAM w_param, |
119 LPARAM l_param) OVERRIDE; | 122 LPARAM l_param) OVERRIDE; |
120 virtual LRESULT OnSetIcon(UINT size_type, HICON new_icon) OVERRIDE; | 123 virtual LRESULT OnSetIcon(UINT size_type, HICON new_icon) OVERRIDE; |
121 virtual LRESULT OnSetText(const wchar_t* text) OVERRIDE; | 124 virtual LRESULT OnSetText(const wchar_t* text) OVERRIDE; |
122 virtual void OnSettingChange(UINT flags, const wchar_t* section) OVERRIDE; | 125 virtual void OnSettingChange(UINT flags, const wchar_t* section) OVERRIDE; |
123 virtual void OnSize(UINT size_param, const CSize& new_size) OVERRIDE; | 126 virtual void OnSize(UINT size_param, const CSize& new_size) OVERRIDE; |
124 virtual void OnSysCommand(UINT notification_code, CPoint click) OVERRIDE; | 127 virtual void OnSysCommand(UINT notification_code, CPoint click) OVERRIDE; |
125 virtual void OnWindowPosChanging(WINDOWPOS* window_pos) OVERRIDE; | 128 virtual void OnWindowPosChanging(WINDOWPOS* window_pos) OVERRIDE; |
126 virtual Window* GetWindow() OVERRIDE { return this; } | |
127 virtual const Window* GetWindow() const OVERRIDE { return this; } | |
128 virtual void Close() OVERRIDE; | 129 virtual void Close() OVERRIDE; |
129 virtual void SetInitialFocus() OVERRIDE; | 130 virtual void SetInitialFocus() OVERRIDE; |
130 | 131 |
131 // Overridden from NativeWindow: | 132 // Overridden from NativeWindow: |
132 virtual NativeWidget* AsNativeWidget() OVERRIDE; | 133 virtual NativeWidget* AsNativeWidget() OVERRIDE; |
133 virtual const NativeWidget* AsNativeWidget() const OVERRIDE; | 134 virtual const NativeWidget* AsNativeWidget() const OVERRIDE; |
134 virtual gfx::Rect GetRestoredBounds() const OVERRIDE; | 135 virtual gfx::Rect GetRestoredBounds() const OVERRIDE; |
135 virtual void ShowNativeWindow(ShowState state) OVERRIDE; | 136 virtual void ShowNativeWindow(ShowState state) OVERRIDE; |
136 virtual void BecomeModal() OVERRIDE; | 137 virtual void BecomeModal() OVERRIDE; |
137 virtual void CenterWindow(const gfx::Size& size) OVERRIDE; | 138 virtual void CenterWindow(const gfx::Size& size) OVERRIDE; |
(...skipping 14 matching lines...) Expand all Loading... |
152 virtual void Maximize() OVERRIDE; | 153 virtual void Maximize() OVERRIDE; |
153 virtual void Minimize() OVERRIDE; | 154 virtual void Minimize() OVERRIDE; |
154 virtual void Restore() OVERRIDE; | 155 virtual void Restore() OVERRIDE; |
155 virtual bool IsActive() const OVERRIDE; | 156 virtual bool IsActive() const OVERRIDE; |
156 virtual bool IsVisible() const OVERRIDE; | 157 virtual bool IsVisible() const OVERRIDE; |
157 virtual bool IsMaximized() const OVERRIDE; | 158 virtual bool IsMaximized() const OVERRIDE; |
158 virtual bool IsMinimized() const OVERRIDE; | 159 virtual bool IsMinimized() const OVERRIDE; |
159 virtual void SetFullscreen(bool fullscreen) OVERRIDE; | 160 virtual void SetFullscreen(bool fullscreen) OVERRIDE; |
160 virtual bool IsFullscreen() const OVERRIDE; | 161 virtual bool IsFullscreen() const OVERRIDE; |
161 virtual void SetAlwaysOnTop(bool always_on_top) OVERRIDE; | 162 virtual void SetAlwaysOnTop(bool always_on_top) OVERRIDE; |
162 virtual bool IsAppWindow() const OVERRIDE; | |
163 virtual void SetUseDragFrame(bool use_drag_frame) OVERRIDE; | 163 virtual void SetUseDragFrame(bool use_drag_frame) OVERRIDE; |
164 virtual NonClientFrameView* CreateFrameViewForWindow() OVERRIDE; | 164 virtual NonClientFrameView* CreateFrameViewForWindow() OVERRIDE; |
165 virtual void UpdateFrameAfterFrameChange() OVERRIDE; | 165 virtual void UpdateFrameAfterFrameChange() OVERRIDE; |
166 virtual gfx::NativeWindow GetNativeWindow() const OVERRIDE; | 166 virtual gfx::NativeWindow GetNativeWindow() const OVERRIDE; |
167 virtual bool ShouldUseNativeFrame() const OVERRIDE; | 167 virtual bool ShouldUseNativeFrame() const OVERRIDE; |
168 virtual void FrameTypeChanged() OVERRIDE; | 168 virtual void FrameTypeChanged() OVERRIDE; |
169 | 169 |
170 private: | 170 private: |
171 // Information saved before going into fullscreen mode, used to restore the | 171 // Information saved before going into fullscreen mode, used to restore the |
172 // window afterwards. | 172 // window afterwards. |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 | 267 |
268 // True when the window is being moved/sized. | 268 // True when the window is being moved/sized. |
269 bool is_in_size_move_; | 269 bool is_in_size_move_; |
270 | 270 |
271 DISALLOW_COPY_AND_ASSIGN(WindowWin); | 271 DISALLOW_COPY_AND_ASSIGN(WindowWin); |
272 }; | 272 }; |
273 | 273 |
274 } // namespace views | 274 } // namespace views |
275 | 275 |
276 #endif // VIEWS_WINDOW_WINDOW_WIN_H_ | 276 #endif // VIEWS_WINDOW_WINDOW_WIN_H_ |
OLD | NEW |