| 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 #include "views/window/window_win.h" | 5 #include "views/window/window_win.h" |
| 6 | 6 |
| 7 #include <dwmapi.h> | 7 #include <dwmapi.h> |
| 8 #include <shellapi.h> | 8 #include <shellapi.h> |
| 9 | 9 |
| 10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 | 223 |
| 224 ~ScopedRedrawLock() { | 224 ~ScopedRedrawLock() { |
| 225 window_->UnlockUpdates(); | 225 window_->UnlockUpdates(); |
| 226 } | 226 } |
| 227 | 227 |
| 228 private: | 228 private: |
| 229 // The window having its style changed. | 229 // The window having its style changed. |
| 230 WindowWin* window_; | 230 WindowWin* window_; |
| 231 }; | 231 }; |
| 232 | 232 |
| 233 HCURSOR WindowWin::resize_cursors_[6]; | |
| 234 | |
| 235 //////////////////////////////////////////////////////////////////////////////// | 233 //////////////////////////////////////////////////////////////////////////////// |
| 236 // WindowWin, public: | 234 // WindowWin, public: |
| 237 | 235 |
| 238 WindowWin::~WindowWin() { | 236 WindowWin::~WindowWin() { |
| 239 } | 237 } |
| 240 | 238 |
| 241 // static | 239 // static |
| 242 Window* Window::CreateChromeWindow(gfx::NativeWindow parent, | 240 Window* Window::CreateChromeWindow(gfx::NativeWindow parent, |
| 243 const gfx::Rect& bounds, | 241 const gfx::Rect& bounds, |
| 244 WindowDelegate* window_delegate) { | 242 WindowDelegate* window_delegate) { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 lock_updates_(false), | 305 lock_updates_(false), |
| 308 saved_window_style_(0), | 306 saved_window_style_(0), |
| 309 ignore_window_pos_changes_(false), | 307 ignore_window_pos_changes_(false), |
| 310 ignore_pos_changes_factory_(this), | 308 ignore_pos_changes_factory_(this), |
| 311 force_hidden_count_(0), | 309 force_hidden_count_(0), |
| 312 is_right_mouse_pressed_on_caption_(false), | 310 is_right_mouse_pressed_on_caption_(false), |
| 313 last_monitor_(NULL), | 311 last_monitor_(NULL), |
| 314 is_in_size_move_(false) { | 312 is_in_size_move_(false) { |
| 315 SetNativeWindow(this); | 313 SetNativeWindow(this); |
| 316 is_window_ = true; | 314 is_window_ = true; |
| 317 InitClass(); | |
| 318 // Initialize these values to 0 so that subclasses can override the default | 315 // Initialize these values to 0 so that subclasses can override the default |
| 319 // behavior before calling Init. | 316 // behavior before calling Init. |
| 320 set_window_style(0); | 317 set_window_style(0); |
| 321 set_window_ex_style(0); | 318 set_window_ex_style(0); |
| 322 } | 319 } |
| 323 | 320 |
| 324 void WindowWin::Init(gfx::NativeView parent, const gfx::Rect& bounds) { | 321 void WindowWin::Init(gfx::NativeView parent, const gfx::Rect& bounds) { |
| 325 if (window_style() == 0) | 322 if (window_style() == 0) |
| 326 set_window_style(CalculateWindowStyle()); | 323 set_window_style(CalculateWindowStyle()); |
| 327 if (window_ex_style() == 0) | 324 if (window_ex_style() == 0) |
| (...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1333 // it from doing so. | 1330 // it from doing so. |
| 1334 ScopedRedrawLock lock(this); | 1331 ScopedRedrawLock lock(this); |
| 1335 return DefWindowProc(GetNativeView(), WM_NCACTIVATE, active, 0); | 1332 return DefWindowProc(GetNativeView(), WM_NCACTIVATE, active, 0); |
| 1336 } | 1333 } |
| 1337 | 1334 |
| 1338 void WindowWin::ExecuteSystemMenuCommand(int command) { | 1335 void WindowWin::ExecuteSystemMenuCommand(int command) { |
| 1339 if (command) | 1336 if (command) |
| 1340 SendMessage(GetNativeView(), WM_SYSCOMMAND, command, 0); | 1337 SendMessage(GetNativeView(), WM_SYSCOMMAND, command, 0); |
| 1341 } | 1338 } |
| 1342 | 1339 |
| 1343 void WindowWin::InitClass() { | |
| 1344 static bool initialized = false; | |
| 1345 if (!initialized) { | |
| 1346 resize_cursors_[RC_NORMAL] = LoadCursor(NULL, IDC_ARROW); | |
| 1347 resize_cursors_[RC_VERTICAL] = LoadCursor(NULL, IDC_SIZENS); | |
| 1348 resize_cursors_[RC_HORIZONTAL] = LoadCursor(NULL, IDC_SIZEWE); | |
| 1349 resize_cursors_[RC_NESW] = LoadCursor(NULL, IDC_SIZENESW); | |
| 1350 resize_cursors_[RC_NWSE] = LoadCursor(NULL, IDC_SIZENWSE); | |
| 1351 initialized = true; | |
| 1352 } | |
| 1353 } | |
| 1354 | |
| 1355 namespace { | 1340 namespace { |
| 1356 BOOL CALLBACK WindowCallbackProc(HWND hwnd, LPARAM lParam) { | 1341 BOOL CALLBACK WindowCallbackProc(HWND hwnd, LPARAM lParam) { |
| 1357 NativeWidget* native_widget = | 1342 NativeWidget* native_widget = |
| 1358 NativeWidget::GetNativeWidgetForNativeView(hwnd); | 1343 NativeWidget::GetNativeWidgetForNativeView(hwnd); |
| 1359 if (native_widget) | 1344 if (native_widget) |
| 1360 Window::CloseSecondaryWidget(native_widget->GetWidget()); | 1345 Window::CloseSecondaryWidget(native_widget->GetWidget()); |
| 1361 return TRUE; | 1346 return TRUE; |
| 1362 } | 1347 } |
| 1363 } // namespace | 1348 } // namespace |
| 1364 | 1349 |
| 1365 void Window::CloseAllSecondaryWindows() { | 1350 void Window::CloseAllSecondaryWindows() { |
| 1366 EnumThreadWindows(GetCurrentThreadId(), WindowCallbackProc, 0); | 1351 EnumThreadWindows(GetCurrentThreadId(), WindowCallbackProc, 0); |
| 1367 } | 1352 } |
| 1368 | 1353 |
| 1369 } // namespace views | 1354 } // namespace views |
| OLD | NEW |