Index: views/window/native_window_win.cc |
=================================================================== |
--- views/window/native_window_win.cc (revision 86938) |
+++ views/window/native_window_win.cc (working copy) |
@@ -1175,6 +1175,53 @@ |
kMonitorEdgePadding, 0); |
} |
+void NativeWindowWin::HideWindow() { |
+ // We can just call the function implemented by the widget. |
+ Hide(); |
+} |
+ |
+void NativeWindowWin::Activate() { |
+ if (IsMinimized()) |
+ ::ShowWindow(GetNativeView(), SW_RESTORE); |
+ ::SetWindowPos(GetNativeView(), HWND_TOP, 0, 0, 0, 0, |
+ SWP_NOSIZE | SWP_NOMOVE); |
+ SetForegroundWindow(GetNativeView()); |
+} |
+ |
+void NativeWindowWin::Deactivate() { |
+ HWND hwnd = ::GetNextWindow(GetNativeView(), GW_HWNDNEXT); |
+ if (hwnd) |
+ ::SetForegroundWindow(hwnd); |
+} |
+ |
+void NativeWindowWin::Maximize() { |
+ ExecuteSystemMenuCommand(SC_MAXIMIZE); |
+} |
+ |
+void NativeWindowWin::Minimize() { |
+ ExecuteSystemMenuCommand(SC_MINIMIZE); |
+} |
+ |
+void NativeWindowWin::Restore() { |
+ ExecuteSystemMenuCommand(SC_RESTORE); |
+} |
+ |
+bool NativeWindowWin::IsActive() const { |
+ return is_active_; |
+} |
+ |
+bool NativeWindowWin::IsVisible() const { |
+ return !!::IsWindowVisible(GetNativeView()); |
+} |
+ |
+bool NativeWindowWin::IsMaximized() const { |
+ return !!::IsZoomed(GetNativeView()); |
+} |
+ |
+bool NativeWindowWin::IsMinimized() const { |
+ return !!::IsIconic(GetNativeView()); |
+} |
+ |
void NativeWindowWin::SetFullscreen(bool fullscreen) { |
if (fullscreen_ == fullscreen) |
return; // Nothing to do. |
@@ -1236,6 +1283,11 @@ |
return fullscreen_; |
} |
+void NativeWindowWin::SetAlwaysOnTop(bool always_on_top) { |
+ ::SetWindowPos(GetNativeView(), always_on_top ? HWND_TOPMOST : HWND_NOTOPMOST, |
+ 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); |
+} |
+ |
void NativeWindowWin::SetUseDragFrame(bool use_drag_frame) { |
if (use_drag_frame) { |
// Make the frame slightly transparent during the drag operation. |
@@ -1264,6 +1316,10 @@ |
ResetWindowRegion(true); |
} |
+gfx::NativeWindow NativeWindowWin::GetNativeWindow() const { |
+ return GetNativeView(); |
+} |
+ |
bool NativeWindowWin::ShouldUseNativeFrame() const { |
return NativeWidgetWin::IsAeroGlassEnabled(); |
} |
@@ -1298,15 +1354,6 @@ |
} |
//////////////////////////////////////////////////////////////////////////////// |
-// NativeWindowWin, NativeWidgetWin overrides: |
- |
-bool NativeWindowWin::IsActive() const { |
- // TODO(beng): evaluate whether or not this is needed. NativeWidgetWin checks |
- // active-state with the OS using GetWindowInfo(). |
- return is_active_; |
-} |
- |
-//////////////////////////////////////////////////////////////////////////////// |
// NativeWindowWin, private: |
void NativeWindowWin::RestoreEnabledIfNecessary() { |
@@ -1409,6 +1456,11 @@ |
return DefWindowProc(GetNativeView(), WM_NCACTIVATE, active, 0); |
} |
+void NativeWindowWin::ExecuteSystemMenuCommand(int command) { |
+ if (command) |
+ SendMessage(GetNativeView(), WM_SYSCOMMAND, command, 0); |
+} |
+ |
//////////////////////////////////////////////////////////////////////////////// |
// NativeWindow, public: |