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

Side by Side Diff: views/controls/button/checkbox.cc

Issue 113443: ChromeCanvas->gfx::Canvas (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 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 | « views/controls/button/checkbox.h ('k') | views/controls/button/image_button.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) 2009 The Chromium Authors. All rights reserved. Use of this 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this
2 // source code is governed by a BSD-style license that can be found in the 2 // source code is governed by a BSD-style license that can be found in the
3 // LICENSE file. 3 // LICENSE file.
4 4
5 #include "views/controls/button/checkbox.h" 5 #include "views/controls/button/checkbox.h"
6 6
7 #include "app/gfx/chrome_canvas.h" 7 #include "app/gfx/canvas.h"
8 #include "views/controls/label.h" 8 #include "views/controls/label.h"
9 9
10 namespace views { 10 namespace views {
11 11
12 // static 12 // static
13 const char Checkbox::kViewClassName[] = "views/Checkbox"; 13 const char Checkbox::kViewClassName[] = "views/Checkbox";
14 14
15 static const int kCheckboxLabelSpacing = 4; 15 static const int kCheckboxLabelSpacing = 4;
16 static const int kLabelFocusPaddingHorizontal = 2; 16 static const int kLabelFocusPaddingHorizontal = 2;
17 static const int kLabelFocusPaddingVertical = 1; 17 static const int kLabelFocusPaddingVertical = 1;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 label_->SetBounds( 78 label_->SetBounds(
79 label_x, 0, std::max(0, width() - label_x - kLabelFocusPaddingHorizontal), 79 label_x, 0, std::max(0, width() - label_x - kLabelFocusPaddingHorizontal),
80 height()); 80 height());
81 int first_line_height = label_->GetFont().height(); 81 int first_line_height = label_->GetFont().height();
82 native_wrapper_->GetView()->SetBounds( 82 native_wrapper_->GetView()->SetBounds(
83 0, ((first_line_height - checkmark_prefsize.height()) / 2), 83 0, ((first_line_height - checkmark_prefsize.height()) / 2),
84 checkmark_prefsize.width(), checkmark_prefsize.height()); 84 checkmark_prefsize.width(), checkmark_prefsize.height());
85 native_wrapper_->GetView()->Layout(); 85 native_wrapper_->GetView()->Layout();
86 } 86 }
87 87
88 void Checkbox::PaintFocusBorder(ChromeCanvas* canvas) { 88 void Checkbox::PaintFocusBorder(gfx::Canvas* canvas) {
89 // Our focus border is rendered by the label, so we don't do anything here. 89 // Our focus border is rendered by the label, so we don't do anything here.
90 } 90 }
91 91
92 View* Checkbox::GetViewForPoint(const gfx::Point& point) { 92 View* Checkbox::GetViewForPoint(const gfx::Point& point) {
93 return GetViewForPoint(point, false); 93 return GetViewForPoint(point, false);
94 } 94 }
95 95
96 View* Checkbox::GetViewForPoint(const gfx::Point& point, 96 View* Checkbox::GetViewForPoint(const gfx::Point& point,
97 bool can_create_floating) { 97 bool can_create_floating) {
98 return GetLocalBounds(true).Contains(point) ? this : NULL; 98 return GetLocalBounds(true).Contains(point) ? this : NULL;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 166
167 void Checkbox::Init(const std::wstring& label_text) { 167 void Checkbox::Init(const std::wstring& label_text) {
168 set_minimum_size(gfx::Size(0, 0)); 168 set_minimum_size(gfx::Size(0, 0));
169 label_ = new Label(label_text); 169 label_ = new Label(label_text);
170 label_->set_has_focus_border(true); 170 label_->set_has_focus_border(true);
171 label_->SetHorizontalAlignment(Label::ALIGN_LEFT); 171 label_->SetHorizontalAlignment(Label::ALIGN_LEFT);
172 AddChildView(label_); 172 AddChildView(label_);
173 } 173 }
174 174
175 } // namespace views 175 } // namespace views
OLDNEW
« no previous file with comments | « views/controls/button/checkbox.h ('k') | views/controls/button/image_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698