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 11 matching lines...) Expand all Loading... |
22 #include "ui/accessibility/ax_enums.h" | 22 #include "ui/accessibility/ax_enums.h" |
23 #include "ui/base/accelerators/accelerator.h" | 23 #include "ui/base/accelerators/accelerator.h" |
24 #include "ui/base/class_property.h" | 24 #include "ui/base/class_property.h" |
25 #include "ui/base/dragdrop/drag_drop_types.h" | 25 #include "ui/base/dragdrop/drag_drop_types.h" |
26 #include "ui/base/dragdrop/drop_target_event.h" | 26 #include "ui/base/dragdrop/drop_target_event.h" |
27 #include "ui/base/dragdrop/os_exchange_data.h" | 27 #include "ui/base/dragdrop/os_exchange_data.h" |
28 #include "ui/base/ui_base_types.h" | 28 #include "ui/base/ui_base_types.h" |
29 #include "ui/compositor/layer_delegate.h" | 29 #include "ui/compositor/layer_delegate.h" |
30 #include "ui/compositor/layer_owner.h" | 30 #include "ui/compositor/layer_owner.h" |
31 #include "ui/compositor/paint_cache.h" | 31 #include "ui/compositor/paint_cache.h" |
| 32 #include "ui/compositor/paint_context.h" |
32 #include "ui/events/event.h" | 33 #include "ui/events/event.h" |
33 #include "ui/events/event_target.h" | 34 #include "ui/events/event_target.h" |
34 #include "ui/gfx/geometry/insets.h" | 35 #include "ui/gfx/geometry/insets.h" |
35 #include "ui/gfx/geometry/point.h" | 36 #include "ui/gfx/geometry/point.h" |
36 #include "ui/gfx/geometry/rect.h" | 37 #include "ui/gfx/geometry/rect.h" |
37 #include "ui/gfx/geometry/vector2d.h" | 38 #include "ui/gfx/geometry/vector2d.h" |
38 #include "ui/gfx/native_widget_types.h" | 39 #include "ui/gfx/native_widget_types.h" |
39 #include "ui/gfx/path.h" | 40 #include "ui/gfx/path.h" |
40 #include "ui/views/view_targeter.h" | 41 #include "ui/views/view_targeter.h" |
41 #include "ui/views/views_export.h" | 42 #include "ui/views/views_export.h" |
(...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1264 static int GetHorizontalDragThreshold(); | 1265 static int GetHorizontalDragThreshold(); |
1265 static int GetVerticalDragThreshold(); | 1266 static int GetVerticalDragThreshold(); |
1266 | 1267 |
1267 // NativeTheme --------------------------------------------------------------- | 1268 // NativeTheme --------------------------------------------------------------- |
1268 | 1269 |
1269 // Invoked when the NativeTheme associated with this View changes, including | 1270 // Invoked when the NativeTheme associated with this View changes, including |
1270 // when one first becomes available (after the view is added to a widget | 1271 // when one first becomes available (after the view is added to a widget |
1271 // hierarchy). | 1272 // hierarchy). |
1272 virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) {} | 1273 virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) {} |
1273 | 1274 |
| 1275 // Pixel Canvas -------------------------------------------------------------- |
| 1276 |
| 1277 // Returns the type of scaling to be done for this View. Values should be from |
| 1278 // ui::PaintContext::ScaleType. |
| 1279 virtual ui::PaintContext::ScaleType GetContextScaleType() const; |
| 1280 |
1274 // Debugging ----------------------------------------------------------------- | 1281 // Debugging ----------------------------------------------------------------- |
1275 | 1282 |
1276 #if !defined(NDEBUG) | 1283 #if !defined(NDEBUG) |
1277 // Returns string containing a graph of the views hierarchy in graphViz DOT | 1284 // Returns string containing a graph of the views hierarchy in graphViz DOT |
1278 // language (http://graphviz.org/). Can be called within debugger and save | 1285 // language (http://graphviz.org/). Can be called within debugger and save |
1279 // to a file to compile/view. | 1286 // to a file to compile/view. |
1280 // Note: Assumes initial call made with first = true. | 1287 // Note: Assumes initial call made with first = true. |
1281 virtual std::string PrintViewGraph(bool first); | 1288 virtual std::string PrintViewGraph(bool first); |
1282 | 1289 |
1283 // Some classes may own an object which contains the children to displayed in | 1290 // Some classes may own an object which contains the children to displayed in |
(...skipping 28 matching lines...) Expand all Loading... |
1312 | 1319 |
1313 // Schedules a paint on the parent View if it exists. | 1320 // Schedules a paint on the parent View if it exists. |
1314 void SchedulePaintOnParent(); | 1321 void SchedulePaintOnParent(); |
1315 | 1322 |
1316 // Returns whether this view is eligible for painting, i.e. is visible and | 1323 // Returns whether this view is eligible for painting, i.e. is visible and |
1317 // nonempty. Note that this does not behave like IsDrawn(), since it doesn't | 1324 // nonempty. Note that this does not behave like IsDrawn(), since it doesn't |
1318 // check ancestors recursively; rather, it's used to prune subtrees of views | 1325 // check ancestors recursively; rather, it's used to prune subtrees of views |
1319 // during painting. | 1326 // during painting. |
1320 bool ShouldPaint() const; | 1327 bool ShouldPaint() const; |
1321 | 1328 |
1322 // Returns the offset that should be used when constructing the paint context | 1329 // Returns the bounds that should be used when constructing the paint context |
1323 // for this view. | 1330 // for this view. |
1324 gfx::Vector2d GetPaintContextOffset() const; | 1331 gfx::Rect GetPaintContextBounds() const; |
1325 | 1332 |
1326 // Adjusts the transform of |recorder| in advance of painting. | 1333 // Adjusts the transform of |recorder| in advance of painting. |
1327 void SetupTransformRecorderForPainting(ui::TransformRecorder* recorder) const; | 1334 void SetupTransformRecorderForPainting( |
| 1335 ui::TransformRecorder* recorder, |
| 1336 const gfx::Vector2d& offset_from_parent) const; |
1328 | 1337 |
1329 // Recursively calls the painting method |func| on all non-layered children, | 1338 // Recursively calls the painting method |func| on all non-layered children, |
1330 // in Z order. | 1339 // in Z order. |
1331 void RecursivePaintHelper(void (View::*func)(const ui::PaintContext&), | 1340 void RecursivePaintHelper(void (View::*func)(const ui::PaintContext&), |
1332 const ui::PaintContext& context); | 1341 const ui::PaintContext& context); |
1333 | 1342 |
1334 // Invokes Paint() and, if necessary, PaintDebugRects(). Should be called | 1343 // Invokes Paint() and, if necessary, PaintDebugRects(). Should be called |
1335 // only on the root of a widget/layer. PaintDebugRects() is invoked as a | 1344 // only on the root of a widget/layer. PaintDebugRects() is invoked as a |
1336 // separate pass, instead of being rolled into Paint(), so that siblings will | 1345 // separate pass, instead of being rolled into Paint(), so that siblings will |
1337 // not obscure debug rects. | 1346 // not obscure debug rects. |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1712 // Observers ------------------------------------------------------------- | 1721 // Observers ------------------------------------------------------------- |
1713 | 1722 |
1714 base::ObserverList<ViewObserver> observers_; | 1723 base::ObserverList<ViewObserver> observers_; |
1715 | 1724 |
1716 DISALLOW_COPY_AND_ASSIGN(View); | 1725 DISALLOW_COPY_AND_ASSIGN(View); |
1717 }; | 1726 }; |
1718 | 1727 |
1719 } // namespace views | 1728 } // namespace views |
1720 | 1729 |
1721 #endif // UI_VIEWS_VIEW_H_ | 1730 #endif // UI_VIEWS_VIEW_H_ |
OLD | NEW |