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_VIEW_H_ | 5 #ifndef VIEWS_VIEW_H_ |
6 #define VIEWS_VIEW_H_ | 6 #define VIEWS_VIEW_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <map> | 10 #include <map> |
(...skipping 18 matching lines...) Expand all Loading... |
29 namespace gfx { | 29 namespace gfx { |
30 class Canvas; | 30 class Canvas; |
31 class Insets; | 31 class Insets; |
32 class Path; | 32 class Path; |
33 } | 33 } |
34 | 34 |
35 namespace ui { | 35 namespace ui { |
36 struct AccessibleViewState; | 36 struct AccessibleViewState; |
37 class Compositor; | 37 class Compositor; |
38 class Layer; | 38 class Layer; |
| 39 class LayerAnimationSequence; |
39 class Texture; | 40 class Texture; |
40 class ThemeProvider; | 41 class ThemeProvider; |
41 class Transform; | 42 class Transform; |
42 enum TouchStatus; | 43 enum TouchStatus; |
43 } | 44 } |
44 | 45 |
45 #if defined(OS_WIN) | 46 #if defined(OS_WIN) |
46 class NativeViewAccessibilityWin; | 47 class NativeViewAccessibilityWin; |
47 #endif | 48 #endif |
48 | 49 |
49 namespace views { | 50 namespace views { |
50 | 51 |
51 class Background; | 52 class Background; |
52 class Border; | 53 class Border; |
53 class ContextMenuController; | 54 class ContextMenuController; |
54 class DragController; | 55 class DragController; |
55 class FocusManager; | 56 class FocusManager; |
56 class FocusTraversable; | 57 class FocusTraversable; |
57 class InputMethod; | 58 class InputMethod; |
58 class LayerPropertySetter; | |
59 class LayoutManager; | 59 class LayoutManager; |
60 class ScrollView; | 60 class ScrollView; |
61 class TextInputClient; | 61 class TextInputClient; |
62 class Widget; | 62 class Widget; |
63 | 63 |
64 namespace internal { | 64 namespace internal { |
65 class NativeWidgetView; | 65 class NativeWidgetView; |
66 class RootView; | 66 class RootView; |
67 } | 67 } |
68 | 68 |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 void SetTransform(const ui::Transform& transform); | 279 void SetTransform(const ui::Transform& transform); |
280 | 280 |
281 // Sets whether this view paints to a layer. A view paints to a layer if | 281 // Sets whether this view paints to a layer. A view paints to a layer if |
282 // either of the following are true: | 282 // either of the following are true: |
283 // . the view has a non-identity transform. | 283 // . the view has a non-identity transform. |
284 // . SetPaintToLayer(true) has been invoked. | 284 // . SetPaintToLayer(true) has been invoked. |
285 // View creates the Layer only when it exists in a Widget with a non-NULL | 285 // View creates the Layer only when it exists in a Widget with a non-NULL |
286 // Compositor. | 286 // Compositor. |
287 void SetPaintToLayer(bool paint_to_layer); | 287 void SetPaintToLayer(bool paint_to_layer); |
288 | 288 |
289 // Sets the LayerPropertySetter for this view. A value of NULL resets the | |
290 // LayerPropertySetter to the default (immediate). Can only be called on a | |
291 // View that has a layer(). | |
292 void SetLayerPropertySetter(LayerPropertySetter* setter); | |
293 | |
294 const ui::Layer* layer() const { return layer_.get(); } | 289 const ui::Layer* layer() const { return layer_.get(); } |
295 ui::Layer* layer() { return layer_.get(); } | 290 ui::Layer* layer() { return layer_.get(); } |
296 | 291 |
297 // RTL positioning ----------------------------------------------------------- | 292 // RTL positioning ----------------------------------------------------------- |
298 | 293 |
299 // Methods for accessing the bounds and position of the view, relative to its | 294 // Methods for accessing the bounds and position of the view, relative to its |
300 // parent. The position returned is mirrored if the parent view is using a RTL | 295 // parent. The position returned is mirrored if the parent view is using a RTL |
301 // layout. | 296 // layout. |
302 // | 297 // |
303 // NOTE: in the vast majority of the cases, the mirroring implementation is | 298 // NOTE: in the vast majority of the cases, the mirroring implementation is |
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
982 // the right layer. | 977 // the right layer. |
983 virtual void MoveLayerToParent(ui::Layer* parent_layer, | 978 virtual void MoveLayerToParent(ui::Layer* parent_layer, |
984 const gfx::Point& point); | 979 const gfx::Point& point); |
985 | 980 |
986 // Called to update the bounds of any child layers within this View's | 981 // Called to update the bounds of any child layers within this View's |
987 // hierarchy when something happens to the hierarchy. | 982 // hierarchy when something happens to the hierarchy. |
988 virtual void UpdateChildLayerBounds(const gfx::Point& offset); | 983 virtual void UpdateChildLayerBounds(const gfx::Point& offset); |
989 | 984 |
990 // Overridden from ui::LayerDelegate: | 985 // Overridden from ui::LayerDelegate: |
991 virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE; | 986 virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE; |
992 virtual void OnLayerAnimationEnded(const ui::Animation* animation) OVERRIDE; | 987 virtual void OnLayerAnimationEnded( |
| 988 const ui::LayerAnimationSequence* animation) OVERRIDE; |
993 | 989 |
994 // Finds the layer that this view paints to (it may belong to an ancestor | 990 // Finds the layer that this view paints to (it may belong to an ancestor |
995 // view), then reorders the immediate children of that layer to match the | 991 // view), then reorders the immediate children of that layer to match the |
996 // order of the view tree. | 992 // order of the view tree. |
997 virtual void ReorderLayers(); | 993 virtual void ReorderLayers(); |
998 | 994 |
999 // This reorders the immediate children of |*parent_layer| to match the | 995 // This reorders the immediate children of |*parent_layer| to match the |
1000 // order of the view tree. | 996 // order of the view tree. |
1001 virtual void ReorderChildLayers(ui::Layer* parent_layer); | 997 virtual void ReorderChildLayers(ui::Layer* parent_layer); |
1002 | 998 |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1392 | 1388 |
1393 // Indicates whether or not the gfx::Canvas object passed to View::Paint() | 1389 // Indicates whether or not the gfx::Canvas object passed to View::Paint() |
1394 // is going to be flipped horizontally (using the appropriate transform) on | 1390 // is going to be flipped horizontally (using the appropriate transform) on |
1395 // right-to-left locales for this View. | 1391 // right-to-left locales for this View. |
1396 bool flip_canvas_on_paint_for_rtl_ui_; | 1392 bool flip_canvas_on_paint_for_rtl_ui_; |
1397 | 1393 |
1398 // Accelerated painting ------------------------------------------------------ | 1394 // Accelerated painting ------------------------------------------------------ |
1399 | 1395 |
1400 bool paint_to_layer_; | 1396 bool paint_to_layer_; |
1401 scoped_ptr<ui::Layer> layer_; | 1397 scoped_ptr<ui::Layer> layer_; |
1402 scoped_ptr<LayerPropertySetter> layer_property_setter_; | |
1403 | 1398 |
1404 // Accelerators -------------------------------------------------------------- | 1399 // Accelerators -------------------------------------------------------------- |
1405 | 1400 |
1406 // true if when we were added to hierarchy we were without focus manager | 1401 // true if when we were added to hierarchy we were without focus manager |
1407 // attempt addition when ancestor chain changed. | 1402 // attempt addition when ancestor chain changed. |
1408 bool accelerator_registration_delayed_; | 1403 bool accelerator_registration_delayed_; |
1409 | 1404 |
1410 // Focus manager accelerators registered on. | 1405 // Focus manager accelerators registered on. |
1411 FocusManager* accelerator_focus_manager_; | 1406 FocusManager* accelerator_focus_manager_; |
1412 | 1407 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1446 #if defined(OS_WIN) | 1441 #if defined(OS_WIN) |
1447 scoped_refptr<NativeViewAccessibilityWin> native_view_accessibility_win_; | 1442 scoped_refptr<NativeViewAccessibilityWin> native_view_accessibility_win_; |
1448 #endif | 1443 #endif |
1449 | 1444 |
1450 DISALLOW_COPY_AND_ASSIGN(View); | 1445 DISALLOW_COPY_AND_ASSIGN(View); |
1451 }; | 1446 }; |
1452 | 1447 |
1453 } // namespace views | 1448 } // namespace views |
1454 | 1449 |
1455 #endif // VIEWS_VIEW_H_ | 1450 #endif // VIEWS_VIEW_H_ |
OLD | NEW |