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

Side by Side Diff: chrome/views/checkbox.cc

Issue 14601: Some cleanup in view menu delegate (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 12 years 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 | « chrome/browser/views/toolbar_view.cc ('k') | chrome/views/menu_button.cc » ('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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "chrome/views/checkbox.h" 5 #include "chrome/views/checkbox.h"
6 6
7 #include "chrome/common/gfx/chrome_canvas.h" 7 #include "chrome/common/gfx/chrome_canvas.h"
8 #include "chrome/views/checkbox.h" 8 #include "chrome/views/checkbox.h"
9 #include "chrome/views/hwnd_view.h" 9 #include "chrome/views/hwnd_view.h"
10 #include "chrome/views/label.h" 10 #include "chrome/views/label.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 } 134 }
135 135
136 void CheckBox::HighlightButton(bool f) { 136 void CheckBox::HighlightButton(bool f) {
137 ::SendMessage(GetNativeControlHWND(), 137 ::SendMessage(GetNativeControlHWND(),
138 static_cast<UINT>(BM_SETSTATE), 138 static_cast<UINT>(BM_SETSTATE),
139 static_cast<WPARAM>(f), 139 static_cast<WPARAM>(f),
140 0); 140 0);
141 } 141 }
142 142
143 bool CheckBox::LabelHitTest(const MouseEvent& event) { 143 bool CheckBox::LabelHitTest(const MouseEvent& event) {
144 CPoint p(event.x(), event.y());
145 gfx::Rect r; 144 gfx::Rect r;
146 ComputeTextRect(&r); 145 ComputeTextRect(&r);
147 return r.Contains(event.x(), event.y()); 146 return r.Contains(event.x(), event.y());
148 } 147 }
149 148
150 void CheckBox::OnMouseEntered(const MouseEvent& event) { 149 void CheckBox::OnMouseEntered(const MouseEvent& event) {
151 HighlightButton(LabelHitTest(event)); 150 HighlightButton(LabelHitTest(event));
152 } 151 }
153 152
154 void CheckBox::OnMouseMoved(const MouseEvent& event) { 153 void CheckBox::OnMouseMoved(const MouseEvent& event) {
(...skipping 16 matching lines...) Expand all
171 170
172 void CheckBox::OnMouseReleased(const MouseEvent& event, 171 void CheckBox::OnMouseReleased(const MouseEvent& event,
173 bool canceled) { 172 bool canceled) {
174 HighlightButton(false); 173 HighlightButton(false);
175 if (!canceled && LabelHitTest(event)) 174 if (!canceled && LabelHitTest(event))
176 OnCommand(BN_CLICKED, 0, GetNativeControlHWND()); 175 OnCommand(BN_CLICKED, 0, GetNativeControlHWND());
177 } 176 }
178 177
179 } // namespace views 178 } // namespace views
180 179
OLDNEW
« no previous file with comments | « chrome/browser/views/toolbar_view.cc ('k') | chrome/views/menu_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698