| OLD | NEW | 
|---|
|  | (Empty) | 
| 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 |  | 
| 3 // found in the LICENSE file. |  | 
| 4 |  | 
| 5 #ifndef VIEWS_WIDGET_NATIVE_WIDGET_VIEW_H_ |  | 
| 6 #define VIEWS_WIDGET_NATIVE_WIDGET_VIEW_H_ |  | 
| 7 #pragma once |  | 
| 8 |  | 
| 9 #include "views/view.h" |  | 
| 10 #include "views/widget/native_widget_delegate.h" |  | 
| 11 #include "views/widget/native_widget_views.h" |  | 
| 12 |  | 
| 13 namespace ui { |  | 
| 14 enum TouchStatus; |  | 
| 15 } |  | 
| 16 |  | 
| 17 namespace views { |  | 
| 18 namespace internal { |  | 
| 19 |  | 
| 20 //////////////////////////////////////////////////////////////////////////////// |  | 
| 21 // NativeWidgetView |  | 
| 22 // |  | 
| 23 // This class represents the View that is the "native view" for a |  | 
| 24 // NativeWidgetViews. It is the View that is a member of the parent Widget's |  | 
| 25 // View hierarchy. It is responsible for receiving relevant events from that |  | 
| 26 // hierarchy and forwarding them to its NativeWidgetViews' delegate's hierarchy. |  | 
| 27 // |  | 
| 28 class VIEWS_EXPORT NativeWidgetView : public View { |  | 
| 29  public: |  | 
| 30   static const char kViewClassName[]; |  | 
| 31 |  | 
| 32   explicit NativeWidgetView(NativeWidgetViews* native_widget); |  | 
| 33   virtual ~NativeWidgetView(); |  | 
| 34 |  | 
| 35   Widget* GetAssociatedWidget(); |  | 
| 36 |  | 
| 37   void set_delete_native_widget(bool delete_native_widget) { |  | 
| 38     delete_native_widget_ = delete_native_widget; |  | 
| 39   } |  | 
| 40 |  | 
| 41   void set_cursor(gfx::NativeCursor cursor) { cursor_ = cursor; } |  | 
| 42 |  | 
| 43   // Overridden from View: |  | 
| 44   virtual void CalculateOffsetToAncestorWithLayer( |  | 
| 45       gfx::Point* offset, |  | 
| 46       ui::Layer** layer_parent) OVERRIDE; |  | 
| 47   virtual void ReorderLayers() OVERRIDE; |  | 
| 48 |  | 
| 49 #if !defined(NDEBUG) |  | 
| 50   virtual std::string PrintViewGraph(bool first) OVERRIDE; |  | 
| 51 #endif |  | 
| 52 |  | 
| 53  private: |  | 
| 54   // Overridden from View: |  | 
| 55   virtual void ViewHierarchyChanged(bool is_add, |  | 
| 56                                     View* parent, |  | 
| 57                                     View* child) OVERRIDE; |  | 
| 58   virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; |  | 
| 59   virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |  | 
| 60   virtual gfx::NativeCursor GetCursor(const MouseEvent& event) OVERRIDE; |  | 
| 61   virtual bool OnMousePressed(const MouseEvent& event) OVERRIDE; |  | 
| 62   virtual bool OnMouseDragged(const MouseEvent& event) OVERRIDE; |  | 
| 63   virtual void OnMouseReleased(const MouseEvent& event) OVERRIDE; |  | 
| 64   virtual void OnMouseCaptureLost() OVERRIDE; |  | 
| 65   virtual void OnMouseMoved(const MouseEvent& event) OVERRIDE; |  | 
| 66   virtual void OnMouseEntered(const MouseEvent& event) OVERRIDE; |  | 
| 67   virtual void OnMouseExited(const MouseEvent& event) OVERRIDE; |  | 
| 68   virtual ui::TouchStatus OnTouchEvent(const TouchEvent& event) OVERRIDE; |  | 
| 69   virtual bool OnKeyPressed(const KeyEvent& event) OVERRIDE; |  | 
| 70   virtual bool OnKeyReleased(const KeyEvent& event) OVERRIDE; |  | 
| 71   virtual bool OnMouseWheel(const MouseWheelEvent& event) OVERRIDE; |  | 
| 72   virtual void VisibilityChanged(View* starting_from, bool is_visible) OVERRIDE; |  | 
| 73   virtual void OnFocus() OVERRIDE; |  | 
| 74   virtual void OnBlur() OVERRIDE; |  | 
| 75   virtual std::string GetClassName() const OVERRIDE; |  | 
| 76   virtual void MoveLayerToParent(ui::Layer* parent_layer, |  | 
| 77                                  const gfx::Point& point) OVERRIDE; |  | 
| 78   virtual void UpdateChildLayerBounds(const gfx::Point& offset) OVERRIDE; |  | 
| 79   virtual void ReorderChildLayers(ui::Layer* parent_layer) OVERRIDE; |  | 
| 80 |  | 
| 81   internal::NativeWidgetDelegate* delegate() { |  | 
| 82     return native_widget_->delegate(); |  | 
| 83   } |  | 
| 84 |  | 
| 85   NativeWidgetViews* native_widget_; |  | 
| 86 |  | 
| 87   // Have we sent OnNativeWidgetCreated? |  | 
| 88   bool sent_create_; |  | 
| 89 |  | 
| 90   bool delete_native_widget_; |  | 
| 91 |  | 
| 92   // The cursor set for the associated widget. |  | 
| 93   gfx::NativeCursor cursor_; |  | 
| 94 |  | 
| 95   DISALLOW_COPY_AND_ASSIGN(NativeWidgetView); |  | 
| 96 }; |  | 
| 97 |  | 
| 98 }  // namespace internal |  | 
| 99 }  // namespace views |  | 
| 100 |  | 
| 101 #endif  // VIEWS_WIDGET_NATIVE_WIDGET_VIEW_H_ |  | 
| OLD | NEW | 
|---|