OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 UI_VIEWS_VIEW_H_ | 5 #ifndef UI_VIEWS_VIEW_H_ |
6 #define UI_VIEWS_VIEW_H_ | 6 #define UI_VIEWS_VIEW_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1039 // implementations of common cases. | 1039 // implementations of common cases. |
1040 virtual int GetPageScrollIncrement(ScrollView* scroll_view, | 1040 virtual int GetPageScrollIncrement(ScrollView* scroll_view, |
1041 bool is_horizontal, bool is_positive); | 1041 bool is_horizontal, bool is_positive); |
1042 virtual int GetLineScrollIncrement(ScrollView* scroll_view, | 1042 virtual int GetLineScrollIncrement(ScrollView* scroll_view, |
1043 bool is_horizontal, bool is_positive); | 1043 bool is_horizontal, bool is_positive); |
1044 | 1044 |
1045 void AddObserver(ViewObserver* observer); | 1045 void AddObserver(ViewObserver* observer); |
1046 void RemoveObserver(ViewObserver* observer); | 1046 void RemoveObserver(ViewObserver* observer); |
1047 bool HasObserver(const ViewObserver* observer) const; | 1047 bool HasObserver(const ViewObserver* observer) const; |
1048 | 1048 |
1049 // Returns the type of scaling to be done for this View. Values should be from | |
1050 // ui::PaintContext::ScaleType. | |
1051 virtual int GetContextScaleType() const; | |
oshima
2017/06/17 16:05:53
can you make this protected?
| |
1052 | |
1049 protected: | 1053 protected: |
1050 // Used to track a drag. RootView passes this into | 1054 // Used to track a drag. RootView passes this into |
1051 // ProcessMousePressed/Dragged. | 1055 // ProcessMousePressed/Dragged. |
1052 struct DragInfo { | 1056 struct DragInfo { |
1053 // Sets possible_drag to false and start_x/y to 0. This is invoked by | 1057 // Sets possible_drag to false and start_x/y to 0. This is invoked by |
1054 // RootView prior to invoke ProcessMousePressed. | 1058 // RootView prior to invoke ProcessMousePressed. |
1055 void Reset(); | 1059 void Reset(); |
1056 | 1060 |
1057 // Sets possible_drag to true and start_pt to the specified point. | 1061 // Sets possible_drag to true and start_pt to the specified point. |
1058 // This is invoked by the target view if it detects the press may generate | 1062 // This is invoked by the target view if it detects the press may generate |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1309 | 1313 |
1310 // Schedules a paint on the parent View if it exists. | 1314 // Schedules a paint on the parent View if it exists. |
1311 void SchedulePaintOnParent(); | 1315 void SchedulePaintOnParent(); |
1312 | 1316 |
1313 // Returns whether this view is eligible for painting, i.e. is visible and | 1317 // Returns whether this view is eligible for painting, i.e. is visible and |
1314 // nonempty. Note that this does not behave like IsDrawn(), since it doesn't | 1318 // nonempty. Note that this does not behave like IsDrawn(), since it doesn't |
1315 // check ancestors recursively; rather, it's used to prune subtrees of views | 1319 // check ancestors recursively; rather, it's used to prune subtrees of views |
1316 // during painting. | 1320 // during painting. |
1317 bool ShouldPaint() const; | 1321 bool ShouldPaint() const; |
1318 | 1322 |
1319 // Returns the offset that should be used when constructing the paint context | 1323 // Returns the bounds that should be used when constructing the paint context |
1320 // for this view. | 1324 // for this view. |
1321 gfx::Vector2d GetPaintContextOffset() const; | 1325 gfx::Rect GetPaintContextBounds() const; |
1322 | 1326 |
1323 // Adjusts the transform of |recorder| in advance of painting. | 1327 // Adjusts the transform of |recorder| in advance of painting. |
1324 void SetupTransformRecorderForPainting(ui::TransformRecorder* recorder) const; | 1328 void SetupTransformRecorderForPainting(ui::TransformRecorder* recorder, |
1329 const ui::PaintContext& context) const; | |
1325 | 1330 |
1326 // Recursively calls the painting method |func| on all non-layered children, | 1331 // Recursively calls the painting method |func| on all non-layered children, |
1327 // in Z order. | 1332 // in Z order. |
1328 void RecursivePaintHelper(void (View::*func)(const ui::PaintContext&), | 1333 void RecursivePaintHelper(void (View::*func)(const ui::PaintContext&), |
1329 const ui::PaintContext& context); | 1334 const ui::PaintContext& context); |
1330 | 1335 |
1331 // Invokes Paint() and, if necessary, PaintDebugRects(). Should be called | 1336 // Invokes Paint() and, if necessary, PaintDebugRects(). Should be called |
1332 // only on the root of a widget/layer. PaintDebugRects() is invoked as a | 1337 // only on the root of a widget/layer. PaintDebugRects() is invoked as a |
1333 // separate pass, instead of being rolled into Paint(), so that siblings will | 1338 // separate pass, instead of being rolled into Paint(), so that siblings will |
1334 // not obscure debug rects. | 1339 // not obscure debug rects. |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1709 // Observers ------------------------------------------------------------- | 1714 // Observers ------------------------------------------------------------- |
1710 | 1715 |
1711 base::ObserverList<ViewObserver> observers_; | 1716 base::ObserverList<ViewObserver> observers_; |
1712 | 1717 |
1713 DISALLOW_COPY_AND_ASSIGN(View); | 1718 DISALLOW_COPY_AND_ASSIGN(View); |
1714 }; | 1719 }; |
1715 | 1720 |
1716 } // namespace views | 1721 } // namespace views |
1717 | 1722 |
1718 #endif // UI_VIEWS_VIEW_H_ | 1723 #endif // UI_VIEWS_VIEW_H_ |
OLD | NEW |