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 "build/build_config.h" | 9 #include "build/build_config.h" |
10 | 10 |
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 // Mark all or part of the View's bounds as dirty (needing repaint). | 515 // Mark all or part of the View's bounds as dirty (needing repaint). |
516 // |r| is in the View's coordinates. | 516 // |r| is in the View's coordinates. |
517 // When |urgent| is true, the view will be repainted when the current event | 517 // When |urgent| is true, the view will be repainted when the current event |
518 // processing is done. Otherwise, painting will take place as soon as | 518 // processing is done. Otherwise, painting will take place as soon as |
519 // possible. Rectangle |r| should be in the view's coordinate system. The | 519 // possible. Rectangle |r| should be in the view's coordinate system. The |
520 // transformations are applied to it to convert it into the parent coordinate | 520 // transformations are applied to it to convert it into the parent coordinate |
521 // system before propagating SchedulePaint up the view hierarchy. | 521 // system before propagating SchedulePaint up the view hierarchy. |
522 virtual void SchedulePaint(); | 522 virtual void SchedulePaint(); |
523 virtual void SchedulePaintInRect(const gfx::Rect& r, bool urgent); | 523 virtual void SchedulePaintInRect(const gfx::Rect& r, bool urgent); |
524 | 524 |
| 525 // Responsible for calling Paint() on child Views. Override to control the |
| 526 // order child Views are painted. |
| 527 virtual void PaintChildren(gfx::Canvas* canvas); |
| 528 |
525 // Override to provide rendering in any part of the View's bounds. Typically | 529 // Override to provide rendering in any part of the View's bounds. Typically |
526 // this is the "contents" of the view. If you override this method you will | 530 // this is the "contents" of the view. If you override this method you will |
527 // have to call the subsequent OnPaint*() methods manually. | 531 // have to call the subsequent OnPaint*() methods manually. |
528 virtual void OnPaint(gfx::Canvas* canvas); | 532 virtual void OnPaint(gfx::Canvas* canvas); |
529 | 533 |
530 // Override to paint a background before any content is drawn. Typically this | 534 // Override to paint a background before any content is drawn. Typically this |
531 // is done if you are satisfied with a default OnPaint handler but wish to | 535 // is done if you are satisfied with a default OnPaint handler but wish to |
532 // supply a different background. | 536 // supply a different background. |
533 virtual void OnPaintBackground(gfx::Canvas* canvas); | 537 virtual void OnPaintBackground(gfx::Canvas* canvas); |
534 | 538 |
535 // Override to paint a border not specified by SetBorder(). | 539 // Override to paint a border not specified by SetBorder(). |
536 virtual void OnPaintBorder(gfx::Canvas* canvas); | 540 virtual void OnPaintBorder(gfx::Canvas* canvas); |
537 | 541 |
538 // Override to paint a focus border (usually a dotted rectangle) around | 542 // Override to paint a focus border (usually a dotted rectangle) around |
539 // relevant contents. | 543 // relevant contents. |
540 virtual void OnPaintFocusBorder(gfx::Canvas* canvas); | 544 virtual void OnPaintFocusBorder(gfx::Canvas* canvas); |
541 | 545 |
542 // Paint this View immediately. | 546 // Paint this View immediately. |
543 virtual void PaintNow(); | 547 virtual void PaintNow(); |
544 | 548 |
545 // This method is the main entry point to process paint for this | 549 // TODO(beng): move to protected. |
546 // view and its children. This method is called by the painting | 550 // Called by the framework to paint a View. Performs translation and clipping |
547 // system. You should call this only if you want to draw a sub tree | 551 // for View coordinates and language direction as required, allows the View |
548 // inside a custom graphics. | 552 // to paint itself via the various OnPaint*() event handlers and then paints |
549 // To customize painting override either the Paint or PaintChildren method, | 553 // the hierarchy beneath it. |
550 // not this one. | 554 virtual void Paint(gfx::Canvas* canvas); |
551 virtual void ProcessPaint(gfx::Canvas* canvas); | |
552 | |
553 // Paint the View's child Views, in reverse order. | |
554 virtual void PaintChildren(gfx::Canvas* canvas); | |
555 | 555 |
556 // The background object is owned by this object and may be NULL. | 556 // The background object is owned by this object and may be NULL. |
557 void set_background(Background* b) { background_.reset(b); } | 557 void set_background(Background* b) { background_.reset(b); } |
558 const Background* background() const { return background_.get(); } | 558 const Background* background() const { return background_.get(); } |
559 | 559 |
560 // The border object is owned by this object and may be NULL. | 560 // The border object is owned by this object and may be NULL. |
561 void set_border(Border* b) { border_.reset(b); } | 561 void set_border(Border* b) { border_.reset(b); } |
562 const Border* border() const { return border_.get(); } | 562 const Border* border() const { return border_.get(); } |
563 | 563 |
564 // Get the theme provider from the parent widget. | 564 // Get the theme provider from the parent widget. |
(...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1432 // The accessibility implementation for this View. | 1432 // The accessibility implementation for this View. |
1433 scoped_refptr<ViewAccessibility> view_accessibility_; | 1433 scoped_refptr<ViewAccessibility> view_accessibility_; |
1434 #endif | 1434 #endif |
1435 | 1435 |
1436 DISALLOW_COPY_AND_ASSIGN(View); | 1436 DISALLOW_COPY_AND_ASSIGN(View); |
1437 }; | 1437 }; |
1438 | 1438 |
1439 } // namespace views | 1439 } // namespace views |
1440 | 1440 |
1441 #endif // VIEWS_VIEW_H_ | 1441 #endif // VIEWS_VIEW_H_ |
OLD | NEW |