Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Unified Diff: views/widget/native_widget_win.cc

Issue 7075019: Move a bunch of functions from Window onto Widget. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « views/widget/native_widget_win.h ('k') | views/widget/widget.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/widget/native_widget_win.cc
===================================================================
--- views/widget/native_widget_win.cc (revision 87016)
+++ views/widget/native_widget_win.cc (working copy)
@@ -394,25 +394,57 @@
}
}
-void NativeWidgetWin::SetOpacity(unsigned char opacity) {
- layered_alpha_ = static_cast<BYTE>(opacity);
+bool NativeWidgetWin::IsVisible() const {
+ return !!::IsWindowVisible(hwnd());
}
-void NativeWidgetWin::SetAlwaysOnTop(bool on_top) {
- if (on_top)
- set_window_ex_style(window_ex_style() | WS_EX_TOPMOST);
- else
- set_window_ex_style(window_ex_style() & ~WS_EX_TOPMOST);
+void NativeWidgetWin::Activate() {
+ if (IsMinimized())
+ ::ShowWindow(GetNativeView(), SW_RESTORE);
+ ::SetWindowPos(GetNativeView(), HWND_TOP, 0, 0, 0, 0,
+ SWP_NOSIZE | SWP_NOMOVE);
+ SetForegroundWindow(GetNativeView());
}
-bool NativeWidgetWin::IsVisible() const {
- return !!::IsWindowVisible(hwnd());
+void NativeWidgetWin::Deactivate() {
+ HWND hwnd = ::GetNextWindow(GetNativeView(), GW_HWNDNEXT);
+ if (hwnd)
+ ::SetForegroundWindow(hwnd);
}
bool NativeWidgetWin::IsActive() const {
return IsWindowActive(hwnd());
}
+void NativeWidgetWin::SetAlwaysOnTop(bool on_top) {
+ ::SetWindowPos(GetNativeView(), on_top ? HWND_TOPMOST : HWND_NOTOPMOST,
+ 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
+}
+
+void NativeWidgetWin::Maximize() {
+ ExecuteSystemMenuCommand(SC_MAXIMIZE);
+}
+
+void NativeWidgetWin::Minimize() {
+ ExecuteSystemMenuCommand(SC_MINIMIZE);
+}
+
+bool NativeWidgetWin::IsMaximized() const {
+ return !!::IsZoomed(GetNativeView());
+}
+
+bool NativeWidgetWin::IsMinimized() const {
+ return !!::IsIconic(GetNativeView());
+}
+
+void NativeWidgetWin::Restore() {
+ ExecuteSystemMenuCommand(SC_RESTORE);
+}
+
+void NativeWidgetWin::SetOpacity(unsigned char opacity) {
+ layered_alpha_ = static_cast<BYTE>(opacity);
+}
+
bool NativeWidgetWin::IsAccessibleWidget() const {
return screen_reader_active_;
}
@@ -997,6 +1029,11 @@
v->RequestFocus();
}
+void NativeWidgetWin::ExecuteSystemMenuCommand(int command) {
+ if (command)
+ SendMessage(GetNativeView(), WM_SYSCOMMAND, command, 0);
+}
+
////////////////////////////////////////////////////////////////////////////////
// NativeWidgetWin, private:
« no previous file with comments | « views/widget/native_widget_win.h ('k') | views/widget/widget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698