| 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 |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "ui/base/accessibility/accessibility_types.h" | 13 #include "ui/base/accessibility/accessibility_types.h" |
| 14 #include "ui/gfx/native_widget_types.h" | 14 #include "ui/gfx/native_widget_types.h" |
| 15 #include "views/focus/focus_manager.h" | 15 #include "views/focus/focus_manager.h" |
| 16 #include "views/ime/input_method_delegate.h" |
| 16 #include "views/widget/native_widget_delegate.h" | 17 #include "views/widget/native_widget_delegate.h" |
| 17 | 18 |
| 18 namespace gfx { | 19 namespace gfx { |
| 19 class Canvas; | 20 class Canvas; |
| 20 class Path; | 21 class Path; |
| 21 class Point; | 22 class Point; |
| 22 class Rect; | 23 class Rect; |
| 23 } | 24 } |
| 24 | 25 |
| 25 namespace ui { | 26 namespace ui { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 52 // context specific NativeWidget implementation. | 53 // context specific NativeWidget implementation. |
| 53 // | 54 // |
| 54 // TODO(beng): Note that this class being non-abstract means that we have a | 55 // TODO(beng): Note that this class being non-abstract means that we have a |
| 55 // violation of Google style in that we are using multiple | 56 // violation of Google style in that we are using multiple |
| 56 // inheritance. The intention is to split this into a separate | 57 // inheritance. The intention is to split this into a separate |
| 57 // object associated with but not equal to a NativeWidget | 58 // object associated with but not equal to a NativeWidget |
| 58 // implementation. Multiple inheritance is required for this | 59 // implementation. Multiple inheritance is required for this |
| 59 // transitional step. | 60 // transitional step. |
| 60 // | 61 // |
| 61 class Widget : public internal::NativeWidgetDelegate, | 62 class Widget : public internal::NativeWidgetDelegate, |
| 62 public FocusTraversable { | 63 public FocusTraversable, |
| 64 public internal::InputMethodDelegate { |
| 63 public: | 65 public: |
| 64 struct CreateParams { | 66 struct CreateParams { |
| 65 enum Type { | 67 enum Type { |
| 66 TYPE_WINDOW, // A Window, like a frame window. | 68 TYPE_WINDOW, // A Window, like a frame window. |
| 67 TYPE_CONTROL, // A control, like a button. | 69 TYPE_CONTROL, // A control, like a button. |
| 68 TYPE_POPUP, // An undecorated Window, with transient properties. | 70 TYPE_POPUP, // An undecorated Window, with transient properties. |
| 69 TYPE_MENU // An undecorated Window, with transient properties | 71 TYPE_MENU // An undecorated Window, with transient properties |
| 70 // specialized to menus. | 72 // specialized to menus. |
| 71 }; | 73 }; |
| 72 | 74 |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 // Debugging code to help track 77651. | 294 // Debugging code to help track 77651. |
| 293 bool got_native_widget_created() const { return got_native_widget_created_; } | 295 bool got_native_widget_created() const { return got_native_widget_created_; } |
| 294 | 296 |
| 295 // Overridden from NativeWidgetDelegate: | 297 // Overridden from NativeWidgetDelegate: |
| 296 virtual void OnNativeFocus(gfx::NativeView focused_view) OVERRIDE; | 298 virtual void OnNativeFocus(gfx::NativeView focused_view) OVERRIDE; |
| 297 virtual void OnNativeBlur(gfx::NativeView focused_view) OVERRIDE; | 299 virtual void OnNativeBlur(gfx::NativeView focused_view) OVERRIDE; |
| 298 virtual void OnNativeWidgetCreated() OVERRIDE; | 300 virtual void OnNativeWidgetCreated() OVERRIDE; |
| 299 virtual void OnSizeChanged(const gfx::Size& new_size) OVERRIDE; | 301 virtual void OnSizeChanged(const gfx::Size& new_size) OVERRIDE; |
| 300 virtual bool HasFocusManager() const OVERRIDE; | 302 virtual bool HasFocusManager() const OVERRIDE; |
| 301 virtual void OnNativeWidgetPaint(gfx::Canvas* canvas) OVERRIDE; | 303 virtual void OnNativeWidgetPaint(gfx::Canvas* canvas) OVERRIDE; |
| 304 virtual bool OnKeyEvent(const KeyEvent& event) OVERRIDE; |
| 302 virtual bool OnMouseEvent(const MouseEvent& event) OVERRIDE; | 305 virtual bool OnMouseEvent(const MouseEvent& event) OVERRIDE; |
| 303 virtual void OnMouseCaptureLost() OVERRIDE; | 306 virtual void OnMouseCaptureLost() OVERRIDE; |
| 304 | 307 |
| 305 // Overridden from FocusTraversable: | 308 // Overridden from FocusTraversable: |
| 306 virtual FocusSearch* GetFocusSearch() OVERRIDE; | 309 virtual FocusSearch* GetFocusSearch() OVERRIDE; |
| 307 virtual FocusTraversable* GetFocusTraversableParent() OVERRIDE; | 310 virtual FocusTraversable* GetFocusTraversableParent() OVERRIDE; |
| 308 virtual View* GetFocusTraversableParentView() OVERRIDE; | 311 virtual View* GetFocusTraversableParentView() OVERRIDE; |
| 309 | 312 |
| 313 // Overridden from internal::InputMethodDelegate |
| 314 virtual bool DispatchKeyEventPostIME(const KeyEvent& key) OVERRIDE; |
| 315 |
| 310 protected: | 316 protected: |
| 311 // Creates the RootView to be used within this Widget. Subclasses may override | 317 // Creates the RootView to be used within this Widget. Subclasses may override |
| 312 // to create custom RootViews that do specialized event processing. | 318 // to create custom RootViews that do specialized event processing. |
| 313 // TODO(beng): Investigate whether or not this is needed. | 319 // TODO(beng): Investigate whether or not this is needed. |
| 314 virtual RootView* CreateRootView(); | 320 virtual RootView* CreateRootView(); |
| 315 | 321 |
| 316 // Provided to allow the WidgetWin/Gtk implementations to destroy the RootView | 322 // Provided to allow the WidgetWin/Gtk implementations to destroy the RootView |
| 317 // _before_ the focus manager/tooltip manager. | 323 // _before_ the focus manager/tooltip manager. |
| 318 // TODO(beng): remove once we fold those objects onto this one. | 324 // TODO(beng): remove once we fold those objects onto this one. |
| 319 void DestroyRootView(); | 325 void DestroyRootView(); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 | 385 |
| 380 // Debugging code to help track 77651. | 386 // Debugging code to help track 77651. |
| 381 bool got_native_widget_created_; | 387 bool got_native_widget_created_; |
| 382 | 388 |
| 383 DISALLOW_COPY_AND_ASSIGN(Widget); | 389 DISALLOW_COPY_AND_ASSIGN(Widget); |
| 384 }; | 390 }; |
| 385 | 391 |
| 386 } // namespace views | 392 } // namespace views |
| 387 | 393 |
| 388 #endif // VIEWS_WIDGET_WIDGET_H_ | 394 #endif // VIEWS_WIDGET_WIDGET_H_ |
| OLD | NEW |