| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 class InputMethod; | 53 class InputMethod; |
| 54 class Layer; | 54 class Layer; |
| 55 class NativeTheme; | 55 class NativeTheme; |
| 56 class OSExchangeData; | 56 class OSExchangeData; |
| 57 class ThemeProvider; | 57 class ThemeProvider; |
| 58 } | 58 } |
| 59 | 59 |
| 60 namespace views { | 60 namespace views { |
| 61 | 61 |
| 62 class DesktopWindowTreeHost; | 62 class DesktopWindowTreeHost; |
| 63 class InputMethod; | |
| 64 class NativeWidget; | 63 class NativeWidget; |
| 65 class NonClientFrameView; | 64 class NonClientFrameView; |
| 66 class TooltipManager; | 65 class TooltipManager; |
| 67 class View; | 66 class View; |
| 68 class WidgetDelegate; | 67 class WidgetDelegate; |
| 69 class WidgetObserver; | 68 class WidgetObserver; |
| 70 class WidgetRemovalsObserver; | 69 class WidgetRemovalsObserver; |
| 71 | 70 |
| 72 namespace internal { | 71 namespace internal { |
| 73 class NativeWidgetPrivate; | 72 class NativeWidgetPrivate; |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 return const_cast<ui::NativeTheme*>( | 558 return const_cast<ui::NativeTheme*>( |
| 560 const_cast<const Widget*>(this)->GetNativeTheme()); | 559 const_cast<const Widget*>(this)->GetNativeTheme()); |
| 561 } | 560 } |
| 562 const ui::NativeTheme* GetNativeTheme() const; | 561 const ui::NativeTheme* GetNativeTheme() const; |
| 563 | 562 |
| 564 // Returns the FocusManager for this widget. | 563 // Returns the FocusManager for this widget. |
| 565 // Note that all widgets in a widget hierarchy share the same focus manager. | 564 // Note that all widgets in a widget hierarchy share the same focus manager. |
| 566 FocusManager* GetFocusManager(); | 565 FocusManager* GetFocusManager(); |
| 567 const FocusManager* GetFocusManager() const; | 566 const FocusManager* GetFocusManager() const; |
| 568 | 567 |
| 569 // Returns the focused text input client within this widget. | |
| 570 ui::TextInputClient* GetFocusedTextInputClient(); | |
| 571 | |
| 572 // Returns the InputMethod for this widget. | |
| 573 // Note that all widgets in a widget hierarchy share the same input method. | |
| 574 InputMethod* GetInputMethod(); | |
| 575 const InputMethod* GetInputMethod() const; | |
| 576 | |
| 577 // Returns the ui::InputMethod for this widget. | 568 // Returns the ui::InputMethod for this widget. |
| 578 // TODO(yukishiino): Rename this method to GetInputMethod once we remove | 569 ui::InputMethod* GetInputMethod(); |
| 579 // views::InputMethod. | |
| 580 ui::InputMethod* GetHostInputMethod(); | |
| 581 | 570 |
| 582 // Starts a drag operation for the specified view. This blocks until the drag | 571 // Starts a drag operation for the specified view. This blocks until the drag |
| 583 // operation completes. |view| can be NULL. | 572 // operation completes. |view| can be NULL. |
| 584 // If the view is non-NULL it can be accessed during the drag by calling | 573 // If the view is non-NULL it can be accessed during the drag by calling |
| 585 // dragged_view(). If the view has not been deleted during the drag, | 574 // dragged_view(). If the view has not been deleted during the drag, |
| 586 // OnDragDone() is called on it. |location| is in the widget's coordinate | 575 // OnDragDone() is called on it. |location| is in the widget's coordinate |
| 587 // system. | 576 // system. |
| 588 void RunShellDrag(View* view, | 577 void RunShellDrag(View* view, |
| 589 const ui::OSExchangeData& data, | 578 const ui::OSExchangeData& data, |
| 590 const gfx::Point& location, | 579 const gfx::Point& location, |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 795 void OnNativeWidgetEndUserBoundsChange() override; | 784 void OnNativeWidgetEndUserBoundsChange() override; |
| 796 bool HasFocusManager() const override; | 785 bool HasFocusManager() const override; |
| 797 void OnNativeWidgetPaint(const ui::PaintContext& context) override; | 786 void OnNativeWidgetPaint(const ui::PaintContext& context) override; |
| 798 int GetNonClientComponent(const gfx::Point& point) override; | 787 int GetNonClientComponent(const gfx::Point& point) override; |
| 799 void OnKeyEvent(ui::KeyEvent* event) override; | 788 void OnKeyEvent(ui::KeyEvent* event) override; |
| 800 void OnMouseEvent(ui::MouseEvent* event) override; | 789 void OnMouseEvent(ui::MouseEvent* event) override; |
| 801 void OnMouseCaptureLost() override; | 790 void OnMouseCaptureLost() override; |
| 802 void OnScrollEvent(ui::ScrollEvent* event) override; | 791 void OnScrollEvent(ui::ScrollEvent* event) override; |
| 803 void OnGestureEvent(ui::GestureEvent* event) override; | 792 void OnGestureEvent(ui::GestureEvent* event) override; |
| 804 bool ExecuteCommand(int command_id) override; | 793 bool ExecuteCommand(int command_id) override; |
| 805 InputMethod* GetInputMethodDirect() override; | |
| 806 const std::vector<ui::Layer*>& GetRootLayers() override; | 794 const std::vector<ui::Layer*>& GetRootLayers() override; |
| 807 bool HasHitTestMask() const override; | 795 bool HasHitTestMask() const override; |
| 808 void GetHitTestMask(gfx::Path* mask) const override; | 796 void GetHitTestMask(gfx::Path* mask) const override; |
| 809 Widget* AsWidget() override; | 797 Widget* AsWidget() override; |
| 810 const Widget* AsWidget() const override; | 798 const Widget* AsWidget() const override; |
| 811 bool SetInitialFocus(ui::WindowShowState show_state) override; | 799 bool SetInitialFocus(ui::WindowShowState show_state) override; |
| 812 | 800 |
| 813 // Overridden from ui::EventSource: | 801 // Overridden from ui::EventSource: |
| 814 ui::EventProcessor* GetEventProcessor() override; | 802 ui::EventProcessor* GetEventProcessor() override; |
| 815 | 803 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 859 void SetInitialBounds(const gfx::Rect& bounds); | 847 void SetInitialBounds(const gfx::Rect& bounds); |
| 860 | 848 |
| 861 // Sizes and positions the frameless window just after it is created. | 849 // Sizes and positions the frameless window just after it is created. |
| 862 void SetInitialBoundsForFramelessWindow(const gfx::Rect& bounds); | 850 void SetInitialBoundsForFramelessWindow(const gfx::Rect& bounds); |
| 863 | 851 |
| 864 // Returns the bounds and "show" state from the delegate. Returns true if | 852 // Returns the bounds and "show" state from the delegate. Returns true if |
| 865 // the delegate wants to use a specified bounds. | 853 // the delegate wants to use a specified bounds. |
| 866 bool GetSavedWindowPlacement(gfx::Rect* bounds, | 854 bool GetSavedWindowPlacement(gfx::Rect* bounds, |
| 867 ui::WindowShowState* show_state); | 855 ui::WindowShowState* show_state); |
| 868 | 856 |
| 869 // Creates and initializes a new InputMethod and returns it, otherwise null. | |
| 870 scoped_ptr<InputMethod> CreateInputMethod(); | |
| 871 | |
| 872 // Sets a different InputMethod instance to this widget. The instance | |
| 873 // must not be initialized, the ownership will be assumed by the widget. | |
| 874 // It's only for testing purpose. | |
| 875 void ReplaceInputMethod(InputMethod* input_method); | |
| 876 | |
| 877 internal::NativeWidgetPrivate* native_widget_; | 857 internal::NativeWidgetPrivate* native_widget_; |
| 878 | 858 |
| 879 base::ObserverList<WidgetObserver> observers_; | 859 base::ObserverList<WidgetObserver> observers_; |
| 880 | 860 |
| 881 base::ObserverList<WidgetRemovalsObserver> removals_observers_; | 861 base::ObserverList<WidgetRemovalsObserver> removals_observers_; |
| 882 | 862 |
| 883 // Non-owned pointer to the Widget's delegate. If a NULL delegate is supplied | 863 // Non-owned pointer to the Widget's delegate. If a NULL delegate is supplied |
| 884 // to Init() a default WidgetDelegate is created. | 864 // to Init() a default WidgetDelegate is created. |
| 885 WidgetDelegate* widget_delegate_; | 865 WidgetDelegate* widget_delegate_; |
| 886 | 866 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 931 | 911 |
| 932 // The restored bounds used for the initial show. This is only used if | 912 // The restored bounds used for the initial show. This is only used if |
| 933 // |saved_show_state_| is maximized. | 913 // |saved_show_state_| is maximized. |
| 934 gfx::Rect initial_restored_bounds_; | 914 gfx::Rect initial_restored_bounds_; |
| 935 | 915 |
| 936 // Focus is automatically set to the view provided by the delegate | 916 // Focus is automatically set to the view provided by the delegate |
| 937 // when the widget is shown. Set this value to false to override | 917 // when the widget is shown. Set this value to false to override |
| 938 // initial focus for the widget. | 918 // initial focus for the widget. |
| 939 bool focus_on_creation_; | 919 bool focus_on_creation_; |
| 940 | 920 |
| 941 mutable scoped_ptr<InputMethod> input_method_; | |
| 942 | |
| 943 // See |is_top_level()| accessor. | 921 // See |is_top_level()| accessor. |
| 944 bool is_top_level_; | 922 bool is_top_level_; |
| 945 | 923 |
| 946 // Tracks whether native widget has been initialized. | 924 // Tracks whether native widget has been initialized. |
| 947 bool native_widget_initialized_; | 925 bool native_widget_initialized_; |
| 948 | 926 |
| 949 // Whether native widget has been destroyed. | 927 // Whether native widget has been destroyed. |
| 950 bool native_widget_destroyed_; | 928 bool native_widget_destroyed_; |
| 951 | 929 |
| 952 // TODO(beng): Remove NativeWidgetGtk's dependence on these: | 930 // TODO(beng): Remove NativeWidgetGtk's dependence on these: |
| (...skipping 25 matching lines...) Expand all Loading... |
| 978 bool movement_disabled_; | 956 bool movement_disabled_; |
| 979 | 957 |
| 980 ScopedObserver<ui::NativeTheme, ui::NativeThemeObserver> observer_manager_; | 958 ScopedObserver<ui::NativeTheme, ui::NativeThemeObserver> observer_manager_; |
| 981 | 959 |
| 982 DISALLOW_COPY_AND_ASSIGN(Widget); | 960 DISALLOW_COPY_AND_ASSIGN(Widget); |
| 983 }; | 961 }; |
| 984 | 962 |
| 985 } // namespace views | 963 } // namespace views |
| 986 | 964 |
| 987 #endif // UI_VIEWS_WIDGET_WIDGET_H_ | 965 #endif // UI_VIEWS_WIDGET_WIDGET_H_ |
| OLD | NEW |