OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 UI_VIEWS_WIDGET_WIDGET_H_ | 5 #ifndef UI_VIEWS_WIDGET_WIDGET_H_ |
6 #define UI_VIEWS_WIDGET_WIDGET_H_ | 6 #define UI_VIEWS_WIDGET_WIDGET_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <stack> | 9 #include <stack> |
10 #include <vector> | 10 #include <vector> |
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
624 NativeWidget* native_widget(); | 624 NativeWidget* native_widget(); |
625 | 625 |
626 internal::NativeWidgetPrivate* native_widget_private() { | 626 internal::NativeWidgetPrivate* native_widget_private() { |
627 return native_widget_; | 627 return native_widget_; |
628 } | 628 } |
629 const internal::NativeWidgetPrivate* native_widget_private() const { | 629 const internal::NativeWidgetPrivate* native_widget_private() const { |
630 return native_widget_; | 630 return native_widget_; |
631 } | 631 } |
632 | 632 |
633 // Sets capture to the specified view. This makes it so that all mouse, touch | 633 // Sets capture to the specified view. This makes it so that all mouse, touch |
634 // and gesture events go to |view|. | 634 // and gesture events go to |view|. If |view| is NULL, the widget still |
| 635 // obtains event capture, but the events will go to the view they'd normally |
| 636 // go to. |
635 void SetCapture(View* view); | 637 void SetCapture(View* view); |
636 | 638 |
637 // Releases capture. | 639 // Releases capture. |
638 void ReleaseCapture(); | 640 void ReleaseCapture(); |
639 | 641 |
640 // Returns true if the widget has capture. | 642 // Returns true if the widget has capture. |
641 bool HasCapture(); | 643 bool HasCapture(); |
642 | 644 |
| 645 void set_auto_release_capture(bool auto_release_capture) { |
| 646 auto_release_capture_ = auto_release_capture; |
| 647 } |
| 648 |
643 // Invoked when the tooltip text changes for the specified views. | 649 // Invoked when the tooltip text changes for the specified views. |
644 void TooltipTextChanged(View* view); | 650 void TooltipTextChanged(View* view); |
645 | 651 |
646 // Sets-up the focus manager with the view that should have focus when the | 652 // Sets-up the focus manager with the view that should have focus when the |
647 // window is shown the first time. Returns true if the initial focus has been | 653 // window is shown the first time. Returns true if the initial focus has been |
648 // set or the widget should not set the initial focus, or false if the caller | 654 // set or the widget should not set the initial focus, or false if the caller |
649 // should set the initial focus (if any). | 655 // should set the initial focus (if any). |
650 bool SetInitialFocus(); | 656 bool SetInitialFocus(); |
651 | 657 |
652 void set_focus_on_creation(bool focus_on_creation) { | 658 void set_focus_on_creation(bool focus_on_creation) { |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 | 734 |
729 // Provided to allow the NativeWidget implementations to destroy the RootView | 735 // Provided to allow the NativeWidget implementations to destroy the RootView |
730 // _before_ the focus manager/tooltip manager. | 736 // _before_ the focus manager/tooltip manager. |
731 // TODO(beng): remove once we fold those objects onto this one. | 737 // TODO(beng): remove once we fold those objects onto this one. |
732 void DestroyRootView(); | 738 void DestroyRootView(); |
733 | 739 |
734 private: | 740 private: |
735 friend class NativeTextfieldViewsTest; | 741 friend class NativeTextfieldViewsTest; |
736 friend class NativeComboboxViewsTest; | 742 friend class NativeComboboxViewsTest; |
737 | 743 |
738 // Returns whether capture should be released on mouse release. | |
739 virtual bool ShouldReleaseCaptureOnMouseReleased() const; | |
740 | |
741 // Sets the value of |disable_inactive_rendering_|. If the value changes, | 744 // Sets the value of |disable_inactive_rendering_|. If the value changes, |
742 // both the NonClientView and WidgetDelegate are notified. | 745 // both the NonClientView and WidgetDelegate are notified. |
743 void SetInactiveRenderingDisabled(bool value); | 746 void SetInactiveRenderingDisabled(bool value); |
744 | 747 |
745 // Persists the window's restored position and "show" state using the | 748 // Persists the window's restored position and "show" state using the |
746 // window delegate. | 749 // window delegate. |
747 void SaveWindowPlacement(); | 750 void SaveWindowPlacement(); |
748 | 751 |
749 // Sizes and positions the window just after it is created. | 752 // Sizes and positions the window just after it is created. |
750 void SetInitialBounds(const gfx::Rect& bounds); | 753 void SetInitialBounds(const gfx::Rect& bounds); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
845 // If true, a touch device is currently down. | 848 // If true, a touch device is currently down. |
846 bool is_touch_down_; | 849 bool is_touch_down_; |
847 | 850 |
848 // TODO(beng): Remove NativeWidgetGtk's dependence on these: | 851 // TODO(beng): Remove NativeWidgetGtk's dependence on these: |
849 // The following are used to detect duplicate mouse move events and not | 852 // The following are used to detect duplicate mouse move events and not |
850 // deliver them. Displaying a window may result in the system generating | 853 // deliver them. Displaying a window may result in the system generating |
851 // duplicate move events even though the mouse hasn't moved. | 854 // duplicate move events even though the mouse hasn't moved. |
852 bool last_mouse_event_was_move_; | 855 bool last_mouse_event_was_move_; |
853 gfx::Point last_mouse_event_position_; | 856 gfx::Point last_mouse_event_position_; |
854 | 857 |
| 858 // True if event capture should be released on a mouse up event. Default is |
| 859 // true. |
| 860 bool auto_release_capture_; |
| 861 |
855 // See description in GetRootLayers(). | 862 // See description in GetRootLayers(). |
856 std::vector<ui::Layer*> root_layers_; | 863 std::vector<ui::Layer*> root_layers_; |
857 | 864 |
858 // Is |root_layers_| out of date? | 865 // Is |root_layers_| out of date? |
859 bool root_layers_dirty_; | 866 bool root_layers_dirty_; |
860 | 867 |
861 // True when window movement via mouse interaction with the frame should be | 868 // True when window movement via mouse interaction with the frame should be |
862 // disabled. | 869 // disabled. |
863 bool movement_disabled_; | 870 bool movement_disabled_; |
864 | 871 |
865 DISALLOW_COPY_AND_ASSIGN(Widget); | 872 DISALLOW_COPY_AND_ASSIGN(Widget); |
866 }; | 873 }; |
867 | 874 |
868 } // namespace views | 875 } // namespace views |
869 | 876 |
870 #endif // UI_VIEWS_WIDGET_WIDGET_H_ | 877 #endif // UI_VIEWS_WIDGET_WIDGET_H_ |
OLD | NEW |