| 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 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 SetMsgHandled(FALSE); | 450 SetMsgHandled(FALSE); |
| 451 return 0; | 451 return 0; |
| 452 } | 452 } |
| 453 virtual void OnSettingChange(UINT flags, const wchar_t* section); | 453 virtual void OnSettingChange(UINT flags, const wchar_t* section); |
| 454 virtual void OnSize(UINT param, const CSize& size); | 454 virtual void OnSize(UINT param, const CSize& size); |
| 455 virtual void OnSysCommand(UINT notification_code, CPoint click) { } | 455 virtual void OnSysCommand(UINT notification_code, CPoint click) { } |
| 456 virtual void OnThemeChanged(); | 456 virtual void OnThemeChanged(); |
| 457 virtual void OnVScroll(int scroll_type, short position, HWND scrollbar) { | 457 virtual void OnVScroll(int scroll_type, short position, HWND scrollbar) { |
| 458 SetMsgHandled(FALSE); | 458 SetMsgHandled(FALSE); |
| 459 } | 459 } |
| 460 virtual void OnWindowPosChanging(WINDOWPOS* window_pos) { | 460 virtual void OnWindowPosChanging(WINDOWPOS* window_pos); |
| 461 SetMsgHandled(FALSE); | |
| 462 } | |
| 463 virtual void OnWindowPosChanged(WINDOWPOS* window_pos) { | 461 virtual void OnWindowPosChanged(WINDOWPOS* window_pos) { |
| 464 SetMsgHandled(FALSE); | 462 SetMsgHandled(FALSE); |
| 465 } | 463 } |
| 466 | 464 |
| 467 // deletes this window as it is destroyed, override to provide different | 465 // deletes this window as it is destroyed, override to provide different |
| 468 // behavior. | 466 // behavior. |
| 469 virtual void OnFinalMessage(HWND window); | 467 virtual void OnFinalMessage(HWND window); |
| 470 | 468 |
| 471 // Start tracking all mouse events so that this window gets sent mouse leave | 469 // Start tracking all mouse events so that this window gets sent mouse leave |
| 472 // messages too. |is_nonclient| is true when we should track WM_NCMOUSELEAVE | 470 // messages too. |is_nonclient| is true when we should track WM_NCMOUSELEAVE |
| 473 // messages instead of WM_MOUSELEAVE ones. | 471 // messages instead of WM_MOUSELEAVE ones. |
| 474 void TrackMouseEvents(DWORD mouse_tracking_flags); | 472 void TrackMouseEvents(DWORD mouse_tracking_flags); |
| 475 | 473 |
| 476 // Actually handle mouse events. These functions are called by subclasses who | 474 // Actually handle mouse events. These functions are called by subclasses who |
| 477 // override the message handlers above to do the actual real work of handling | 475 // override the message handlers above to do the actual real work of handling |
| 478 // the event in the View system. | 476 // the event in the View system. |
| 479 bool ProcessMousePressed(const CPoint& point, | 477 bool ProcessMousePressed(const CPoint& point, |
| 480 UINT flags, | 478 UINT flags, |
| 481 bool dbl_click, | 479 bool dbl_click, |
| 482 bool non_client); | 480 bool non_client); |
| 483 void ProcessMouseDragged(const CPoint& point, UINT flags); | 481 void ProcessMouseDragged(const CPoint& point, UINT flags); |
| 484 void ProcessMouseReleased(const CPoint& point, UINT flags); | 482 void ProcessMouseReleased(const CPoint& point, UINT flags); |
| 485 void ProcessMouseMoved(const CPoint& point, UINT flags, bool is_nonclient); | 483 void ProcessMouseMoved(const CPoint& point, UINT flags, bool is_nonclient); |
| 486 void ProcessMouseExited(); | 484 void ProcessMouseExited(); |
| 487 | 485 |
| 488 // Makes sure the window still fits on screen after a settings change message | |
| 489 // from the OS, e.g. a screen resolution change. | |
| 490 virtual void AdjustWindowToFitScreenSize(); | |
| 491 | |
| 492 // Handles re-laying out content in response to a window size change. | 486 // Handles re-laying out content in response to a window size change. |
| 493 virtual void ChangeSize(UINT size_param, const CSize& size); | 487 virtual void ChangeSize(UINT size_param, const CSize& size); |
| 494 | 488 |
| 495 // Returns whether capture should be released on mouse release. The default | 489 // Returns whether capture should be released on mouse release. The default |
| 496 // is true. | 490 // is true. |
| 497 virtual bool ReleaseCaptureOnMouseReleased() { return true; } | 491 virtual bool ReleaseCaptureOnMouseReleased() { return true; } |
| 498 | 492 |
| 499 enum FrameAction {FA_NONE = 0, FA_RESIZING, FA_MOVING, FA_FORWARDING}; | 493 enum FrameAction {FA_NONE = 0, FA_RESIZING, FA_MOVING, FA_FORWARDING}; |
| 500 | 494 |
| 501 virtual RootView* CreateRootView(); | 495 virtual RootView* CreateRootView(); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 // The windows procedure used by all WidgetWins. | 530 // The windows procedure used by all WidgetWins. |
| 537 static LRESULT CALLBACK WndProc(HWND window, | 531 static LRESULT CALLBACK WndProc(HWND window, |
| 538 UINT message, | 532 UINT message, |
| 539 WPARAM w_param, | 533 WPARAM w_param, |
| 540 LPARAM l_param); | 534 LPARAM l_param); |
| 541 | 535 |
| 542 // Gets the window class name to use when creating the corresponding HWND. | 536 // Gets the window class name to use when creating the corresponding HWND. |
| 543 // If necessary, this registers the window class. | 537 // If necessary, this registers the window class. |
| 544 std::wstring GetWindowClassName(); | 538 std::wstring GetWindowClassName(); |
| 545 | 539 |
| 540 // Stops ignoring SetWindowPos() requests (see below). |
| 541 void StopIgnoringPosChanges() { ignore_window_pos_changes_ = false; } |
| 542 |
| 546 // The following factory is used for calls to close the WidgetWin | 543 // The following factory is used for calls to close the WidgetWin |
| 547 // instance. | 544 // instance. |
| 548 ScopedRunnableMethodFactory<WidgetWin> close_widget_factory_; | 545 ScopedRunnableMethodFactory<WidgetWin> close_widget_factory_; |
| 549 | 546 |
| 547 // The following factory is used to ignore SetWindowPos() calls for short time |
| 548 // periods. |
| 549 ScopedRunnableMethodFactory<WidgetWin> ignore_pos_changes_factory_; |
| 550 |
| 550 // The flags currently being used with TrackMouseEvent to track mouse | 551 // The flags currently being used with TrackMouseEvent to track mouse |
| 551 // messages. 0 if there is no active tracking. The value of this member is | 552 // messages. 0 if there is no active tracking. The value of this member is |
| 552 // used when tracking is canceled. | 553 // used when tracking is canceled. |
| 553 DWORD active_mouse_tracking_flags_; | 554 DWORD active_mouse_tracking_flags_; |
| 554 | 555 |
| 555 // Whether or not this is a top level window. | 556 // Whether or not this is a top level window. |
| 556 bool toplevel_; | 557 bool toplevel_; |
| 557 | 558 |
| 558 bool opaque_; | 559 bool opaque_; |
| 559 | 560 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 | 605 |
| 605 // Coordinates of the last mouse move event, in screen coordinates. | 606 // Coordinates of the last mouse move event, in screen coordinates. |
| 606 int last_mouse_move_x_; | 607 int last_mouse_move_x_; |
| 607 int last_mouse_move_y_; | 608 int last_mouse_move_y_; |
| 608 | 609 |
| 609 // Instance of accessibility information and handling for MSAA root | 610 // Instance of accessibility information and handling for MSAA root |
| 610 CComPtr<IAccessible> accessibility_root_; | 611 CComPtr<IAccessible> accessibility_root_; |
| 611 | 612 |
| 612 // Our hwnd. | 613 // Our hwnd. |
| 613 HWND hwnd_; | 614 HWND hwnd_; |
| 615 |
| 616 // The last-seen monitor containing us, and its work area. These are used to |
| 617 // catch updates to the work area and react accordingly. |
| 618 HMONITOR last_monitor_; |
| 619 gfx::Rect last_work_area_; |
| 620 |
| 621 // When true, this flag makes us discard incoming SetWindowPos() requests that |
| 622 // only change our position/size. (We still allow changes to Z-order, |
| 623 // activation, etc.) |
| 624 bool ignore_window_pos_changes_; |
| 614 }; | 625 }; |
| 615 | 626 |
| 616 } // namespace views | 627 } // namespace views |
| 617 | 628 |
| 618 #endif // #ifndef CHROME_VIEWS_WIDGET_WIDGET_WIN_H_ | 629 #endif // #ifndef CHROME_VIEWS_WIDGET_WIDGET_WIN_H_ |
| OLD | NEW |