| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_WIDGET_H_ | 5 #ifndef VIEWS_WIDGET_WIDGET_H_ |
| 6 #define VIEWS_WIDGET_WIDGET_H_ | 6 #define VIEWS_WIDGET_WIDGET_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 | 267 |
| 268 NativeWidget* native_widget() { return native_widget_; } | 268 NativeWidget* native_widget() { return native_widget_; } |
| 269 | 269 |
| 270 // Overridden from NativeWidgetDelegate: | 270 // Overridden from NativeWidgetDelegate: |
| 271 virtual void OnNativeFocus(gfx::NativeView focused_view) OVERRIDE; | 271 virtual void OnNativeFocus(gfx::NativeView focused_view) OVERRIDE; |
| 272 virtual void OnNativeBlur(gfx::NativeView focused_view) OVERRIDE; | 272 virtual void OnNativeBlur(gfx::NativeView focused_view) OVERRIDE; |
| 273 virtual void OnNativeWidgetCreated() OVERRIDE; | 273 virtual void OnNativeWidgetCreated() OVERRIDE; |
| 274 virtual void OnSizeChanged(const gfx::Size& new_size) OVERRIDE; | 274 virtual void OnSizeChanged(const gfx::Size& new_size) OVERRIDE; |
| 275 virtual bool HasFocusManager() const OVERRIDE; | 275 virtual bool HasFocusManager() const OVERRIDE; |
| 276 virtual void OnNativeWidgetPaint(gfx::Canvas* canvas) OVERRIDE; | 276 virtual void OnNativeWidgetPaint(gfx::Canvas* canvas) OVERRIDE; |
| 277 virtual bool OnMouseEvent(const MouseEvent& event) OVERRIDE; |
| 278 virtual void OnMouseCaptureLost() OVERRIDE; |
| 277 | 279 |
| 278 // Overridden from FocusTraversable: | 280 // Overridden from FocusTraversable: |
| 279 virtual FocusSearch* GetFocusSearch() OVERRIDE; | 281 virtual FocusSearch* GetFocusSearch() OVERRIDE; |
| 280 virtual FocusTraversable* GetFocusTraversableParent() OVERRIDE; | 282 virtual FocusTraversable* GetFocusTraversableParent() OVERRIDE; |
| 281 virtual View* GetFocusTraversableParentView() OVERRIDE; | 283 virtual View* GetFocusTraversableParentView() OVERRIDE; |
| 282 | 284 |
| 283 protected: | 285 protected: |
| 284 // Creates the RootView to be used within this Widget. Subclasses may override | 286 // Creates the RootView to be used within this Widget. Subclasses may override |
| 285 // to create custom RootViews that do specialized event processing. | 287 // to create custom RootViews that do specialized event processing. |
| 286 // TODO(beng): Investigate whether or not this is needed. | 288 // TODO(beng): Investigate whether or not this is needed. |
| 287 virtual RootView* CreateRootView(); | 289 virtual RootView* CreateRootView(); |
| 288 | 290 |
| 289 // Provided to allow the WidgetWin/Gtk implementations to destroy the RootView | 291 // Provided to allow the WidgetWin/Gtk implementations to destroy the RootView |
| 290 // _before_ the focus manager/tooltip manager. | 292 // _before_ the focus manager/tooltip manager. |
| 291 // TODO(beng): remove once we fold those objects onto this one. | 293 // TODO(beng): remove once we fold those objects onto this one. |
| 292 void DestroyRootView(); | 294 void DestroyRootView(); |
| 293 | 295 |
| 294 // TODO(beng): Temporarily provided as a way to associate the subclass' | 296 // TODO(beng): Temporarily provided as a way to associate the subclass' |
| 295 // implementation of NativeWidget with this. | 297 // implementation of NativeWidget with this. |
| 296 void set_native_widget(NativeWidget* native_widget) { | 298 void set_native_widget(NativeWidget* native_widget) { |
| 297 native_widget_ = native_widget; | 299 native_widget_ = native_widget; |
| 298 } | 300 } |
| 299 | 301 |
| 300 // Used for testing. | 302 // Used for testing. |
| 301 void ReplaceFocusManager(FocusManager* focus_manager); | 303 void ReplaceFocusManager(FocusManager* focus_manager); |
| 302 | 304 |
| 305 // TODO(msw): Make this mouse state member private. |
| 306 // If true, the mouse is currently down. |
| 307 bool is_mouse_button_pressed_; |
| 308 |
| 309 // TODO(msw): Make these mouse state members private. |
| 310 // The following are used to detect duplicate mouse move events and not |
| 311 // deliver them. Displaying a window may result in the system generating |
| 312 // duplicate move events even though the mouse hasn't moved. |
| 313 bool last_mouse_event_was_move_; |
| 314 gfx::Point last_mouse_event_position_; |
| 315 |
| 303 private: | 316 private: |
| 304 // Refresh the compositor tree. This is called by a View whenever its texture | 317 // Refresh the compositor tree. This is called by a View whenever its texture |
| 305 // is updated. | 318 // is updated. |
| 306 void RefreshCompositeTree(); | 319 void RefreshCompositeTree(); |
| 307 | 320 |
| 308 // Try to create a compositor if one hasn't been created yet. Returns false if | 321 // Try to create a compositor if one hasn't been created yet. Returns false if |
| 309 // a compositor couldn't be created. | 322 // a compositor couldn't be created. |
| 310 bool EnsureCompositor(); | 323 bool EnsureCompositor(); |
| 311 | 324 |
| 325 // Returns whether capture should be released on mouse release. |
| 326 virtual bool ShouldReleaseCaptureOnMouseReleased() const { return true; } |
| 327 |
| 312 NativeWidget* native_widget_; | 328 NativeWidget* native_widget_; |
| 313 | 329 |
| 314 // Non-owned pointer to the Widget's delegate. May be NULL if no delegate is | 330 // Non-owned pointer to the Widget's delegate. May be NULL if no delegate is |
| 315 // being used. | 331 // being used. |
| 316 WidgetDelegate* widget_delegate_; | 332 WidgetDelegate* widget_delegate_; |
| 317 | 333 |
| 318 // The root of the View hierarchy attached to this window. | 334 // The root of the View hierarchy attached to this window. |
| 319 // WARNING: see warning in tooltip_manager_ for ordering dependencies with | 335 // WARNING: see warning in tooltip_manager_ for ordering dependencies with |
| 320 // this and tooltip_manager_. | 336 // this and tooltip_manager_. |
| 321 scoped_ptr<RootView> root_view_; | 337 scoped_ptr<RootView> root_view_; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 335 | 351 |
| 336 // The compositor for accelerated drawing. | 352 // The compositor for accelerated drawing. |
| 337 scoped_refptr<ui::Compositor> compositor_; | 353 scoped_refptr<ui::Compositor> compositor_; |
| 338 | 354 |
| 339 DISALLOW_COPY_AND_ASSIGN(Widget); | 355 DISALLOW_COPY_AND_ASSIGN(Widget); |
| 340 }; | 356 }; |
| 341 | 357 |
| 342 } // namespace views | 358 } // namespace views |
| 343 | 359 |
| 344 #endif // VIEWS_WIDGET_WIDGET_H_ | 360 #endif // VIEWS_WIDGET_WIDGET_H_ |
| OLD | NEW |