| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 lock_updates_(false), | 307 lock_updates_(false), |
| 310 saved_window_style_(0), | 308 saved_window_style_(0), |
| 311 ignore_window_pos_changes_(false), | 309 ignore_window_pos_changes_(false), |
| 312 ignore_pos_changes_factory_(this), | 310 ignore_pos_changes_factory_(this), |
| 313 force_hidden_count_(0), | 311 force_hidden_count_(0), |
| 314 is_right_mouse_pressed_on_caption_(false), | 312 is_right_mouse_pressed_on_caption_(false), |
| 315 last_monitor_(NULL), | 313 last_monitor_(NULL), |
| 316 is_in_size_move_(false) { | 314 is_in_size_move_(false) { |
| 317 SetNativeWindow(this); | 315 SetNativeWindow(this); |
| 318 is_window_ = true; | 316 is_window_ = true; |
| 319 InitClass(); | |
| 320 // Initialize these values to 0 so that subclasses can override the default | 317 // Initialize these values to 0 so that subclasses can override the default |
| 321 // behavior before calling Init. | 318 // behavior before calling Init. |
| 322 set_window_style(0); | 319 set_window_style(0); |
| 323 set_window_ex_style(0); | 320 set_window_ex_style(0); |
| 324 } | 321 } |
| 325 | 322 |
| 326 gfx::Insets WindowWin::GetClientAreaInsets() const { | 323 gfx::Insets WindowWin::GetClientAreaInsets() const { |
| 327 // Returning an empty Insets object causes the default handling in | 324 // Returning an empty Insets object causes the default handling in |
| 328 // WidgetWin::OnNCCalcSize() to be invoked. | 325 // WidgetWin::OnNCCalcSize() to be invoked. |
| 329 if (delegate_->IsUsingNativeFrame()) | 326 if (delegate_->IsUsingNativeFrame()) |
| (...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1335 // it from doing so. | 1332 // it from doing so. |
| 1336 ScopedRedrawLock lock(this); | 1333 ScopedRedrawLock lock(this); |
| 1337 return DefWindowProc(GetNativeView(), WM_NCACTIVATE, active, 0); | 1334 return DefWindowProc(GetNativeView(), WM_NCACTIVATE, active, 0); |
| 1338 } | 1335 } |
| 1339 | 1336 |
| 1340 void WindowWin::ExecuteSystemMenuCommand(int command) { | 1337 void WindowWin::ExecuteSystemMenuCommand(int command) { |
| 1341 if (command) | 1338 if (command) |
| 1342 SendMessage(GetNativeView(), WM_SYSCOMMAND, command, 0); | 1339 SendMessage(GetNativeView(), WM_SYSCOMMAND, command, 0); |
| 1343 } | 1340 } |
| 1344 | 1341 |
| 1345 void WindowWin::InitClass() { | |
| 1346 static bool initialized = false; | |
| 1347 if (!initialized) { | |
| 1348 resize_cursors_[RC_NORMAL] = LoadCursor(NULL, IDC_ARROW); | |
| 1349 resize_cursors_[RC_VERTICAL] = LoadCursor(NULL, IDC_SIZENS); | |
| 1350 resize_cursors_[RC_HORIZONTAL] = LoadCursor(NULL, IDC_SIZEWE); | |
| 1351 resize_cursors_[RC_NESW] = LoadCursor(NULL, IDC_SIZENESW); | |
| 1352 resize_cursors_[RC_NWSE] = LoadCursor(NULL, IDC_SIZENWSE); | |
| 1353 initialized = true; | |
| 1354 } | |
| 1355 } | |
| 1356 | |
| 1357 namespace { | 1342 namespace { |
| 1358 BOOL CALLBACK WindowCallbackProc(HWND hwnd, LPARAM lParam) { | 1343 BOOL CALLBACK WindowCallbackProc(HWND hwnd, LPARAM lParam) { |
| 1359 NativeWidget* native_widget = | 1344 NativeWidget* native_widget = |
| 1360 NativeWidget::GetNativeWidgetForNativeView(hwnd); | 1345 NativeWidget::GetNativeWidgetForNativeView(hwnd); |
| 1361 if (native_widget) | 1346 if (native_widget) |
| 1362 Window::CloseSecondaryWidget(native_widget->GetWidget()); | 1347 Window::CloseSecondaryWidget(native_widget->GetWidget()); |
| 1363 return TRUE; | 1348 return TRUE; |
| 1364 } | 1349 } |
| 1365 } // namespace | 1350 } // namespace |
| 1366 | 1351 |
| 1367 void Window::CloseAllSecondaryWindows() { | 1352 void Window::CloseAllSecondaryWindows() { |
| 1368 EnumThreadWindows(GetCurrentThreadId(), WindowCallbackProc, 0); | 1353 EnumThreadWindows(GetCurrentThreadId(), WindowCallbackProc, 0); |
| 1369 } | 1354 } |
| 1370 | 1355 |
| 1371 } // namespace views | 1356 } // namespace views |
| OLD | NEW |