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

Unified Diff: ui/views/controls/label.h

Issue 111023004: Add GetMinimumSize() for Labels and ensure it's zero for empty Links. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/avatar_menu_bubble_view.cc ('k') | ui/views/controls/label.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/label.h
===================================================================
--- ui/views/controls/label.h (revision 239550)
+++ ui/views/controls/label.h (working copy)
@@ -27,9 +27,6 @@
/////////////////////////////////////////////////////////////////////////////
class VIEWS_EXPORT Label : public View {
public:
- // Internal class name.
- static const char kViewClassName[];
-
// The following enum is used to indicate whether using the Chrome UI's
// directionality as the label's directionality, or auto-detecting the label's
// directionality.
@@ -52,6 +49,12 @@
ELIDE_AS_EMAIL, // Elide while retaining username/domain chars as needed.
};
+ // Internal class name.
+ static const char kViewClassName[];
+
+ // The padding for the focus border when rendering focused text.
+ static const int kFocusBorderPadding;
+
Label();
explicit Label(const string16& text);
Label(const string16& text, const gfx::FontList& font_list);
@@ -67,7 +70,7 @@
// Get or set the label text.
const string16& text() const { return text_; }
- void SetText(const string16& text);
+ virtual void SetText(const string16& text);
// Enables or disables auto-color-readability (enabled by default). If this
// is enabled, then calls to set any foreground or background color will
@@ -160,13 +163,13 @@
void set_collapse_when_hidden(bool value) { collapse_when_hidden_ = value; }
bool collapse_when_hidden() const { return collapse_when_hidden_; }
- void SetHasFocusBorder(bool has_focus_border);
-
// Overridden from View:
virtual gfx::Insets GetInsets() const OVERRIDE;
virtual int GetBaseline() const OVERRIDE;
// Overridden to compute the size required to display this label.
virtual gfx::Size GetPreferredSize() OVERRIDE;
+ // Returns the width of an ellipsis if the label is non-empty, or 0 otherwise.
+ virtual gfx::Size GetMinimumSize() OVERRIDE;
// Returns the height necessary to display this label with the provided width.
// This method is used to layout multi-line labels. It is equivalent to
// GetPreferredSize().height() if the receiver is not multi-line.
@@ -265,10 +268,6 @@
// directionality is auto-detected based on first strong directionality
// character or is determined by chrome UI's locale.
DirectionalityMode directionality_mode_;
- // When embedded in a larger control that is focusable, setting this flag
- // allows this view to reserve space for a focus border that it otherwise
- // might not have because it is not itself focusable.
- bool has_focus_border_;
// Colors for shadow.
SkColor enabled_shadow_color_;
« no previous file with comments | « chrome/browser/ui/views/avatar_menu_bubble_view.cc ('k') | ui/views/controls/label.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698