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

Side by Side Diff: ui/views/controls/tabbed_pane/native_tabbed_pane_views.cc

Issue 10832282: Replace views::MouseEvent with ui::MouseEvent (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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
« no previous file with comments | « ui/views/controls/slider_unittest.cc ('k') | ui/views/controls/table/table_view_views.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/native_tabbed_pane_views.h" 5 #include "ui/views/controls/tabbed_pane/native_tabbed_pane_views.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "ui/base/resource/resource_bundle.h" 9 #include "ui/base/resource/resource_bundle.h"
10 #include "ui/gfx/canvas.h" 10 #include "ui/gfx/canvas.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 } 43 }
44 44
45 static View* GetContents(View* tab) { 45 static View* GetContents(View* tab) {
46 return static_cast<Tab*>(tab)->contents_; 46 return static_cast<Tab*>(tab)->contents_;
47 } 47 }
48 48
49 void OnSelectedStateChanged(bool selected); 49 void OnSelectedStateChanged(bool selected);
50 50
51 // Overridden from View: 51 // Overridden from View:
52 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; 52 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
53 virtual bool OnMousePressed(const MouseEvent& event) OVERRIDE; 53 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE;
54 virtual void OnMouseReleased(const MouseEvent& event) OVERRIDE; 54 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE;
55 virtual void OnMouseCaptureLost() OVERRIDE; 55 virtual void OnMouseCaptureLost() OVERRIDE;
56 virtual void OnMouseEntered(const MouseEvent& event) OVERRIDE; 56 virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE;
57 virtual void OnMouseExited(const MouseEvent& event) OVERRIDE; 57 virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE;
58 virtual gfx::Size GetPreferredSize() OVERRIDE { 58 virtual gfx::Size GetPreferredSize() OVERRIDE {
59 const int kTabMinWidth = 54; 59 const int kTabMinWidth = 54;
60 gfx::Size ps(GetTabTitleFont().GetStringWidth(title_), 60 gfx::Size ps(GetTabTitleFont().GetStringWidth(title_),
61 GetMinimumTabHeight()); 61 GetMinimumTabHeight());
62 ps.Enlarge(30, 10); 62 ps.Enlarge(30, 10);
63 if (ps.width() < kTabMinWidth) 63 if (ps.width() < kTabMinWidth)
64 ps.set_width(kTabMinWidth); 64 ps.set_width(kTabMinWidth);
65 return ps; 65 return ps;
66 } 66 }
67 67
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 205
206 void Tab::OnPaint(gfx::Canvas* canvas) { 206 void Tab::OnPaint(gfx::Canvas* canvas) {
207 bool selected = tab_strip_->IsTabSelected(this); 207 bool selected = tab_strip_->IsTabSelected(this);
208 if (selected) { 208 if (selected) {
209 PaintTabBackground(canvas); 209 PaintTabBackground(canvas);
210 PaintTabBorder(canvas); 210 PaintTabBorder(canvas);
211 } 211 }
212 PaintTabTitle(canvas, selected); 212 PaintTabTitle(canvas, selected);
213 } 213 }
214 214
215 bool Tab::OnMousePressed(const MouseEvent& event) { 215 bool Tab::OnMousePressed(const ui::MouseEvent& event) {
216 SetTitleColor(kTabTitleColor_Pressed); 216 SetTitleColor(kTabTitleColor_Pressed);
217 return true; 217 return true;
218 } 218 }
219 219
220 void Tab::OnMouseReleased(const MouseEvent& event) { 220 void Tab::OnMouseReleased(const ui::MouseEvent& event) {
221 SetTitleColor(kTabTitleColor_Hovered); 221 SetTitleColor(kTabTitleColor_Hovered);
222 tab_strip_->SelectTab(this); 222 tab_strip_->SelectTab(this);
223 } 223 }
224 224
225 void Tab::OnMouseCaptureLost() { 225 void Tab::OnMouseCaptureLost() {
226 SetTitleColor(kTabTitleColor_Inactive); 226 SetTitleColor(kTabTitleColor_Inactive);
227 } 227 }
228 228
229 void Tab::OnMouseEntered(const MouseEvent& event) { 229 void Tab::OnMouseEntered(const ui::MouseEvent& event) {
230 SetTitleColor(tab_strip_->IsTabSelected(this) ? kTabTitleColor_Active : 230 SetTitleColor(tab_strip_->IsTabSelected(this) ? kTabTitleColor_Active :
231 kTabTitleColor_Hovered); 231 kTabTitleColor_Hovered);
232 } 232 }
233 233
234 void Tab::OnMouseExited(const MouseEvent& event) { 234 void Tab::OnMouseExited(const ui::MouseEvent& event) {
235 SetTitleColor(tab_strip_->IsTabSelected(this) ? kTabTitleColor_Active : 235 SetTitleColor(tab_strip_->IsTabSelected(this) ? kTabTitleColor_Active :
236 kTabTitleColor_Inactive); 236 kTabTitleColor_Inactive);
237 } 237 }
238 238
239 // Custom layout manager that takes care of sizing and displaying the tab pages. 239 // Custom layout manager that takes care of sizing and displaying the tab pages.
240 class TabLayout : public LayoutManager { 240 class TabLayout : public LayoutManager {
241 public: 241 public:
242 TabLayout() {} 242 TabLayout() {}
243 243
244 // Switches to the tab page identified. 244 // Switches to the tab page identified.
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 if (tab_strip_->has_children()) 419 if (tab_strip_->has_children())
420 InitializeTabs(); 420 InitializeTabs();
421 } 421 }
422 422
423 void NativeTabbedPaneViews::InitializeTabs() { 423 void NativeTabbedPaneViews::InitializeTabs() {
424 for (int i = 0; i < tab_strip_->child_count(); ++i) 424 for (int i = 0; i < tab_strip_->child_count(); ++i)
425 content_view_->AddChildView(Tab::GetContents(tab_strip_->child_at(i))); 425 content_view_->AddChildView(Tab::GetContents(tab_strip_->child_at(i)));
426 } 426 }
427 427
428 } // namespace views 428 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/slider_unittest.cc ('k') | ui/views/controls/table/table_view_views.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698