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

Side by Side Diff: views/controls/label.h

Issue 7298009: Labels don't need to respond to mouse clicks and doing so can interfere with button clicks, for e... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 5 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 | « no previous file | views/controls/label.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef VIEWS_CONTROLS_LABEL_H_ 5 #ifndef VIEWS_CONTROLS_LABEL_H_
6 #define VIEWS_CONTROLS_LABEL_H_ 6 #define VIEWS_CONTROLS_LABEL_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string>
10
9 #include "base/gtest_prod_util.h" 11 #include "base/gtest_prod_util.h"
10 #include "googleurl/src/gurl.h" 12 #include "googleurl/src/gurl.h"
11 #include "third_party/skia/include/core/SkColor.h" 13 #include "third_party/skia/include/core/SkColor.h"
12 #include "ui/gfx/font.h" 14 #include "ui/gfx/font.h"
13 #include "views/view.h" 15 #include "views/view.h"
14 16
15 namespace views { 17 namespace views {
16 18
17 ///////////////////////////////////////////////////////////////////////////// 19 /////////////////////////////////////////////////////////////////////////////
18 // 20 //
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 virtual int GetBaseline() const OVERRIDE; 158 virtual int GetBaseline() const OVERRIDE;
157 // Overridden to compute the size required to display this label. 159 // Overridden to compute the size required to display this label.
158 virtual gfx::Size GetPreferredSize() OVERRIDE; 160 virtual gfx::Size GetPreferredSize() OVERRIDE;
159 // Return the height necessary to display this label with the provided width. 161 // Return the height necessary to display this label with the provided width.
160 // This method is used to layout multi-line labels. It is equivalent to 162 // This method is used to layout multi-line labels. It is equivalent to
161 // GetPreferredSize().height() if the receiver is not multi-line. 163 // GetPreferredSize().height() if the receiver is not multi-line.
162 virtual int GetHeightForWidth(int w); 164 virtual int GetHeightForWidth(int w);
163 // Sets the enabled state. Setting the enabled state resets the color. 165 // Sets the enabled state. Setting the enabled state resets the color.
164 virtual void OnEnabledChanged() OVERRIDE; 166 virtual void OnEnabledChanged() OVERRIDE;
165 virtual std::string GetClassName() const OVERRIDE; 167 virtual std::string GetClassName() const OVERRIDE;
168 virtual bool HitTest(const gfx::Point& l) const OVERRIDE;
166 // Mouse enter/exit are overridden to render mouse over background color. 169 // Mouse enter/exit are overridden to render mouse over background color.
167 // These invoke SetContainsMouse as necessary. 170 // These invoke SetContainsMouse as necessary.
168 virtual void OnMouseMoved(const MouseEvent& event) OVERRIDE; 171 virtual void OnMouseMoved(const MouseEvent& event) OVERRIDE;
169 virtual void OnMouseEntered(const MouseEvent& event) OVERRIDE; 172 virtual void OnMouseEntered(const MouseEvent& event) OVERRIDE;
170 virtual void OnMouseExited(const MouseEvent& event) OVERRIDE; 173 virtual void OnMouseExited(const MouseEvent& event) OVERRIDE;
171 // Gets the tooltip text for labels that are wider than their bounds, except 174 // Gets the tooltip text for labels that are wider than their bounds, except
172 // when the label is multiline, in which case it just returns false (no 175 // when the label is multiline, in which case it just returns false (no
173 // tooltip). If a custom tooltip has been specified with SetTooltipText() 176 // tooltip). If a custom tooltip has been specified with SetTooltipText()
174 // it is returned instead. 177 // it is returned instead.
175 virtual bool GetTooltipText(const gfx::Point& p, std::wstring* tooltip); 178 virtual bool GetTooltipText(const gfx::Point& p, std::wstring* tooltip);
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 // allows this view to reserve space for a focus border that it otherwise 262 // allows this view to reserve space for a focus border that it otherwise
260 // might not have because it is not itself focusable. 263 // might not have because it is not itself focusable.
261 bool has_focus_border_; 264 bool has_focus_border_;
262 265
263 DISALLOW_COPY_AND_ASSIGN(Label); 266 DISALLOW_COPY_AND_ASSIGN(Label);
264 }; 267 };
265 268
266 } // namespace views 269 } // namespace views
267 270
268 #endif // VIEWS_CONTROLS_LABEL_H_ 271 #endif // VIEWS_CONTROLS_LABEL_H_
OLDNEW
« no previous file with comments | « no previous file | views/controls/label.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698