| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 UI_MESSAGE_CENTER_BOUNDED_LABEL_H_ | 5 #ifndef UI_MESSAGE_CENTER_BOUNDED_LABEL_H_ |
| 6 #define UI_MESSAGE_CENTER_BOUNDED_LABEL_H_ | 6 #define UI_MESSAGE_CENTER_BOUNDED_LABEL_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 // to avoid exposing some of views::Label's methods that can't be made to work | 31 // to avoid exposing some of views::Label's methods that can't be made to work |
| 32 // with BoundedLabel. See the description of InnerBoundedLabel in the | 32 // with BoundedLabel. See the description of InnerBoundedLabel in the |
| 33 // bounded_label.cc file for details. | 33 // bounded_label.cc file for details. |
| 34 class MESSAGE_CENTER_EXPORT BoundedLabel : public views::View { | 34 class MESSAGE_CENTER_EXPORT BoundedLabel : public views::View { |
| 35 public: | 35 public: |
| 36 BoundedLabel(const string16& text, gfx::Font font); | 36 BoundedLabel(const string16& text, gfx::Font font); |
| 37 BoundedLabel(const string16& text); | 37 BoundedLabel(const string16& text); |
| 38 virtual ~BoundedLabel(); | 38 virtual ~BoundedLabel(); |
| 39 | 39 |
| 40 void SetColors(SkColor textColor, SkColor backgroundColor); | 40 void SetColors(SkColor textColor, SkColor backgroundColor); |
| 41 void SetLineHeight(int height); // Pass in 0 for default height. |
| 41 void SetLineLimit(int lines); // Pass in -1 for no limit. | 42 void SetLineLimit(int lines); // Pass in -1 for no limit. |
| 42 | 43 |
| 43 int line_limit() const { return line_limit_; } | 44 int GetLineHeight() const; |
| 45 int GetLineLimit() const; |
| 44 | 46 |
| 45 // Pass in a -1 width to use the preferred width, a -1 limit to skip limits. | 47 // Pass in a -1 width to use the preferred width, a -1 limit to skip limits. |
| 46 int GetLinesForWidthAndLimit(int width, int limit); | 48 int GetLinesForWidthAndLimit(int width, int limit); |
| 47 gfx::Size GetSizeForWidthAndLines(int width, int lines); | 49 gfx::Size GetSizeForWidthAndLines(int width, int lines); |
| 48 | 50 |
| 49 // Overridden from views::View. | 51 // Overridden from views::View. |
| 50 virtual int GetBaseline() const OVERRIDE; | 52 virtual int GetBaseline() const OVERRIDE; |
| 51 virtual gfx::Size GetPreferredSize() OVERRIDE; | 53 virtual gfx::Size GetPreferredSize() OVERRIDE; |
| 52 virtual int GetHeightForWidth(int width) OVERRIDE; | 54 virtual int GetHeightForWidth(int width) OVERRIDE; |
| 53 virtual void Paint(gfx::Canvas* canvas) OVERRIDE; | 55 virtual void Paint(gfx::Canvas* canvas) OVERRIDE; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 66 | 68 |
| 67 scoped_ptr<InnerBoundedLabel> label_; | 69 scoped_ptr<InnerBoundedLabel> label_; |
| 68 int line_limit_; | 70 int line_limit_; |
| 69 | 71 |
| 70 DISALLOW_COPY_AND_ASSIGN(BoundedLabel); | 72 DISALLOW_COPY_AND_ASSIGN(BoundedLabel); |
| 71 }; | 73 }; |
| 72 | 74 |
| 73 } // namespace message_center | 75 } // namespace message_center |
| 74 | 76 |
| 75 #endif // UI_MESSAGE_CENTER_BOUNDED_LABEL_H_ | 77 #endif // UI_MESSAGE_CENTER_BOUNDED_LABEL_H_ |
| OLD | NEW |