| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 VIEWS_WIDGET_ROOT_VIEW_H_ | 5 #ifndef VIEWS_WIDGET_ROOT_VIEW_H_ |
| 6 #define VIEWS_WIDGET_ROOT_VIEW_H_ | 6 #define VIEWS_WIDGET_ROOT_VIEW_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 // | 115 // |
| 116 // Note: this is a single view at this point. We may want to make | 116 // Note: this is a single view at this point. We may want to make |
| 117 // this a list if needed. | 117 // this a list if needed. |
| 118 void SetDefaultKeyboardHandler(View* v); | 118 void SetDefaultKeyboardHandler(View* v); |
| 119 | 119 |
| 120 // Process a mousewheel event. Return true if the event was processed | 120 // Process a mousewheel event. Return true if the event was processed |
| 121 // and false otherwise. | 121 // and false otherwise. |
| 122 // MouseWheel events are sent on the focus path. | 122 // MouseWheel events are sent on the focus path. |
| 123 virtual bool ProcessMouseWheelEvent(const MouseWheelEvent& e); | 123 virtual bool ProcessMouseWheelEvent(const MouseWheelEvent& e); |
| 124 | 124 |
| 125 // Starts a drag operation for the specified view. This blocks until done. | |
| 126 // If the view has not been deleted during the drag, OnDragDone is invoked | |
| 127 // on the view. | |
| 128 // NOTE: |view| may be null. | |
| 129 void StartDragForViewFromMouseEvent(View* view, | |
| 130 const OSExchangeData& data, | |
| 131 int operation); | |
| 132 | |
| 133 #if defined(TOUCH_UI) && defined(UNIT_TEST) | 125 #if defined(TOUCH_UI) && defined(UNIT_TEST) |
| 134 // For unit testing purposes, we use this method to set a mock | 126 // For unit testing purposes, we use this method to set a mock |
| 135 // GestureManager | 127 // GestureManager |
| 136 void SetGestureManager(GestureManager* g) { gesture_manager_ = g; } | 128 void SetGestureManager(GestureManager* g) { gesture_manager_ = g; } |
| 137 #endif | 129 #endif |
| 138 | 130 |
| 139 // Focus --------------------------------------------------------------------- | 131 // Focus --------------------------------------------------------------------- |
| 140 | 132 |
| 141 // Make the provided view focused. Also make sure that our Widget is focused. | |
| 142 void FocusView(View* view); | |
| 143 | |
| 144 // Returns the View in this RootView hierarchy that has the focus, or NULL if | |
| 145 // no View currently has the focus. | |
| 146 View* GetFocusedView(); | |
| 147 | |
| 148 // Set whether this root view should focus the corresponding hwnd | 133 // Set whether this root view should focus the corresponding hwnd |
| 149 // when an unprocessed mouse event occurs. | 134 // when an unprocessed mouse event occurs. |
| 150 void SetFocusOnMousePressed(bool f); | 135 void SetFocusOnMousePressed(bool f); |
| 151 | 136 |
| 152 // Used to set the FocusTraversable parent after the view has been created | 137 // Used to set the FocusTraversable parent after the view has been created |
| 153 // (typically when the hierarchy changes and this RootView is added/removed). | 138 // (typically when the hierarchy changes and this RootView is added/removed). |
| 154 virtual void SetFocusTraversableParent(FocusTraversable* focus_traversable); | 139 virtual void SetFocusTraversableParent(FocusTraversable* focus_traversable); |
| 155 | 140 |
| 156 // Used to set the View parent after the view has been created. | 141 // Used to set the View parent after the view has been created. |
| 157 virtual void SetFocusTraversableParentView(View* view); | 142 virtual void SetFocusTraversableParentView(View* view); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 // event handlers to honor the cursor desired by views located under the | 203 // event handlers to honor the cursor desired by views located under the |
| 219 // cursor during drag operations. | 204 // cursor during drag operations. |
| 220 void UpdateCursor(const MouseEvent& e); | 205 void UpdateCursor(const MouseEvent& e); |
| 221 | 206 |
| 222 // Sets the current cursor, or resets it to the last one if NULL is provided. | 207 // Sets the current cursor, or resets it to the last one if NULL is provided. |
| 223 void SetActiveCursor(gfx::NativeCursor cursor); | 208 void SetActiveCursor(gfx::NativeCursor cursor); |
| 224 | 209 |
| 225 // Updates the last_mouse_* fields from e. | 210 // Updates the last_mouse_* fields from e. |
| 226 void SetMouseLocationAndFlags(const MouseEvent& e); | 211 void SetMouseLocationAndFlags(const MouseEvent& e); |
| 227 | 212 |
| 228 // Drag and drop ------------------------------------------------------------- | |
| 229 | |
| 230 // If a view is dragging, this returns it. Otherwise returns NULL. | |
| 231 View* GetDragView(); | |
| 232 | |
| 233 ////////////////////////////////////////////////////////////////////////////// | 213 ////////////////////////////////////////////////////////////////////////////// |
| 234 | 214 |
| 235 // Tree operations ----------------------------------------------------------- | 215 // Tree operations ----------------------------------------------------------- |
| 236 | 216 |
| 237 // The host Widget | 217 // The host Widget |
| 238 Widget* widget_; | 218 Widget* widget_; |
| 239 | 219 |
| 240 // Painting ------------------------------------------------------------------ | 220 // Painting ------------------------------------------------------------------ |
| 241 | 221 |
| 242 // The rectangle that should be painted | 222 // The rectangle that should be painted |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 | 298 |
| 319 // The View that contains this RootView. This is used when we have RootView | 299 // The View that contains this RootView. This is used when we have RootView |
| 320 // wrapped inside native components, and is used for the focus traversal. | 300 // wrapped inside native components, and is used for the focus traversal. |
| 321 View* focus_traversable_parent_view_; | 301 View* focus_traversable_parent_view_; |
| 322 | 302 |
| 323 // Drag and drop ------------------------------------------------------------- | 303 // Drag and drop ------------------------------------------------------------- |
| 324 | 304 |
| 325 // Tracks drag state for a view. | 305 // Tracks drag state for a view. |
| 326 View::DragInfo drag_info; | 306 View::DragInfo drag_info; |
| 327 | 307 |
| 328 // Valid for the lifetime of StartDragForViewFromMouseEvent, indicates the | |
| 329 // view the drag started from. | |
| 330 View* drag_view_; | |
| 331 | |
| 332 DISALLOW_IMPLICIT_CONSTRUCTORS(RootView); | 308 DISALLOW_IMPLICIT_CONSTRUCTORS(RootView); |
| 333 }; | 309 }; |
| 334 } // namespace views | 310 } // namespace views |
| 335 | 311 |
| 336 #endif // VIEWS_WIDGET_ROOT_VIEW_H_ | 312 #endif // VIEWS_WIDGET_ROOT_VIEW_H_ |
| OLD | NEW |