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 #include "ui/views/controls/tabbed_pane/tabbed_pane.h" | 5 #include "ui/views/controls/tabbed_pane/tabbed_pane.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "ui/accessibility/ax_view_state.h" | 8 #include "ui/accessibility/ax_view_state.h" |
9 #include "ui/base/resource/resource_bundle.h" | 9 #include "ui/base/resource/resource_bundle.h" |
10 #include "ui/events/keycodes/keyboard_codes.h" | 10 #include "ui/events/keycodes/keyboard_codes.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 public: | 36 public: |
37 Tab(TabbedPane* tabbed_pane, const base::string16& title, View* contents); | 37 Tab(TabbedPane* tabbed_pane, const base::string16& title, View* contents); |
38 virtual ~Tab(); | 38 virtual ~Tab(); |
39 | 39 |
40 View* contents() const { return contents_; } | 40 View* contents() const { return contents_; } |
41 | 41 |
42 bool selected() const { return contents_->visible(); } | 42 bool selected() const { return contents_->visible(); } |
43 void SetSelected(bool selected); | 43 void SetSelected(bool selected); |
44 | 44 |
45 // Overridden from View: | 45 // Overridden from View: |
46 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; | 46 virtual bool OnMousePressed(const ui::MouseEvent& event) override; |
47 virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE; | 47 virtual void OnMouseEntered(const ui::MouseEvent& event) override; |
48 virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; | 48 virtual void OnMouseExited(const ui::MouseEvent& event) override; |
49 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; | 49 virtual void OnGestureEvent(ui::GestureEvent* event) override; |
50 virtual gfx::Size GetPreferredSize() const OVERRIDE; | 50 virtual gfx::Size GetPreferredSize() const override; |
51 virtual void Layout() OVERRIDE; | 51 virtual void Layout() override; |
52 | 52 |
53 private: | 53 private: |
54 enum TabState { | 54 enum TabState { |
55 TAB_INACTIVE, | 55 TAB_INACTIVE, |
56 TAB_ACTIVE, | 56 TAB_ACTIVE, |
57 TAB_HOVERED, | 57 TAB_HOVERED, |
58 }; | 58 }; |
59 | 59 |
60 void SetState(TabState tab_state); | 60 void SetState(TabState tab_state); |
61 | 61 |
62 TabbedPane* tabbed_pane_; | 62 TabbedPane* tabbed_pane_; |
63 Label* title_; | 63 Label* title_; |
64 gfx::Size preferred_title_size_; | 64 gfx::Size preferred_title_size_; |
65 TabState tab_state_; | 65 TabState tab_state_; |
66 // The content view associated with this tab. | 66 // The content view associated with this tab. |
67 View* contents_; | 67 View* contents_; |
68 | 68 |
69 DISALLOW_COPY_AND_ASSIGN(Tab); | 69 DISALLOW_COPY_AND_ASSIGN(Tab); |
70 }; | 70 }; |
71 | 71 |
72 // The tab strip shown above the tab contents. | 72 // The tab strip shown above the tab contents. |
73 class TabStrip : public View { | 73 class TabStrip : public View { |
74 public: | 74 public: |
75 explicit TabStrip(TabbedPane* tabbed_pane); | 75 explicit TabStrip(TabbedPane* tabbed_pane); |
76 virtual ~TabStrip(); | 76 virtual ~TabStrip(); |
77 | 77 |
78 // Overridden from View: | 78 // Overridden from View: |
79 virtual gfx::Size GetPreferredSize() const OVERRIDE; | 79 virtual gfx::Size GetPreferredSize() const override; |
80 virtual void Layout() OVERRIDE; | 80 virtual void Layout() override; |
81 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 81 virtual void OnPaint(gfx::Canvas* canvas) override; |
82 | 82 |
83 private: | 83 private: |
84 TabbedPane* tabbed_pane_; | 84 TabbedPane* tabbed_pane_; |
85 | 85 |
86 DISALLOW_COPY_AND_ASSIGN(TabStrip); | 86 DISALLOW_COPY_AND_ASSIGN(TabStrip); |
87 }; | 87 }; |
88 | 88 |
89 Tab::Tab(TabbedPane* tabbed_pane, const base::string16& title, View* contents) | 89 Tab::Tab(TabbedPane* tabbed_pane, const base::string16& title, View* contents) |
90 : tabbed_pane_(tabbed_pane), | 90 : tabbed_pane_(tabbed_pane), |
91 title_(new Label(title, | 91 title_(new Label(title, |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 selected_tab->NotifyAccessibilityEvent( | 366 selected_tab->NotifyAccessibilityEvent( |
367 ui::AX_EVENT_FOCUS, true); | 367 ui::AX_EVENT_FOCUS, true); |
368 } | 368 } |
369 } | 369 } |
370 | 370 |
371 void TabbedPane::GetAccessibleState(ui::AXViewState* state) { | 371 void TabbedPane::GetAccessibleState(ui::AXViewState* state) { |
372 state->role = ui::AX_ROLE_TAB_LIST; | 372 state->role = ui::AX_ROLE_TAB_LIST; |
373 } | 373 } |
374 | 374 |
375 } // namespace views | 375 } // namespace views |
OLD | NEW |