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

Side by Side Diff: views/view.h

Issue 7273073: Animated Rotation (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 5 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) 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 } 42 }
43 43
44 #if defined(OS_WIN) 44 #if defined(OS_WIN)
45 class NativeViewAccessibilityWin; 45 class NativeViewAccessibilityWin;
46 #endif 46 #endif
47 47
48 namespace views { 48 namespace views {
49 49
50 class Background; 50 class Background;
51 class Border; 51 class Border;
52 class CallbackLock;
52 class ContextMenuController; 53 class ContextMenuController;
53 class DragController; 54 class DragController;
54 class FocusManager; 55 class FocusManager;
55 class FocusTraversable; 56 class FocusTraversable;
56 class InputMethod; 57 class InputMethod;
57 class LayerPropertySetter; 58 class LayerPropertySetter;
58 class LayoutManager; 59 class LayoutManager;
59 class ScrollView; 60 class ScrollView;
60 class TextInputClient; 61 class TextInputClient;
61 class Widget; 62 class Widget;
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 virtual bool IsVisibleInRootView() const; 240 virtual bool IsVisibleInRootView() const;
240 241
241 // Set whether this view is enabled. A disabled view does not receive keyboard 242 // Set whether this view is enabled. A disabled view does not receive keyboard
242 // or mouse inputs. If flag differs from the current value, SchedulePaint is 243 // or mouse inputs. If flag differs from the current value, SchedulePaint is
243 // invoked. 244 // invoked.
244 void SetEnabled(bool enabled); 245 void SetEnabled(bool enabled);
245 246
246 // Returns whether the view is enabled. 247 // Returns whether the view is enabled.
247 virtual bool IsEnabled() const; 248 virtual bool IsEnabled() const;
248 249
250 //TODO(vollick) return a ref-counted lock that releases painting when destroye d.
Jói 2011/06/30 19:50:50 +80
251 //These methods are dangerous.
252 void SetPaintingEnabled(bool enabled);
253 bool IsPaintingEnabled() const;
254
249 // Transformations ----------------------------------------------------------- 255 // Transformations -----------------------------------------------------------
250 256
251 // Methods for setting transformations for a view (e.g. rotation, scaling). 257 // Methods for setting transformations for a view (e.g. rotation, scaling).
252 258
253 const ui::Transform& GetTransform() const; 259 const ui::Transform& GetTransform() const;
254 260
255 // Clipping parameters. Clipping happens from the right and/or bottom. The 261 // Clipping parameters. Clipping happens from the right and/or bottom. The
256 // clipping amount is in parent's coordinate system, as in, if the view is 262 // clipping amount is in parent's coordinate system, as in, if the view is
257 // rotated, then the clipping will be applied after the rotation (and other 263 // rotated, then the clipping will be applied after the rotation (and other
258 // transformations, if any). 264 // transformations, if any).
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 static void ConvertPointToView(const View* src, 417 static void ConvertPointToView(const View* src,
412 const View* dst, 418 const View* dst,
413 gfx::Point* point); 419 gfx::Point* point);
414 420
415 // Convert a point from the coordinate system of a View to that of the 421 // Convert a point from the coordinate system of a View to that of the
416 // Widget. This is useful for example when sizing HWND children of the 422 // Widget. This is useful for example when sizing HWND children of the
417 // Widget that don't know about the View hierarchy and need to be placed 423 // Widget that don't know about the View hierarchy and need to be placed
418 // relative to the Widget that is their parent. 424 // relative to the Widget that is their parent.
419 static void ConvertPointToWidget(const View* src, gfx::Point* point); 425 static void ConvertPointToWidget(const View* src, gfx::Point* point);
420 426
427 // TODO(vollick) get from Sadrul's fix
428 static void ConvertRectToWidget(const View* src, gfx::Rect* rect);
429
421 // Convert a point from a view Widget to a View dest 430 // Convert a point from a view Widget to a View dest
422 static void ConvertPointFromWidget(const View* dest, gfx::Point* p); 431 static void ConvertPointFromWidget(const View* dest, gfx::Point* p);
423 432
424 // Convert a point from the coordinate system of a View to that of the 433 // Convert a point from the coordinate system of a View to that of the
425 // screen. This is useful for example when placing popup windows. 434 // screen. This is useful for example when placing popup windows.
426 static void ConvertPointToScreen(const View* src, gfx::Point* point); 435 static void ConvertPointToScreen(const View* src, gfx::Point* point);
427 436
428 // Applies transformation on the rectangle, which is in the view's coordinate 437 // Applies transformation on the rectangle, which is in the view's coordinate
429 // system, to convert it into the parent's coordinate system. 438 // system, to convert it into the parent's coordinate system.
430 gfx::Rect ConvertRectToParent(const gfx::Rect& rect) const; 439 gfx::Rect ConvertRectToParent(const gfx::Rect& rect) const;
431 440
432 // Painting ------------------------------------------------------------------ 441 // Painting ------------------------------------------------------------------
433 442
434 // Mark all or part of the View's bounds as dirty (needing repaint). 443 // Mark all or part of the View's bounds as dirty (needing repaint).
435 // |r| is in the View's coordinates. 444 // |r| is in the View's coordinates.
436 // Rectangle |r| should be in the view's coordinate system. The 445 // Rectangle |r| should be in the view's coordinate system. The
437 // transformations are applied to it to convert it into the parent coordinate 446 // transformations are applied to it to convert it into the parent coordinate
438 // system before propagating SchedulePaint up the view hierarchy. 447 // system before propagating SchedulePaint up the view hierarchy.
439 // TODO(beng): Make protected. 448 // TODO(beng): Make protected.
440 virtual void SchedulePaint(); 449 virtual void SchedulePaint();
441 virtual void SchedulePaintInRect(const gfx::Rect& r); 450 virtual void SchedulePaintInRect(const gfx::Rect& r);
442 451
452 virtual void ScheduleComposite();
453 virtual void ScheduleCompositeInRect(const gfx::Rect& r);
454
443 // Called by the framework to paint a View. Performs translation and clipping 455 // Called by the framework to paint a View. Performs translation and clipping
444 // for View coordinates and language direction as required, allows the View 456 // for View coordinates and language direction as required, allows the View
445 // to paint itself via the various OnPaint*() event handlers and then paints 457 // to paint itself via the various OnPaint*() event handlers and then paints
446 // the hierarchy beneath it. 458 // the hierarchy beneath it.
447 virtual void Paint(gfx::Canvas* canvas); 459 virtual void Paint(gfx::Canvas* canvas);
448 460
449 // The background object is owned by this object and may be NULL. 461 // The background object is owned by this object and may be NULL.
450 void set_background(Background* b) { background_.reset(b); } 462 void set_background(Background* b) { background_.reset(b); }
451 const Background* background() const { return background_.get(); } 463 const Background* background() const { return background_.get(); }
452 Background* background() { return background_.get(); } 464 Background* background() { return background_.get(); }
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
1169 static void ConvertPointToView(const View* src, 1181 static void ConvertPointToView(const View* src,
1170 const View* dst, 1182 const View* dst,
1171 gfx::Point* point, 1183 gfx::Point* point,
1172 bool try_other_direction); 1184 bool try_other_direction);
1173 1185
1174 // Convert a point in the view's coordinate to an ancestor view's coordinate 1186 // Convert a point in the view's coordinate to an ancestor view's coordinate
1175 // system using necessary transformations. Returns whether the point was 1187 // system using necessary transformations. Returns whether the point was
1176 // successfully converted to the ancestor's coordinate system. 1188 // successfully converted to the ancestor's coordinate system.
1177 bool ConvertPointForAncestor(const View* ancestor, gfx::Point* point) const; 1189 bool ConvertPointForAncestor(const View* ancestor, gfx::Point* point) const;
1178 1190
1191 // TODO(vollick) use Sadrul's fix;
1192 bool ConvertRectForAncestor(const View* ancestor, gfx::Rect* rect) const;
1193
1179 // Convert a point in the ancestor's coordinate system to the view's 1194 // Convert a point in the ancestor's coordinate system to the view's
1180 // coordinate system using necessary transformations. Returns whether the 1195 // coordinate system using necessary transformations. Returns whether the
1181 // point was successfully from the ancestor's coordinate system to the view's 1196 // point was successfully from the ancestor's coordinate system to the view's
1182 // coordinate system. 1197 // coordinate system.
1183 bool ConvertPointFromAncestor(const View* ancestor, gfx::Point* point) const; 1198 bool ConvertPointFromAncestor(const View* ancestor, gfx::Point* point) const;
1184 1199
1185 // Accelerated painting ------------------------------------------------------ 1200 // Accelerated painting ------------------------------------------------------
1186 1201
1187 // Returns true if this view should paint to layer. 1202 // Returns true if this view should paint to layer.
1188 bool ShouldPaintToLayer() const; 1203 bool ShouldPaintToLayer() const;
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
1398 // Next view to be focused when the Shift-Tab key combination is pressed. 1413 // Next view to be focused when the Shift-Tab key combination is pressed.
1399 View* previous_focusable_view_; 1414 View* previous_focusable_view_;
1400 1415
1401 // Whether this view can be focused. 1416 // Whether this view can be focused.
1402 bool focusable_; 1417 bool focusable_;
1403 1418
1404 // Whether this view is focusable if the user requires full keyboard access, 1419 // Whether this view is focusable if the user requires full keyboard access,
1405 // even though it may not be normally focusable. 1420 // even though it may not be normally focusable.
1406 bool accessibility_focusable_; 1421 bool accessibility_focusable_;
1407 1422
1423 // Whether this view can be painted
1424 bool painting_enabled_;
1425
1408 // Context menus ------------------------------------------------------------- 1426 // Context menus -------------------------------------------------------------
1409 1427
1410 // The menu controller. 1428 // The menu controller.
1411 ContextMenuController* context_menu_controller_; 1429 ContextMenuController* context_menu_controller_;
1412 1430
1413 // Drag and drop ------------------------------------------------------------- 1431 // Drag and drop -------------------------------------------------------------
1414 1432
1415 DragController* drag_controller_; 1433 DragController* drag_controller_;
1416 1434
1417 // Accessibility ------------------------------------------------------------- 1435 // Accessibility -------------------------------------------------------------
1418 1436
1419 // The Windows-specific accessibility implementation for this view. 1437 // The Windows-specific accessibility implementation for this view.
1420 #if defined(OS_WIN) 1438 #if defined(OS_WIN)
1421 scoped_refptr<NativeViewAccessibilityWin> native_view_accessibility_win_; 1439 scoped_refptr<NativeViewAccessibilityWin> native_view_accessibility_win_;
1422 #endif 1440 #endif
1423 1441
1424 DISALLOW_COPY_AND_ASSIGN(View); 1442 DISALLOW_COPY_AND_ASSIGN(View);
1425 }; 1443 };
1426 1444
1427 } // namespace views 1445 } // namespace views
1428 1446
1429 #endif // VIEWS_VIEW_H_ 1447 #endif // VIEWS_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698