Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(241)

Side by Side Diff: ui/views/view.h

Issue 9562038: ui/gfx: Make gfx::Canvas inherit from gfx::CanvasSkia. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more fixes Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #pragma once 7 #pragma once
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <map> 10 #include <map>
(...skipping 15 matching lines...) Expand all
26 #include "ui/views/border.h" 26 #include "ui/views/border.h"
27 #include "ui/views/events/event.h" 27 #include "ui/views/events/event.h"
28 28
29 #if defined(OS_WIN) 29 #if defined(OS_WIN)
30 #include "base/win/scoped_comptr.h" 30 #include "base/win/scoped_comptr.h"
31 #endif 31 #endif
32 32
33 using ui::OSExchangeData; 33 using ui::OSExchangeData;
34 34
35 namespace gfx { 35 namespace gfx {
36 class Canvas; 36 class CanvasSkia;
37 class Insets; 37 class Insets;
38 class Path; 38 class Path;
39 } 39 }
40 40
41 namespace ui { 41 namespace ui {
42 struct AccessibleViewState; 42 struct AccessibleViewState;
43 class Compositor; 43 class Compositor;
44 class Layer; 44 class Layer;
45 class TextInputClient; 45 class TextInputClient;
46 class Texture; 46 class Texture;
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 // transformations are applied to it to convert it into the parent coordinate 450 // transformations are applied to it to convert it into the parent coordinate
451 // system before propagating SchedulePaint up the view hierarchy. 451 // system before propagating SchedulePaint up the view hierarchy.
452 // TODO(beng): Make protected. 452 // TODO(beng): Make protected.
453 virtual void SchedulePaint(); 453 virtual void SchedulePaint();
454 virtual void SchedulePaintInRect(const gfx::Rect& r); 454 virtual void SchedulePaintInRect(const gfx::Rect& r);
455 455
456 // Called by the framework to paint a View. Performs translation and clipping 456 // Called by the framework to paint a View. Performs translation and clipping
457 // for View coordinates and language direction as required, allows the View 457 // for View coordinates and language direction as required, allows the View
458 // to paint itself via the various OnPaint*() event handlers and then paints 458 // to paint itself via the various OnPaint*() event handlers and then paints
459 // the hierarchy beneath it. 459 // the hierarchy beneath it.
460 virtual void Paint(gfx::Canvas* canvas); 460 virtual void Paint(gfx::CanvasSkia* canvas);
461 461
462 // The background object is owned by this object and may be NULL. 462 // The background object is owned by this object and may be NULL.
463 void set_background(Background* b) { background_.reset(b); } 463 void set_background(Background* b) { background_.reset(b); }
464 const Background* background() const { return background_.get(); } 464 const Background* background() const { return background_.get(); }
465 Background* background() { return background_.get(); } 465 Background* background() { return background_.get(); }
466 466
467 // The border object is owned by this object and may be NULL. 467 // The border object is owned by this object and may be NULL.
468 void set_border(Border* b) { border_.reset(b); } 468 void set_border(Border* b) { border_.reset(b); }
469 const Border* border() const { return border_.get(); } 469 const Border* border() const { return border_.get(); }
470 Border* border() { return border_.get(); } 470 Border* border() { return border_.get(); }
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
938 // When this function is called they could do the processing that requires 938 // When this function is called they could do the processing that requires
939 // it - like registering accelerators, for example. 939 // it - like registering accelerators, for example.
940 virtual void NativeViewHierarchyChanged(bool attached, 940 virtual void NativeViewHierarchyChanged(bool attached,
941 gfx::NativeView native_view, 941 gfx::NativeView native_view,
942 internal::RootView* root_view); 942 internal::RootView* root_view);
943 943
944 // Painting ------------------------------------------------------------------ 944 // Painting ------------------------------------------------------------------
945 945
946 // Responsible for calling Paint() on child Views. Override to control the 946 // Responsible for calling Paint() on child Views. Override to control the
947 // order child Views are painted. 947 // order child Views are painted.
948 virtual void PaintChildren(gfx::Canvas* canvas); 948 virtual void PaintChildren(gfx::CanvasSkia* canvas);
949 949
950 // Override to provide rendering in any part of the View's bounds. Typically 950 // Override to provide rendering in any part of the View's bounds. Typically
951 // this is the "contents" of the view. If you override this method you will 951 // this is the "contents" of the view. If you override this method you will
952 // have to call the subsequent OnPaint*() methods manually. 952 // have to call the subsequent OnPaint*() methods manually.
953 virtual void OnPaint(gfx::Canvas* canvas); 953 virtual void OnPaint(gfx::CanvasSkia* canvas);
954 954
955 // Override to paint a background before any content is drawn. Typically this 955 // Override to paint a background before any content is drawn. Typically this
956 // is done if you are satisfied with a default OnPaint handler but wish to 956 // is done if you are satisfied with a default OnPaint handler but wish to
957 // supply a different background. 957 // supply a different background.
958 virtual void OnPaintBackground(gfx::Canvas* canvas); 958 virtual void OnPaintBackground(gfx::CanvasSkia* canvas);
959 959
960 // Override to paint a border not specified by SetBorder(). 960 // Override to paint a border not specified by SetBorder().
961 virtual void OnPaintBorder(gfx::Canvas* canvas); 961 virtual void OnPaintBorder(gfx::CanvasSkia* canvas);
962 962
963 // Override to paint a focus border (usually a dotted rectangle) around 963 // Override to paint a focus border (usually a dotted rectangle) around
964 // relevant contents. 964 // relevant contents.
965 virtual void OnPaintFocusBorder(gfx::Canvas* canvas); 965 virtual void OnPaintFocusBorder(gfx::CanvasSkia* canvas);
966 966
967 // Accelerated painting ------------------------------------------------------ 967 // Accelerated painting ------------------------------------------------------
968 968
969 // This creates a layer for the view, if one does not exist. It then 969 // This creates a layer for the view, if one does not exist. It then
970 // passes the texture to a layer associated with the view. While an external 970 // passes the texture to a layer associated with the view. While an external
971 // texture is set, the view will not update the layer contents. 971 // texture is set, the view will not update the layer contents.
972 // 972 //
973 // |texture| cannot be NULL. 973 // |texture| cannot be NULL.
974 // 974 //
975 // Returns false if it cannot create a layer to which to assign the texture. 975 // Returns false if it cannot create a layer to which to assign the texture.
(...skipping 11 matching lines...) Expand all
987 // existing view to make sure all descendants that have layers are parented to 987 // existing view to make sure all descendants that have layers are parented to
988 // the right layer. 988 // the right layer.
989 virtual void MoveLayerToParent(ui::Layer* parent_layer, 989 virtual void MoveLayerToParent(ui::Layer* parent_layer,
990 const gfx::Point& point); 990 const gfx::Point& point);
991 991
992 // Called to update the bounds of any child layers within this View's 992 // Called to update the bounds of any child layers within this View's
993 // hierarchy when something happens to the hierarchy. 993 // hierarchy when something happens to the hierarchy.
994 virtual void UpdateChildLayerBounds(const gfx::Point& offset); 994 virtual void UpdateChildLayerBounds(const gfx::Point& offset);
995 995
996 // Overridden from ui::LayerDelegate: 996 // Overridden from ui::LayerDelegate:
997 virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE; 997 virtual void OnPaintLayer(gfx::CanvasSkia* canvas) OVERRIDE;
998 998
999 // Finds the layer that this view paints to (it may belong to an ancestor 999 // Finds the layer that this view paints to (it may belong to an ancestor
1000 // view), then reorders the immediate children of that layer to match the 1000 // view), then reorders the immediate children of that layer to match the
1001 // order of the view tree. 1001 // order of the view tree.
1002 virtual void ReorderLayers(); 1002 virtual void ReorderLayers();
1003 1003
1004 // This reorders the immediate children of |*parent_layer| to match the 1004 // This reorders the immediate children of |*parent_layer| to match the
1005 // order of the view tree. 1005 // order of the view tree.
1006 virtual void ReorderChildLayers(ui::Layer* parent_layer); 1006 virtual void ReorderChildLayers(ui::Layer* parent_layer);
1007 1007
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
1124 // Indicates the size changed (and possibly the origin). 1124 // Indicates the size changed (and possibly the origin).
1125 SCHEDULE_PAINT_SIZE_CHANGED 1125 SCHEDULE_PAINT_SIZE_CHANGED
1126 }; 1126 };
1127 1127
1128 // Invoked before and after the bounds change to schedule painting the old and 1128 // Invoked before and after the bounds change to schedule painting the old and
1129 // new bounds. 1129 // new bounds.
1130 void SchedulePaintBoundsChanged(SchedulePaintType type); 1130 void SchedulePaintBoundsChanged(SchedulePaintType type);
1131 1131
1132 // Common Paint() code shared by accelerated and non-accelerated code paths to 1132 // Common Paint() code shared by accelerated and non-accelerated code paths to
1133 // invoke OnPaint() on the View. 1133 // invoke OnPaint() on the View.
1134 void PaintCommon(gfx::Canvas* canvas); 1134 void PaintCommon(gfx::CanvasSkia* canvas);
1135 1135
1136 // Tree operations ----------------------------------------------------------- 1136 // Tree operations -----------------------------------------------------------
1137 1137
1138 // Removes |view| from the hierarchy tree. If |update_focus_cycle| is true, 1138 // Removes |view| from the hierarchy tree. If |update_focus_cycle| is true,
1139 // the next and previous focusable views of views pointing to this view are 1139 // the next and previous focusable views of views pointing to this view are
1140 // updated. If |update_tool_tip| is true, the tooltip is updated. If 1140 // updated. If |update_tool_tip| is true, the tooltip is updated. If
1141 // |delete_removed_view| is true, the view is also deleted (if it is parent 1141 // |delete_removed_view| is true, the view is also deleted (if it is parent
1142 // owned). 1142 // owned).
1143 void DoRemoveChildView(View* view, 1143 void DoRemoveChildView(View* view,
1144 bool update_focus_cycle, 1144 bool update_focus_cycle,
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
1439 base::win::ScopedComPtr<NativeViewAccessibilityWin> 1439 base::win::ScopedComPtr<NativeViewAccessibilityWin>
1440 native_view_accessibility_win_; 1440 native_view_accessibility_win_;
1441 #endif 1441 #endif
1442 1442
1443 DISALLOW_COPY_AND_ASSIGN(View); 1443 DISALLOW_COPY_AND_ASSIGN(View);
1444 }; 1444 };
1445 1445
1446 } // namespace views 1446 } // namespace views
1447 1447
1448 #endif // UI_VIEWS_VIEW_H_ 1448 #endif // UI_VIEWS_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698