Chromium Code Reviews| 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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 235 virtual bool IsVisibleInRootView() const; | 235 virtual bool IsVisibleInRootView() const; |
| 236 | 236 |
| 237 // Set whether this view is enabled. A disabled view does not receive keyboard | 237 // Set whether this view is enabled. A disabled view does not receive keyboard |
| 238 // or mouse inputs. If flag differs from the current value, SchedulePaint is | 238 // or mouse inputs. If flag differs from the current value, SchedulePaint is |
| 239 // invoked. | 239 // invoked. |
| 240 void SetEnabled(bool enabled); | 240 void SetEnabled(bool enabled); |
| 241 | 241 |
| 242 // Returns whether the view is enabled. | 242 // Returns whether the view is enabled. |
| 243 virtual bool IsEnabled() const; | 243 virtual bool IsEnabled() const; |
| 244 | 244 |
| 245 // Sets whether this view is painting. | |
| 246 void SetPaintingEnabled(bool enabled); | |
| 247 | |
| 248 // Returns whether the view is painting. | |
| 249 bool IsPaintingEnabled() const; | |
| 250 | |
| 245 // Transformations ----------------------------------------------------------- | 251 // Transformations ----------------------------------------------------------- |
| 246 | 252 |
| 247 // Methods for setting transformations for a view (e.g. rotation, scaling). | 253 // Methods for setting transformations for a view (e.g. rotation, scaling). |
| 248 | 254 |
| 249 const ui::Transform& GetTransform() const; | 255 const ui::Transform& GetTransform() const; |
| 250 | 256 |
| 251 // Clipping parameters. Clipping happens from the right and/or bottom. The | 257 // Clipping parameters. Clipping happens from the right and/or bottom. The |
| 252 // clipping amount is in parent's coordinate system, as in, if the view is | 258 // clipping amount is in parent's coordinate system, as in, if the view is |
| 253 // rotated, then the clipping will be applied after the rotation (and other | 259 // rotated, then the clipping will be applied after the rotation (and other |
| 254 // transformations, if any). | 260 // transformations, if any). |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 433 | 439 |
| 434 // Mark all or part of the View's bounds as dirty (needing repaint). | 440 // Mark all or part of the View's bounds as dirty (needing repaint). |
| 435 // |r| is in the View's coordinates. | 441 // |r| is in the View's coordinates. |
| 436 // Rectangle |r| should be in the view's coordinate system. The | 442 // Rectangle |r| should be in the view's coordinate system. The |
| 437 // transformations are applied to it to convert it into the parent coordinate | 443 // transformations are applied to it to convert it into the parent coordinate |
| 438 // system before propagating SchedulePaint up the view hierarchy. | 444 // system before propagating SchedulePaint up the view hierarchy. |
| 439 // TODO(beng): Make protected. | 445 // TODO(beng): Make protected. |
| 440 virtual void SchedulePaint(); | 446 virtual void SchedulePaint(); |
| 441 virtual void SchedulePaintInRect(const gfx::Rect& r); | 447 virtual void SchedulePaintInRect(const gfx::Rect& r); |
| 442 | 448 |
| 449 virtual void ScheduleComposite(); | |
| 450 virtual void ScheduleCompositeInRect(const gfx::Rect& r); | |
| 451 | |
| 443 // Called by the framework to paint a View. Performs translation and clipping | 452 // Called by the framework to paint a View. Performs translation and clipping |
| 444 // for View coordinates and language direction as required, allows the View | 453 // for View coordinates and language direction as required, allows the View |
| 445 // to paint itself via the various OnPaint*() event handlers and then paints | 454 // to paint itself via the various OnPaint*() event handlers and then paints |
| 446 // the hierarchy beneath it. | 455 // the hierarchy beneath it. |
| 447 virtual void Paint(gfx::Canvas* canvas); | 456 virtual void Paint(gfx::Canvas* canvas); |
| 448 | 457 |
| 449 // The background object is owned by this object and may be NULL. | 458 // The background object is owned by this object and may be NULL. |
| 450 void set_background(Background* b) { background_.reset(b); } | 459 void set_background(Background* b) { background_.reset(b); } |
| 451 const Background* background() const { return background_.get(); } | 460 const Background* background() const { return background_.get(); } |
| 452 Background* background() { return background_.get(); } | 461 Background* background() { return background_.get(); } |
| (...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1401 // Next view to be focused when the Shift-Tab key combination is pressed. | 1410 // Next view to be focused when the Shift-Tab key combination is pressed. |
| 1402 View* previous_focusable_view_; | 1411 View* previous_focusable_view_; |
| 1403 | 1412 |
| 1404 // Whether this view can be focused. | 1413 // Whether this view can be focused. |
| 1405 bool focusable_; | 1414 bool focusable_; |
| 1406 | 1415 |
| 1407 // Whether this view is focusable if the user requires full keyboard access, | 1416 // Whether this view is focusable if the user requires full keyboard access, |
| 1408 // even though it may not be normally focusable. | 1417 // even though it may not be normally focusable. |
| 1409 bool accessibility_focusable_; | 1418 bool accessibility_focusable_; |
| 1410 | 1419 |
| 1420 // Whether this view can be painted | |
|
sadrul
2011/07/15 15:25:48
Perhaps leave a note explaining it can be used dur
| |
| 1421 bool painting_enabled_; | |
| 1422 | |
| 1411 // Context menus ------------------------------------------------------------- | 1423 // Context menus ------------------------------------------------------------- |
| 1412 | 1424 |
| 1413 // The menu controller. | 1425 // The menu controller. |
| 1414 ContextMenuController* context_menu_controller_; | 1426 ContextMenuController* context_menu_controller_; |
| 1415 | 1427 |
| 1416 // Drag and drop ------------------------------------------------------------- | 1428 // Drag and drop ------------------------------------------------------------- |
| 1417 | 1429 |
| 1418 DragController* drag_controller_; | 1430 DragController* drag_controller_; |
| 1419 | 1431 |
| 1420 // Accessibility ------------------------------------------------------------- | 1432 // Accessibility ------------------------------------------------------------- |
| 1421 | 1433 |
| 1422 // The Windows-specific accessibility implementation for this view. | 1434 // The Windows-specific accessibility implementation for this view. |
| 1423 #if defined(OS_WIN) | 1435 #if defined(OS_WIN) |
| 1424 scoped_refptr<NativeViewAccessibilityWin> native_view_accessibility_win_; | 1436 scoped_refptr<NativeViewAccessibilityWin> native_view_accessibility_win_; |
| 1425 #endif | 1437 #endif |
| 1426 | 1438 |
| 1427 DISALLOW_COPY_AND_ASSIGN(View); | 1439 DISALLOW_COPY_AND_ASSIGN(View); |
| 1428 }; | 1440 }; |
| 1429 | 1441 |
| 1430 } // namespace views | 1442 } // namespace views |
| 1431 | 1443 |
| 1432 #endif // VIEWS_VIEW_H_ | 1444 #endif // VIEWS_VIEW_H_ |
| OLD | NEW |