OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 CHROME_VIEWS_WIDGET_WIDGET_WIN_H_ | 5 #ifndef CHROME_VIEWS_WIDGET_WIDGET_WIN_H_ |
6 #define CHROME_VIEWS_WIDGET_WIDGET_WIN_H_ | 6 #define CHROME_VIEWS_WIDGET_WIDGET_WIN_H_ |
7 | 7 |
8 #include <atlbase.h> | 8 #include <atlbase.h> |
9 #include <atlcrack.h> | 9 #include <atlcrack.h> |
10 | 10 |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 | 275 |
276 HWND SetCapture() { | 276 HWND SetCapture() { |
277 DCHECK(::IsWindow(GetNativeView())); | 277 DCHECK(::IsWindow(GetNativeView())); |
278 return ::SetCapture(GetNativeView()); | 278 return ::SetCapture(GetNativeView()); |
279 } | 279 } |
280 | 280 |
281 HWND GetParent() const { | 281 HWND GetParent() const { |
282 return ::GetParent(GetNativeView()); | 282 return ::GetParent(GetNativeView()); |
283 } | 283 } |
284 | 284 |
| 285 LONG GetWindowLong(int index) { |
| 286 DCHECK(::IsWindow(GetNativeView())); |
| 287 return ::GetWindowLong(GetNativeView(), index); |
| 288 } |
| 289 |
285 BOOL GetWindowRect(RECT* rect) const { | 290 BOOL GetWindowRect(RECT* rect) const { |
286 return ::GetWindowRect(GetNativeView(), rect); | 291 return ::GetWindowRect(GetNativeView(), rect); |
287 } | 292 } |
288 | 293 |
| 294 LONG SetWindowLong(int index, LONG new_long) { |
| 295 DCHECK(::IsWindow(GetNativeView())); |
| 296 return ::SetWindowLong(GetNativeView(), index, new_long); |
| 297 } |
| 298 |
289 BOOL SetWindowPos(HWND hwnd_after, int x, int y, int cx, int cy, UINT flags) { | 299 BOOL SetWindowPos(HWND hwnd_after, int x, int y, int cx, int cy, UINT flags) { |
290 DCHECK(::IsWindow(GetNativeView())); | 300 DCHECK(::IsWindow(GetNativeView())); |
291 return ::SetWindowPos(GetNativeView(), hwnd_after, x, y, cx, cy, flags); | 301 return ::SetWindowPos(GetNativeView(), hwnd_after, x, y, cx, cy, flags); |
292 } | 302 } |
293 | 303 |
294 BOOL IsZoomed() const { | 304 BOOL IsZoomed() const { |
295 DCHECK(::IsWindow(GetNativeView())); | 305 DCHECK(::IsWindow(GetNativeView())); |
296 return ::IsZoomed(GetNativeView()); | 306 return ::IsZoomed(GetNativeView()); |
297 } | 307 } |
298 | 308 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 SetMsgHandled(FALSE); | 453 SetMsgHandled(FALSE); |
444 } | 454 } |
445 virtual LRESULT OnSetIcon(UINT size_type, HICON new_icon) { | 455 virtual LRESULT OnSetIcon(UINT size_type, HICON new_icon) { |
446 SetMsgHandled(FALSE); | 456 SetMsgHandled(FALSE); |
447 return 0; | 457 return 0; |
448 } | 458 } |
449 virtual LRESULT OnSetText(const wchar_t* text) { | 459 virtual LRESULT OnSetText(const wchar_t* text) { |
450 SetMsgHandled(FALSE); | 460 SetMsgHandled(FALSE); |
451 return 0; | 461 return 0; |
452 } | 462 } |
453 virtual void OnSettingChange(UINT flags, const wchar_t* section); | 463 virtual void OnSettingChange(UINT flags, const wchar_t* section) { |
| 464 SetMsgHandled(FALSE); |
| 465 } |
454 virtual void OnSize(UINT param, const CSize& size); | 466 virtual void OnSize(UINT param, const CSize& size); |
455 virtual void OnSysCommand(UINT notification_code, CPoint click) { } | 467 virtual void OnSysCommand(UINT notification_code, CPoint click) { } |
456 virtual void OnThemeChanged(); | 468 virtual void OnThemeChanged(); |
457 virtual void OnVScroll(int scroll_type, short position, HWND scrollbar) { | 469 virtual void OnVScroll(int scroll_type, short position, HWND scrollbar) { |
458 SetMsgHandled(FALSE); | 470 SetMsgHandled(FALSE); |
459 } | 471 } |
460 virtual void OnWindowPosChanging(WINDOWPOS* window_pos); | 472 virtual void OnWindowPosChanging(WINDOWPOS* window_pos) { |
| 473 SetMsgHandled(FALSE); |
| 474 } |
461 virtual void OnWindowPosChanged(WINDOWPOS* window_pos) { | 475 virtual void OnWindowPosChanged(WINDOWPOS* window_pos) { |
462 SetMsgHandled(FALSE); | 476 SetMsgHandled(FALSE); |
463 } | 477 } |
464 | 478 |
465 // deletes this window as it is destroyed, override to provide different | 479 // deletes this window as it is destroyed, override to provide different |
466 // behavior. | 480 // behavior. |
467 virtual void OnFinalMessage(HWND window); | 481 virtual void OnFinalMessage(HWND window); |
468 | 482 |
469 // Start tracking all mouse events so that this window gets sent mouse leave | 483 // Start tracking all mouse events so that this window gets sent mouse leave |
470 // messages too. |is_nonclient| is true when we should track WM_NCMOUSELEAVE | 484 // messages too. |is_nonclient| is true when we should track WM_NCMOUSELEAVE |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 // The windows procedure used by all WidgetWins. | 544 // The windows procedure used by all WidgetWins. |
531 static LRESULT CALLBACK WndProc(HWND window, | 545 static LRESULT CALLBACK WndProc(HWND window, |
532 UINT message, | 546 UINT message, |
533 WPARAM w_param, | 547 WPARAM w_param, |
534 LPARAM l_param); | 548 LPARAM l_param); |
535 | 549 |
536 // Gets the window class name to use when creating the corresponding HWND. | 550 // Gets the window class name to use when creating the corresponding HWND. |
537 // If necessary, this registers the window class. | 551 // If necessary, this registers the window class. |
538 std::wstring GetWindowClassName(); | 552 std::wstring GetWindowClassName(); |
539 | 553 |
540 // Stops ignoring SetWindowPos() requests (see below). | |
541 void StopIgnoringPosChanges() { ignore_window_pos_changes_ = false; } | |
542 | |
543 // The following factory is used for calls to close the WidgetWin | 554 // The following factory is used for calls to close the WidgetWin |
544 // instance. | 555 // instance. |
545 ScopedRunnableMethodFactory<WidgetWin> close_widget_factory_; | 556 ScopedRunnableMethodFactory<WidgetWin> close_widget_factory_; |
546 | 557 |
547 // The following factory is used to ignore SetWindowPos() calls for short time | |
548 // periods. | |
549 ScopedRunnableMethodFactory<WidgetWin> ignore_pos_changes_factory_; | |
550 | |
551 // The flags currently being used with TrackMouseEvent to track mouse | 558 // The flags currently being used with TrackMouseEvent to track mouse |
552 // messages. 0 if there is no active tracking. The value of this member is | 559 // messages. 0 if there is no active tracking. The value of this member is |
553 // used when tracking is canceled. | 560 // used when tracking is canceled. |
554 DWORD active_mouse_tracking_flags_; | 561 DWORD active_mouse_tracking_flags_; |
555 | 562 |
556 bool opaque_; | 563 bool opaque_; |
557 | 564 |
558 // Window Styles used when creating the window. | 565 // Window Styles used when creating the window. |
559 DWORD window_style_; | 566 DWORD window_style_; |
560 | 567 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 | 609 |
603 // Coordinates of the last mouse move event, in screen coordinates. | 610 // Coordinates of the last mouse move event, in screen coordinates. |
604 int last_mouse_move_x_; | 611 int last_mouse_move_x_; |
605 int last_mouse_move_y_; | 612 int last_mouse_move_y_; |
606 | 613 |
607 // Instance of accessibility information and handling for MSAA root | 614 // Instance of accessibility information and handling for MSAA root |
608 CComPtr<IAccessible> accessibility_root_; | 615 CComPtr<IAccessible> accessibility_root_; |
609 | 616 |
610 // Our hwnd. | 617 // Our hwnd. |
611 HWND hwnd_; | 618 HWND hwnd_; |
612 | |
613 // The last-seen monitor containing us, and its work area. These are used to | |
614 // catch updates to the work area and react accordingly. | |
615 HMONITOR last_monitor_; | |
616 gfx::Rect last_work_area_; | |
617 | |
618 // When true, this flag makes us discard incoming SetWindowPos() requests that | |
619 // only change our position/size. (We still allow changes to Z-order, | |
620 // activation, etc.) | |
621 bool ignore_window_pos_changes_; | |
622 }; | 619 }; |
623 | 620 |
624 } // namespace views | 621 } // namespace views |
625 | 622 |
626 #endif // #ifndef CHROME_VIEWS_WIDGET_WIDGET_WIN_H_ | 623 #endif // #ifndef CHROME_VIEWS_WIDGET_WIDGET_WIN_H_ |
OLD | NEW |