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

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

Issue 6462022: It turns out I had the sense of the GetLocalBounds bool wrong everywhere, so ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 10 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "views/controls/button/checkbox.h" 5 #include "views/controls/button/checkbox.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ui/gfx/canvas.h" 8 #include "ui/gfx/canvas.h"
9 #include "views/controls/label.h" 9 #include "views/controls/label.h"
10 10
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 void Checkbox::PaintFocusBorder(gfx::Canvas* canvas) { 120 void Checkbox::PaintFocusBorder(gfx::Canvas* canvas) {
121 // Our focus border is rendered by the label, so we don't do anything here. 121 // Our focus border is rendered by the label, so we don't do anything here.
122 } 122 }
123 123
124 View* Checkbox::GetViewForPoint(const gfx::Point& point) { 124 View* Checkbox::GetViewForPoint(const gfx::Point& point) {
125 return GetViewForPoint(point, false); 125 return GetViewForPoint(point, false);
126 } 126 }
127 127
128 View* Checkbox::GetViewForPoint(const gfx::Point& point, 128 View* Checkbox::GetViewForPoint(const gfx::Point& point,
129 bool can_create_floating) { 129 bool can_create_floating) {
130 return GetContentsBounds().Contains(point) ? this : NULL; 130 return GetLocalBounds().Contains(point) ? this : NULL;
131 } 131 }
132 132
133 void Checkbox::OnMouseEntered(const MouseEvent& e) { 133 void Checkbox::OnMouseEntered(const MouseEvent& e) {
134 native_wrapper_->SetPushed(HitTestLabel(e)); 134 native_wrapper_->SetPushed(HitTestLabel(e));
135 } 135 }
136 136
137 void Checkbox::OnMouseMoved(const MouseEvent& e) { 137 void Checkbox::OnMouseMoved(const MouseEvent& e) {
138 native_wrapper_->SetPushed(HitTestLabel(e)); 138 native_wrapper_->SetPushed(HitTestLabel(e));
139 } 139 }
140 140
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 void Checkbox::Init(const std::wstring& label_text) { 215 void Checkbox::Init(const std::wstring& label_text) {
216 // Checkboxs don't need to enforce a minimum size. 216 // Checkboxs don't need to enforce a minimum size.
217 set_ignore_minimum_size(true); 217 set_ignore_minimum_size(true);
218 label_ = new Label(label_text); 218 label_ = new Label(label_text);
219 label_->SetHasFocusBorder(true); 219 label_->SetHasFocusBorder(true);
220 label_->SetHorizontalAlignment(Label::ALIGN_LEFT); 220 label_->SetHorizontalAlignment(Label::ALIGN_LEFT);
221 AddChildView(label_); 221 AddChildView(label_);
222 } 222 }
223 223
224 } // namespace views 224 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698