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 <algorithm> | 8 #include <algorithm> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
15 #include "base/i18n/rtl.h" | 15 #include "base/i18n/rtl.h" |
16 #include "base/logging.h" | 16 #include "base/logging.h" |
17 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
18 #include "build/build_config.h" | 18 #include "build/build_config.h" |
19 #include "ui/base/accelerators/accelerator.h" | 19 #include "ui/base/accelerators/accelerator.h" |
20 #include "ui/base/dragdrop/os_exchange_data.h" | 20 #include "ui/base/dragdrop/os_exchange_data.h" |
21 #include "ui/base/events/event.h" | 21 #include "ui/base/events/event.h" |
22 #include "ui/compositor/layer_delegate.h" | 22 #include "ui/compositor/layer_delegate.h" |
23 #include "ui/compositor/layer_owner.h" | 23 #include "ui/compositor/layer_owner.h" |
24 #include "ui/gfx/native_widget_types.h" | 24 #include "ui/gfx/native_widget_types.h" |
25 #include "ui/gfx/rect.h" | 25 #include "ui/gfx/rect.h" |
26 #include "ui/views/background.h" | 26 #include "ui/views/background.h" |
27 #include "ui/views/border.h" | 27 #include "ui/views/border.h" |
| 28 #include "ui/views/focus_border.h" |
28 | 29 |
29 #if defined(OS_WIN) | 30 #if defined(OS_WIN) |
30 #include "base/win/scoped_comptr.h" | 31 #include "base/win/scoped_comptr.h" |
31 #endif | 32 #endif |
32 | 33 |
33 using ui::OSExchangeData; | 34 using ui::OSExchangeData; |
34 | 35 |
35 namespace gfx { | 36 namespace gfx { |
36 class Canvas; | 37 class Canvas; |
37 class Insets; | 38 class Insets; |
(...skipping 14 matching lines...) Expand all Loading... |
52 class __declspec(uuid("26f5641a-246d-457b-a96d-07f3fae6acf2")) | 53 class __declspec(uuid("26f5641a-246d-457b-a96d-07f3fae6acf2")) |
53 NativeViewAccessibilityWin; | 54 NativeViewAccessibilityWin; |
54 #endif | 55 #endif |
55 | 56 |
56 namespace views { | 57 namespace views { |
57 | 58 |
58 class Background; | 59 class Background; |
59 class Border; | 60 class Border; |
60 class ContextMenuController; | 61 class ContextMenuController; |
61 class DragController; | 62 class DragController; |
| 63 class FocusBorder; |
62 class FocusManager; | 64 class FocusManager; |
63 class FocusTraversable; | 65 class FocusTraversable; |
64 class InputMethod; | 66 class InputMethod; |
65 class LayoutManager; | 67 class LayoutManager; |
66 class ScrollView; | 68 class ScrollView; |
67 class Widget; | 69 class Widget; |
68 | 70 |
69 namespace internal { | 71 namespace internal { |
70 class RootView; | 72 class RootView; |
71 } | 73 } |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 // The background object is owned by this object and may be NULL. | 453 // The background object is owned by this object and may be NULL. |
452 void set_background(Background* b) { background_.reset(b); } | 454 void set_background(Background* b) { background_.reset(b); } |
453 const Background* background() const { return background_.get(); } | 455 const Background* background() const { return background_.get(); } |
454 Background* background() { return background_.get(); } | 456 Background* background() { return background_.get(); } |
455 | 457 |
456 // The border object is owned by this object and may be NULL. | 458 // The border object is owned by this object and may be NULL. |
457 void set_border(Border* b) { border_.reset(b); } | 459 void set_border(Border* b) { border_.reset(b); } |
458 const Border* border() const { return border_.get(); } | 460 const Border* border() const { return border_.get(); } |
459 Border* border() { return border_.get(); } | 461 Border* border() { return border_.get(); } |
460 | 462 |
| 463 // The focus_border object is owned by this object and may be NULL. |
| 464 void set_focus_border(FocusBorder* b) { focus_border_.reset(b); } |
| 465 const FocusBorder* focus_border() const { return focus_border_.get(); } |
| 466 FocusBorder* focus_border() { return focus_border_.get(); } |
| 467 |
461 // Get the theme provider from the parent widget. | 468 // Get the theme provider from the parent widget. |
462 virtual ui::ThemeProvider* GetThemeProvider() const; | 469 virtual ui::ThemeProvider* GetThemeProvider() const; |
463 | 470 |
464 // RTL painting -------------------------------------------------------------- | 471 // RTL painting -------------------------------------------------------------- |
465 | 472 |
466 // This method determines whether the gfx::Canvas object passed to | 473 // This method determines whether the gfx::Canvas object passed to |
467 // View::Paint() needs to be transformed such that anything drawn on the | 474 // View::Paint() needs to be transformed such that anything drawn on the |
468 // canvas object during View::Paint() is flipped horizontally. | 475 // canvas object during View::Paint() is flipped horizontally. |
469 // | 476 // |
470 // By default, this function returns false (which is the initial value of | 477 // By default, this function returns false (which is the initial value of |
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
976 virtual void OnPaint(gfx::Canvas* canvas); | 983 virtual void OnPaint(gfx::Canvas* canvas); |
977 | 984 |
978 // Override to paint a background before any content is drawn. Typically this | 985 // Override to paint a background before any content is drawn. Typically this |
979 // is done if you are satisfied with a default OnPaint handler but wish to | 986 // is done if you are satisfied with a default OnPaint handler but wish to |
980 // supply a different background. | 987 // supply a different background. |
981 virtual void OnPaintBackground(gfx::Canvas* canvas); | 988 virtual void OnPaintBackground(gfx::Canvas* canvas); |
982 | 989 |
983 // Override to paint a border not specified by SetBorder(). | 990 // Override to paint a border not specified by SetBorder(). |
984 virtual void OnPaintBorder(gfx::Canvas* canvas); | 991 virtual void OnPaintBorder(gfx::Canvas* canvas); |
985 | 992 |
986 // Override to paint a focus border (usually a dotted rectangle) around | 993 // Override to paint a focus border not specified by set_focus_border() around |
987 // relevant contents. | 994 // relevant contents. The focus border is usually a dotted rectangle. |
988 virtual void OnPaintFocusBorder(gfx::Canvas* canvas); | 995 virtual void OnPaintFocusBorder(gfx::Canvas* canvas); |
989 | 996 |
990 // Accelerated painting ------------------------------------------------------ | 997 // Accelerated painting ------------------------------------------------------ |
991 | 998 |
992 // This creates a layer for the view, if one does not exist. It then | 999 // This creates a layer for the view, if one does not exist. It then |
993 // passes the texture to a layer associated with the view. While an external | 1000 // passes the texture to a layer associated with the view. While an external |
994 // texture is set, the view will not update the layer contents. | 1001 // texture is set, the view will not update the layer contents. |
995 // | 1002 // |
996 // |texture| cannot be NULL. | 1003 // |texture| cannot be NULL. |
997 // | 1004 // |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1408 scoped_ptr<LayoutManager> layout_manager_; | 1415 scoped_ptr<LayoutManager> layout_manager_; |
1409 | 1416 |
1410 // Painting ------------------------------------------------------------------ | 1417 // Painting ------------------------------------------------------------------ |
1411 | 1418 |
1412 // Background | 1419 // Background |
1413 scoped_ptr<Background> background_; | 1420 scoped_ptr<Background> background_; |
1414 | 1421 |
1415 // Border. | 1422 // Border. |
1416 scoped_ptr<Border> border_; | 1423 scoped_ptr<Border> border_; |
1417 | 1424 |
| 1425 // Focus border. |
| 1426 scoped_ptr<FocusBorder> focus_border_; |
| 1427 |
1418 // RTL painting -------------------------------------------------------------- | 1428 // RTL painting -------------------------------------------------------------- |
1419 | 1429 |
1420 // Indicates whether or not the gfx::Canvas object passed to View::Paint() | 1430 // Indicates whether or not the gfx::Canvas object passed to View::Paint() |
1421 // is going to be flipped horizontally (using the appropriate transform) on | 1431 // is going to be flipped horizontally (using the appropriate transform) on |
1422 // right-to-left locales for this View. | 1432 // right-to-left locales for this View. |
1423 bool flip_canvas_on_paint_for_rtl_ui_; | 1433 bool flip_canvas_on_paint_for_rtl_ui_; |
1424 | 1434 |
1425 // Accelerated painting ------------------------------------------------------ | 1435 // Accelerated painting ------------------------------------------------------ |
1426 | 1436 |
1427 bool paint_to_layer_; | 1437 bool paint_to_layer_; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1472 base::win::ScopedComPtr<NativeViewAccessibilityWin> | 1482 base::win::ScopedComPtr<NativeViewAccessibilityWin> |
1473 native_view_accessibility_win_; | 1483 native_view_accessibility_win_; |
1474 #endif | 1484 #endif |
1475 | 1485 |
1476 DISALLOW_COPY_AND_ASSIGN(View); | 1486 DISALLOW_COPY_AND_ASSIGN(View); |
1477 }; | 1487 }; |
1478 | 1488 |
1479 } // namespace views | 1489 } // namespace views |
1480 | 1490 |
1481 #endif // UI_VIEWS_VIEW_H_ | 1491 #endif // UI_VIEWS_VIEW_H_ |
OLD | NEW |